public void apply(IDocument document) { if (editor instanceof ITextEditor) { final IWorkbenchPage page = editor.getSite().getPage(); final IEditorInput input = editor.getEditorInput(); ((ITextEditor) editor).doSave(null); ((ITextEditor) editor).close(true); Display.getCurrent().asyncExec(new Runnable() { public void run() { try { IDE.openEditor(page, input, AspectJEditor.ASPECTJ_EDITOR_ID); } catch (PartInitException e) { } } }); } } };
if (editor != null) editor.close(true);
if (editor != null) editor.close(false);