/** * The <code>TextOperationAction</code> implementation of this * <code>IAction</code> method runs the operation with the current * operation code. */ 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() { public void run() { fOperationTarget.doOperation(fOperationCode); } }); }
/** * 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); } }); }
/** * 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, () -> fOperationTarget.doOperation(fOperationCode)); }
/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ @Override public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }
/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }
/** * The <code>TextOperationAction</code> implementation of this * <code>IUpdate</code> method discovers the operation through the current * editor's <code>ITextOperationTarget</code> adapter, and sets the * enabled state accordingly. */ @Override public void update() { if (!fAllowUpdate) return; super.update(); if (!fRunsOnReadOnly && !canModifyEditor()) { setEnabled(false); return; } ITextEditor editor= getTextEditor(); if (fOperationTarget == null && editor!= null && fOperationCode != -1) fOperationTarget= editor.getAdapter(ITextOperationTarget.class); boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode)); setEnabled(isEnabled); }