/** * Handles a property change notification from a nested editor. The default * implementation simply forwards the change to listeners on this multi * editor by calling <code>firePropertyChange</code> with the same property * id. For example, if the dirty state of a nested editor changes (property * id <code>ISaveablePart.PROP_DIRTY</code>), this method handles it by * firing a property change event for <code>ISaveablePart.PROP_DIRTY</code> * to property listeners on this multi editor. * <p> * Subclasses may extend or reimplement this method. * </p> * * @param propId * the id of the property that changed * @since 3.6 */ protected void handlePropertyChange(int propId) { firePropertyChange(propId); }
/** * Activates the given nested editor. * * @param part the nested editor * @since 3.0 */ public void activateEditor(IEditorPart part) { activeEditorIndex = getIndex(part); // IEditorPart e = getActiveEditor(); // EditorSite innerSite = (EditorSite) e.getEditorSite(); // ((WorkbenchPage) innerSite.getPage()).requestActivation(e); E4Util.unsupported("We need to request an activation of this part"); //$NON-NLS-1$ }
/** * Set the inner editors. * * Should not be called by clients. * * @param children * the inner editors of this multi editor * @noreference This method is not intended to be referenced by clients. */ public final void setChildren(IEditorPart[] children) { innerEditors = children; activeEditorIndex = 0; for (IEditorPart child : children) { child.addPropertyListener( (source, propId) -> handlePropertyChange(propId)); } innerEditorsCreated(); }
private AbstractTextEditor getActiveTextEditor(ExecutionEvent event) { IWorkbenchPart part= HandlerUtil.getActiveEditor(event); if (part instanceof AbstractTextEditor) { return (AbstractTextEditor)part; } else if ((part instanceof AbstractMultiEditor) && ((AbstractMultiEditor)part).getActiveEditor() instanceof AbstractTextEditor) { return (AbstractTextEditor)((AbstractMultiEditor)part).getActiveEditor(); } else if ((part instanceof MultiPageEditorPart) && ((MultiPageEditorPart)part).getSelectedPage() instanceof AbstractTextEditor) { return (AbstractTextEditor)((MultiPageEditorPart)part).getSelectedPage(); } return null; }
/** * Release the added listener. * * @since 3.2 */ @Override public void dispose() { getSite().getPage().removePartListener(propagationListener); super.dispose(); }
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { init(site, (MultiEditorInput) input); }
/** * Activates the given nested editor. * * @param part the nested editor * @since 3.5 */ @Override public void activateEditor(IEditorPart part) { IEditorPart oldEditor = getActiveEditor(); super.activateEditor(part); updateGradient(oldEditor); }
private AbstractTextEditor getActiveTextEditor(IEditorPart part) { if (part instanceof AbstractTextEditor) { return (AbstractTextEditor)part; } else if ((part instanceof AbstractMultiEditor) && ((AbstractMultiEditor)part).getActiveEditor() instanceof AbstractTextEditor) { return (AbstractTextEditor)((AbstractMultiEditor)part).getActiveEditor(); } else if ((part instanceof MultiPageEditorPart) && ((MultiPageEditorPart)part).getSelectedPage() instanceof AbstractTextEditor) { return (AbstractTextEditor)((MultiPageEditorPart)part).getSelectedPage(); } return part != null ? part.getAdapter(AbstractTextEditor.class) : null; }
getSite().getPage().addPartListener(propagationListener);
ei= ((AbstractMultiEditor)part).getActiveEditor().getEditorInput(); else ei= ((IEditorPart)part).getEditorInput();
ei= ((AbstractMultiEditor)part).getActiveEditor().getEditorInput(); else ei= ((IEditorPart)part).getEditorInput();