### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.views.properties.tabbed Index: src/org/eclipse/ui/views/properties/tabbed/AdvancedPropertySection.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/AdvancedPropertySection.java,v retrieving revision 1.2 diff -u -r1.2 AdvancedPropertySection.java --- src/org/eclipse/ui/views/properties/tabbed/AdvancedPropertySection.java 17 Apr 2006 18:56:22 -0000 1.2 +++ src/org/eclipse/ui/views/properties/tabbed/AdvancedPropertySection.java 1 Aug 2007 08:35:31 -0000 @@ -14,6 +14,7 @@ import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IActionBars; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.views.properties.PropertySheetPage; @@ -30,6 +31,11 @@ * The Property Sheet Page. */ protected PropertySheetPage page; + + /** + * Whether action bar contributions have been registered or not. + */ + private boolean contributionsRegistered; /** * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite, @@ -86,4 +92,49 @@ public boolean shouldUseExtraSpace() { return true; } + + /** + * Registers the part contributions of the property sheet page. + */ + public void aboutToBeShown() { + super.aboutToBeShown(); + + registerPartContributions(); + } + + /** + * Unregisters the part contributions of the property sheet page. + */ + public void aboutToBeHidden() { + super.aboutToBeHidden(); + + unregisterPartContributions(); + } + + /** + * Registers the property sheet page's contributions (toolbar, menubar, ...) + */ + private void registerPartContributions() { + if (contributionsRegistered) { + return; + } + + contributionsRegistered = true; + IActionBars actionBars = tabbedPropertySheetPage.getSite().getActionBars(); + page.makeContributions(actionBars.getMenuManager(), actionBars.getToolBarManager(), actionBars.getStatusLineManager()); + actionBars.getToolBarManager().update(true); + } + + /** + * Remove the property sheet page's contributions. + * (Actually removes all contributions) + */ + private void unregisterPartContributions() { + contributionsRegistered = false; + IActionBars actionBars = tabbedPropertySheetPage.getSite().getActionBars(); + actionBars.getMenuManager().removeAll(); + actionBars.getToolBarManager().removeAll(); + actionBars.getStatusLineManager().removeAll(); + actionBars.getToolBarManager().update(true); + } } Index: src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java,v retrieving revision 1.1 diff -u -r1.1 AbstractPropertySection.java --- src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java 30 Jan 2006 21:34:23 -0000 1.1 +++ src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java 1 Aug 2007 08:35:31 -0000 @@ -33,7 +33,7 @@ /** * The tabbed property sheet page */ - private TabbedPropertySheetPage tabbedPropertySheetPage; + protected TabbedPropertySheetPage tabbedPropertySheetPage; /** * The current workbench selection.