private void finishNotCompiledReport() { UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { pcontainer.setNotRunning(true); if (pcontainer.getSite() instanceof MultiPageEditorSite) { MultiPageEditorPart mpe = ((MultiPageEditorSite) pcontainer.getSite()).getMultiPageEditor(); IEditorPart[] editors = mpe.findEditors(mpe.getEditorInput()); if (editors != null && editors.length > 0) { // Dialog, if not ..., it's not clear for the user that error happened UIUtils.showInformation(Messages.ReportControler_compilationerrors); mpe.setActiveEditor(editors[0]); } } } }); }
/** * This function takes a workbench part site, which might be from a top-level view, * or from a top-level editor, or from a page-level editor in a multipage editor * site. The function finds the corresponding part for this site and activates it. * @param site */ public static void activate(IWorkbenchPartSite site) { try { IWorkbenchPart part; if (site instanceof MultiPageEditorSite) { part = ((MultiPageEditorSite)site).getMultiPageEditor(); } else { part = site.getPart(); } if (part == null) { return; } IWorkbenchPage page = site.getPage(); if (page == null) { return; } page.activate(part); } catch (ThreadDeath td) { throw td; } catch (Throwable t) { Logger.getLogger(WorkbenchUtils.class).error("throwable in activate", t); } }
/** * disposes all color objects */ public void dispose( ) { // colorManager.dispose( ); // remove the mediator listener // SessionHandleAdapter.getInstance( ) // .getMediator( root ) // .removeColleague( this ); selectionMap.clear( ); editingDomainEditor = null; if ( scriptEditor != null ) { scriptEditor.dispose( ); scriptEditor = null; } super.dispose( ); // ( (ReportMultiPageEditorSite) getSite( ) ).dispose( ); ( (MultiPageEditorSite) getSite( ) ).dispose( ); }
public static void openEditor(final Object val, IEditorPart editor, ANode node) { if (editor.getEditorSite() instanceof MultiPageEditorSite) { final MultiPageEditorPart mpep = ((MultiPageEditorSite) editor.getEditorSite()).getMultiPageEditor(); if (mpep instanceof IJROBjectEditor) doOpenEditor(val, (IJROBjectEditor) mpep, node); } else { editor = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor instanceof IJROBjectEditor) doOpenEditor(val, (IJROBjectEditor) editor, node); } }
@Override protected IEditorSite createSite(IEditorPart editor) { // Due to an eclipse bug/misfeature, the Id of a multipart editor is always "", so you can't contribute // to the editor without doing this in code. This workaround allows the debugger plugin to add a RulerDoubleClick // event to make breakpoints work again. return new MultiPageEditorSite(this, editor) { @Override public String getId() { return EditorConstants.APEX_EDITOR_ID; } }; }
public void dispose( ) { super.dispose( ); ( (MultiPageEditorSite) getSite( ) ).dispose( ); reportXMLEditor.dispose( ); reportXMLEditor = null; unhookModelEventManager( getModel( ) ); SessionHandleAdapter.getInstance( ) .getMediator( getModel( ) ) .removeColleague( this ); }
public void init( IEditorSite site, IEditorInput input ) throws PartInitException { super.init( site, input ); initialize( (FormEditor) ( (MultiPageEditorSite) site ).getMultiPageEditor( ) ); // Initializes command stack // WrapperCommandStack stack = (WrapperCommandStack) getCommandStack( ); // if ( stack != null ) // { // stack.addCommandStackListener( getCommandStackListener( ) ); // } }
public void dispose( ) { if (fSourceViewerDecorationSupport != null) { fSourceViewerDecorationSupport.dispose(); fSourceViewerDecorationSupport= null; } fAnnotationAccess= null; colorManager.dispose( ); super.dispose( ); ( (MultiPageEditorSite) getSite( ) ).dispose( ); }
/** * Get the next position off the global mark ring and move to that file and location * * @param editor * @param document * @param currentSelection * @param norotate - if true, pop else rotate and pop * @return NO_OFFSET * @throws BadLocationException */ protected int doTransform(ITextEditor editor, IDocument document, ITextSelection currentSelection, boolean norotate, boolean isTags) throws BadLocationException { // get editor and offset IBufferLocation location = (isTags ? MarkUtils.popTagMark() : MarkUtils.popGlobalMark(norotate)); if (location != null) { if (currentSelection != null && location.getEditor() == editor && location.getOffset() == currentSelection.getOffset()) { // if we're already at the global mark location, move to next location // recurse with no selection to avoid infinite loop if only one global location return doTransform(editor,document,null,norotate, isTags); } ITextEditor jumpTo = location.getEditor(); int offset = location.getOffset(); IWorkbenchPage page = getWorkbenchPage(); IEditorPart part = jumpTo; if (part != null) { // move to the correct page IEditorPart apart = part; IEditorSite esite = part.getEditorSite(); if (esite instanceof MultiPageEditorSite) { apart = ((MultiPageEditorSite)esite).getMultiPageEditor(); // handle multi page by activating the correct part within the parent if (apart instanceof MultiPageEditorPart) { ((MultiPageEditorPart)apart).setActiveEditor(part); } } // check to make sure the editor is still valid if (page.findEditor(apart.getEditorInput()) != null) { // then activate page.activate(apart); page.bringToTop(apart); if (part instanceof ITextEditor) { selectAndReveal((ITextEditor) part,offset,offset); EmacsPlusUtils.clearMessage(part); } } else { EmacsPlusUtils.showMessage(editor, String.format(BAD_MARK, apart.getTitle()), true); } } } else { beep(); } return NO_OFFSET; }
/** * @see com.mulgasoft.emacsplus.minibuffer.IMinibufferExecutable#executeResult(org.eclipse.ui.texteditor.ITextEditor, java.lang.Object) */ public boolean doExecuteResult(ITextEditor editor, Object minibufferResult) { if (minibufferResult != null) { String key = (String)minibufferResult; IRegisterLocation location = TecoRegister.getInstance().getLocation(key); if (location != null) { IWorkbenchPage page = getWorkbenchPage(); IEditorPart part = location.getEditor(); int offset = location.getOffset(); if (part != null) { // move to the correct page IEditorPart apart = part; IEditorSite esite = part.getEditorSite(); if (esite instanceof MultiPageEditorSite) { apart = ((MultiPageEditorSite)esite).getMultiPageEditor(); // handle multi page by activating the correct part within the parent if (apart instanceof MultiPageEditorPart) { ((MultiPageEditorPart)apart).setActiveEditor(part); } } // now activate page.activate(apart); page.bringToTop(apart); } else { // restore the resource from the file system if (location.getPath() != null) { try { // loads and activates part = IDE.openEditor(page, location.getPath(), true); if (part instanceof IEditorPart) { if (part instanceof MultiPageEditorPart) { IEditorPart[] parts = ((MultiPageEditorPart)part).findEditors(part.getEditorInput()); // TODO this will only work on the first load of a multi page // There is no supported way to determine the correct sub part in this case // Investigate org.eclipse.ui.PageSwitcher (used in org.eclipse.ui.part.MultiPageEditorPart) // as a means for locating the correct sub page at this level for (int i = 0; i < parts.length; i++) { if (parts[i] instanceof ITextEditor) { ((MultiPageEditorPart)part).setActiveEditor(parts[i]); part = parts[i]; break; } } } location.setEditor((ITextEditor)part); } } catch (PartInitException e) { showResultMessage(editor, String.format(BAD_LOCATION,key + ' ' + e.getLocalizedMessage()), true); } } else { showResultMessage(editor, String.format(NO_LOCATION,key), true); } } if (part instanceof ITextEditor) { ((ITextEditor) part).selectAndReveal(offset, 0); showResultMessage(editor, String.format(LOCATED, key), false); } else { } } else { showResultMessage(editor, NO_REGISTER, true); } } return true; }