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

(-)src/org/eclipse/jface/window/ApplicationWindow.java (-3 / +61 lines)
Lines 15-20 Link Here
15
15
16
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.core.runtime.NullProgressMonitor;
17
import org.eclipse.jface.action.CoolBarManager;
17
import org.eclipse.jface.action.CoolBarManager;
18
import org.eclipse.jface.action.ICoolBarManager;
19
import org.eclipse.jface.action.IToolBarManager;
20
import org.eclipse.jface.action.IToolBarManager2;
18
import org.eclipse.jface.action.MenuManager;
21
import org.eclipse.jface.action.MenuManager;
19
import org.eclipse.jface.action.StatusLineManager;
22
import org.eclipse.jface.action.StatusLineManager;
20
import org.eclipse.jface.action.ToolBarManager;
23
import org.eclipse.jface.action.ToolBarManager;
Lines 77-83 Link Here
77
     *
80
     *
78
     * @see #addToolBar
81
     * @see #addToolBar
79
     */
82
     */
80
    private ToolBarManager toolBarManager = null;
83
    protected IToolBarManager2 toolBarManager = null;
81
84
82
    /**
85
    /**
83
     * Status line manager, or <code>null</code> if none (default).
86
     * Status line manager, or <code>null</code> if none (default).
Lines 92-98 Link Here
92
     * @see #addCoolBar
95
     * @see #addCoolBar
93
     * @since 3.0
96
     * @since 3.0
94
     */
97
     */
95
    private CoolBarManager coolBarManager = null;
98
    protected ICoolBarManager coolBarManager = null;
96
99
97
    /**
100
    /**
98
     * The seperator between the menu bar and the rest of the window.
101
     * The seperator between the menu bar and the rest of the window.
Lines 404-409 Link Here
404
    protected ToolBarManager createToolBarManager(int style) {
407
    protected ToolBarManager createToolBarManager(int style) {
405
        return new ToolBarManager(style);
408
        return new ToolBarManager(style);
406
    }
409
    }
410
    
411
    /**
412
     * Returns a new tool bar manager for the window. 
413
     * <p>
414
     * Subclasses may override this method to customize the tool bar manager.
415
     * The default implementation calls <code>createToolBarManager</code>.
416
     * </p>
417
     * @return a tool bar manager
418
     * @since 3.2
419
     */
420
    protected IToolBarManager createToolBarManager2(int style) {
421
        return createToolBarManager(style);
422
    }
407
423
408
    /**
424
    /**
409
     * Returns a new cool bar manager for the window.
425
     * Returns a new cool bar manager for the window.
Lines 417-422 Link Here
417
    protected CoolBarManager createCoolBarManager(int style) {
433
    protected CoolBarManager createCoolBarManager(int style) {
418
        return new CoolBarManager(style);
434
        return new CoolBarManager(style);
419
    }
435
    }
436
    
437
    /**
438
     * Returns a new cool bar manager for the window.
439
     * <p>
440
     * Subclasses may override this method to customize the cool bar manager.
441
     * The default implementation calls <code>createCoolBarManager</code>
442
     * </p>
443
     * 
444
     * @return a cool bar manager
445
     * @since 3.2
446
     */
447
    protected ICoolBarManager createCoolBarManager2(int style) {
448
        return new CoolBarManager(style);
449
    }
420
450
421
    /**
451
    /**
422
     * Creates the control for the tool bar manager.
452
     * Creates the control for the tool bar manager.
Lines 443-449 Link Here
443
     */
473
     */
444
    protected Control createCoolBarControl(Composite composite) {
474
    protected Control createCoolBarControl(Composite composite) {
445
        if (coolBarManager != null) {
475
        if (coolBarManager != null) {
446
            return coolBarManager.createControl(composite);
476
            return coolBarManager.createControl2(composite);
447
        }
477
        }
448
        return null;
478
        return null;
449
    }
479
    }
Lines 510-515 Link Here
510
     * @see #addToolBar(int)
540
     * @see #addToolBar(int)
511
     */
541
     */
512
    public ToolBarManager getToolBarManager() {
542
    public ToolBarManager getToolBarManager() {
543
    	if (toolBarManager instanceof ToolBarManager)
544
        	return (ToolBarManager)toolBarManager;
545
        return null;
546
    }
547
    
548
    /**
549
     * Returns the tool bar manager for this window (if it has one).
550
     *
551
     * @return the tool bar manager, or <code>null</code> if
552
     *   this window does not have a tool bar
553
     * @see #addToolBar(int)
554
	 * @since 3.2
555
     */
556
    public IToolBarManager2 getToolBarManager2() {
513
        return toolBarManager;
557
        return toolBarManager;
514
    }
558
    }
515
559
Lines 522-527 Link Here
522
     * @since 3.0
566
     * @since 3.0
523
     */
567
     */
524
    public CoolBarManager getCoolBarManager() {
568
    public CoolBarManager getCoolBarManager() {
569
    	if (coolBarManager instanceof CoolBarManager)
570
        	return (CoolBarManager)coolBarManager;
571
        return null;
572
    }
573
    
574
    /**
575
     * Returns the cool bar manager for this window.
576
     *
577
     * @return the cool bar manager, or <code>null</code> if
578
     *   this window does not have a cool bar
579
     * @see #addCoolBar(int)
580
     * @since 3.2
581
     */
582
    public ICoolBarManager getCoolBarManager2() {
525
        return coolBarManager;
583
        return coolBarManager;
526
    }
584
    }
527
585
(-)src/org/eclipse/jface/action/CoolBarManager.java (+23 lines)
Lines 245-250 Link Here
245
        }
245
        }
246
        return coolBar;
246
        return coolBar;
247
    }
247
    }
248
    
249
    /**
250
     * Creates and returns this manager's cool bar control. Does not create a
251
     * new control if one already exists.
252
     * 
253
     * @param parent
254
     *            the parent control
255
     * @return the cool bar control
256
	 * @since 3.2
257
     */
258
    public Control createControl2(Composite parent) {
259
        return createControl(parent);
260
    }
248
261
249
    /**
262
    /**
250
     * Disposes of this cool bar manager and frees all allocated SWT resources.
263
     * Disposes of this cool bar manager and frees all allocated SWT resources.
Lines 382-387 Link Here
382
    public CoolBar getControl() {
395
    public CoolBar getControl() {
383
        return coolBar;
396
        return coolBar;
384
    }
397
    }
398
    
399
    /**
400
     * Returns the control for this manager.
401
     * 
402
     * @return the control, or <code>null</code> if none
403
	 * @since 3.2
404
     */
405
    public Control getControl2() {
406
        return coolBar;
407
    }
385
408
386
    /**
409
    /**
387
     * Returns an array list of all the contribution items in the manager.
410
     * Returns an array list of all the contribution items in the manager.
(-)src/org/eclipse/jface/action/ICoolBarManager.java (-2 / +78 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jface.action;
11
package org.eclipse.jface.action;
12
12
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Control;
13
import org.eclipse.swt.widgets.CoolBar;
15
import org.eclipse.swt.widgets.CoolBar;
14
16
15
/**
17
/**
Lines 50-55 Link Here
50
     * @see ToolBarContributionItem
52
     * @see ToolBarContributionItem
51
     */
53
     */
52
    public void add(IToolBarManager toolBarManager);
54
    public void add(IToolBarManager toolBarManager);
55
    
56
    /**
57
     * Creates and returns this manager's cool bar control. Does not create a
58
     * new control if one already exists.
59
     * 
60
     * @param parent
61
     *            the parent control
62
     * @return the cool bar control
63
	 * @since 3.2
64
     */
65
    public CoolBar createControl(Composite parent);
66
67
    /**
68
     * Creates and returns this manager's cool bar control. Does not create a
69
     * new control if one already exists.
70
     * 
71
     * @param parent
72
     *            the parent control
73
     * @return the cool bar control
74
	 * @since 3.2
75
     */
76
    public Control createControl2(Composite parent);
53
77
54
    /**
78
    /**
55
     * Returns the context menu manager used by this cool bar manager. This
79
     * Returns the context menu manager used by this cool bar manager. This
Lines 62-67 Link Here
62
    public IMenuManager getContextMenuManager();
86
    public IMenuManager getContextMenuManager();
63
87
64
    /**
88
    /**
89
     * Returns the cool bar control for this manager.
90
     * 
91
     * @return the cool bar control, or <code>null</code> if none
92
	 * @since 3.2
93
     */
94
    public CoolBar getControl();
95
    
96
    /**
97
     * Returns the cool bar control for this manager.
98
     * 
99
     * @return the cool bar control, or <code>null</code> if none
100
	 * @since 3.2
101
     */
102
    public Control getControl2();
103
104
    /**
65
     * Returns whether the layout of the underlying cool bar widget is locked.
105
     * Returns whether the layout of the underlying cool bar widget is locked.
66
     * 
106
     * 
67
     * @return <code>true</code> if cool bar layout is locked, <code>false</code>
107
     * @return <code>true</code> if cool bar layout is locked, <code>false</code>
Lines 87-92 Link Here
87
    public void setContextMenuManager(IMenuManager menuManager);
127
    public void setContextMenuManager(IMenuManager menuManager);
88
128
89
    /**
129
    /**
130
     * Synchronizes the visual order of the cool items in the control with this
131
     * manager's internal data structures. This method should be called before
132
     * requesting the order of the contribution items to ensure that the order
133
     * is accurate.
134
     * <p>
135
     * Note that <code>update()</code> and <code>refresh()</code> are
136
     * converses: <code>update()</code> changes the visual order to match the
137
     * internal structures, and <code>refresh</code> changes the internal
138
     * structures to match the visual order.
139
     * </p>
140
	 *
141
	 * @since 3.2
142
     */
143
    public void refresh();
144
    
145
    /**
146
     * @since 3.2 
147
     */
148
    public void dispose();
149
150
    /**
151
     * Restores the canonical order of this cool bar manager. The canonical
152
     * order is the order in which the contribution items where added.
153
     */
154
    public void resetItemOrder();
155
156
    /**
157
     * Replaces the current items with the given items.
158
     * Forces an update.
159
     * 
160
     * @param newItems the items with which to replace the current items
161
     * @since 3.2
162
	 */
163
    public void setItems(IContributionItem[] newItems);
164
	
165
    /**
90
     * Locks or unlocks the layout of the underlying cool bar widget. Once the
166
     * Locks or unlocks the layout of the underlying cool bar widget. Once the
91
     * cool bar is locked, cool items cannot be repositioned by the user.
167
     * cool bar is locked, cool items cannot be repositioned by the user.
92
     * <p>
168
     * <p>
Lines 97-103 Link Here
97
     * @param value
173
     * @param value
98
     *            <code>true</code> to lock the cool bar, <code>false</code>
174
     *            <code>true</code> to lock the cool bar, <code>false</code>
99
     *            to unlock
175
     *            to unlock
100
     */
176
     * @since 3.2
177
	 */
101
    public void setLockLayout(boolean value);
178
    public void setLockLayout(boolean value);
102
103
}
179
}
(-)src/org/eclipse/jface/action/ToolBarManager.java (-1 / +15 lines)
Lines 33-39 Link Here
33
 * </p>
33
 * </p>
34
 */
34
 */
35
public class ToolBarManager extends ContributionManager implements
35
public class ToolBarManager extends ContributionManager implements
36
		IToolBarManager {
36
		IToolBarManager2 {
37
37
38
	/**
38
	/**
39
	 * The tool bar items style; <code>SWT.NONE</code> by default.
39
	 * The tool bar items style; <code>SWT.NONE</code> by default.
Lines 396-399 Link Here
396
		}
396
		}
397
	}
397
	}
398
398
399
	/* (non-Javadoc)
400
	 * @see org.eclipse.jface.action.IToolBarManager2#createControl2(org.eclipse.swt.widgets.Composite)
401
	 */
402
	public Control createControl2(Composite parent) {
403
		return createControl(parent);
404
	}
405
406
	/* (non-Javadoc)
407
	 * @see org.eclipse.jface.action.IToolBarManager2#getControl2()
408
	 */
409
	public Control getControl2() {
410
		return getControl();
411
	}
412
399
}
413
}
(-)src/org/eclipse/jface/action/SubCoolBarManager.java (+69 lines)
Lines 11-16 Link Here
11
package org.eclipse.jface.action;
11
package org.eclipse.jface.action;
12
12
13
import org.eclipse.jface.util.Assert;
13
import org.eclipse.jface.util.Assert;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.CoolBar;
14
17
15
/**
18
/**
16
 * A <code>SubCoolBarManager</code> monitors the additional and removal of 
19
 * A <code>SubCoolBarManager</code> monitors the additional and removal of 
Lines 42-47 Link Here
42
        super.add(new ToolBarContributionItem(toolBarManager));
45
        super.add(new ToolBarContributionItem(toolBarManager));
43
    }
46
    }
44
47
48
    /*
49
     *  (non-Javadoc)
50
     * @see org.eclipse.jface.action.ICoolBarManager#createControl(org.eclipse.swt.widgets.Composite)
51
     */
52
    public CoolBar createControl(Composite parent) {
53
        return null;
54
    }
55
    
56
    /*
57
     *  (non-Javadoc)
58
     * @see org.eclipse.jface.action.ICoolBarManager#createControl2(org.eclipse.swt.widgets.Composite)
59
     */
60
    public Control createControl2(Composite parent) {
61
        return createControl(parent);
62
    }
63
64
    /*
65
     *  (non-Javadoc)
66
     * @see org.eclipse.jface.action.ICoolBarManager#getControl()
67
     */
68
    public CoolBar getControl() {
69
        return null;
70
    }
71
    
72
    /*
73
     *  (non-Javadoc)
74
     * @see org.eclipse.jface.action.ICoolBarManager#getControl2()
75
     */
76
    public Control getControl2() {
77
        return null;
78
    }
79
    
45
    /* (non-Javadoc)
80
    /* (non-Javadoc)
46
     * @see org.eclipse.jface.action.ICoolBarManager#getStyle()
81
     * @see org.eclipse.jface.action.ICoolBarManager#getStyle()
47
     */
82
     */
Lines 82-87 Link Here
82
        return null;
117
        return null;
83
    }
118
    }
84
119
120
    /*
121
     *  (non-Javadoc)
122
     * @see org.eclipse.jface.action.ICoolBarManager#refresh()
123
     */
124
    public void refresh() {
125
        // do nothing
126
    }
127
128
    /*
129
     *  (non-Javadoc)
130
     * @see org.eclipse.jface.action.ICoolBarManager#resetItemOrder()
131
     */
132
    public void resetItemOrder() {
133
        // do nothing
134
    }
135
    
85
    /* (non-Javadoc)
136
    /* (non-Javadoc)
86
     * In SubCoolBarManager we do nothing.
137
     * In SubCoolBarManager we do nothing.
87
     */
138
     */
Lines 89-94 Link Here
89
        // do nothing
140
        // do nothing
90
    }
141
    }
91
142
143
    /*
144
     *  (non-Javadoc)
145
     * @see org.eclipse.jface.action.ICoolBarManager#setItems(org.eclipse.jface.action.IContributionItem[])
146
     */
147
    public void setItems(IContributionItem[] newItems) {
148
    	// do nothing
149
    }
150
92
    /* (non-Javadoc)
151
    /* (non-Javadoc)
93
     * @see org.eclipse.jface.action.IContributionManager#update(boolean)
152
     * @see org.eclipse.jface.action.IContributionManager#update(boolean)
94
     */
153
     */
Lines 99-102 Link Here
99
        getParentCoolBarManager().update(force);
158
        getParentCoolBarManager().update(force);
100
    }
159
    }
101
160
161
	public void dispose() {
162
		// do nothing
163
	}
164
165
166
167
168
169
170
102
}
171
}
(-)src/org/eclipse/jface/action/IToolBarManager2.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 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.jface.action;
12
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Control;
15
import org.eclipse.swt.widgets.ToolBar;
16
17
/**
18
 * The <code>IToolBarManager2</code> interface provides protocol for managing
19
 * contributions to a tool bar. It extends <code>IToolBarManager</code>
20
 * and provides a <code>dispose</code> method.
21
 * <p>
22
 * This package also provides a concrete tool bar manager implementation,
23
 * {@link ToolBarManager <code>ToolBarManager</code>}.
24
 * </p>
25
 */
26
public interface IToolBarManager2 extends IToolBarManager {
27
	
28
	/**
29
	 * @param parent
30
	 * @return
31
	 */
32
	public ToolBar createControl(Composite parent);
33
	
34
	/**
35
	 * @param parent
36
	 * @return
37
	 */
38
	public Control createControl2(Composite parent);
39
	
40
	/**
41
	 * @return
42
	 */
43
	public ToolBar getControl();
44
	
45
	/**
46
	 * @return
47
	 */
48
	public Control getControl2();
49
50
	/**
51
	 * 
52
	 */
53
	public void dispose();
54
	
55
}

Return to bug 123257