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 (-8 / +67 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 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.IToolBarManager2;
18
import org.eclipse.jface.action.MenuManager;
20
import org.eclipse.jface.action.MenuManager;
19
import org.eclipse.jface.action.StatusLineManager;
21
import org.eclipse.jface.action.StatusLineManager;
20
import org.eclipse.jface.action.ToolBarManager;
22
import org.eclipse.jface.action.ToolBarManager;
Lines 77-83 Link Here
77
     *
79
     *
78
     * @see #addToolBar
80
     * @see #addToolBar
79
     */
81
     */
80
    private ToolBarManager toolBarManager = null;
82
    protected IToolBarManager2 toolBarManager = null;
81
83
82
    /**
84
    /**
83
     * Status line manager, or <code>null</code> if none (default).
85
     * Status line manager, or <code>null</code> if none (default).
Lines 92-98 Link Here
92
     * @see #addCoolBar
94
     * @see #addCoolBar
93
     * @since 3.0
95
     * @since 3.0
94
     */
96
     */
95
    private CoolBarManager coolBarManager = null;
97
    protected ICoolBarManager coolBarManager = null;
96
98
97
    /**
99
    /**
98
     * The seperator between the menu bar and the rest of the window.
100
     * The seperator between the menu bar and the rest of the window.
Lines 255-261 Link Here
255
    protected void addToolBar(int style) {
257
    protected void addToolBar(int style) {
256
        if ((getShell() == null) && (toolBarManager == null)
258
        if ((getShell() == null) && (toolBarManager == null)
257
                && (coolBarManager == null)) {
259
                && (coolBarManager == null)) {
258
            toolBarManager = createToolBarManager(style);
260
            toolBarManager = createToolBarManager2(style);
259
        }
261
        }
260
    }
262
    }
261
263
Lines 270-277 Link Here
270
    protected void addCoolBar(int style) {
272
    protected void addCoolBar(int style) {
271
        if ((getShell() == null) && (toolBarManager == null)
273
        if ((getShell() == null) && (toolBarManager == null)
272
                && (coolBarManager == null)) {
274
                && (coolBarManager == null)) {
273
            coolBarManager = createCoolBarManager(style);
275
            coolBarManager = createCoolBarManager2(style);
274
        }
276
        }	
275
    }
277
    }
276
278
277
    /* (non-Javadoc)
279
    /* (non-Javadoc)
Lines 404-409 Link Here
404
    protected ToolBarManager createToolBarManager(int style) {
406
    protected ToolBarManager createToolBarManager(int style) {
405
        return new ToolBarManager(style);
407
        return new ToolBarManager(style);
406
    }
408
    }
409
    
410
    /**
411
     * Returns a new tool bar manager for the window. 
412
     * <p> 
413
     * By default this method calls <code>createToolBarManager</code>.  Subclasses
414
     * may override this method to provide an alternative implementation for the
415
     * tool bar manager.
416
     * </p>
417
     * @return a tool bar manager
418
     * @since 3.2
419
     */
420
    protected IToolBarManager2 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
     * By default this method calls <code>createCoolBarManager</code>.  Subclasses
441
     * may override this method to provide an alternative implementation for the
442
     * cool bar manager.
443
     * </p>
444
     * 
445
     * @return a cool bar manager
446
     * @since 3.2
447
     */
448
    protected ICoolBarManager createCoolBarManager2(int style) {
449
        return createCoolBarManager(style);
450
    }
420
451
421
    /**
452
    /**
422
     * Creates the control for the tool bar manager.
453
     * Creates the control for the tool bar manager.
Lines 427-433 Link Here
427
     */
458
     */
428
    protected Control createToolBarControl(Composite parent) {
459
    protected Control createToolBarControl(Composite parent) {
429
        if (toolBarManager != null) {
460
        if (toolBarManager != null) {
430
            return toolBarManager.createControl(parent);
461
            return toolBarManager.createControl2(parent);
431
        }
462
        }
432
        return null;
463
        return null;
433
    }
464
    }
Lines 443-449 Link Here
443
     */
474
     */
444
    protected Control createCoolBarControl(Composite composite) {
475
    protected Control createCoolBarControl(Composite composite) {
445
        if (coolBarManager != null) {
476
        if (coolBarManager != null) {
446
            return coolBarManager.createControl(composite);
477
            return coolBarManager.createControl2(composite);
447
        }
478
        }
448
        return null;
479
        return null;
449
    }
480
    }
Lines 510-515 Link Here
510
     * @see #addToolBar(int)
541
     * @see #addToolBar(int)
511
     */
542
     */
512
    public ToolBarManager getToolBarManager() {
543
    public ToolBarManager getToolBarManager() {
544
    	if (toolBarManager instanceof ToolBarManager)
545
        	return (ToolBarManager)toolBarManager;
546
        return null;
547
    }
548
    
549
    /**
550
     * Returns the tool bar manager for this window (if it has one).
551
     *
552
     * @return the tool bar manager, or <code>null</code> if
553
     *   this window does not have a tool bar
554
     * @see #addToolBar(int)
555
	 * @since 3.2
556
     */
557
    public IToolBarManager2 getToolBarManager2() {
513
        return toolBarManager;
558
        return toolBarManager;
514
    }
559
    }
515
560
Lines 522-527 Link Here
522
     * @since 3.0
567
     * @since 3.0
523
     */
568
     */
524
    public CoolBarManager getCoolBarManager() {
569
    public CoolBarManager getCoolBarManager() {
570
    	if (coolBarManager instanceof CoolBarManager)
571
        	return (CoolBarManager)coolBarManager;
572
        return null;
573
    }
574
    
575
    /**
576
     * Returns the cool bar manager for this window.
577
     *
578
     * @return the cool bar manager, or <code>null</code> if
579
     *   this window does not have a cool bar
580
     * @see #addCoolBar(int)
581
     * @since 3.2
582
     */
583
    public ICoolBarManager getCoolBarManager2() {
525
        return coolBarManager;
584
        return coolBarManager;
526
    }
585
    }
527
586
(-)src/org/eclipse/jface/action/CoolBarManager.java (-1 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2004 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 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/ToolBarContributionItem.java (-1 / +1 lines)
Lines 43-49 Link Here
43
 * 
43
 * 
44
 * @since 3.0
44
 * @since 3.0
45
 */
45
 */
46
public class ToolBarContributionItem extends ContributionItem {
46
public class ToolBarContributionItem extends ContributionItem implements IToolBarContributionItem {
47
47
48
    /**
48
    /**
49
     * A constant used by <code>setMinimumItemsToShow</code> and <code>getMinimumItemsToShow</code>
49
     * A constant used by <code>setMinimumItemsToShow</code> and <code>getMinimumItemsToShow</code>
(-)src/org/eclipse/jface/action/ICoolBarManager.java (-1 / +81 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2004 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 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 control. Does not create a
69
     * new control if one already exists.
70
     * 
71
     * @param parent
72
     *            the parent control
73
     * @return the 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 bar control for this manager.
98
     * 
99
     * @return the 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
	 * Disposes the resources for this manager.
147
	 *
148
     * @since 3.2 
149
     */
150
    public void dispose();
151
152
    /**
153
     * Restores the canonical order of this cool bar manager. The canonical
154
     * order is the order in which the contribution items where added.
155
     *
156
	 * @since 3.2     
157
	 */
158
    public void resetItemOrder();
159
160
    /**
161
     * Replaces the current items with the given items.
162
     * Forces an update.
163
     * 
164
     * @param newItems the items with which to replace the current items
165
     * @since 3.2
166
	 */
167
    public void setItems(IContributionItem[] newItems);
168
	
169
    /**
90
     * Locks or unlocks the layout of the underlying cool bar widget. Once the
170
     * 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.
171
     * cool bar is locked, cool items cannot be repositioned by the user.
92
     * <p>
172
     * <p>
(-)src/org/eclipse/jface/action/ToolBarManager.java (-2 / +98 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-18 Link Here
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.Iterator;
14
import java.util.Iterator;
15
15
16
import org.eclipse.core.runtime.ListenerList;
17
import org.eclipse.jface.util.IPropertyChangeListener;
18
import org.eclipse.jface.util.PropertyChangeEvent;
16
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.accessibility.ACC;
20
import org.eclipse.swt.accessibility.ACC;
18
import org.eclipse.swt.accessibility.AccessibleAdapter;
21
import org.eclipse.swt.accessibility.AccessibleAdapter;
Lines 33-39 Link Here
33
 * </p>
36
 * </p>
34
 */
37
 */
35
public class ToolBarManager extends ContributionManager implements
38
public class ToolBarManager extends ContributionManager implements
36
		IToolBarManager {
39
		IToolBarManager2 {
37
40
38
	/**
41
	/**
39
	 * The tool bar items style; <code>SWT.NONE</code> by default.
42
	 * The tool bar items style; <code>SWT.NONE</code> by default.
Lines 54-59 Link Here
54
	private MenuManager contextMenuManager = null;
57
	private MenuManager contextMenuManager = null;
55
58
56
	/**
59
	/**
60
	 * A collection of objects listening to changes to this manager. This
61
	 * collection is <code>null</code> if there are no listeners.
62
	 */
63
	private transient ListenerList listenerList = null;
64
	
65
	/**
57
	 * Creates a new tool bar manager with the default SWT button style. Use the
66
	 * Creates a new tool bar manager with the default SWT button style. Use the
58
	 * <code>createControl</code> method to create the tool bar control.
67
	 * <code>createControl</code> method to create the tool bar control.
59
	 */
68
	 */
Lines 182-187 Link Here
182
	protected void relayout(ToolBar layoutBar, int oldCount, int newCount) {
191
	protected void relayout(ToolBar layoutBar, int oldCount, int newCount) {
183
		if ((oldCount == 0) != (newCount == 0))
192
		if ((oldCount == 0) != (newCount == 0))
184
			layoutBar.getParent().layout();
193
			layoutBar.getParent().layout();
194
		firePropertyChange(PROP_LAYOUT, new Integer(oldCount), new Integer(newCount));
185
	}
195
	}
186
196
187
	/**
197
	/**
Lines 396-399 Link Here
396
		}
406
		}
397
	}
407
	}
398
408
409
	/* (non-Javadoc)
410
	 * @see org.eclipse.jface.action.IToolBarManager2#createControl2(org.eclipse.swt.widgets.Composite)
411
	 */
412
	public Control createControl2(Composite parent) {
413
		return createControl(parent);
414
	}
415
416
	/* (non-Javadoc)
417
	 * @see org.eclipse.jface.action.IToolBarManager2#getControl2()
418
	 */
419
	public Control getControl2() {
420
		return getControl();
421
	}
422
423
	/* (non-Javadoc)
424
	 * @see org.eclipse.jface.action.IToolBarManager2#getItemCount()
425
	 */
426
	public int getItemCount() {
427
		if (!toolBarExist())
428
			return 0;
429
		return toolBar.getItemCount();
430
	}
431
432
	/* (non-Javadoc)
433
	 * @see org.eclipse.jface.action.IToolBarManager2#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
434
	 */
435
	public void addPropertyChangeListener(IPropertyChangeListener listener) {
436
		if (listenerList == null) {
437
			listenerList = new ListenerList(ListenerList.IDENTITY);
438
		}
439
440
		listenerList.add(listener);
441
	}
442
443
	/* (non-Javadoc)
444
	 * @see org.eclipse.jface.action.IToolBarManager2#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
445
	 */
446
	public void removePropertyChangeListener(IPropertyChangeListener listener) {
447
		if (listenerList != null) {
448
			listenerList.remove(listener);
449
450
			if (listenerList.isEmpty()) {
451
				listenerList = null;
452
			}
453
		}
454
	}
455
	
456
	/*
457
	 * Returns the listeners attached to this event manager.
458
	 * The listeners currently attached; may be empty, but never
459
	 * null.
460
	 */
461
	protected final Object[] getListeners() {
462
		final ListenerList list = listenerList;
463
		if (list == null) {
464
			return new Object[0];
465
		}
466
467
		return list.getListeners();
468
	}
469
470
	/*
471
	 * Notifies any property change listeners that a property has changed. Only
472
	 * listeners registered at the time this method is called are notified.
473
	 */
474
	private void firePropertyChange(final PropertyChangeEvent event) {
475
		final Object[] list = getListeners();
476
		for (int i = 0; i < list.length; ++i) {
477
			((IPropertyChangeListener) list[i]).propertyChange(event);
478
		}
479
	}
480
481
	/*
482
	 * Notifies any property change listeners that a property has changed. Only
483
	 * listeners registered at the time this method is called are notified. This
484
	 * method avoids creating an event object if there are no listeners
485
	 * registered, but calls firePropertyChange(PropertyChangeEvent) if there are.
486
	 */
487
	private void firePropertyChange(final String propertyName,
488
			final Object oldValue, final Object newValue) {
489
		if (listenerList != null) {
490
			firePropertyChange(new PropertyChangeEvent(this, propertyName,
491
					oldValue, newValue));
492
		}
493
	}
494
399
}
495
}
(-)src/org/eclipse/jface/action/SubCoolBarManager.java (-1 / +73 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2004 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 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
	/* (non-Javadoc)
162
	 * @see org.eclipse.jface.action.ICoolBarManager#dispose()
163
	 */
164
	public void dispose() {
165
		// do nothing
166
	}
167
168
169
170
171
172
173
102
}
174
}
(-)src/org/eclipse/jface/action/IToolBarManager2.java (+103 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 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
package org.eclipse.jface.action;
12
13
import org.eclipse.jface.util.IPropertyChangeListener;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.ToolBar;
17
18
/**
19
 * The <code>IToolBarManager2</code> interface provides protocol for managing
20
 * contributions to a tool bar. It extends <code>IToolBarManager</code>
21
 * and provides a <code>dispose</code> method.
22
 * <p>
23
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
24
 * part of a work in progress. There is a guarantee neither that this API will
25
 * work nor that it will remain the same. Please do not use this API without
26
 * consulting with the Platform/UI team.
27
 * </p>
28
 * 
29
 * This package also provides a concrete tool bar manager implementation,
30
 * {@link ToolBarManager <code>ToolBarManager</code>}.
31
 * </p>
32
 * 
33
 * @since 3.2
34
 */
35
public interface IToolBarManager2 extends IToolBarManager {
36
	
37
	/**
38
	 * The property id for changes to the control's layout
39
	 */
40
	public static final String PROP_LAYOUT = "PROP_LAYOUT"; //$NON-NLS-1$
41
	
42
    /**
43
     * Creates and returns this manager's toolbar control. Does not create a
44
     * new control if one already exists.
45
     * 
46
     * @param parent
47
     *            the parent control
48
     * @return the toolbar control
49
     */
50
	public ToolBar createControl(Composite parent);
51
	
52
    /**
53
     * Creates and returns this manager's control. Does not create a
54
     * new control if one already exists.
55
     * 
56
     * @param parent
57
     *            the parent control
58
     * @return the control
59
     */
60
	public Control createControl2(Composite parent);
61
	
62
    /**
63
     * Returns the toolbar control for this manager.
64
     * 
65
     * @return the toolbar control, or <code>null</code> if none
66
     */
67
	public ToolBar getControl();
68
	
69
    /**
70
     * Returns the control for this manager.
71
     * 
72
     * @return the control, or <code>null</code> if none
73
     */
74
	public Control getControl2();
75
76
    /**
77
	 * Disposes the resources for this manager.
78
     */
79
	public void dispose();
80
	
81
	/**
82
	 * Returns the item count of the control used 
83
	 * by this manager.
84
	 * 
85
	 * @return the number of items in the control
86
	 */
87
	public int getItemCount();
88
	
89
	/**
90
	 * Registers a property change listner with this manager.
91
	 * 
92
	 * @param listener
93
	 */
94
	public void addPropertyChangeListener(IPropertyChangeListener listener);
95
	
96
	/**
97
	 * Removes a property change listner from this manager.
98
	 * 
99
	 * @param listener
100
	 */
101
	public void removePropertyChangeListener(IPropertyChangeListener listener);
102
	
103
}
(-)src/org/eclipse/jface/action/IToolBarContributionItem.java (+117 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.jface.action;
13
14
/**
15
 * <p>
16
 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
17
 * part of a work in progress. There is a guarantee neither that this API will
18
 * work nor that it will remain the same. Please do not use this API without
19
 * consulting with the Platform/UI team.
20
 * </p>
21
 * 
22
 * @since 3.2
23
 */
24
public interface IToolBarContributionItem extends IContributionItem {
25
26
    /**
27
     * Returns the current height of the corresponding cool item.
28
     * 
29
     * @return the current height
30
     */
31
    public int getCurrentHeight();
32
33
    /**
34
     * Returns the current width of the corresponding cool item.
35
     * 
36
     * @return the current size
37
     */
38
    public int getCurrentWidth();
39
40
    /**
41
     * Returns the minimum number of tool items to show in the cool item.
42
     * 
43
     * @return the minimum number of tool items to show, or <code>SHOW_ALL_ITEMS</code>
44
     *         if a value was not set
45
     * @see #setMinimumItemsToShow(int)
46
     */
47
    public int getMinimumItemsToShow();
48
    
49
    /**
50
     * Returns whether chevron support is enabled.
51
     * 
52
     * @return <code>true</code> if chevron support is enabled, <code>false</code>
53
     *         otherwise
54
     */
55
    public boolean getUseChevron();
56
    
57
    /**
58
     * Sets the current height of the cool item. Update(SIZE) should be called
59
     * to adjust the widget.
60
     * 
61
     * @param currentHeight
62
     *            the current height to set
63
     */
64
    public void setCurrentHeight(int currentHeight);
65
66
    /**
67
     * Sets the current width of the cool item. Update(SIZE) should be called
68
     * to adjust the widget.
69
     * 
70
     * @param currentWidth
71
     *            the current width to set
72
     */
73
    public void setCurrentWidth(int currentWidth);
74
75
    /**
76
     * Sets the minimum number of tool items to show in the cool item. If this
77
     * number is less than the total tool items, a chevron will appear and the
78
     * hidden tool items appear in a drop down menu. By default, all the tool
79
     * items are shown in the cool item.
80
     * 
81
     * @param minimumItemsToShow
82
     *            the minimum number of tool items to show.
83
     * @see #getMinimumItemsToShow()
84
     * @see #setUseChevron(boolean)
85
     */
86
    public void setMinimumItemsToShow(int minimumItemsToShow);
87
88
    /**
89
     * Enables or disables chevron support for the cool item. By default,
90
     * chevron support is enabled.
91
     * 
92
     * @param value
93
     *            <code>true</code> to enable chevron support, <code>false</code>
94
     *            otherwise.
95
     */
96
    public void setUseChevron(boolean value);
97
    
98
    /**
99
     * Returns the internal tool bar manager of the contribution item.
100
     * 
101
     * @return the tool bar manager, or <code>null</code> if one is not
102
     *         defined.
103
     * @see IToolBarManager
104
     */
105
    public IToolBarManager getToolBarManager();
106
    
107
    /**
108
     * Returns the parent contribution manager, or <code>null</code> if this 
109
     * contribution item is not currently added to a contribution manager.
110
     * 
111
     * @return the parent contribution manager, or <code>null</code>
112
     * 
113
     * TODO may not need this, getToolBarManager may be enough.
114
     */
115
    public IContributionManager getParent();
116
    
117
}

Return to bug 123257