/** * @return true if content assist is available */ public boolean isContentAssistAvailable() { boolean result = getSourceViewer().getTextOperationTarget().canDoOperation( ISourceViewer.CONTENTASSIST_PROPOSALS); return result; }
public Object execute(ExecutionEvent event) throws ExecutionException { Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl"); //$NON-NLS-1$ if (activeFocusControl instanceof Control) { Control control = (Control) activeFocusControl; if (!control.isDisposed()) { ISourceViewer viewer = (ISourceViewer) control.getData(ISourceViewer.class.getName()); if (viewer != null) { ITextOperationTarget operationTarget = viewer.getTextOperationTarget(); if (operationTarget.canDoOperation(QUICK_OUTLINE)) { operationTarget.doOperation(QUICK_OUTLINE); } } } } return null; } }
return (fSourceViewer == null ? null : (T) fSourceViewer.getTextOperationTarget());
return (fSourceViewer == null ? null : fSourceViewer.getTextOperationTarget());
return (fSourceViewer == null ? null : (T) fSourceViewer.getTextOperationTarget());
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISourceViewer viewer = null; Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl"); //$NON-NLS-1$ if (activeFocusControl instanceof Control) { Control control = (Control) activeFocusControl; if (!control.isDisposed()) { viewer = (ISourceViewer) control.getData(ISourceViewer.class.getName()); } } if (viewer == null) { IEditorPart editor = HandlerUtil.getActiveEditor(event); if (editor instanceof JsonEditor) { viewer = ((JsonEditor) editor).getProjectionViewer(); } } if (viewer != null) { ITextOperationTarget operationTarget = viewer.getTextOperationTarget(); if (operationTarget.canDoOperation(QUICK_OUTLINE)) { operationTarget.doOperation(QUICK_OUTLINE); } } return null; }