public CommandStack getCommandStack() { Object commandStack = owningEditor.getAdapter(CommandStack.class); if (commandStack==null) return null; else return (CommandStack)commandStack; }
protected ActionRegistry getEditorActionRegistry() { return (ActionRegistry) editor.getAdapter(ActionRegistry.class); } protected CommandStack commandStack;
protected ActionRegistry getEditorActionRegistry(IEditorPart editor) { return (ActionRegistry) editor.getAdapter(ActionRegistry.class); } }
public static XtextEditor getXtextEditor(IEditorPart openEditor) { if (openEditor != null) { return (XtextEditor) openEditor.getAdapter(XtextEditor.class); } return null; }
public static ITextEditor toTextEditor(IEditorPart editor) { ITextEditor result = null; if (editor instanceof ITextEditor) { result = (ITextEditor) editor; } else if (editor != null) { result = (ITextEditor) editor.getAdapter(ITextEditor.class); } return result; }
public String getCurrentEditorContent() { final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (activeEditor == null) return null; final IDocument doc = (IDocument) activeEditor.getAdapter(IDocument.class); if (doc == null) return null; return doc.get(); }
/** * Opens the quick type hierarchy for the given editor. * * @param editor the editor for which to open the quick hierarchy */ private static void openQuickHierarchy(IEditorPart editor) { ITextOperationTarget textOperationTarget= editor.getAdapter(ITextOperationTarget.class); textOperationTarget.doOperation(JavaSourceViewer.SHOW_HIERARCHY); } }
public static XtextEditor getActiveXtextEditor(ExecutionEvent event) { IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); if (activeEditor == null) return null; XtextEditor xtextEditor = (XtextEditor) activeEditor.getAdapter(XtextEditor.class); return xtextEditor; }
protected ComponentReferenceEditManager getComponentReferenceEditManager() { ComponentReferenceEditManager result = null; IEditorPart editor = getActiveEditor(); if (editor != null) { result = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class); } return result; }
public AspectJBreakpointRulerAction(IVerticalRulerInfo ruler, ITextEditor editor, IEditorPart editorPart) { super(UIMessages.ManageBreakpointRulerAction_label); //$NON-NLS-1$ fRuler = ruler; fTextEditor = editor; fStatusLine = (IEditorStatusLine) editorPart .getAdapter(IEditorStatusLine.class); fBreakpointAdapter = new ToggleBreakpointAdapter(); }
protected IEditorPart getEditorPart() { IEditorPart part = super.getEditorPart(); if (part != null) return (ITextEditor) part.getAdapter(ITextEditor.class); return null; }
protected ComponentReferenceEditManager getComponentReferenceEditManager() { ComponentReferenceEditManager result = null; IEditorPart editor = getActiveEditor(); if (editor != null) { result = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class); } return result; }
public boolean show(ShowInContext context) { if (getEditor() != null) { IShowInTarget target = (IShowInTarget) getEditor().getAdapter(IShowInTarget.class); if (target != null) { return target.show(context); } } return false; }
public ShowInContext getShowInContext() { if (getEditor() != null) { IShowInSource source = (IShowInSource) getEditor().getAdapter(IShowInSource.class); if (source != null) { return source.getShowInContext(); } } return null; }
@Override public void launch(IEditorPart editor, String mode) { final SarlJavaElementDelegateMainLaunch javaElementDelegate = editor.getAdapter(SarlJavaElementDelegateMainLaunch.class); if (javaElementDelegate != null) { super.launch(new StructuredSelection(javaElementDelegate), mode); } else { super.launch(editor, mode); } }
private void doIncrementalSearch() { IEditorPart editor = InstaSearchUI.getActiveEditor(); if( editor != null ) { IFindReplaceTarget target = (IFindReplaceTarget) editor.getAdapter(IFindReplaceTarget.class); if( target != null ) lastIncrementalSearchPos = target.findAndSelect(lastIncrementalSearchPos, searchText.getText(), true, false, false) + searchText.getText().length(); } }
public void run() { IEditorStatusLine fStatusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class); if (fStatusLine != null) { fStatusLine.setMessage(true, message, null); } if (message != null && JDIDebugUIPlugin.getActiveWorkbenchShell() != null) { Display.getCurrent().beep(); } } });
public void run() { EditPart editPart = ((AbstractEditPartViewer) getViewer()).getRootEditPart().getContents(); if (editPart instanceof RootContentEditPart) { IEditorPart editorPart = getEditorPart(); ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class); IAction action = registry.getAction(SetInputToGraphView.ID); action.run(); } } };
public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); IEditorPart editor = workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor(); Object adapter = editor.getAdapter(ISelectionProvider.class); if (adapter instanceof ISelectionProvider) { ISelectionProvider sel = (ISelectionProvider) adapter; sel.setSelection(new StructuredSelection(getEditPart().getModel())); } } };
public void run() { ImageExporter imageExporter = new ImageExporter(); imageExporter.save(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(), (GraphicalViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(GraphicalViewer.class)); }