use of org.eclipse.ui.IWorkbenchPartSite in project eclipse.platform.text by eclipse.
the class ContentAssistAction method run.
/**
* Runs the content assist operation on the editor's text operation target.
*/
@Override
public void run() {
if (fOperationTarget != null) {
ITextEditor editor = getTextEditor();
if (editor != null && validateEditorInputState()) {
Display display = null;
IWorkbenchPartSite site = editor.getSite();
Shell shell = site.getShell();
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
@Override
public void run() {
fOperationTarget.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
}
});
}
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project eclipse.platform.text by eclipse.
the class ShiftAction method run.
/**
* The <code>TextOperationAction</code> implementation of this
* <code>IAction</code> method runs the operation with the current
* operation code.
*/
@Override
public void run() {
if (fOperationCode == -1 || fOperationTarget == null)
return;
ITextEditor editor = getTextEditor();
if (editor == null)
return;
if (!validateEditorInputState())
return;
Display display = null;
IWorkbenchPartSite site = editor.getSite();
Shell shell = site.getShell();
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
@Override
public void run() {
fOperationTarget.doOperation(fOperationCode);
}
});
}
use of org.eclipse.ui.IWorkbenchPartSite in project eclipse.platform.text by eclipse.
the class TextOperationAction method run.
/**
* The <code>TextOperationAction</code> implementation of this
* <code>IAction</code> method runs the operation with the current
* operation code.
*/
@Override
public void run() {
if (fOperationCode == -1 || fOperationTarget == null)
return;
ITextEditor editor = getTextEditor();
if (editor == null)
return;
if (!fRunsOnReadOnly && !validateEditorInputState())
return;
Display display = null;
IWorkbenchPartSite site = editor.getSite();
Shell shell = site.getShell();
if (shell != null && !shell.isDisposed())
display = shell.getDisplay();
BusyIndicator.showWhile(display, new Runnable() {
@Override
public void run() {
fOperationTarget.doOperation(fOperationCode);
}
});
}
use of org.eclipse.ui.IWorkbenchPartSite in project eclipse.platform.text by eclipse.
the class RulerColumnDescriptor method matchesEditor.
/**
* Returns <code>true</code> if this contribution matches the passed editor, <code>false</code> if not.
*
* @param editor the editor to check
* @return <code>true</code> if this contribution targets the passed editor
*/
public boolean matchesEditor(ITextEditor editor) {
Assert.isLegal(editor != null);
RulerColumnTarget target = getTarget();
IWorkbenchPartSite site = editor.getSite();
if (site != null && target.matchesEditorId(site.getId()))
return true;
if (target.matchesClass(editor.getClass()))
return true;
IContentType contentType = getContentType(editor);
return contentType != null && target.matchesContentType(contentType);
}
use of org.eclipse.ui.IWorkbenchPartSite in project linuxtools by eclipse.
the class BrowserView method registerContextMenu.
protected void registerContextMenu(String menuName) {
Control control = this.viewer.getControl();
MenuManager manager = new MenuManager(menuName);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
Menu menu = manager.createContextMenu(control);
viewer.getControl().setMenu(menu);
IWorkbenchPartSite partSite = getSite();
partSite.registerContextMenu(manager, viewer);
partSite.setSelectionProvider(viewer);
}
Aggregations