org.eclipse.jface.text.IWidgetTokenOwnerExtension Java Examples

The following examples show how to use org.eclipse.jface.text.IWidgetTokenOwnerExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InformationPresenterControlManager.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void showInformationControl(Rectangle subjectArea) {
    if (fControl instanceof IWidgetTokenOwnerExtension && fControl instanceof IWidgetTokenOwner) {
        IWidgetTokenOwnerExtension extension = (IWidgetTokenOwnerExtension) fControl;
        if (extension.requestWidgetToken(this, WIDGET_PRIORITY)) {
            super.showInformationControl(subjectArea);
        }
    } else if (fControl instanceof IWidgetTokenOwner) {
        IWidgetTokenOwner owner = (IWidgetTokenOwner) fControl;
        if (owner.requestWidgetToken(this)) {
            super.showInformationControl(subjectArea);
        }

    } else {
        super.showInformationControl(subjectArea);
    }
}
 
Example #2
Source File: RenameRefactoringPopup.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void updateVisibility() {
	if (popup != null && !popup.isDisposed() && delayJobFinished) {
		boolean visible = false;
		if (renameLinkedMode.isCaretInLinkedPosition()) {
			StyledText textWidget = editor.getInternalSourceViewer().getTextWidget();
			Rectangle eArea = Geometry.toDisplay(textWidget, textWidget.getClientArea());
			Rectangle pBounds = popup.getBounds();
			pBounds.x -= GAP;
			pBounds.y -= GAP;
			pBounds.width += 2 * GAP;
			pBounds.height += 2 * GAP;
			if (eArea.intersects(pBounds)) {
				visible = true;
			}
		}
		if (visible && !popup.isVisible()) {
			ISourceViewer viewer = editor.getInternalSourceViewer();
			if (viewer instanceof IWidgetTokenOwnerExtension) {
				IWidgetTokenOwnerExtension widgetTokenOwnerExtension = (IWidgetTokenOwnerExtension) viewer;
				widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
			}
		} else if (!visible && popup.isVisible()) {
			releaseWidgetToken();
		}
		popup.setVisible(visible);
	}
}
 
Example #3
Source File: RenameInformationPopup.java    From typescript.java with MIT License 5 votes vote down vote up
private void updateVisibility() {
	if (fPopup != null && !fPopup.isDisposed() && fDelayJobFinished) {
		boolean visible= false;
		//TODO: Check for visibility of linked position, not whether popup is outside of editor?
		if (fRenameLinkedMode.isCaretInLinkedPosition()) {
			StyledText textWidget= fEditor.getViewer().getTextWidget();
			Rectangle eArea= Geometry.toDisplay(textWidget, textWidget.getClientArea());
			Rectangle pBounds= fPopup.getBounds();
			pBounds.x-= GAP;
			pBounds.y-= GAP;
			pBounds.width+= 2 * GAP;
			pBounds.height+= 2 * GAP;
			if (eArea.intersects(pBounds)) {
				visible= true;
			}
		}
		if (visible && ! fPopup.isVisible()) {
			ISourceViewer viewer= fEditor.getViewer();
			if (viewer instanceof IWidgetTokenOwnerExtension) {
				IWidgetTokenOwnerExtension widgetTokenOwnerExtension= (IWidgetTokenOwnerExtension) viewer;
				visible= widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
			}
		} else if (! visible && fPopup.isVisible()) {
			releaseWidgetToken();
		}
		fPopup.setVisible(visible);
	}
}
 
Example #4
Source File: RenameInformationPopup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateVisibility() {
	if (fPopup != null && !fPopup.isDisposed() && fDelayJobFinished) {
		boolean visible= false;
		//TODO: Check for visibility of linked position, not whether popup is outside of editor?
		if (fRenameLinkedMode.isCaretInLinkedPosition()) {
			StyledText textWidget= fEditor.getViewer().getTextWidget();
			Rectangle eArea= Geometry.toDisplay(textWidget, textWidget.getClientArea());
			Rectangle pBounds= fPopup.getBounds();
			pBounds.x-= GAP;
			pBounds.y-= GAP;
			pBounds.width+= 2 * GAP;
			pBounds.height+= 2 * GAP;
			if (eArea.intersects(pBounds)) {
				visible= true;
			}
		}
		if (visible && ! fPopup.isVisible()) {
			ISourceViewer viewer= fEditor.getViewer();
			if (viewer instanceof IWidgetTokenOwnerExtension) {
				IWidgetTokenOwnerExtension widgetTokenOwnerExtension= (IWidgetTokenOwnerExtension) viewer;
				visible= widgetTokenOwnerExtension.requestWidgetToken(this, WIDGET_PRIORITY);
			}
		} else if (! visible && fPopup.isVisible()) {
			releaseWidgetToken();
		}
		fPopup.setVisible(visible);
	}
}