|
Lines 36-42
Link Here
|
| 36 |
import org.eclipse.jface.action.IAction; |
36 |
import org.eclipse.jface.action.IAction; |
| 37 |
import org.eclipse.jface.action.IContributionItem; |
37 |
import org.eclipse.jface.action.IContributionItem; |
| 38 |
import org.eclipse.jface.action.IContributionManager; |
38 |
import org.eclipse.jface.action.IContributionManager; |
|
|
39 |
import org.eclipse.jface.action.ICoolBarManager; |
| 39 |
import org.eclipse.jface.action.IMenuManager; |
40 |
import org.eclipse.jface.action.IMenuManager; |
|
|
41 |
import org.eclipse.jface.action.IToolBarManager; |
| 42 |
import org.eclipse.jface.action.IToolBarManager2; |
| 40 |
import org.eclipse.jface.action.MenuManager; |
43 |
import org.eclipse.jface.action.MenuManager; |
| 41 |
import org.eclipse.jface.action.Separator; |
44 |
import org.eclipse.jface.action.Separator; |
| 42 |
import org.eclipse.jface.action.StatusLineManager; |
45 |
import org.eclipse.jface.action.StatusLineManager; |
|
Lines 112-117
Link Here
|
| 112 |
import org.eclipse.ui.internal.registry.IActionSetDescriptor; |
115 |
import org.eclipse.ui.internal.registry.IActionSetDescriptor; |
| 113 |
import org.eclipse.ui.internal.registry.UIExtensionTracker; |
116 |
import org.eclipse.ui.internal.registry.UIExtensionTracker; |
| 114 |
import org.eclipse.ui.internal.util.PrefUtil; |
117 |
import org.eclipse.ui.internal.util.PrefUtil; |
|
|
118 |
import org.eclipse.ui.presentations.ActionBarPresentation; |
| 115 |
|
119 |
|
| 116 |
/** |
120 |
/** |
| 117 |
* A window within the workbench. |
121 |
* A window within the workbench. |
|
Lines 293-300
Link Here
|
| 293 |
addCoolBar(SWT.FLAT); |
297 |
addCoolBar(SWT.FLAT); |
| 294 |
addStatusLine(); |
298 |
addStatusLine(); |
| 295 |
|
299 |
|
| 296 |
actionPresentation = new ActionPresentation(this); |
|
|
| 297 |
|
| 298 |
// register with the tracker |
300 |
// register with the tracker |
| 299 |
getExtensionTracker() |
301 |
getExtensionTracker() |
| 300 |
.registerHandler( |
302 |
.registerHandler( |
|
Lines 742-748
Link Here
|
| 742 |
* Return whether or not the coolbar layout is locked. |
744 |
* Return whether or not the coolbar layout is locked. |
| 743 |
*/ |
745 |
*/ |
| 744 |
protected boolean isCoolBarLocked() { |
746 |
protected boolean isCoolBarLocked() { |
| 745 |
CoolBarManager cbm = getCoolBarManager(); |
747 |
ICoolBarManager cbm = getCoolBarManager2(); |
| 746 |
return cbm != null && cbm.getLockLayout(); |
748 |
return cbm != null && cbm.getLockLayout(); |
| 747 |
} |
749 |
} |
| 748 |
|
750 |
|
|
Lines 1403-1409
Link Here
|
| 1403 |
boolean result; |
1405 |
boolean result; |
| 1404 |
try { |
1406 |
try { |
| 1405 |
// Clear the action sets, fix for bug 27416. |
1407 |
// Clear the action sets, fix for bug 27416. |
| 1406 |
actionPresentation.clearActionSets(); |
1408 |
getActionPresentation().clearActionSets(); |
| 1407 |
|
1409 |
|
| 1408 |
// Remove the handler submissions. Bug 64024. |
1410 |
// Remove the handler submissions. Bug 64024. |
| 1409 |
final IWorkbench workbench = getWorkbench(); |
1411 |
final IWorkbench workbench = getWorkbench(); |
|
Lines 1465-1471
Link Here
|
| 1465 |
*/ |
1467 |
*/ |
| 1466 |
/* package */ |
1468 |
/* package */ |
| 1467 |
void lockCoolBar(boolean lock) { |
1469 |
void lockCoolBar(boolean lock) { |
| 1468 |
getCoolBarManager().setLockLayout(lock); |
1470 |
getCoolBarManager2().setLockLayout(lock); |
| 1469 |
} |
1471 |
} |
| 1470 |
|
1472 |
|
| 1471 |
/** |
1473 |
/** |
|
Lines 1631-1638
Link Here
|
| 1631 |
// Restore the cool bar order by creating all the tool bar contribution items |
1633 |
// Restore the cool bar order by creating all the tool bar contribution items |
| 1632 |
// This needs to be done before pages are created to ensure proper canonical creation |
1634 |
// This needs to be done before pages are created to ensure proper canonical creation |
| 1633 |
// of cool items |
1635 |
// of cool items |
| 1634 |
if (getCoolBarManager() != null) { |
1636 |
ICoolBarManager coolBarMgr = getCoolBarManager2(); |
| 1635 |
CoolBarManager coolBarMgr = getCoolBarManager(); |
1637 |
if (coolBarMgr != null) { |
| 1636 |
IMemento coolBarMem = memento |
1638 |
IMemento coolBarMem = memento |
| 1637 |
.getChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT); |
1639 |
.getChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT); |
| 1638 |
if (coolBarMem != null) { |
1640 |
if (coolBarMem != null) { |
|
Lines 1917-1923
Link Here
|
| 1917 |
if (coolbarMem == null) { |
1919 |
if (coolbarMem == null) { |
| 1918 |
return false; |
1920 |
return false; |
| 1919 |
} |
1921 |
} |
| 1920 |
CoolBarManager coolBarMgr = getCoolBarManager(); |
1922 |
ICoolBarManager coolBarMgr = getCoolBarManager2(); |
| 1921 |
// Check to see if layout is locked |
1923 |
// Check to see if layout is locked |
| 1922 |
Integer locked = coolbarMem.getInteger(IWorkbenchConstants.TAG_LOCKED); |
1924 |
Integer locked = coolbarMem.getInteger(IWorkbenchConstants.TAG_LOCKED); |
| 1923 |
boolean state = (locked != null) && (locked.intValue() == 1); |
1925 |
boolean state = (locked != null) && (locked.intValue() == 1); |
|
Lines 2243-2258
Link Here
|
| 2243 |
} |
2245 |
} |
| 2244 |
|
2246 |
|
| 2245 |
/// Save the order of the cool bar contribution items |
2247 |
/// Save the order of the cool bar contribution items |
| 2246 |
if (getCoolBarManager() != null) { |
2248 |
ICoolBarManager coolBarMgr = getCoolBarManager2(); |
| 2247 |
getCoolBarManager().refresh(); |
2249 |
if (coolBarMgr != null) { |
|
|
2250 |
coolBarMgr.refresh(); |
| 2248 |
IMemento coolBarMem = memento |
2251 |
IMemento coolBarMem = memento |
| 2249 |
.createChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT); |
2252 |
.createChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT); |
| 2250 |
if (getCoolBarManager().getLockLayout() == true) { |
2253 |
if (coolBarMgr.getLockLayout() == true) { |
| 2251 |
coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 1); |
2254 |
coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 1); |
| 2252 |
} else { |
2255 |
} else { |
| 2253 |
coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 0); |
2256 |
coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 0); |
| 2254 |
} |
2257 |
} |
| 2255 |
IContributionItem[] items = getCoolBarManager().getItems(); |
2258 |
IContributionItem[] items = coolBarMgr.getItems(); |
| 2256 |
for (int i = 0; i < items.length; i++) { |
2259 |
for (int i = 0; i < items.length; i++) { |
| 2257 |
IMemento coolItemMem = coolBarMem |
2260 |
IMemento coolItemMem = coolBarMem |
| 2258 |
.createChild(IWorkbenchConstants.TAG_COOLITEM); |
2261 |
.createChild(IWorkbenchConstants.TAG_COOLITEM); |
|
Lines 2590-2596
Link Here
|
| 2590 |
} |
2593 |
} |
| 2591 |
// updateAll required in order to enable accelerators on pull-down menus |
2594 |
// updateAll required in order to enable accelerators on pull-down menus |
| 2592 |
getMenuBarManager().updateAll(false); |
2595 |
getMenuBarManager().updateAll(false); |
| 2593 |
getCoolBarManager().update(false); |
2596 |
getCoolBarManager2().update(false); |
| 2594 |
getStatusLineManager().update(false); |
2597 |
getStatusLineManager().update(false); |
| 2595 |
} |
2598 |
} |
| 2596 |
|
2599 |
|
|
Lines 2652-2663
Link Here
|
| 2652 |
|
2655 |
|
| 2653 |
WorkbenchPage currentPage = getActiveWorkbenchPage(); |
2656 |
WorkbenchPage currentPage = getActiveWorkbenchPage(); |
| 2654 |
if (currentPage == null) |
2657 |
if (currentPage == null) |
| 2655 |
actionPresentation.clearActionSets(); |
2658 |
getActionPresentation().clearActionSets(); |
| 2656 |
else { |
2659 |
else { |
| 2657 |
if (getCoolBarManager() != null) { |
2660 |
ICoolBarManager coolBarMgr = getCoolBarManager2(); |
| 2658 |
getCoolBarManager().refresh(); |
2661 |
if (coolBarMgr != null) { |
|
|
2662 |
coolBarMgr.refresh(); |
| 2659 |
} |
2663 |
} |
| 2660 |
actionPresentation.setActionSets(currentPage.getActionSets()); |
2664 |
getActionPresentation().setActionSets(currentPage.getActionSets()); |
| 2661 |
} |
2665 |
} |
| 2662 |
updateActionBars(); |
2666 |
updateActionBars(); |
| 2663 |
|
2667 |
|
|
Lines 2669-2675
Link Here
|
| 2669 |
IContributionItem item = getMenuBarManager().findUsingPath(path); |
2673 |
IContributionItem item = getMenuBarManager().findUsingPath(path); |
| 2670 |
|
2674 |
|
| 2671 |
// TODO remove: updateActiveActions(); |
2675 |
// TODO remove: updateActiveActions(); |
| 2672 |
IActionSet actionSets[] = actionPresentation.getActionSets(); |
2676 |
IActionSet actionSets[] = getActionPresentation().getActionSets(); |
| 2673 |
registerActionSets(actionSets); |
2677 |
registerActionSets(actionSets); |
| 2674 |
|
2678 |
|
| 2675 |
if (manager == null || item == null) |
2679 |
if (manager == null || item == null) |
|
Lines 3120-3129
Link Here
|
| 3120 |
.getPerspectiveBar(); |
3124 |
.getPerspectiveBar(); |
| 3121 |
} |
3125 |
} |
| 3122 |
|
3126 |
|
| 3123 |
//for dynamic UI |
3127 |
/** |
|
|
3128 |
* Returns the action presentation for dynamic UI |
| 3129 |
* @return action presentation |
| 3130 |
*/ |
| 3124 |
public ActionPresentation getActionPresentation() { |
3131 |
public ActionPresentation getActionPresentation() { |
|
|
3132 |
if (actionPresentation == null) { |
| 3133 |
ActionBarPresentation toolBarPresentation = getWindowConfigurer() |
| 3134 |
.getPresentationFactory().createToolBarPresentation(this); |
| 3135 |
actionPresentation = new ActionPresentation(this, toolBarPresentation); |
| 3136 |
} |
| 3125 |
return actionPresentation; |
3137 |
return actionPresentation; |
| 3126 |
} |
3138 |
} |
|
|
3139 |
|
| 3140 |
private ActionBarPresentation getActionBarPresentation() { |
| 3141 |
ActionBarPresentation value = null; |
| 3142 |
ActionPresentation actionPresentation = getActionPresentation(); |
| 3143 |
|
| 3144 |
if (actionPresentation != null) |
| 3145 |
value = actionPresentation.getActionBarPresentation(); |
| 3146 |
|
| 3147 |
return value; |
| 3148 |
} |
| 3127 |
|
3149 |
|
| 3128 |
/* (non-Javadoc) |
3150 |
/* (non-Javadoc) |
| 3129 |
* @see org.eclipse.jface.window.ApplicationWindow#showTopSeperator() |
3151 |
* @see org.eclipse.jface.window.ApplicationWindow#showTopSeperator() |
|
Lines 3133-3138
Link Here
|
| 3133 |
} |
3155 |
} |
| 3134 |
|
3156 |
|
| 3135 |
/** |
3157 |
/** |
|
|
3158 |
* Returns a new cool bar manager for the window. |
| 3159 |
* <p> |
| 3160 |
* Subclasses may override this method to customize the cool bar manager. |
| 3161 |
* </p> |
| 3162 |
* |
| 3163 |
* @return a cool bar manager |
| 3164 |
*/ |
| 3165 |
protected ICoolBarManager createCoolBarManager2(int style) { |
| 3166 |
return getActionBarPresentation().createCoolBarManager(style); |
| 3167 |
} |
| 3168 |
|
| 3169 |
/** |
| 3170 |
* Creates the control for the cool bar manager. |
| 3171 |
* <p> |
| 3172 |
* Subclasses may override this method to customize the cool bar manager. |
| 3173 |
* </p> |
| 3174 |
* |
| 3175 |
* @return an instance of <code>CoolBar</code> |
| 3176 |
*/ |
| 3177 |
protected Control createCoolBarControl(Composite parent) { |
| 3178 |
return getActionBarPresentation().createCoolBarControl(getCoolBarManager2(), parent); |
| 3179 |
} |
| 3180 |
|
| 3181 |
/** |
| 3182 |
* Returns a new tool bar manager for the window. |
| 3183 |
* <p> |
| 3184 |
* Subclasses may override this method to customize the tool bar manager. |
| 3185 |
* </p> |
| 3186 |
* @return a tool bar manager |
| 3187 |
*/ |
| 3188 |
protected IToolBarManager createToolBarManager2(int style) { |
| 3189 |
return getActionBarPresentation().createToolBarManager(style); |
| 3190 |
} |
| 3191 |
|
| 3192 |
/** |
| 3193 |
* Creates the control for the tool bar manager. |
| 3194 |
* <p> |
| 3195 |
* Subclasses may override this method to customize the tool bar manager. |
| 3196 |
* </p> |
| 3197 |
* @return a Control |
| 3198 |
*/ |
| 3199 |
protected Control createToolBarControl(Composite parent) { |
| 3200 |
return getActionBarPresentation().createToolBarControl(getToolBarManager2(), parent); |
| 3201 |
} |
| 3202 |
|
| 3203 |
/** |
| 3136 |
* Delegate to the presentation factory. |
3204 |
* Delegate to the presentation factory. |
| 3137 |
* |
3205 |
* |
| 3138 |
* @see org.eclipse.jface.window.ApplicationWindow#createStatusLineManager |
3206 |
* @see org.eclipse.jface.window.ApplicationWindow#createStatusLineManager |
|
Lines 3140-3147
Link Here
|
| 3140 |
*/ |
3208 |
*/ |
| 3141 |
protected StatusLineManager createStatusLineManager() { |
3209 |
protected StatusLineManager createStatusLineManager() { |
| 3142 |
// @issue ApplicationWindow and WorkbenchWindow should allow full IStatusLineManager |
3210 |
// @issue ApplicationWindow and WorkbenchWindow should allow full IStatusLineManager |
| 3143 |
return (StatusLineManager) getWindowConfigurer() |
3211 |
StatusLineManager slm = (StatusLineManager) getWindowConfigurer() |
| 3144 |
.getPresentationFactory().createStatusLineManager(); |
3212 |
.getPresentationFactory().createStatusLineManager(); |
|
|
3213 |
|
| 3214 |
// use new methods |
| 3215 |
if (slm == null) |
| 3216 |
slm = (StatusLineManager)getActionBarPresentation().createStatusLineManager(); |
| 3217 |
|
| 3218 |
return slm; |
| 3145 |
} |
3219 |
} |
| 3146 |
|
3220 |
|
| 3147 |
/** |
3221 |
/** |
|
Lines 3151-3158
Link Here
|
| 3151 |
* @since 3.0 |
3225 |
* @since 3.0 |
| 3152 |
*/ |
3226 |
*/ |
| 3153 |
protected void createStatusLine(Shell shell) { |
3227 |
protected void createStatusLine(Shell shell) { |
| 3154 |
getWindowConfigurer().getPresentationFactory().createStatusLineControl( |
3228 |
Control control = getWindowConfigurer().getPresentationFactory().createStatusLineControl( |
| 3155 |
getStatusLineManager(), shell); |
3229 |
getStatusLineManager(), shell); |
|
|
3230 |
|
| 3231 |
// use the new method |
| 3232 |
if (control == null) |
| 3233 |
control = getActionBarPresentation().createStatusLineControl(getStatusLineManager(), shell); |
| 3156 |
} |
3234 |
} |
| 3157 |
|
3235 |
|
| 3158 |
/** |
3236 |
/** |
|
Lines 3259-3262
Link Here
|
| 3259 |
public ITrimManager getTrimManager() { |
3337 |
public ITrimManager getTrimManager() { |
| 3260 |
return defaultLayout; |
3338 |
return defaultLayout; |
| 3261 |
} |
3339 |
} |
|
|
3340 |
|
| 3341 |
protected CoolBarManager createCoolBarManager(int style) { |
| 3342 |
// TODO Auto-generated method stub |
| 3343 |
return super.createCoolBarManager(style); |
| 3344 |
} |
| 3345 |
|
| 3346 |
protected ToolBarManager createToolBarManager(int style) { |
| 3347 |
// TODO Auto-generated method stub |
| 3348 |
return super.createToolBarManager(style); |
| 3349 |
} |
| 3350 |
|
| 3351 |
protected void addCoolBar(int style) { |
| 3352 |
if ((getShell() == null) && (toolBarManager == null) |
| 3353 |
&& (coolBarManager == null)) { |
| 3354 |
coolBarManager = createCoolBarManager2(style); |
| 3355 |
} } |
| 3356 |
|
| 3357 |
protected void addToolBar(int style) { |
| 3358 |
if ((getShell() == null) && (toolBarManager == null) |
| 3359 |
&& (coolBarManager == null)) { |
| 3360 |
toolBarManager = (IToolBarManager2)createToolBarManager2(style); |
| 3361 |
} |
| 3362 |
} |
| 3262 |
} |
3363 |
} |