@Override public void setActivePage(IEditorPart page) { for (MultiPageEditorActionBarContributor c : INSTANCES) { c.setActivePage(page); } IActionBars bars = getActionBars(); if (bars != null) { if (page instanceof IEnsembleEditorPart) { ((IEnsembleEditorPart)page).updateActionBars(bars); } bars.setGlobalActionHandler(IPlanEditorConstants.ACTION_SET_COLLAPSE_ALL_RETARGET, collapseActionHandler); bars.setGlobalActionHandler(IPlanEditorConstants.ACTION_SET_EXPAND_ALL_RETARGET, expandActionHandler); // bars.setGlobalActionHandler(IPlanEditorConstants.ACTION_SET_VALIDATE_PLAN_RETARGET, validatePlanActionHandler); bars.updateActionBars(); } }
@Override protected void postPageChange(int newPageIndex, int oldPageIndex) { AbstractVisualEditor activeEditor = editors.get(newPageIndex); //request the rapaint of the element on the main editor node when switching between the subeditors, supposing they were modified in the subeditor if (oldPageIndex > 0){ AbstractVisualEditor oldEditor = editors.get(oldPageIndex); INode subModel = getInnerModel(oldEditor.getModel()); ((JRChangeEventsSupport)subModel.getValue()).getEventSupport().firePropertyChange(MGraphicElement.FORCE_GRAPHICAL_REFRESH, null, null); } IEditorActionBarContributor contributor = parent.getEditorSite().getActionBarContributor(); if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) { ((MultiPageEditorActionBarContributor) contributor).setActivePage(activeEditor); } }
@Override public void init(IActionBars bars) { super.init(bars); for (MultiPageEditorActionBarContributor c : INSTANCES) { c.init(bars); } }
@Override public void dispose() { super.dispose(); for (MultiPageEditorActionBarContributor c : INSTANCES) { c.dispose(); } }
protected void pageChange(final int newPageIndex, final int oldPageIndex) { getActiveEditor(); deactivateSite(false, false); IPartService partService = (IPartService) getSite().getService(IPartService.class); if (partService.getActivePart() == this) { setFocus(); } IEditorPart activeEditor = getEditor(newPageIndex); IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor(); if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) { ((MultiPageEditorActionBarContributor) contributor).setActivePage(activeEditor); } if (activeEditor != null) { ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider(); if (selectionProvider != null) { ISelectionProvider outerProvider = getSite().getSelectionProvider(); if (outerProvider instanceof MultiPageToolbarSelectionProvider) { SelectionChangedEvent event = new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()); MultiPageToolbarSelectionProvider provider = (MultiPageToolbarSelectionProvider) outerProvider; provider.fireSelectionChanged(event); provider.firePostSelectionChanged(event); } else { if (Policy.DEBUG_MPE) { Tracing.printTrace(TRACING_COMPONENT, "MultiPageEditorPart " + getTitle() //$NON-NLS-1$ + " did not propogate selection for " //$NON-NLS-1$ + activeEditor.getTitle()); } } } } activateSite(); postPageChange(newPageIndex, oldPageIndex); Object selectedPage = getSelectedPage(); if (selectedPage != null) { firePageChanged(new PageChangedEvent(this, selectedPage)); } }
@Override public void setActiveEditor(IEditorPart part) { super.setActiveEditor(part); for (MultiPageEditorActionBarContributor c : INSTANCES) c.setActiveEditor(part); }