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/EditorReference.java (-4 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 21-27 Link Here
21
import org.eclipse.swt.graphics.Point;
21
import org.eclipse.swt.graphics.Point;
22
import org.eclipse.swt.layout.FillLayout;
22
import org.eclipse.swt.layout.FillLayout;
23
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.ui.IActionBars2;
25
import org.eclipse.ui.IEditorInput;
24
import org.eclipse.ui.IEditorInput;
26
import org.eclipse.ui.IEditorPart;
25
import org.eclipse.ui.IEditorPart;
27
import org.eclipse.ui.IEditorReference;
26
import org.eclipse.ui.IEditorReference;
Lines 401-408 Link Here
401
            
400
            
402
            EditorSite site = new EditorSite(this, part, manager.page, descr);
401
            EditorSite site = new EditorSite(this, part, manager.page, descr);
403
            
402
            
404
            site.setActionBars(new EditorActionBars((IActionBars2) manager.page
403
            site.setActionBars(new EditorActionBars(manager.page, site, getId()));
405
					.getActionBars(), site, getId()));
406
            try {
404
            try {
407
                part.init(site, input);
405
                part.init(site, input);
408
            } catch (PartInitException e) {
406
            } catch (PartInitException e) {
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java (-3 / +33 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2005 IBM Corporation and others.
2
 * Copyright (c) 2003, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 20-25 Link Here
20
import org.eclipse.jface.action.ICoolBarManager;
20
import org.eclipse.jface.action.ICoolBarManager;
21
import org.eclipse.jface.action.IMenuManager;
21
import org.eclipse.jface.action.IMenuManager;
22
import org.eclipse.jface.action.IStatusLineManager;
22
import org.eclipse.jface.action.IStatusLineManager;
23
import org.eclipse.jface.action.IToolBarManager;
24
import org.eclipse.jface.action.IToolBarManager2;
23
import org.eclipse.jface.window.Window;
25
import org.eclipse.jface.window.Window;
24
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.dnd.DropTarget;
27
import org.eclipse.swt.dnd.DropTarget;
Lines 37-42 Link Here
37
import org.eclipse.ui.application.IWorkbenchConfigurer;
39
import org.eclipse.ui.application.IWorkbenchConfigurer;
38
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
40
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
39
import org.eclipse.ui.application.WorkbenchAdvisor;
41
import org.eclipse.ui.application.WorkbenchAdvisor;
42
import org.eclipse.ui.internal.presentations.ActionBarPresentation;
40
import org.eclipse.ui.presentations.AbstractPresentationFactory;
43
import org.eclipse.ui.presentations.AbstractPresentationFactory;
41
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
44
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
42
45
Lines 205-211 Link Here
205
            if (proxy != null) {
208
            if (proxy != null) {
206
                return proxy.getCoolBarManager();
209
                return proxy.getCoolBarManager();
207
            }
210
            }
208
            return window.getCoolBarManager();
211
            return window.getCoolBarManager2();
209
        }
212
        }
210
213
211
        /* (non-Javadoc)
214
        /* (non-Javadoc)
Lines 217-222 Link Here
217
            }
220
            }
218
            window.registerGlobalAction(action);
221
            window.registerGlobalAction(action);
219
        }
222
        }
223
224
		private ActionBarPresentation getActionBarPresentation() {
225
			WorkbenchWindow window = (WorkbenchWindow)getWindowConfigurer().getWindow();
226
			return window.getActionBarPresentation();
227
		}
228
229
		/* (non-Javadoc)
230
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarManager(int)
231
		 */
232
		public IToolBarManager createToolBarManager(int style) {
233
			return getActionBarPresentation().createToolBarManager(style);
234
		}
235
236
		/* (non-Javadoc)
237
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarControl(org.eclipse.jface.action.IToolBarManager2, org.eclipse.swt.widgets.Composite)
238
		 */
239
		public Control createToolBarControl(IToolBarManager2 toolBarManager, Composite parent) {
240
			return getActionBarPresentation().createToolBarControl(toolBarManager, parent);
241
		}
242
243
		/* (non-Javadoc)
244
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarContributionItem(org.eclipse.jface.action.IToolBarManager, java.lang.String)
245
		 */
246
		public IContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id) {
247
			return getActionBarPresentation().createToolBarContributionItem(toolBarManager, id);
248
		}
220
    }
249
    }
221
250
222
    /**
251
    /**
Lines 588-594 Link Here
588
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
617
     * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer
589
     */
618
     */
590
    public Control createCoolBarControl(Composite parent) {
619
    public Control createCoolBarControl(Composite parent) {
591
        return window.getCoolBarManager().createControl(parent);
620
        return actionBarConfigurer.getActionBarPresentation().createCoolBarControl(
621
        		window.getCoolBarManager2(), parent);
592
    }
622
    }
593
623
594
    /* (non-Javadoc)
624
    /* (non-Javadoc)
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java (-37 / +113 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 36-47 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.IToolBarContributionItem;
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;
43
import org.eclipse.jface.action.ToolBarContributionItem;
44
import org.eclipse.jface.action.ToolBarManager;
45
import org.eclipse.jface.commands.ActionHandler;
46
import org.eclipse.jface.commands.ActionHandler;
46
import org.eclipse.jface.menus.ILayoutNode;
47
import org.eclipse.jface.menus.ILayoutNode;
47
import org.eclipse.jface.menus.SMenuLayout;
48
import org.eclipse.jface.menus.SMenuLayout;
Lines 117-122 Link Here
117
import org.eclipse.ui.internal.misc.Policy;
118
import org.eclipse.ui.internal.misc.Policy;
118
import org.eclipse.ui.internal.misc.UIListenerLogging;
119
import org.eclipse.ui.internal.misc.UIListenerLogging;
119
import org.eclipse.ui.internal.misc.UIStats;
120
import org.eclipse.ui.internal.misc.UIStats;
121
import org.eclipse.ui.internal.presentations.ActionBarPresentation;
122
import org.eclipse.ui.internal.presentations.InternalPresentationFactory;
120
import org.eclipse.ui.internal.progress.ProgressRegion;
123
import org.eclipse.ui.internal.progress.ProgressRegion;
121
import org.eclipse.ui.internal.registry.ActionSetRegistry;
124
import org.eclipse.ui.internal.registry.ActionSetRegistry;
122
import org.eclipse.ui.internal.registry.IActionSetDescriptor;
125
import org.eclipse.ui.internal.registry.IActionSetDescriptor;
Lines 125-130 Link Here
125
import org.eclipse.ui.internal.services.ServiceLocator;
128
import org.eclipse.ui.internal.services.ServiceLocator;
126
import org.eclipse.ui.internal.util.PrefUtil;
129
import org.eclipse.ui.internal.util.PrefUtil;
127
import org.eclipse.ui.menus.IMenuService;
130
import org.eclipse.ui.menus.IMenuService;
131
import org.eclipse.ui.presentations.AbstractPresentationFactory;
128
132
129
/**
133
/**
130
 * A window within the workbench.
134
 * A window within the workbench.
Lines 318-325 Link Here
318
		addCoolBar(SWT.FLAT);
322
		addCoolBar(SWT.FLAT);
319
		addStatusLine();
323
		addStatusLine();
320
324
321
		actionPresentation = new ActionPresentation(this);
322
323
		// register with the tracker
325
		// register with the tracker
324
		getExtensionTracker()
326
		getExtensionTracker()
325
				.registerHandler(
327
				.registerHandler(
Lines 700-706 Link Here
700
	 * Return whether or not the coolbar layout is locked.
702
	 * Return whether or not the coolbar layout is locked.
701
	 */
703
	 */
702
	protected boolean isCoolBarLocked() {
704
	protected boolean isCoolBarLocked() {
703
		CoolBarManager cbm = getCoolBarManager();
705
        ICoolBarManager cbm = getCoolBarManager2(); 
704
		return cbm != null && cbm.getLockLayout();
706
		return cbm != null && cbm.getLockLayout();
705
	}
707
	}
706
708
Lines 1411-1417 Link Here
1411
		boolean result;
1413
		boolean result;
1412
		try {
1414
		try {
1413
			// Clear the action sets, fix for bug 27416.
1415
			// Clear the action sets, fix for bug 27416.
1414
			actionPresentation.clearActionSets();
1416
            getActionPresentation().clearActionSets();
1415
1417
1416
			// Remove the handler submissions. Bug 64024.
1418
			// Remove the handler submissions. Bug 64024.
1417
			final IWorkbench workbench = getWorkbench();
1419
			final IWorkbench workbench = getWorkbench();
Lines 1476-1482 Link Here
1476
	 */
1478
	 */
1477
	/* package */
1479
	/* package */
1478
	void lockCoolBar(boolean lock) {
1480
	void lockCoolBar(boolean lock) {
1479
		getCoolBarManager().setLockLayout(lock);
1481
        getCoolBarManager2().setLockLayout(lock);
1480
	}
1482
	}
1481
1483
1482
	/**
1484
	/**
Lines 1642-1649 Link Here
1642
		// This needs to be done before pages are created to ensure proper
1644
		// This needs to be done before pages are created to ensure proper
1643
		// canonical creation
1645
		// canonical creation
1644
		// of cool items
1646
		// of cool items
1645
		if (getCoolBarManager() != null) {
1647
		ICoolBarManager coolBarMgr = getCoolBarManager2();
1646
			CoolBarManager coolBarMgr = getCoolBarManager();
1648
        if (coolBarMgr != null) {
1647
			IMemento coolBarMem = memento
1649
			IMemento coolBarMem = memento
1648
					.getChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT);
1650
					.getChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT);
1649
			if (coolBarMem != null) {
1651
			if (coolBarMem != null) {
Lines 1711-1722 Link Here
1711
							if (oldItem != null) {
1713
							if (oldItem != null) {
1712
								newItem = oldItem;
1714
								newItem = oldItem;
1713
							} else {
1715
							} else {
1714
								newItem = new ToolBarContributionItem(
1716
								ActionBarPresentation actionBarPresentation = getActionBarPresentation();
1715
										new ToolBarManager(coolBarMgr
1717
								newItem = actionBarPresentation.createToolBarContributionItem(
1718
										actionBarPresentation.createToolBarManager(coolBarMgr
1716
												.getStyle()), id);
1719
												.getStyle()), id);
1717
								if (type
1720
								if (type
1718
										.equals(IWorkbenchConstants.TAG_TYPE_PLACEHOLDER)) {
1721
										.equals(IWorkbenchConstants.TAG_TYPE_PLACEHOLDER)) {
1719
									ToolBarContributionItem newToolBarItem = (ToolBarContributionItem) newItem;
1722
									IToolBarContributionItem newToolBarItem = (IToolBarContributionItem) newItem;
1720
									if (height != null) {
1723
									if (height != null) {
1721
										newToolBarItem.setCurrentHeight(height
1724
										newToolBarItem.setCurrentHeight(height
1722
												.intValue());
1725
												.intValue());
Lines 1744-1756 Link Here
1744
							}
1747
							}
1745
							// Set the current height and width
1748
							// Set the current height and width
1746
							if ((width != null)
1749
							if ((width != null)
1747
									&& (newItem instanceof ToolBarContributionItem)) {
1750
									&& (newItem instanceof IToolBarContributionItem)) {
1748
								((ToolBarContributionItem) newItem)
1751
								((IToolBarContributionItem) newItem)
1749
										.setCurrentWidth(width.intValue());
1752
										.setCurrentWidth(width.intValue());
1750
							}
1753
							}
1751
							if ((height != null)
1754
							if ((height != null)
1752
									&& (newItem instanceof ToolBarContributionItem)) {
1755
									&& (newItem instanceof IToolBarContributionItem)) {
1753
								((ToolBarContributionItem) newItem)
1756
								((IToolBarContributionItem) newItem)
1754
										.setCurrentHeight(height.intValue());
1757
										.setCurrentHeight(height.intValue());
1755
							}
1758
							}
1756
						}
1759
						}
Lines 1935-1941 Link Here
1935
		if (coolbarMem == null) {
1938
		if (coolbarMem == null) {
1936
			return false;
1939
			return false;
1937
		}
1940
		}
1938
		CoolBarManager coolBarMgr = getCoolBarManager();
1941
        ICoolBarManager coolBarMgr = getCoolBarManager2();
1939
		// Check to see if layout is locked
1942
		// Check to see if layout is locked
1940
		Integer locked = coolbarMem.getInteger(IWorkbenchConstants.TAG_LOCKED);
1943
		Integer locked = coolbarMem.getInteger(IWorkbenchConstants.TAG_LOCKED);
1941
		boolean state = (locked != null) && (locked.intValue() == 1);
1944
		boolean state = (locked != null) && (locked.intValue() == 1);
Lines 2027-2037 Link Here
2027
				}
2030
				}
2028
				// If a tool bar contribution item already exists for this id
2031
				// If a tool bar contribution item already exists for this id
2029
				// then use the old object
2032
				// then use the old object
2030
				if (oldItem instanceof ToolBarContributionItem) {
2033
				if (oldItem instanceof IToolBarContributionItem) {
2031
					newItem = oldItem;
2034
					newItem = oldItem;
2032
				} else {
2035
				} else {
2033
					newItem = new ToolBarContributionItem(new ToolBarManager(
2036
					ActionBarPresentation actionBarPresentaiton = getActionBarPresentation();
2034
							coolBarMgr.getStyle()), id);
2037
					newItem = actionBarPresentaiton.createToolBarContributionItem(
2038
									actionBarPresentaiton.createToolBarManager(coolBarMgr.getStyle()), id);
2035
					// make it invisible by default
2039
					// make it invisible by default
2036
					newItem.setVisible(false);
2040
					newItem.setVisible(false);
2037
					// Need to add the item to the cool bar manager so that its
2041
					// Need to add the item to the cool bar manager so that its
Lines 2267-2282 Link Here
2267
		}
2271
		}
2268
2272
2269
		// / Save the order of the cool bar contribution items
2273
		// / Save the order of the cool bar contribution items
2270
		if (getCoolBarManager() != null) {
2274
        ICoolBarManager coolBarMgr = getCoolBarManager2();
2271
			getCoolBarManager().refresh();
2275
        if (coolBarMgr != null) {
2276
        	coolBarMgr.refresh();
2272
			IMemento coolBarMem = memento
2277
			IMemento coolBarMem = memento
2273
					.createChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT);
2278
					.createChild(IWorkbenchConstants.TAG_COOLBAR_LAYOUT);
2274
			if (getCoolBarManager().getLockLayout() == true) {
2279
            if (coolBarMgr.getLockLayout() == true) {
2275
				coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 1);
2280
				coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 1);
2276
			} else {
2281
			} else {
2277
				coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 0);
2282
				coolBarMem.putInteger(IWorkbenchConstants.TAG_LOCKED, 0);
2278
			}
2283
			}
2279
			IContributionItem[] items = getCoolBarManager().getItems();
2284
            IContributionItem[] items = coolBarMgr.getItems();
2280
			for (int i = 0; i < items.length; i++) {
2285
			for (int i = 0; i < items.length; i++) {
2281
				IMemento coolItemMem = coolBarMem
2286
				IMemento coolItemMem = coolBarMem
2282
						.createChild(IWorkbenchConstants.TAG_COOLITEM);
2287
						.createChild(IWorkbenchConstants.TAG_COOLITEM);
Lines 2312-2319 Link Here
2312
					 */
2317
					 */
2313
					final int height;
2318
					final int height;
2314
					final int width;
2319
					final int width;
2315
					if (item instanceof ToolBarContributionItem) {
2320
					if (item instanceof IToolBarContributionItem) {
2316
						ToolBarContributionItem toolBarItem = (ToolBarContributionItem) item;
2321
						IToolBarContributionItem toolBarItem = (IToolBarContributionItem) item;
2317
						toolBarItem.saveWidgetState();
2322
						toolBarItem.saveWidgetState();
2318
						height = toolBarItem.getCurrentHeight();
2323
						height = toolBarItem.getCurrentHeight();
2319
						width = toolBarItem.getCurrentWidth();
2324
						width = toolBarItem.getCurrentWidth();
Lines 2619-2625 Link Here
2619
		}
2624
		}
2620
		// updateAll required in order to enable accelerators on pull-down menus
2625
		// updateAll required in order to enable accelerators on pull-down menus
2621
		getMenuBarManager().updateAll(false);
2626
		getMenuBarManager().updateAll(false);
2622
		getCoolBarManager().update(false);
2627
        getCoolBarManager2().update(false);
2623
		getStatusLineManager().update(false);
2628
		getStatusLineManager().update(false);
2624
	}
2629
	}
2625
2630
Lines 2683-2694 Link Here
2683
2688
2684
		WorkbenchPage currentPage = getActiveWorkbenchPage();
2689
		WorkbenchPage currentPage = getActiveWorkbenchPage();
2685
		if (currentPage == null)
2690
		if (currentPage == null)
2686
			actionPresentation.clearActionSets();
2691
			getActionPresentation().clearActionSets();
2687
		else {
2692
		else {
2688
			if (getCoolBarManager() != null) {
2693
			if (getCoolBarManager2() != null) {
2689
				getCoolBarManager().refresh();
2694
				getCoolBarManager2().refresh();
2690
			}
2695
			}
2691
			actionPresentation.setActionSets(currentPage.getActionSets());
2696
			getActionPresentation().setActionSets(currentPage.getActionSets());
2692
		}
2697
		}
2693
		fireActionSetsChanged();
2698
		fireActionSetsChanged();
2694
		updateActionBars();
2699
		updateActionBars();
Lines 3195-3205 Link Here
3195
				.getPerspectiveBar();
3200
				.getPerspectiveBar();
3196
	}
3201
	}
3197
3202
3198
	// for dynamic UI
3203
    /**
3199
	public ActionPresentation getActionPresentation() {
3204
     * Returns the action presentation for dynamic UI
3200
		return actionPresentation;
3205
     * @return action presentation
3201
	}
3206
     */
3202
3207
    public ActionPresentation getActionPresentation() {
3208
        if (actionPresentation == null) {
3209
        	actionPresentation = new ActionPresentation(this);
3210
        }
3211
        return actionPresentation;
3212
    }
3213
    
3214
    /*package*/ ActionBarPresentation getActionBarPresentation() {
3215
    	// allow replacement of the actionbar presentation
3216
    	ActionBarPresentation actionBarPresentation;        	
3217
    	AbstractPresentationFactory presentationFactory = 
3218
    		getWindowConfigurer().getPresentationFactory();
3219
    	if (presentationFactory instanceof InternalPresentationFactory) {
3220
        	actionBarPresentation = ((InternalPresentationFactory) presentationFactory)
3221
					.createActionBarPresentation(this);
3222
    	}
3223
    	else 
3224
    		actionBarPresentation = new ActionBarPresentation();      
3225
    	
3226
    	return actionBarPresentation;        	
3227
    }
3228
    
3203
	/*
3229
	/*
3204
	 * (non-Javadoc)
3230
	 * (non-Javadoc)
3205
	 * 
3231
	 * 
Lines 3210-3215 Link Here
3210
	}
3236
	}
3211
3237
3212
	/**
3238
	/**
3239
     * Returns a new cool bar manager for the window.
3240
     * <p>
3241
     * Subclasses may override this method to customize the cool bar manager.
3242
     * </p>
3243
     * 
3244
     * @return a cool bar manager
3245
	 * @since 3.2
3246
     */
3247
    protected ICoolBarManager createCoolBarManager2(int style) {
3248
        return getActionBarPresentation().createCoolBarManager(style);
3249
    }
3250
    
3251
    /**
3252
     * Creates the control for the cool bar manager.
3253
     * <p>
3254
     * Subclasses may override this method to customize the cool bar manager.
3255
     * </p>
3256
     * 
3257
     * @return an instance of <code>CoolBar</code>\
3258
	 * @since 3.2
3259
     */
3260
    protected Control createCoolBarControl(Composite parent) {
3261
        return getActionBarPresentation().createCoolBarControl(getCoolBarManager2(), parent);
3262
    }
3263
3264
    /**
3265
     * Returns a new tool bar manager for the window.
3266
     * <p>
3267
     * Subclasses may override this method to customize the tool bar manager.
3268
     * </p>
3269
     * @return a tool bar manager
3270
	 * @since 3.2
3271
     */
3272
    protected IToolBarManager2 createToolBarManager2(int style) {
3273
        return getActionBarPresentation().createToolBarManager(style);
3274
    }
3275
3276
    /**
3277
     * Creates the control for the tool bar manager.
3278
     * <p>
3279
     * Subclasses may override this method to customize the tool bar manager.
3280
     * </p>
3281
     * @return a Control
3282
	 * @since 3.2
3283
     */
3284
    protected Control createToolBarControl(Composite parent) {
3285
        return getActionBarPresentation().createToolBarControl(getToolBarManager2(), parent);
3286
    }
3287
    
3288
    /**
3213
	 * Delegate to the presentation factory.
3289
	 * Delegate to the presentation factory.
3214
	 * 
3290
	 * 
3215
	 * @see org.eclipse.jface.window.ApplicationWindow#createStatusLineManager
3291
	 * @see org.eclipse.jface.window.ApplicationWindow#createStatusLineManager
(-)Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 375-381 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
380
381
            bars.addAdjunctContribution(actionContribution);
381
            bars.addAdjunctContribution(actionContribution);
Lines 430-436 Link Here
430
430
431
            // Create the action
431
            // Create the action
432
            PluginAction action = ad.getAction();
432
            PluginAction action = ad.getAction();
433
            PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
433
            ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
434
                    action);
434
                    action);
435
435
436
            // retreive the toolbar from the action bars.
436
            // retreive the toolbar from the action bars.
Lines 562-568 Link Here
562
            //			if (menuMgr != null) 
562
            //			if (menuMgr != null) 
563
            //				revokeActionSetFromMenu(menuMgr, id);
563
            //				revokeActionSetFromMenu(menuMgr, id);
564
564
565
            revokeActionSetFromCoolbar(window.getCoolBarManager(), id);
565
            revokeActionSetFromCoolbar(window.getCoolBarManager2(), id);
566
            //			IToolBarManager toolBarMgr = bars.getToolBarManager();
566
            //			IToolBarManager toolBarMgr = bars.getToolBarManager();
567
            //			if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager) 
567
            //			if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager) 
568
            //				revokeActionSetFromToolbar(toolBarMgr, id);
568
            //				revokeActionSetFromToolbar(toolBarMgr, id);
(-)Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 41-47 Link Here
41
     * 
41
     * 
42
     */
42
     */
43
    public ICoolBarManager getCoolBarManager() {
43
    public ICoolBarManager getCoolBarManager() {
44
        return window.getCoolBarManager();
44
        return window.getCoolBarManager2();
45
    }
45
    }
46
46
47
    /**
47
    /**
(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java (-7 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
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 2539-2545 Link Here
2539
        // Run op in busy cursor.
2539
        // Run op in busy cursor.
2540
        // Use set redraw to eliminate the "flash" that can occur in the
2540
        // Use set redraw to eliminate the "flash" that can occur in the
2541
        // coolbar as the perspective is reset.
2541
        // coolbar as the perspective is reset.
2542
        CoolBarManager mgr = window.getCoolBarManager();
2542
        ICoolBarManager mgr = window.getCoolBarManager2();
2543
        try {
2543
        try {
2544
            mgr.getControl().setRedraw(false);
2544
            mgr.getControl().setRedraw(false);
2545
            BusyIndicator.showWhile(null, new Runnable() {
2545
            BusyIndicator.showWhile(null, new Runnable() {
Lines 3144-3152 Link Here
3144
        // Going from multiple to single rows can make the coolbar
3144
        // Going from multiple to single rows can make the coolbar
3145
        // and its adjacent views appear jumpy as perspectives are
3145
        // and its adjacent views appear jumpy as perspectives are
3146
        // switched. Turn off redraw to help with this.
3146
        // switched. Turn off redraw to help with this.
3147
        CoolBarManager mgr = window.getCoolBarManager();
3147
        ICoolBarManager mgr = window.getCoolBarManager2();
3148
        try {
3148
        try {
3149
            mgr.getControl().setRedraw(false);
3149
            mgr.getControl2().setRedraw(false);
3150
            getClientComposite().setRedraw(false);
3150
            getClientComposite().setRedraw(false);
3151
            // Run op in busy cursor.
3151
            // Run op in busy cursor.
3152
            BusyIndicator.showWhile(null, new Runnable() {
3152
            BusyIndicator.showWhile(null, new Runnable() {
Lines 3156-3162 Link Here
3156
            });
3156
            });
3157
        } finally {
3157
        } finally {
3158
            getClientComposite().setRedraw(true);
3158
            getClientComposite().setRedraw(true);
3159
            mgr.getControl().setRedraw(true);
3159
            mgr.getControl2().setRedraw(true);
3160
            IWorkbenchPart part = getActivePart();
3160
            IWorkbenchPart part = getActivePart();
3161
            if (part != null)
3161
            if (part != null)
3162
                part.setFocus();
3162
                part.setFocus();
Lines 3176-3182 Link Here
3176
     * Restore the toolbar layout for the active perspective.
3176
     * Restore the toolbar layout for the active perspective.
3177
     */
3177
     */
3178
    protected void resetToolBarLayout() {
3178
    protected void resetToolBarLayout() {
3179
        window.getCoolBarManager().resetItemOrder();
3179
        window.getCoolBarManager2().resetItemOrder();
3180
    }
3180
    }
3181
3181
3182
    /**
3182
    /**
(-)Eclipse UI/org/eclipse/ui/internal/EditorManager.java (-9 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 52-59 Link Here
52
import org.eclipse.swt.widgets.Display;
52
import org.eclipse.swt.widgets.Display;
53
import org.eclipse.swt.widgets.Shell;
53
import org.eclipse.swt.widgets.Shell;
54
import org.eclipse.ui.ActiveShellExpression;
54
import org.eclipse.ui.ActiveShellExpression;
55
import org.eclipse.ui.ISaveableModel;
56
import org.eclipse.ui.ISaveableModelSource;
57
import org.eclipse.ui.IEditorActionBarContributor;
55
import org.eclipse.ui.IEditorActionBarContributor;
58
import org.eclipse.ui.IEditorDescriptor;
56
import org.eclipse.ui.IEditorDescriptor;
59
import org.eclipse.ui.IEditorInput;
57
import org.eclipse.ui.IEditorInput;
Lines 67-72 Link Here
67
import org.eclipse.ui.IPathEditorInput;
65
import org.eclipse.ui.IPathEditorInput;
68
import org.eclipse.ui.IPersistableElement;
66
import org.eclipse.ui.IPersistableElement;
69
import org.eclipse.ui.IReusableEditor;
67
import org.eclipse.ui.IReusableEditor;
68
import org.eclipse.ui.ISaveableModel;
69
import org.eclipse.ui.ISaveableModelSource;
70
import org.eclipse.ui.ISaveablePart;
70
import org.eclipse.ui.ISaveablePart;
71
import org.eclipse.ui.ISaveablePart2;
71
import org.eclipse.ui.ISaveablePart2;
72
import org.eclipse.ui.IViewPart;
72
import org.eclipse.ui.IViewPart;
Lines 296-303 Link Here
296
		}
296
		}
297
297
298
		// Create a new action bar set.
298
		// Create a new action bar set.
299
		actionBars = new EditorActionBars(
299
		actionBars = new EditorActionBars(page, site, type);
300
				(WWinActionBars) page.getActionBars(), site, type);
301
		actionBars.addRef();
300
		actionBars.addRef();
302
		actionCache.put(type, actionBars);
301
		actionCache.put(type, actionBars);
303
302
Lines 329-336 Link Here
329
328
330
		// Create a new action bar set.
329
		// Create a new action bar set.
331
		// Note: It is an empty set.
330
		// Note: It is an empty set.
332
		EditorActionBars actionBars = new EditorActionBars(
331
		EditorActionBars actionBars = new EditorActionBars(page, site, type);
333
				(WWinActionBars) page.getActionBars(), site, type);
334
		actionBars.addRef();
332
		actionBars.addRef();
335
		actionCache.put(type, actionBars);
333
		actionCache.put(type, actionBars);
336
334
Lines 347-354 Link Here
347
			String type = actionBars.getEditorType();
345
			String type = actionBars.getEditorType();
348
			actionCache.remove(type);
346
			actionCache.remove(type);
349
			// refresh the cool bar manager before disposing of a cool item
347
			// refresh the cool bar manager before disposing of a cool item
350
			if (window.getCoolBarManager() != null) {
348
            if (window.getCoolBarManager2() != null) {
351
				window.getCoolBarManager().refresh();
349
                window.getCoolBarManager2().refresh();
352
			}
350
			}
353
			actionBars.dispose();
351
			actionBars.dispose();
354
		}
352
		}
(-)Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java (-25 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-20 Link Here
13
13
14
import org.eclipse.jface.action.IContributionItem;
14
import org.eclipse.jface.action.IContributionItem;
15
import org.eclipse.jface.action.IContributionManager;
15
import org.eclipse.jface.action.IContributionManager;
16
import org.eclipse.jface.action.ToolBarContributionItem;
16
import org.eclipse.jface.action.IToolBarContributionItem;
17
import org.eclipse.jface.action.ToolBarManager;
18
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.CoolBar;
18
import org.eclipse.swt.widgets.CoolBar;
20
import org.eclipse.swt.widgets.Menu;
19
import org.eclipse.swt.widgets.Menu;
Lines 65-71 Link Here
65
     * @param item
64
     * @param item
66
     *            The item to be replaced; must not be <code>null</code>.
65
     *            The item to be replaced; must not be <code>null</code>.
67
     */
66
     */
68
    PlaceholderContributionItem(final ToolBarContributionItem item) {
67
    PlaceholderContributionItem(final IToolBarContributionItem item) {
69
        item.saveWidgetState();
68
        item.saveWidgetState();
70
        id = item.getId();
69
        id = item.getId();
71
        storedHeight = item.getCurrentHeight();
70
        storedHeight = item.getCurrentHeight();
Lines 74-100 Link Here
74
        storedUseChevron = item.getUseChevron();
73
        storedUseChevron = item.getUseChevron();
75
    }
74
    }
76
75
77
    /**
78
     * Creates a new tool bar contribution item on the given manager -- using
79
     * the stored data to initialize some of its properties.
80
     * 
81
     * @param manager
82
     *            The manager for which the contribution item should be
83
     *            created; must not be <code>null</code>
84
     * @return A new tool bar contribution item equivalent to the contribution
85
     *         item this placeholder was intended to replace; never <code>null</code>.
86
     */
87
    ToolBarContributionItem createToolBarContributionItem(
88
            final ToolBarManager manager) {
89
        ToolBarContributionItem toolBarContributionItem = new ToolBarContributionItem(
90
                manager, id);
91
        toolBarContributionItem.setCurrentHeight(storedHeight);
92
        toolBarContributionItem.setCurrentWidth(storedWidth);
93
        toolBarContributionItem.setMinimumItemsToShow(storedMinimumItems);
94
        toolBarContributionItem.setUseChevron(storedUseChevron);
95
        return toolBarContributionItem;
96
    }
97
98
    /*
76
    /*
99
     * (non-Javadoc)
77
     * (non-Javadoc)
100
     * 
78
     * 
Lines 172-177 Link Here
172
    int getWidth() {
150
    int getWidth() {
173
        return storedWidth;
151
        return storedWidth;
174
    }
152
    }
153
    
154
    /**
155
     * Returns the minimum number of tool items to show in the cool item.
156
     * 
157
     * @return the minimum number of tool items to show, or <code>SHOW_ALL_ITEMS</code>
158
     *         if a value was not set
159
     * @see #setMinimumItemsToShow(int)
160
	 * @since 3.2
161
     */
162
    int getMinimumItemsToShow() {
163
    	return storedMinimumItems;
164
    }
165
    
166
    /**
167
     * Returns whether chevron support is enabled.
168
     * 
169
     * @return <code>true</code> if chevron support is enabled, <code>false</code>
170
     *         otherwise
171
	 * @since 3.2
172
     */
173
    boolean getUseChevron() {
174
        return storedUseChevron;
175
    }
175
176
176
    /*
177
    /*
177
     * (non-Javadoc)
178
     * (non-Javadoc)
(-)Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java (-14 / +33 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-29 Link Here
18
import org.eclipse.jface.action.IContributionManagerOverrides;
18
import org.eclipse.jface.action.IContributionManagerOverrides;
19
import org.eclipse.jface.action.ICoolBarManager;
19
import org.eclipse.jface.action.ICoolBarManager;
20
import org.eclipse.jface.action.IMenuManager;
20
import org.eclipse.jface.action.IMenuManager;
21
import org.eclipse.jface.action.IToolBarContributionItem;
21
import org.eclipse.jface.action.IToolBarManager;
22
import org.eclipse.jface.action.IToolBarManager;
22
import org.eclipse.jface.action.SubContributionManager;
23
import org.eclipse.jface.action.SubContributionManager;
23
import org.eclipse.jface.action.SubMenuManager;
24
import org.eclipse.jface.action.SubMenuManager;
24
import org.eclipse.jface.action.SubStatusLineManager;
25
import org.eclipse.jface.action.SubStatusLineManager;
25
import org.eclipse.jface.action.SubToolBarManager;
26
import org.eclipse.jface.action.SubToolBarManager;
26
import org.eclipse.jface.action.ToolBarContributionItem;
27
import org.eclipse.jface.action.ToolBarManager;
27
import org.eclipse.jface.action.ToolBarManager;
28
import org.eclipse.ui.IActionBars2;
28
import org.eclipse.ui.IActionBars2;
29
import org.eclipse.ui.IEditorActionBarContributor;
29
import org.eclipse.ui.IEditorActionBarContributor;
Lines 33-38 Link Here
33
import org.eclipse.ui.SubActionBars2;
33
import org.eclipse.ui.SubActionBars2;
34
import org.eclipse.ui.actions.RetargetAction;
34
import org.eclipse.ui.actions.RetargetAction;
35
import org.eclipse.ui.internal.misc.Policy;
35
import org.eclipse.ui.internal.misc.Policy;
36
import org.eclipse.ui.internal.presentations.ActionBarPresentation;
36
import org.eclipse.ui.services.IServiceLocator;
37
import org.eclipse.ui.services.IServiceLocator;
37
38
38
/**
39
/**
Lines 82-98 Link Here
82
83
83
	private int refCount;
84
	private int refCount;
84
85
85
	private ToolBarContributionItem toolBarContributionItem = null;
86
	private IToolBarContributionItem toolBarContributionItem = null;
86
87
87
	private String type;
88
	private String type;
89
	
90
	private ActionBarPresentation actionBarPresentation;
88
91
89
	/**
92
	/**
90
	 * Constructs the EditorActionBars for an editor.
93
	 * Constructs the EditorActionBars for an editor.
91
	 */
94
	 */
92
	public EditorActionBars(IActionBars2 parent,
95
	public EditorActionBars(WorkbenchPage page,
93
			final IServiceLocator serviceLocator, String type) {
96
			final IServiceLocator serviceLocator, String type) {
94
		super(parent, serviceLocator);
97
		super((IActionBars2)page.getActionBars(), serviceLocator);
95
		this.type = type;
98
		this.type = type;
99
		this.actionBarPresentation = ((WorkbenchWindow) page
100
				.getWorkbenchWindow()).getActionBarPresentation();
96
	}
101
	}
97
102
98
	/**
103
	/**
Lines 243-256 Link Here
243
		}
248
		}
244
		if (toolBarContributionItem == null) {
249
		if (toolBarContributionItem == null) {
245
			IContributionItem foundItem = coolBarManager.find(type);
250
			IContributionItem foundItem = coolBarManager.find(type);
246
			if ((foundItem instanceof ToolBarContributionItem)) {
251
			if ((foundItem instanceof IToolBarContributionItem)) {
247
				toolBarContributionItem = (ToolBarContributionItem) foundItem;
252
				toolBarContributionItem = (IToolBarContributionItem) foundItem;
248
				coolItemToolBarMgr = toolBarContributionItem
253
				coolItemToolBarMgr = toolBarContributionItem.getToolBarManager();
249
						.getToolBarManager();
250
				if (coolItemToolBarMgr == null) {
254
				if (coolItemToolBarMgr == null) {
251
					coolItemToolBarMgr = new ToolBarManager(coolBarManager
255
					coolItemToolBarMgr = actionBarPresentation.createToolBarManager(coolBarManager
252
							.getStyle());
256
							.getStyle());
253
					toolBarContributionItem = new ToolBarContributionItem(
257
					toolBarContributionItem = actionBarPresentation.createToolBarContributionItem(
254
							coolItemToolBarMgr, type);
258
							coolItemToolBarMgr, type);
255
					// Add editor item to group
259
					// Add editor item to group
256
					coolBarManager.prependToGroup(
260
					coolBarManager.prependToGroup(
Lines 263-275 Link Here
263
				if ((coolBarManager instanceof ContributionManager)
267
				if ((coolBarManager instanceof ContributionManager)
264
						&& (foundItem instanceof PlaceholderContributionItem)) {
268
						&& (foundItem instanceof PlaceholderContributionItem)) {
265
					PlaceholderContributionItem placeholder = (PlaceholderContributionItem) foundItem;
269
					PlaceholderContributionItem placeholder = (PlaceholderContributionItem) foundItem;
266
					toolBarContributionItem = placeholder
270
					toolBarContributionItem = createToolBarContributionItem(
267
							.createToolBarContributionItem((ToolBarManager) coolItemToolBarMgr);
271
							(ToolBarManager) coolItemToolBarMgr, placeholder);
268
					// Restore from a placeholder
272
					// Restore from a placeholder
269
					((ContributionManager) coolBarManager).replaceItem(type,
273
					((ContributionManager) coolBarManager).replaceItem(type,
270
							toolBarContributionItem);
274
							toolBarContributionItem);
271
				} else {
275
				} else {
272
					toolBarContributionItem = new ToolBarContributionItem(
276
					toolBarContributionItem = actionBarPresentation.createToolBarContributionItem(
273
							coolItemToolBarMgr, type);
277
							coolItemToolBarMgr, type);
274
					// Add editor item to group
278
					// Add editor item to group
275
					coolBarManager.prependToGroup(
279
					coolBarManager.prependToGroup(
Lines 284-289 Link Here
284
288
285
		return coolItemToolBarMgr;
289
		return coolItemToolBarMgr;
286
	}
290
	}
291
	
292
    /*
293
     * Creates a new tool bar contribution item on the given manager -- using
294
     * the stored data to initialize some of its properties.
295
     */
296
    IToolBarContributionItem createToolBarContributionItem(
297
			final ToolBarManager manager, PlaceholderContributionItem item) {
298
		IToolBarContributionItem toolBarContributionItem = actionBarPresentation
299
				.createToolBarContributionItem(manager, item.getId());
300
		toolBarContributionItem.setCurrentHeight(item.getHeight());
301
		toolBarContributionItem.setCurrentWidth(item.getWidth());
302
		toolBarContributionItem.setMinimumItemsToShow(item.getMinimumItemsToShow());
303
		toolBarContributionItem.setUseChevron(item.getUseChevron());
304
		return toolBarContributionItem;
305
	}
287
306
288
	/**
307
	/**
289
	 * Returns whether the contribution list is visible. If the visibility is
308
	 * Returns whether the contribution list is visible. If the visibility is
(-)Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java (-19 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-37 Link Here
18
import org.eclipse.jface.action.IContributionManager;
18
import org.eclipse.jface.action.IContributionManager;
19
import org.eclipse.jface.action.ICoolBarManager;
19
import org.eclipse.jface.action.ICoolBarManager;
20
import org.eclipse.jface.action.IMenuManager;
20
import org.eclipse.jface.action.IMenuManager;
21
import org.eclipse.jface.action.IToolBarContributionItem;
21
import org.eclipse.jface.action.IToolBarManager;
22
import org.eclipse.jface.action.IToolBarManager;
22
import org.eclipse.jface.action.SubMenuManager;
23
import org.eclipse.jface.action.SubMenuManager;
23
import org.eclipse.jface.action.SubToolBarManager;
24
import org.eclipse.jface.action.SubToolBarManager;
24
import org.eclipse.jface.action.ToolBarContributionItem;
25
import org.eclipse.jface.action.ToolBarManager;
26
import org.eclipse.ui.IActionBars2;
25
import org.eclipse.ui.IActionBars2;
27
import org.eclipse.ui.IWorkbenchActionConstants;
26
import org.eclipse.ui.IWorkbenchActionConstants;
28
import org.eclipse.ui.SubActionBars2;
27
import org.eclipse.ui.SubActionBars2;
28
import org.eclipse.ui.internal.presentations.ActionBarPresentation;
29
import org.eclipse.ui.services.IServiceLocator;
29
import org.eclipse.ui.services.IServiceLocator;
30
30
31
/**
31
/**
32
 * This class represents the action bars for an action set.
32
 * This class represents the action bars for an action set.
33
 */
33
 */
34
public class ActionSetActionBars extends SubActionBars2 {
34
public class ActionSetActionBars extends SubActionBars2 {
35
	
36
	private ActionBarPresentation actionBarPresentation = null;
35
37
36
	private String actionSetId;
38
	private String actionSetId;
37
39
Lines 39-54 Link Here
39
41
40
	private IToolBarManager coolItemToolBarMgr = null;
42
	private IToolBarManager coolItemToolBarMgr = null;
41
43
42
	private ToolBarContributionItem toolBarContributionItem = null;
44
	private IToolBarContributionItem toolBarContributionItem = null;
43
45
44
	/**
46
	/**
45
	 * Constructs a new action bars object
47
     * Constructs a new action bars object
46
	 */
48
     */
47
	public ActionSetActionBars(IActionBars2 parent,
49
    public ActionSetActionBars(IActionBars2 parent, final IServiceLocator serviceLocator, 
48
			final IServiceLocator serviceLocator, String actionSetId) {
50
    		String actionSetId, WorkbenchWindow window) {
49
		super(parent, serviceLocator);
51
    	super(parent, serviceLocator);
50
		this.actionSetId = actionSetId;
52
		this.actionSetId = actionSetId;		
51
	}
53
        this.actionBarPresentation = window.getActionBarPresentation();
54
    }
52
55
53
	/**
56
	/**
54
	 * Adds to the list all the actions that are part of this action set but
57
	 * Adds to the list all the actions that are part of this action set but
Lines 107-113 Link Here
107
		for (int i = 0; i < adjunctContributions.size(); i++) {
110
		for (int i = 0; i < adjunctContributions.size(); i++) {
108
			ContributionItem item = (ContributionItem) adjunctContributions
111
			ContributionItem item = (ContributionItem) adjunctContributions
109
					.get(i);
112
					.get(i);
110
			ToolBarManager parent = (ToolBarManager) item.getParent();
113
			IContributionManager parent = item.getParent();
111
			if (parent != null) {
114
			if (parent != null) {
112
				parent.remove(item);
115
				parent.remove(item);
113
				item.dispose();
116
				item.dispose();
Lines 181-187 Link Here
181
		if (coolBarManager == null) {
184
		if (coolBarManager == null) {
182
			return null;
185
			return null;
183
		}
186
		}
184
		return new ToolBarManager(coolBarManager.getStyle());
187
        return actionBarPresentation.createToolBarManager(coolBarManager.getStyle());
185
	}
188
	}
186
189
187
	/**
190
	/**
Lines 221-229 Link Here
221
		// tool bar
224
		// tool bar
222
		// id then create one. Otherwise retrieve the tool bar contribution
225
		// id then create one. Otherwise retrieve the tool bar contribution
223
		// item
226
		// item
224
		if (cbItem instanceof ToolBarContributionItem) {
227
		if (cbItem instanceof IToolBarContributionItem) {
225
228
226
			ToolBarContributionItem tbcbItem = (ToolBarContributionItem) cbItem;
229
			IToolBarContributionItem tbcbItem = (IToolBarContributionItem) cbItem;
227
			coolItemToolBarMgr = tbcbItem.getToolBarManager();
230
			coolItemToolBarMgr = tbcbItem.getToolBarManager();
228
			// If this not an adjuct type then we can cashe the tool bar
231
			// If this not an adjuct type then we can cashe the tool bar
229
			// contribution type
232
			// contribution type
Lines 231-245 Link Here
231
				toolBarContributionItem = tbcbItem;
234
				toolBarContributionItem = tbcbItem;
232
			}
235
			}
233
		} else {
236
		} else {
234
237
			
235
			coolItemToolBarMgr = new ToolBarManager(coolBarManager.getStyle());
238
			coolItemToolBarMgr = actionBarPresentation
239
					.createToolBarManager(coolBarManager.getStyle());
240
           
236
			// If this is not an adjunct type then create a tool bar
241
			// If this is not an adjunct type then create a tool bar
237
			// contribution item
242
			// contribution item
238
			// we don't create one for an adjunct type because another action
243
			// we don't create one for an adjunct type because another action
239
			// set action bars contains one
244
			// set action bars contains one
245
            
246
            IContributionItem toolBarContributionItem = actionBarPresentation
247
					.createToolBarContributionItem(coolItemToolBarMgr,
248
							toolBarId);
240
249
241
			toolBarContributionItem = new ToolBarContributionItem(
242
					coolItemToolBarMgr, toolBarId);
243
			toolBarContributionItem.setParent(coolItemToolBarMgr);
250
			toolBarContributionItem.setParent(coolItemToolBarMgr);
244
			toolBarContributionItem.setVisible(getActive());
251
			toolBarContributionItem.setVisible(getActive());
245
			coolItemToolBarMgr.markDirty();
252
			coolItemToolBarMgr.markDirty();
(-)Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 146-152 Link Here
146
                    } else {
146
                    } else {
147
                        IActionSet set = desc.createActionSet();
147
                        IActionSet set = desc.createActionSet();
148
                        SubActionBars bars = new ActionSetActionBars(window
148
                        SubActionBars bars = new ActionSetActionBars(window
149
                                .getActionBars(), window, desc.getId());
149
                                .getActionBars(), window, desc.getId(), window);
150
                        rec = new SetRec(desc, set, bars);
150
                        rec = new SetRec(desc, set, bars);
151
                        set.init(window, bars);
151
                        set.init(window, bars);
152
                        sets.add(set);
152
                        sets.add(set);
(-)Eclipse UI/org/eclipse/ui/internal/ViewPane.java (-24 / +47 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-20 Link Here
13
package org.eclipse.ui.internal;
13
package org.eclipse.ui.internal;
14
14
15
15
16
import org.eclipse.jface.action.IToolBarManager2;
16
import org.eclipse.jface.action.MenuManager;
17
import org.eclipse.jface.action.MenuManager;
17
import org.eclipse.jface.action.ToolBarManager;
18
import org.eclipse.jface.util.IPropertyChangeListener;
19
import org.eclipse.jface.util.PropertyChangeEvent;
18
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.events.MouseAdapter;
21
import org.eclipse.swt.events.MouseAdapter;
20
import org.eclipse.swt.events.MouseEvent;
22
import org.eclipse.swt.events.MouseEvent;
Lines 28-33 Link Here
28
import org.eclipse.ui.IViewReference;
30
import org.eclipse.ui.IViewReference;
29
import org.eclipse.ui.IWorkbenchPart;
31
import org.eclipse.ui.IWorkbenchPart;
30
import org.eclipse.ui.internal.dnd.DragUtil;
32
import org.eclipse.ui.internal.dnd.DragUtil;
33
import org.eclipse.ui.internal.presentations.ActionBarPresentation;
31
import org.eclipse.ui.presentations.IPresentablePart;
34
import org.eclipse.ui.presentations.IPresentablePart;
32
import org.eclipse.ui.presentations.StackPresentation;
35
import org.eclipse.ui.presentations.StackPresentation;
33
36
Lines 41-48 Link Here
41
44
42
    // create initially toolbarless bar manager so that actions may be added in the 
45
    // create initially toolbarless bar manager so that actions may be added in the 
43
    // init method of the view.
46
    // init method of the view.
44
    private ToolBarManager isvToolBarMgr = new PaneToolBarManager(SWT.FLAT
47
    private IToolBarManager2 isvToolBarMgr = null;
45
            | SWT.WRAP);
46
48
47
    private MenuManager isvMenuMgr;
49
    private MenuManager isvMenuMgr;
48
50
Lines 56-71 Link Here
56
    /**
58
    /**
57
     * Toolbar manager for the ISV toolbar.
59
     * Toolbar manager for the ISV toolbar.
58
     */
60
     */
59
    class PaneToolBarManager extends ToolBarManager {
61
    private class ISVPropListener implements IPropertyChangeListener {    	
60
        public PaneToolBarManager(int style) {
62
    	private Control toolBar;    	
61
            super(style);
63
    	
62
        }
64
    	/**
63
65
    	 * Constructor
64
        protected void relayout(ToolBar toolBar, int oldCount, int newCount) {
66
    	 * @param toolBar
65
            toolBarResized(toolBar, newCount);
67
    	 */
66
68
    	public ISVPropListener (Control toolBar) {
67
            toolBar.layout();
69
    		this.toolBar = toolBar;
68
        }
70
    	}
71
    	
72
    	/* (non-Javadoc)
73
    	 * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
74
    	 */
75
    	public void propertyChange(PropertyChangeEvent event) {    		
76
    		String property = event.getProperty();
77
    		Integer newValue = (Integer)event.getNewValue();
78
	       	if (IToolBarManager2.PROP_LAYOUT.equals(property)) {
79
	       		toolBarResized(toolBar, newValue != null ? newValue.intValue() : 0);	
80
	       		if (toolBar instanceof Composite)
81
	       			((Composite)toolBar).layout();
82
	       		else
83
	       			toolBar.getParent().layout();
84
	       	}
85
	    }
69
    }
86
    }
70
87
71
    /**
88
    /**
Lines 92-97 Link Here
92
     */
109
     */
93
    public ViewPane(IViewReference ref, WorkbenchPage page) {
110
    public ViewPane(IViewReference ref, WorkbenchPage page) {
94
        super(ref, page);
111
        super(ref, page);
112
        ActionBarPresentation actionBarPresentation = ((WorkbenchWindow) page
113
				.getWorkbenchWindow()).getActionBarPresentation();
114
        
115
        isvToolBarMgr = actionBarPresentation.createViewToolBarManager(SWT.FLAT | SWT.WRAP);
95
    }
116
    }
96
117
97
    /**
118
    /**
Lines 123-131 Link Here
123
144
124
    }
145
    }
125
146
126
    private void toolBarResized(ToolBar toolBar, int newSize) {
147
    private void toolBarResized(Control toolBar, int newSize) {
127
        
148
        
128
        Control toolbar = isvToolBarMgr.getControl();
149
        Control toolbar = isvToolBarMgr.getControl2();
129
        if (toolbar != null) {
150
        if (toolbar != null) {
130
            Control ctrl = getControl();
151
            Control ctrl = getControl();
131
152
Lines 146-152 Link Here
146
        
167
        
147
        // ISV toolbar.
168
        // ISV toolbar.
148
        //			// 1GD0ISU: ITPUI:ALL - Dbl click on view tool cause zoom
169
        //			// 1GD0ISU: ITPUI:ALL - Dbl click on view tool cause zoom
149
        final ToolBar isvToolBar = isvToolBarMgr.createControl(parentControl.getParent());
170
        final Control isvToolBar = isvToolBarMgr.createControl2(parentControl.getParent());
171
        
172
        isvToolBarMgr.addPropertyChangeListener(new ISVPropListener(isvToolBar));
150
        
173
        
151
        isvToolBar.addMouseListener(new MouseAdapter() {
174
        isvToolBar.addMouseListener(new MouseAdapter() {
152
            public void mouseDoubleClick(MouseEvent event) {
175
            public void mouseDoubleClick(MouseEvent event) {
Lines 301-307 Link Here
301
    /**
324
    /**
302
     * @see ViewActionBars
325
     * @see ViewActionBars
303
     */
326
     */
304
    public ToolBarManager getToolBarManager() {
327
    public IToolBarManager2 getToolBarManager() {
305
        return isvToolBarMgr;
328
        return isvToolBarMgr;
306
    }
329
    }
307
330
Lines 463-469 Link Here
463
        super.reparent(newParent);
486
        super.reparent(newParent);
464
487
465
        if (isvToolBarMgr != null) {
488
        if (isvToolBarMgr != null) {
466
            ToolBar bar = isvToolBarMgr.getControl();
489
            Control bar = isvToolBarMgr.getControl2();
467
            if (bar != null) {
490
            if (bar != null) {
468
                bar.setParent(newParent);
491
                bar.setParent(newParent);
469
                bar.moveAbove(control);
492
                bar.moveAbove(control);
Lines 499-517 Link Here
499
    }
522
    }
500
523
501
    public boolean toolbarIsVisible() {
524
    public boolean toolbarIsVisible() {
502
        ToolBarManager toolbarManager = getToolBarManager();
525
        IToolBarManager2 toolbarManager = getToolBarManager();
503
526
504
        if (toolbarManager == null) {
527
        if (toolbarManager == null) {
505
            return false;
528
            return false;
506
        }
529
        }
507
530
508
        ToolBar control = toolbarManager.getControl();
531
        Control control = toolbarManager.getControl2();
509
532
510
        if (control == null || control.isDisposed()) {
533
        if (control == null || control.isDisposed()) {
511
            return false;
534
            return false;
512
        }
535
        }
513
536
514
        return control.getItemCount() > 0;
537
        return toolbarManager.getItemCount() > 0;
515
    }
538
    }
516
539
517
    /*
540
    /*
Lines 559-570 Link Here
559
        return internalGetToolbar();
582
        return internalGetToolbar();
560
    }
583
    }
561
    
584
    
562
    private ToolBar internalGetToolbar() {
585
    private Control internalGetToolbar() {
563
        if (isvToolBarMgr == null) {
586
        if (isvToolBarMgr == null) {
564
            return null;
587
            return null;
565
        }
588
        }
566
        
589
        
567
        return isvToolBarMgr.getControl();        
590
        return isvToolBarMgr.getControl2();        
568
    }
591
    }
569
592
570
    /* (non-Javadoc)
593
    /* (non-Javadoc)
(-)Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java (+34 lines)
Lines 11-19 Link Here
11
package org.eclipse.ui.application;
11
package org.eclipse.ui.application;
12
12
13
import org.eclipse.jface.action.IAction;
13
import org.eclipse.jface.action.IAction;
14
import org.eclipse.jface.action.IContributionItem;
14
import org.eclipse.jface.action.ICoolBarManager;
15
import org.eclipse.jface.action.ICoolBarManager;
15
import org.eclipse.jface.action.IMenuManager;
16
import org.eclipse.jface.action.IMenuManager;
16
import org.eclipse.jface.action.IStatusLineManager;
17
import org.eclipse.jface.action.IStatusLineManager;
18
import org.eclipse.jface.action.IToolBarManager;
19
import org.eclipse.jface.action.IToolBarManager2;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.swt.widgets.Control;
17
22
18
/**
23
/**
19
 * Interface providing special access for configuring the action bars
24
 * Interface providing special access for configuring the action bars
Lines 61-66 Link Here
61
     * @return the cool bar manager
66
     * @return the cool bar manager
62
     */
67
     */
63
    public ICoolBarManager getCoolBarManager();
68
    public ICoolBarManager getCoolBarManager();
69
    
70
    /**
71
     * Creates tool bar manager for the workbench window's tool bar.
72
	 *
73
     * @param style
74
     * @return toolBarManager
75
     * @since 3.2
76
     */
77
    public IToolBarManager createToolBarManager(int style);
78
    
79
    /**
80
     * Creates the control for the window's tool bar.
81
     * 
82
     * @param toolBarManager the window's tool bar manager
83
     * @param parent the parent composite
84
     * @return the window's tool bar control
85
     * @since 3.2
86
     */
87
    public Control createToolBarControl(IToolBarManager2 toolBarManager, Composite parent);
88
    
89
    /**
90
     * Creates a toolbar contribution item for the window's tool bar.
91
	 * 
92
     * @param toolBarManager the window's tool bar manager
93
     * @param id the id of the contribution
94
     * @return the contribution item
95
	 * @since 3.2
96
     */
97
    public IContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id);
64
98
65
    /**
99
    /**
66
     * Register the action as a global action with a workbench
100
     * Register the action as a global action with a workbench
(-)Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java (-2 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 27-32 Link Here
27
import org.eclipse.jface.action.IMenuManager;
27
import org.eclipse.jface.action.IMenuManager;
28
import org.eclipse.jface.action.IStatusLineManager;
28
import org.eclipse.jface.action.IStatusLineManager;
29
import org.eclipse.jface.action.IToolBarManager;
29
import org.eclipse.jface.action.IToolBarManager;
30
import org.eclipse.jface.action.IToolBarManager2;
30
import org.eclipse.jface.action.MenuManager;
31
import org.eclipse.jface.action.MenuManager;
31
import org.eclipse.jface.action.StatusLineManager;
32
import org.eclipse.jface.action.StatusLineManager;
32
import org.eclipse.jface.action.ToolBarContributionItem;
33
import org.eclipse.jface.action.ToolBarContributionItem;
Lines 479-484 Link Here
479
		public final IServiceLocator getServiceLocator() {
480
		public final IServiceLocator getServiceLocator() {
480
			return configurer.getWindow();
481
			return configurer.getWindow();
481
		}
482
		}
483
484
		/* (non-Javadoc)
485
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarContributionItem(org.eclipse.jface.action.IToolBarManager, java.lang.String)
486
		 */
487
		public IContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id) {
488
			return null;
489
		}
490
491
		/* (non-Javadoc)
492
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarManager(int)
493
		 */
494
		public IToolBarManager createToolBarManager(int style) {
495
			return null;
496
		}
497
498
		/* (non-Javadoc)
499
		 * @see org.eclipse.ui.application.IActionBarConfigurer#createToolBarControl(org.eclipse.jface.action.IToolBarManager2, org.eclipse.swt.widgets.Composite)
500
		 */
501
		public Control createToolBarControl(IToolBarManager2 toolBarManager, Composite parent) {
502
			return null;
503
		}
482
    }
504
    }
483
505
484
    class ShortcutMenuItemContentProvider implements IStructuredContentProvider {
506
    class ShortcutMenuItemContentProvider implements IStructuredContentProvider {
Lines 942-948 Link Here
942
    private void buildMenusAndToolbarsFor(CustomizeActionBars customizeActionBars, ActionSetDescriptor actionSetDesc) {
964
    private void buildMenusAndToolbarsFor(CustomizeActionBars customizeActionBars, ActionSetDescriptor actionSetDesc) {
943
        String id = actionSetDesc.getId();
965
        String id = actionSetDesc.getId();
944
        ActionSetActionBars bars = new ActionSetActionBars(
966
        ActionSetActionBars bars = new ActionSetActionBars(
945
        		customizeActionBars, window, id);
967
        		customizeActionBars, window, id, window);
946
        PluginActionSetBuilder builder = new PluginActionSetBuilder();
968
        PluginActionSetBuilder builder = new PluginActionSetBuilder();
947
        PluginActionSet actionSet = null;
969
        PluginActionSet actionSet = null;
948
        try {
970
        try {
(-)Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2005 IBM Corporation and others.
2
 * Copyright (c) 2003, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
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 (+114 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.internal.presentations;
12
13
import org.eclipse.jface.action.CoolBarManager;
14
import org.eclipse.jface.action.ICoolBarManager;
15
import org.eclipse.jface.action.IToolBarContributionItem;
16
import org.eclipse.jface.action.IToolBarManager;
17
import org.eclipse.jface.action.IToolBarManager2;
18
import org.eclipse.jface.action.ToolBarContributionItem;
19
import org.eclipse.jface.action.ToolBarManager;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.swt.widgets.Control;
22
23
/**
24
 * Manage the creation of tool bars for a presentation factory.
25
 * <p>
26
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
27
 * part of a work in progress. There is a guarantee neither that this API will
28
 * work nor that it will remain the same. Please do not use this API without
29
 * consulting with the Platform/UI team.
30
 * </p>
31
 * 
32
 * @since 3.2
33
 */
34
public class ActionBarPresentation  {
35
    
36
    /**
37
     * Creates CoolBarManager for WorkbenchWindow's tool bar
38
     * 
39
     * @param style
40
     * @return coolBarManager
41
     */
42
    public ICoolBarManager createCoolBarManager(int style) {
43
        CoolBarManager coolBarManager = new CoolBarManager(style);
44
        return coolBarManager;
45
    }
46
    
47
    /**
48
     * Creates the control for the window's cool bar.
49
     * Subclasses may override.
50
     * 
51
     * @param coolBarManager the window's status line manager
52
     * @param parent the parent composite
53
     * @return the window's cool bar control
54
     */
55
    public Control createCoolBarControl(ICoolBarManager coolBarManager, Composite parent) {
56
    	return coolBarManager.createControl2(parent);
57
    }
58
    
59
    /**
60
     * Creates ToolBarManager for WorkbenchWindow's tool bar
61
     * 
62
     * @param style
63
     * @return toolBarManager
64
     */
65
    public IToolBarManager2 createToolBarManager(int style) {
66
        return new ToolBarManager(style);
67
    }
68
    
69
    /**
70
     * Creates the control for the window's tool bar.
71
     * Subclasses may override.
72
     * 
73
     * @param toolBarManager the window's toolbar manager
74
     * @param parent the parent composite
75
     * @return the window's tool bar control
76
     */
77
    public Control createToolBarControl(IToolBarManager2 toolBarManager, Composite parent) {
78
    	return toolBarManager.createControl2(parent);
79
    }
80
    
81
    /**
82
     * Creates ToolBarManager for a view part tool bar
83
     * 
84
     * @param style
85
     * @return toolBarManager
86
     */
87
    public IToolBarManager2 createViewToolBarManager(int style) {
88
        return new ToolBarManager(style);
89
    }
90
    
91
    /**
92
     * Creates the control for a view part tool bar.
93
     * Subclasses may override.
94
     * 
95
     * @param toolBarManager the view part's toolbar manager
96
     * @param parent the parent composite
97
     * @return the window's tool bar control
98
     */
99
    public Control createViewToolBarControl(IToolBarManager2 toolBarManager, Composite parent) {
100
    	return toolBarManager.createControl2(parent);
101
    }
102
    
103
    /**
104
     * Creates a toolbar contribution.  
105
     * This is to support custom coolbar managers.
106
     * 
107
     * @param toolBarManager the toolbar manager
108
     * @param id the id of the contribution 
109
     * @return the toolbar contribution item
110
     */
111
    public IToolBarContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id) {
112
    	return new ToolBarContributionItem(toolBarManager, id);
113
    }   
114
}
(-)Eclipse (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
12
package org.eclipse.ui.internal.presentations;
13
14
import org.eclipse.ui.IWorkbenchWindow;
15
import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
16
17
/**
18
 * <p>
19
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
20
 * part of a work in progress. There is a guarantee neither that this API will
21
 * work nor that it will remain the same. Please do not use this API without
22
 * consulting with the Platform/UI team.
23
 * </p>
24
 * 
25
 * @since 3.2
26
 */
27
public abstract class InternalPresentationFactory extends WorkbenchPresentationFactory {
28
29
    /**
30
     * Creates an action presentation for a window
31
     * @param window 
32
     * @return ActionPresentation
33
     */
34
    public abstract ActionBarPresentation createActionBarPresentation(IWorkbenchWindow window);
35
36
}

Return to bug 123257