Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 123257 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java (-3 / +14 lines)
Lines 38-43 Link Here
38
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
38
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
39
import org.eclipse.ui.application.WorkbenchAdvisor;
39
import org.eclipse.ui.application.WorkbenchAdvisor;
40
import org.eclipse.ui.presentations.AbstractPresentationFactory;
40
import org.eclipse.ui.presentations.AbstractPresentationFactory;
41
import org.eclipse.ui.presentations.ActionBarPresentation;
41
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
42
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
42
43
43
/**
44
/**
Lines 205-211 Link Here
205
            if (proxy != null) {
206
            if (proxy != null) {
206
                return proxy.getCoolBarManager();
207
                return proxy.getCoolBarManager();
207
            }
208
            }
208
            return window.getCoolBarManager();
209
            return window.getCoolBarManager2();
209
        }
210
        }
210
211
211
        /* (non-Javadoc)
212
        /* (non-Javadoc)
Lines 217-222 Link Here
217
            }
218
            }
218
            window.registerGlobalAction(action);
219
            window.registerGlobalAction(action);
219
        }
220
        }
221
222
		/* (non-Javadoc)
223
		 * @see org.eclipse.ui.application.IActionBarConfigurer#getToolBarPresentation()
224
		 */
225
		public ActionBarPresentation getActionBarPresentation() {
226
			WorkbenchWindow window = (WorkbenchWindow)getWindowConfigurer().getWindow();
227
			return window.getActionPresentation().getActionBarPresentation();
228
		}
220
    }
229
    }
221
230
222
    /**
231
    /**
Lines 588-601 Link Here
588
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
597
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
589
     */
598
     */
590
    public Control createCoolBarControl(Composite parent) {
599
    public Control createCoolBarControl(Composite parent) {
591
        return window.getCoolBarManager().createControl(parent);
600
        return actionBarConfigurer.getActionBarPresentation().createCoolBarControl(
601
        		window.getCoolBarManager2(), parent);
592
    }
602
    }
593
603
594
    /* (non-Javadoc)
604
    /* (non-Javadoc)
595
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
605
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
596
     */
606
     */
597
    public Control createStatusLineControl(Composite parent) {
607
    public Control createStatusLineControl(Composite parent) {
598
        return window.getStatusLineManager().createControl(parent);
608
        return actionBarConfigurer.getActionBarPresentation().createStatusLineControl(
609
        		window.getStatusLineManager(), parent);
599
    }
610
    }
600
611
601
    /* (non-Javadoc)
612
    /* (non-Javadoc)
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java (-21 / +122 lines)
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
}
(-)Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java (-4 / +3 lines)
Lines 375-383 Link Here
375
            }
375
            }
376
376
377
            PluginAction action = ad.getAction();
377
            PluginAction action = ad.getAction();
378
            PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
378
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
379
                    action);
379
                    action);
380
381
            bars.addAdjunctContribution(actionContribution);
380
            bars.addAdjunctContribution(actionContribution);
382
381
383
            // create a coolitem for the toolbar id if it does not yet exist				
382
            // create a coolitem for the toolbar id if it does not yet exist				
Lines 430-436 Link Here
430
429
431
            // Create the action
430
            // Create the action
432
            PluginAction action = ad.getAction();
431
            PluginAction action = ad.getAction();
433
            PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
432
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
434
                    action);
433
                    action);
435
434
436
            // retreive the toolbar from the action bars.
435
            // retreive the toolbar from the action bars.
Lines 562-568 Link Here
562
            //			if (menuMgr != null) 
561
            //			if (menuMgr != null) 
563
            //				revokeActionSetFromMenu(menuMgr, id);
562
            //				revokeActionSetFromMenu(menuMgr, id);
564
563
565
            revokeActionSetFromCoolbar(window.getCoolBarManager(), id);
564
            revokeActionSetFromCoolbar(window.getCoolBarManager2(), id);
566
            //			IToolBarManager toolBarMgr = bars.getToolBarManager();
565
            //			IToolBarManager toolBarMgr = bars.getToolBarManager();
567
            //			if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager) 
566
            //			if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager) 
568
            //				revokeActionSetFromToolbar(toolBarMgr, id);
567
            //				revokeActionSetFromToolbar(toolBarMgr, id);
(-)Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java (-1 / +1 lines)
Lines 50-56 Link Here
50
     * 
50
     * 
51
     */
51
     */
52
    public ICoolBarManager getCoolBarManager() {
52
    public ICoolBarManager getCoolBarManager() {
53
        return window.getCoolBarManager();
53
        return window.getCoolBarManager2();
54
    }
54
    }
55
55
56
    /**
56
    /**
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java (-4 / +4 lines)
Lines 37-43 Link Here
37
import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
37
import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
38
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
38
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
39
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
39
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
40
import org.eclipse.jface.action.CoolBarManager;
40
import org.eclipse.jface.action.ICoolBarManager;
41
import org.eclipse.jface.dialogs.ErrorDialog;
41
import org.eclipse.jface.dialogs.ErrorDialog;
42
import org.eclipse.jface.dialogs.IDialogConstants;
42
import org.eclipse.jface.dialogs.IDialogConstants;
43
import org.eclipse.jface.dialogs.MessageDialog;
43
import org.eclipse.jface.dialogs.MessageDialog;
Lines 2542-2548 Link Here
2542
        // Run op in busy cursor.
2542
        // Run op in busy cursor.
2543
        // Use set redraw to eliminate the "flash" that can occur in the
2543
        // Use set redraw to eliminate the "flash" that can occur in the
2544
        // coolbar as the perspective is reset.
2544
        // coolbar as the perspective is reset.
2545
        CoolBarManager mgr = window.getCoolBarManager();
2545
        ICoolBarManager mgr = window.getCoolBarManager2();
2546
        try {
2546
        try {
2547
            mgr.getControl().setRedraw(false);
2547
            mgr.getControl().setRedraw(false);
2548
            BusyIndicator.showWhile(null, new Runnable() {
2548
            BusyIndicator.showWhile(null, new Runnable() {
Lines 3147-3153 Link Here
3147
        // Going from multiple to single rows can make the coolbar
3147
        // Going from multiple to single rows can make the coolbar
3148
        // and its adjacent views appear jumpy as perspectives are
3148
        // and its adjacent views appear jumpy as perspectives are
3149
        // switched. Turn off redraw to help with this.
3149
        // switched. Turn off redraw to help with this.
3150
        CoolBarManager mgr = window.getCoolBarManager();
3150
        ICoolBarManager mgr = window.getCoolBarManager2();
3151
        try {
3151
        try {
3152
            mgr.getControl().setRedraw(false);
3152
            mgr.getControl().setRedraw(false);
3153
            getClientComposite().setRedraw(false);
3153
            getClientComposite().setRedraw(false);
Lines 3183-3189 Link Here
3183
     * Restore the toolbar layout for the active perspective.
3183
     * Restore the toolbar layout for the active perspective.
3184
     */
3184
     */
3185
    protected void resetToolBarLayout() {
3185
    protected void resetToolBarLayout() {
3186
        window.getCoolBarManager().resetItemOrder();
3186
        window.getCoolBarManager2().resetItemOrder();
3187
    }
3187
    }
3188
3188
3189
    /**
3189
    /**
(-)Eclipse UI/org/eclipse/ui/internal/EditorManager.java (-2 / +2 lines)
Lines 340-347 Link Here
340
            String type = actionBars.getEditorType();
340
            String type = actionBars.getEditorType();
341
            actionCache.remove(type);
341
            actionCache.remove(type);
342
            // refresh the cool bar manager before disposing of a cool item
342
            // refresh the cool bar manager before disposing of a cool item
343
            if (window.getCoolBarManager() != null) {
343
            if (window.getCoolBarManager2() != null) {
344
                window.getCoolBarManager().refresh();
344
                window.getCoolBarManager2().refresh();
345
            }
345
            }
346
            actionBars.dispose();
346
            actionBars.dispose();
347
        }
347
        }
(-)Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java (-3 / +20 lines)
Lines 26-37 Link Here
26
import org.eclipse.ui.IActionBars2;
26
import org.eclipse.ui.IActionBars2;
27
import org.eclipse.ui.IWorkbenchActionConstants;
27
import org.eclipse.ui.IWorkbenchActionConstants;
28
import org.eclipse.ui.SubActionBars2;
28
import org.eclipse.ui.SubActionBars2;
29
import org.eclipse.ui.presentations.ActionBarPresentation;
29
30
30
/**
31
/**
31
 * This class represents the action bars for an action set.
32
 * This class represents the action bars for an action set.
32
 */
33
 */
33
public class ActionSetActionBars extends SubActionBars2 {
34
public class ActionSetActionBars extends SubActionBars2 {
34
35
36
    private ActionPresentation actionPresentation = null;
37
35
    private String actionSetId;
38
    private String actionSetId;
36
39
37
    private ArrayList adjunctContributions = new ArrayList();
40
    private ArrayList adjunctContributions = new ArrayList();
Lines 49-54 Link Here
49
    }
52
    }
50
53
51
    /**
54
    /**
55
     * Constructs a new action bars object
56
     */
57
    public ActionSetActionBars(IActionBars2 parent, String actionSetId, ActionPresentation actionPresentation) {
58
        super(parent);
59
        this.actionSetId = actionSetId;
60
        this.actionPresentation = actionPresentation;
61
    }
62
63
    /**
52
     * Adds to the list all the actions that are part of this action set but
64
     * Adds to the list all the actions that are part of this action set but
53
     * belong to different cool bar items.
65
     * belong to different cool bar items.
54
     * 
66
     * 
Lines 179-184 Link Here
179
        if (coolBarManager == null) {
191
        if (coolBarManager == null) {
180
            return null;
192
            return null;
181
        }
193
        }
194
        if (actionPresentation != null)
195
            return actionPresentation.getActionBarPresentation().createToolBarManager(coolBarManager.getStyle());
182
        return new ToolBarManager(coolBarManager.getStyle());
196
        return new ToolBarManager(coolBarManager.getStyle());
183
    }
197
    }
184
198
Lines 195-200 Link Here
195
        // Check if a tool bar manager for an adjunct type is being requested
209
        // Check if a tool bar manager for an adjunct type is being requested
196
        String toolBarId = actionSetId;
210
        String toolBarId = actionSetId;
197
        boolean isAdjunctType = false;
211
        boolean isAdjunctType = false;
212
        ActionBarPresentation actionBarPresentation = actionPresentation.getActionBarPresentation();
198
        if (!actionId.equals(actionSetId)) {
213
        if (!actionId.equals(actionSetId)) {
199
            // Adjunct type
214
            // Adjunct type
200
            toolBarId = actionId;
215
            toolBarId = actionId;
Lines 229-243 Link Here
229
                toolBarContributionItem = tbcbItem;
244
                toolBarContributionItem = tbcbItem;
230
            }
245
            }
231
        } else {
246
        } else {
232
247
            if (actionPresentation != null)
233
            coolItemToolBarMgr = new ToolBarManager(coolBarManager.getStyle());
248
                coolItemToolBarMgr = actionBarPresentation.createToolBarManager(coolBarManager.getStyle());
249
            else
250
                coolItemToolBarMgr = new ToolBarManager(coolBarManager.getStyle());
234
            // If this is not an adjunct type then create a tool bar
251
            // If this is not an adjunct type then create a tool bar
235
            // contribution item
252
            // contribution item
236
            // we don't create one for an adjunct type because another action
253
            // we don't create one for an adjunct type because another action
237
            // set action bars contains one
254
            // set action bars contains one
238
255
239
            toolBarContributionItem = new ToolBarContributionItem(
256
            toolBarContributionItem = new ToolBarContributionItem(
240
                    coolItemToolBarMgr, toolBarId);
257
            		coolItemToolBarMgr, toolBarId);
241
            toolBarContributionItem.setParent(coolItemToolBarMgr);
258
            toolBarContributionItem.setParent(coolItemToolBarMgr);
242
            toolBarContributionItem.setVisible(getActive());
259
            toolBarContributionItem.setVisible(getActive());
243
            coolItemToolBarMgr.markDirty();
260
            coolItemToolBarMgr.markDirty();
(-)Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java (-2 / +10 lines)
Lines 22-27 Link Here
22
import org.eclipse.ui.SubActionBars;
22
import org.eclipse.ui.SubActionBars;
23
import org.eclipse.ui.internal.registry.IActionSet;
23
import org.eclipse.ui.internal.registry.IActionSet;
24
import org.eclipse.ui.internal.registry.IActionSetDescriptor;
24
import org.eclipse.ui.internal.registry.IActionSetDescriptor;
25
import org.eclipse.ui.presentations.ActionBarPresentation;
25
26
26
/**
27
/**
27
 * Manage the configurable actions for one window.
28
 * Manage the configurable actions for one window.
Lines 32-37 Link Here
32
    private HashMap mapDescToRec = new HashMap(3);
33
    private HashMap mapDescToRec = new HashMap(3);
33
34
34
    private HashMap invisibleBars = new HashMap(3);
35
    private HashMap invisibleBars = new HashMap(3);
36
    
37
    private ActionBarPresentation actionBarPresentation;
35
38
36
    private class SetRec {
39
    private class SetRec {
37
        public SetRec(IActionSetDescriptor desc, IActionSet set,
40
        public SetRec(IActionSetDescriptor desc, IActionSet set,
Lines 51-59 Link Here
51
    /**
54
    /**
52
     * ActionPresentation constructor comment.
55
     * ActionPresentation constructor comment.
53
     */
56
     */
54
    public ActionPresentation(WorkbenchWindow window) {
57
    public ActionPresentation(WorkbenchWindow window, ActionBarPresentation toolBarPresentation) {
55
        super();
58
        super();
56
        this.window = window;
59
        this.window = window;
60
        this.actionBarPresentation = toolBarPresentation;
57
    }
61
    }
58
62
59
    /**
63
    /**
Lines 146-152 Link Here
146
                    } else {
150
                    } else {
147
                        IActionSet set = desc.createActionSet();
151
                        IActionSet set = desc.createActionSet();
148
                        SubActionBars bars = new ActionSetActionBars(window
152
                        SubActionBars bars = new ActionSetActionBars(window
149
                                .getActionBars(), desc.getId());
153
                                .getActionBars(), desc.getId(), this);
150
                        rec = new SetRec(desc, set, bars);
154
                        rec = new SetRec(desc, set, bars);
151
                        set.init(window, bars);
155
                        set.init(window, bars);
152
                        sets.add(set);
156
                        sets.add(set);
Lines 217-220 Link Here
217
            result[i] = ((SetRec) iterator.next()).set;
221
            result[i] = ((SetRec) iterator.next()).set;
218
        return result;
222
        return result;
219
    }
223
    }
224
225
	public ActionBarPresentation getActionBarPresentation() {
226
		return actionBarPresentation;
227
	}    
220
}
228
}
(-)Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java (+10 lines)
Lines 14-19 Link Here
14
import org.eclipse.jface.action.ICoolBarManager;
14
import org.eclipse.jface.action.ICoolBarManager;
15
import org.eclipse.jface.action.IMenuManager;
15
import org.eclipse.jface.action.IMenuManager;
16
import org.eclipse.jface.action.IStatusLineManager;
16
import org.eclipse.jface.action.IStatusLineManager;
17
import org.eclipse.ui.presentations.ActionBarPresentation;
17
18
18
/**
19
/**
19
 * Interface providing special access for configuring the action bars
20
 * Interface providing special access for configuring the action bars
Lines 61-66 Link Here
61
     * @return the cool bar manager
62
     * @return the cool bar manager
62
     */
63
     */
63
    public ICoolBarManager getCoolBarManager();
64
    public ICoolBarManager getCoolBarManager();
65
    
66
    /**
67
     * Returns the action bar presentaion used to create cool bar
68
     * contributions.
69
     * 
70
     * @return the action bar presentation
71
     * @since 3.2
72
     */
73
    public ActionBarPresentation getActionBarPresentation();
64
74
65
    /**
75
    /**
66
     * Register the action as a global action with a workbench
76
     * Register the action as a global action with a workbench
(-)Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java (-4 / +14 lines)
Lines 11-20 Link Here
11
package org.eclipse.ui.presentations;
11
package org.eclipse.ui.presentations;
12
12
13
import org.eclipse.jface.action.IStatusLineManager;
13
import org.eclipse.jface.action.IStatusLineManager;
14
import org.eclipse.jface.action.StatusLineManager;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Control;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.ui.IWorkbenchWindow;
18
17
19
/**
18
/**
20
 * This is a factory for presentation objects that control the appearance of
19
 * This is a factory for presentation objects that control the appearance of
Lines 25-30 Link Here
25
public abstract class AbstractPresentationFactory {
24
public abstract class AbstractPresentationFactory {
26
25
27
    /**
26
    /**
27
     * Creates an action presentation for a window
28
     * @param window 
29
     * @return ActionPresentation
30
     */
31
    public ActionBarPresentation createToolBarPresentation(IWorkbenchWindow window) {
32
        return new ActionBarPresentation();
33
    }
34
    
35
    /**
28
     * Creates an editor presentation for presenting editors.
36
     * Creates an editor presentation for presenting editors.
29
     * <p>
37
     * <p>
30
     * The presentation creates its controls under the given parent composite.
38
     * The presentation creates its controls under the given parent composite.
Lines 82-90 Link Here
82
     * Subclasses may override.
90
     * Subclasses may override.
83
     * 
91
     * 
84
     * @return the window's status line manager
92
     * @return the window's status line manager
93
     * @deprecated use <code>ActionBarPresentation</code>
85
     */
94
     */
86
    public IStatusLineManager createStatusLineManager() {
95
    public IStatusLineManager createStatusLineManager() {
87
        return new StatusLineManager();
96
        return null;
88
    }
97
    }
89
98
90
    /**
99
    /**
Lines 94-103 Link Here
94
     * @param statusLine the window's status line manager
103
     * @param statusLine the window's status line manager
95
     * @param parent the parent composite
104
     * @param parent the parent composite
96
     * @return the window's status line control
105
     * @return the window's status line control
106
     * @deprecated use <code>ActionBarPresentation</code>
97
     */
107
     */
98
    public Control createStatusLineControl(IStatusLineManager statusLine,
108
    public Control createStatusLineControl(IStatusLineManager statusLine,
99
            Composite parent) {
109
            Composite parent) {
100
        return ((StatusLineManager) statusLine).createControl(parent, SWT.NONE);
110
        return null;
101
    }
111
    }
102
    
112
    
103
    /**
113
    /**
(-)Eclipse UI/org/eclipse/ui/internal/part/services/NullCoolBarManager.java (-3 / +66 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.internal.part.services;
11
package org.eclipse.ui.internal.part.services;
12
12
13
import org.eclipse.jface.action.IContributionItem;
13
import org.eclipse.jface.action.ICoolBarManager;
14
import org.eclipse.jface.action.ICoolBarManager;
14
import org.eclipse.jface.action.IMenuManager;
15
import org.eclipse.jface.action.IMenuManager;
15
import org.eclipse.jface.action.IToolBarManager;
16
import org.eclipse.jface.action.IToolBarManager;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Control;
19
import org.eclipse.swt.widgets.CoolBar;
16
20
17
/**
21
/**
18
 * @since 3.1
22
 * @since 3.1
Lines 26-39 Link Here
26
		
30
		
27
	}
31
	}
28
32
29
	/* (non-Javadoc)
33
    /*
34
     *  (non-Javadoc)
35
     * @see org.eclipse.jface.action.ICoolBarManager#createControl(org.eclipse.swt.widgets.Composite)
36
     */
37
    public CoolBar createControl(Composite parent) {
38
        return null;
39
    }
40
    
41
    /*
42
     *  (non-Javadoc)
43
     * @see org.eclipse.jface.action.ICoolBarManager#createControl2(org.eclipse.swt.widgets.Composite)
44
     */
45
    public Control createControl2(Composite parent) {
46
        return createControl(parent);
47
    }
48
49
    /* (non-Javadoc)
30
	 * @see org.eclipse.jface.action.ICoolBarManager#getContextMenuManager()
50
	 * @see org.eclipse.jface.action.ICoolBarManager#getContextMenuManager()
31
	 */
51
	 */
32
	public IMenuManager getContextMenuManager() {
52
	public IMenuManager getContextMenuManager() {
33
		return null;
53
		return null;
34
	}
54
	}
35
55
36
	/* (non-Javadoc)
56
    /*
57
     *  (non-Javadoc)
58
     * @see org.eclipse.jface.action.ICoolBarManager#getControl()
59
     */
60
    public CoolBar getControl() {
61
        return null;
62
    }
63
    
64
    /*
65
     *  (non-Javadoc)
66
     * @see org.eclipse.jface.action.ICoolBarManager#getControl2()
67
     */
68
    public Control getControl2() {
69
        return null;
70
    }
71
72
    /* (non-Javadoc)
37
	 * @see org.eclipse.jface.action.ICoolBarManager#getLockLayout()
73
	 * @see org.eclipse.jface.action.ICoolBarManager#getLockLayout()
38
	 */
74
	 */
39
	public boolean getLockLayout() {
75
	public boolean getLockLayout() {
Lines 47-59 Link Here
47
		return 0;
83
		return 0;
48
	}
84
	}
49
85
50
	/* (non-Javadoc)
86
    /*
87
     *  (non-Javadoc)
88
     * @see org.eclipse.jface.action.ICoolBarManager#refresh()
89
     */
90
    public void refresh() {
91
        
92
    }
93
94
    /*
95
     *  (non-Javadoc)
96
     * @see org.eclipse.jface.action.ICoolBarManager#resetItemOrder()
97
     */
98
    public void resetItemOrder() {
99
        
100
    }
101
102
    /* (non-Javadoc)
51
	 * @see org.eclipse.jface.action.ICoolBarManager#setContextMenuManager(org.eclipse.jface.action.IMenuManager)
103
	 * @see org.eclipse.jface.action.ICoolBarManager#setContextMenuManager(org.eclipse.jface.action.IMenuManager)
52
	 */
104
	 */
53
	public void setContextMenuManager(IMenuManager menuManager) {
105
	public void setContextMenuManager(IMenuManager menuManager) {
54
		
106
		
55
	}
107
	}
56
108
109
    /*
110
     *  (non-Javadoc)
111
     * @see org.eclipse.jface.action.ICoolBarManager#setItems(org.eclipse.jface.action.IContributionItem[])
112
     */
113
    public void setItems(IContributionItem[] newItems) {
114
        
115
    }
116
57
	/* (non-Javadoc)
117
	/* (non-Javadoc)
58
	 * @see org.eclipse.jface.action.ICoolBarManager#setLockLayout(boolean)
118
	 * @see org.eclipse.jface.action.ICoolBarManager#setLockLayout(boolean)
59
	 */
119
	 */
Lines 61-64 Link Here
61
		
121
		
62
	}
122
	}
63
123
124
	public void dispose() {
125
		
126
	}
64
}
127
}
(-)Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java (+5 lines)
Lines 106-111 Link Here
106
import org.eclipse.ui.internal.util.BundleUtility;
106
import org.eclipse.ui.internal.util.BundleUtility;
107
import org.eclipse.ui.model.WorkbenchLabelProvider;
107
import org.eclipse.ui.model.WorkbenchLabelProvider;
108
import org.eclipse.ui.model.WorkbenchViewerSorter;
108
import org.eclipse.ui.model.WorkbenchViewerSorter;
109
import org.eclipse.ui.presentations.ActionBarPresentation;
109
import org.eclipse.ui.views.IViewCategory;
110
import org.eclipse.ui.views.IViewCategory;
110
import org.eclipse.ui.views.IViewDescriptor;
111
import org.eclipse.ui.views.IViewDescriptor;
111
import org.eclipse.ui.views.IViewRegistry;
112
import org.eclipse.ui.views.IViewRegistry;
Lines 474-479 Link Here
474
	        menuManager.dispose();	
475
	        menuManager.dispose();	
475
	        statusLineManager.dispose();
476
	        statusLineManager.dispose();
476
	    }
477
	    }
478
479
		public ActionBarPresentation getActionBarPresentation() {
480
			return null;
481
		}
477
    }
482
    }
478
483
479
    class ShortcutMenuItemContentProvider implements IStructuredContentProvider {
484
    class ShortcutMenuItemContentProvider implements IStructuredContentProvider {
(-)Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java (-2 / +2 lines)
Lines 211-221 Link Here
211
                                            if (manager != null)
211
                                            if (manager != null)
212
                                                updateManager(manager);
212
                                                updateManager(manager);
213
                                            manager = window
213
                                            manager = window
214
                                                    .getCoolBarManager();
214
                                                    .getCoolBarManager2();
215
                                            if (manager != null)
215
                                            if (manager != null)
216
                                                updateManager(manager);
216
                                                updateManager(manager);
217
                                            manager = window
217
                                            manager = window
218
                                                    .getToolBarManager();
218
                                                    .getToolBarManager2();
219
                                            if (manager != null)
219
                                            if (manager != null)
220
                                                updateManager(manager);
220
                                                updateManager(manager);
221
                                            manager = window
221
                                            manager = window
(-)Eclipse (+103 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ui.presentations;
12
13
import org.eclipse.jface.action.CoolBarManager;
14
import org.eclipse.jface.action.ICoolBarManager;
15
import org.eclipse.jface.action.IStatusLineManager;
16
import org.eclipse.jface.action.IToolBarManager;
17
import org.eclipse.jface.action.IToolBarManager2;
18
import org.eclipse.jface.action.StatusLineManager;
19
import org.eclipse.jface.action.ToolBarManager;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Control;
23
24
/**
25
 * Manage the creation of tool bars for a presentation factory.
26
 * 
27
 * @since 3.2
28
 */
29
public class ActionBarPresentation  {
30
    
31
    /**
32
     * Creates CoolBarManager for WorkbenchWindow's tool bar
33
     * @param style
34
     * @return coolBarManager
35
     * @since 3.2
36
     */
37
    public ICoolBarManager createCoolBarManager(int style) {
38
        CoolBarManager coolBarManager = new CoolBarManager(style);
39
        return coolBarManager;
40
    }
41
    
42
    /**
43
     * Creates the control for the window's cool bar.
44
     * Subclasses may override.
45
     * 
46
     * @param coolBarManager the window's status line manager
47
     * @param parent the parent composite
48
     * @return the window's cool bar control
49
     * @since 3.2
50
     */
51
    public Control createCoolBarControl(ICoolBarManager coolBarManager, Composite parent) {
52
    	return coolBarManager.createControl2(parent);
53
    }
54
    
55
    /**
56
     * Creates ToolBarManager for WorkbenchWindow's tool bar
57
     * @param style
58
     * @return toolBarManager
59
     * @since 3.2
60
     */
61
    public IToolBarManager createToolBarManager(int style) {
62
        return new ToolBarManager(style);
63
    }
64
    
65
    /**
66
     * Creates the control for the window's tool bar.
67
     * Subclasses may override.
68
     * 
69
     * @param toolBarManager the window's status line manager
70
     * @param parent the parent composite
71
     * @return the window's tool bar control
72
     * @since 3.2
73
     */
74
    public Control createToolBarControl(IToolBarManager2 toolBarManager, Composite parent) {
75
    	return toolBarManager.createControl2(parent);
76
    }
77
    
78
    /**
79
     * Creates the status line manager for the window.
80
     * Subclasses may override.
81
     * 
82
     * @return the window's status line manager
83
     * @since 3.2
84
     */
85
    public IStatusLineManager createStatusLineManager() {
86
        return new StatusLineManager();
87
    }
88
89
    /**
90
     * Creates the control for the window's status line.
91
     * Subclasses may override.
92
     * 
93
     * @param statusLine the window's status line manager
94
     * @param parent the parent composite
95
     * @return the window's status line control
96
     * @since 3.2
97
     */
98
    public Control createStatusLineControl(IStatusLineManager statusLine,
99
            Composite parent) {
100
        return ((StatusLineManager) statusLine).createControl(parent, SWT.NONE);
101
    }
102
   
103
}

Return to bug 123257