/** * Creates the viewer. Registers the full outline at the document model. */ public void createPartControl(Composite parent) { PageSite site = new PageSite(getViewSite()); outline.init(site); outline.createControl(parent); ((SubActionBars) site.getActionBars()).activate(true); outline.switchTreeViewerSelectionChangeListener(this); // add a part listener if the editor isn't available when the view is created. getSite().getPage().addPartListener(this); // register it directly if the view is already created. IEditorPart part = getSite().getPage().getActiveEditor(); if (part != null && part instanceof TexEditor) { TexEditor e = (TexEditor) part; e.registerFullOutline(this); } }
/** * A workbench part has been deactivated. Disconnect from it. * * @param part * the workbench part that has been deactivated */ public void partDeactivated(IWorkbenchPart part) { super.partDeactivated(part); IWorkbenchPartSite site = part.getSite(); SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars(); bars.removePropertyChangeListener(propertyChangeListener); IWorkbenchPart activePart = part.getSite().getPage().getActivePart(); if (activePart != null) { // We are going to get a part activated message so don't bother // setting the // action handler to null. This prevents enablement flash in the // toolbar return; } setActionHandler(null); }
public void propertyChange( PropertyChangeEvent event ) { RegisterAction[] actions = getInsertElementActions( ); if ( actions != null ) { for ( int i = 0; i < actions.length; i++ ) { if ( event.getProperty( ) .equals( SubActionBars.P_ACTION_HANDLERS ) ) { if ( getAction( actions[i].id ) instanceof ReportRetargetAction ) { ( (ReportRetargetAction) getAction( actions[i].id ) ).propagateChange( event ); } } } } }
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS) && activeRec != null && event.getSource() == activeRec.subActionBars) { refreshGlobalActionHandlers(); } }
/** * Prepares the page in the given page rec for use in this view. * * @param rec */ private void preparePage(PageRec rec) { IPageSite site = null; Integer count; if (!doesPageExist(rec.page)) { if (rec.page instanceof IPageBookViewPage) { site = ((IPageBookViewPage) rec.page).getSite(); } if (site == null) { // We will create a site for our use site = new PageSite(getViewSite()); } mapPageToSite.put(rec.page, site); rec.subActionBars = (SubActionBars) site.getActionBars(); rec.subActionBars.addPropertyChangeListener(actionBarPropListener); // for backward compability with IPage rec.page.setActionBars(rec.subActionBars); count = new Integer(0); } else { site = (IPageSite) mapPageToSite.get(rec.page); rec.subActionBars = (SubActionBars) site.getActionBars(); count = ((Integer) mapPageToNumRecs.get(rec.page)); } mapPageToNumRecs.put(rec.page, new Integer(count.intValue() + 1)); }
/** * Disposes of the action and any resources held. */ public void dispose() { if (handler != null) { handler.removePropertyChangeListener(propertyChangeListener); handler = null; } IWorkbenchPart part = getActivePart(); if (part != null) { IWorkbenchPartSite site = part.getSite(); SubActionBars bars = (SubActionBars) ((PartSite) site) .getActionBars(); bars.removePropertyChangeListener(propertyChangeListener); } }
/** * A workbench part has been activated. Try to connect to it. * * @param part * the workbench part that has been activated */ public void partActivated(IWorkbenchPart part) { super.partActivated(part); IWorkbenchPartSite site = part.getSite(); SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars(); bars.addPropertyChangeListener(propertyChangeListener); setActionHandler(bars.getGlobalActionHandler(getId())); }
public void init( IActionBars bars ) { super.init( bars ); if ( bars instanceof SubActionBars ) { ( (SubActionBars) bars ).addPropertyChangeListener( propertyChangeListener ); } }
@Override public void dispose( ) { if ( toggleBreadcrumbAction != null ) { toggleBreadcrumbAction.dispose( ); } if ( getActionBars( ) instanceof SubActionBars ) { ( (SubActionBars) getActionBars( ) ).removePropertyChangeListener( propertyChangeListener ); } super.dispose( ); }
@Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage){ super.createControls(parent, aTabbedPropertySheetPage); fc = new FaelleComposite(parent, SWT.None, aTabbedPropertySheetPage); aTabbedPropertySheetPage.getWidgetFactory().adapt(fc); aTabbedPropertySheetPage.getWidgetFactory().paintBordersFor(fc); subActionBars = new SubActionBars(aTabbedPropertySheetPage.getSite().getActionBars()); // COMPAT subActionBars.getToolBarManager().add(GlobalActions.neuerFallAction); }
public SubActionBarDef( IActionBars rootBar, IEditorActionBarContributor actionBarContrubutor ) { this.subActionBar = new SubActionBars( rootBar ); this.actionBarContrubutor = actionBarContrubutor; }
public SubActionBars getSubActionBar( ) { return subActionBar; }