View | Details | Raw Unified | Return to bug 198402
Collapse All | Expand All

(-)src/org/eclipse/ui/views/properties/tabbed/AdvancedPropertySection.java (+51 lines)
Lines 14-19 Link Here
14
import org.eclipse.swt.layout.FormAttachment;
14
import org.eclipse.swt.layout.FormAttachment;
15
import org.eclipse.swt.layout.FormData;
15
import org.eclipse.swt.layout.FormData;
16
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.ui.IActionBars;
17
import org.eclipse.ui.IWorkbenchPart;
18
import org.eclipse.ui.IWorkbenchPart;
18
import org.eclipse.ui.views.properties.PropertySheetPage;
19
import org.eclipse.ui.views.properties.PropertySheetPage;
19
20
Lines 30-35 Link Here
30
	 * The Property Sheet Page.
31
	 * The Property Sheet Page.
31
	 */
32
	 */
32
	protected PropertySheetPage page;
33
	protected PropertySheetPage page;
34
	
35
	/**
36
	 * Whether action bar contributions have been registered or not.
37
	 */
38
	private boolean contributionsRegistered;
33
39
34
	/**
40
	/**
35
	 * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
41
	 * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
Lines 86-89 Link Here
86
	public boolean shouldUseExtraSpace() {
92
	public boolean shouldUseExtraSpace() {
87
		return true;
93
		return true;
88
	}
94
	}
95
	
96
	/**
97
	 * Registers the part contributions of the property sheet page.
98
	 */
99
	public void aboutToBeShown() {
100
		super.aboutToBeShown();
101
102
		registerPartContributions();
103
	}
104
105
	/**
106
	 * Unregisters the part contributions of the property sheet page.
107
	 */
108
	public void aboutToBeHidden() {
109
		super.aboutToBeHidden();
110
111
		unregisterPartContributions();
112
	}
113
114
	/**
115
	 * Registers the property sheet page's contributions (toolbar, menubar, ...) 
116
	 */
117
	private void registerPartContributions() {
118
		if (contributionsRegistered) {
119
			return;
120
		}
121
		
122
		contributionsRegistered = true;
123
		IActionBars actionBars = tabbedPropertySheetPage.getSite().getActionBars();
124
		page.makeContributions(actionBars.getMenuManager(), actionBars.getToolBarManager(), actionBars.getStatusLineManager());
125
		actionBars.getToolBarManager().update(true);
126
	}
127
128
	/**
129
	 * Remove the property sheet page's contributions. 
130
	 * (Actually removes all contributions)
131
	 */
132
	private void unregisterPartContributions() {
133
		contributionsRegistered = false;
134
		IActionBars actionBars = tabbedPropertySheetPage.getSite().getActionBars();
135
		actionBars.getMenuManager().removeAll();
136
		actionBars.getToolBarManager().removeAll();
137
		actionBars.getStatusLineManager().removeAll();
138
		actionBars.getToolBarManager().update(true);
139
	}
89
}
140
}
(-)src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java (-1 / +1 lines)
Lines 33-39 Link Here
33
	/**
33
	/**
34
	 * The tabbed property sheet page
34
	 * The tabbed property sheet page
35
	 */
35
	 */
36
	private TabbedPropertySheetPage tabbedPropertySheetPage;
36
	protected TabbedPropertySheetPage tabbedPropertySheetPage;
37
37
38
	/**
38
	/**
39
	 * The current workbench selection.
39
	 * The current workbench selection.

Return to bug 198402