/** * Calculates the contents of page 2 when the it is activated. */ protected void pageChange(int newPageIndex) { super.pageChange(newPageIndex); if (newPageIndex == 2) { sortWords(); } }
/** * The <code>MultiPageEditorPart</code> implementation of this * <code>IWorkbenchPart</code> method disposes all nested editors. * Subclasses may extend. */ public void dispose() { ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); super.dispose(); }
/** * The <code>MultiPageEditorExample</code> implementation of this method * checks that the input is an instance of <code>IFileEditorInput</code>. */ public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException { if (!(editorInput instanceof IFileEditorInput)) throw new PartInitException( "Invalid Input: Must be IFileEditorInput"); super.init(site, editorInput); }
/** * Creates and adds a new page containing the given control to this * multi-page editor. The control may be <code>null</code>, allowing it * to be created and set later using <code>setControl</code>. * * @param control * the control, or <code>null</code> * @return the index of the new page * * @see MultiPageEditorPart#setControl(int, Control) */ public int addPage(Control control) { int index = getPageCount(); addPage(index, control); return index; }
private ITextEditor getTextEditor(IEditorInput input, IEditorPart editor) { if( editor instanceof MultiPageEditorPart ) { MultiPageEditorPart multiPageEditor = (MultiPageEditorPart) editor; IEditorPart[] editors = multiPageEditor.findEditors(input); for(IEditorPart ed: editors) { if( ed instanceof ITextEditor ) { multiPageEditor.setActiveEditor(ed); return (ITextEditor) ed; } } } else if( editor instanceof ITextEditor ) { return (ITextEditor) editor; } return null; }
/** * Sets the currently active page. * * @param pageIndex * the index of the page to be activated; the index must be valid */ protected void setActivePage(int pageIndex) { Assert.isTrue(pageIndex >= 0 && pageIndex < getPageCount()); getTabFolder().setSelection(pageIndex); pageChange(pageIndex); }
deactivateSite(false, false); IPartService partService = getSite().getService( IPartService.class); if (partService.getActivePart() == this) { setFocus(); IEditorPart activeEditor = getEditor(newPageIndex); IEditorActionBarContributor contributor = getEditorSite() .getActionBarContributor(); if (contributor != null .getSelectionProvider(); if (selectionProvider != null) { ISelectionProvider outerProvider = getSite() .getSelectionProvider(); if (outerProvider instanceof MultiPageSelectionProvider) { if (Policy.DEBUG_MPE) { Tracing.printTrace(TRACING_COMPONENT, "MultiPageEditorPart " + getTitle() //$NON-NLS-1$ + " did not propogate selection for " //$NON-NLS-1$ + activeEditor.getTitle()); activateSite(); Object selectedPage = getSelectedPage(); if (selectedPage != null) { firePageChanged(new PageChangedEvent(this, selectedPage));
Composite pageContainer = createPageContainer(parent); this.container = createContainer(pageContainer); createPages(); if (getActivePage() == -1) { setActivePage(0); IEditorPart part = getEditor(0); if (part!=null) { final IServiceLocator serviceLocator = part.getEditorSite(); initializePageSwitching(); initializeSubTabSwitching();
protected void _firePropertyChange(int property) { super.firePropertyChange(property); }
/** * Adds a simple SWT control as a page. Overrides superclass implementation * to keep track of pages. * * @param control * the page control to add * @return the 0-based index of the newly added page */ @Override public int addPage(Control control) { int i = super.addPage(control); try { registerPage(-1, control); } catch (PartInitException e) { // cannot happen for controls } return i; }
@Override protected void setInput ( final IEditorInput input ) { if ( input instanceof ConfigurationEditorInput ) { final ConfigurationEditorInput configurationInput = (ConfigurationEditorInput)input; configurationInput.performLoad ( new NullProgressMonitor () ); } super.setInput ( input ); }
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; }
/** * The <code>MultiPageEditorPart</code> implementation of this * <code>IEditorPart</code> method sets its site to the given site, its * input to the given input, and the site's selection provider to a * <code>MultiPageSelectionProvider</code>. Subclasses may extend this * method. * * @param site * The site for which this part is being created; must not be * <code>null</code>. * @param input * The input on which this editor should be created; must not be * <code>null</code>. * @throws PartInitException * If the initialization of the part fails -- currently never. */ @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); site.setSelectionProvider(new MultiPageSelectionProvider(this)); }
public MultiPageMinimapPage(MultiPageEditorPart multiPageEditor) { this.fMultiPageEditor = multiPageEditor; this.fTextWidgetMap = new HashMap<>(); this.fPageChangedListener = e -> { Object selectedPage = multiPageEditor.getSelectedPage(); // Find from cache the minimap for the selected page Control textWidget = fTextWidgetMap.get(selectedPage); if (textWidget != null) { fPageBook.showPage(textWidget); return; } MinimapPage minimapPage = null; if (selectedPage instanceof ITextEditor) { // Create and show a minimap page for the given text editor page ITextEditor textEditor = (ITextEditor) selectedPage; minimapPage = MinimapPage.createMinimapPage(textEditor); } if (minimapPage != null) { minimapPage.createControl(fPageBook); textWidget = minimapPage.getControl(); fTextWidgetMap.put(selectedPage, textWidget); fPageBook.showPage(textWidget); } else { fTextWidgetMap.put(selectedPage, fErrorLabel); fPageBook.showPage(fErrorLabel); } }; multiPageEditor.addPageChangedListener(fPageChangedListener); }
IEditorPart[] editors = mpe.findEditors(mpe.getEditorInput()); for( IEditorPart editor : editors ) { if( editor instanceof TextEditor ){
@Override protected Composite createPageContainer(Composite parent) { parent = super.createPageContainer(parent); toolkit = createToolkit(parent.getDisplay()); return parent; }
private static AbstractDecoratedTextEditor findTextEditorPart(IWorkbenchPage page, IEditorPart editor, IEditorInput input) { if (editor instanceof AbstractDecoratedTextEditor) return (AbstractDecoratedTextEditor) editor; if (editor instanceof MultiPageEditorPart) { MultiPageEditorPart mpep = (MultiPageEditorPart) editor; IEditorPart[] parts = mpep.findEditors(input); for (int i = 0; i < parts.length; i++) { IEditorPart editorPart = parts[i]; if (editorPart instanceof AbstractDecoratedTextEditor) { page.activate(mpep); mpep.setActiveEditor(editorPart); return (AbstractDecoratedTextEditor) editorPart; } } } return null; }
/** * This is here for the listener to be able to call it. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); }
/** * Adds a simple SWT control as a page. Overrides superclass implementation * to keep track of pages. * * @param control * the page control to add * @return the 0-based index of the newly added page */ @Override public int addPage(Control control) { int i = super.addPage(control); try { registerPage(-1, control); } catch (PartInitException e) { // cannot happen for controls } return i; }
protected void setInput(IEditorInput input) { /* * If driven from the Source page, it's "model" may not be up to date * with (or even exist for) the input just yet. Later notification * from the TextViewer could set us straight, although it's not * guaranteed to happen after the model has been created. */ super.setInput(input); if (fDesignViewer != null) { fDesignViewer.setDocument(getDocument()); } setPartName(input.getName()); }