Mercurial > projects > dwt2
comparison org.eclipse.jface/src/org/eclipse/jface/action/SubCoolBarManager.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2003, 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.jface.action.SubCoolBarManager; | |
14 | |
15 import org.eclipse.jface.action.ICoolBarManager; | |
16 import org.eclipse.jface.action.SubContributionManager; | |
17 import org.eclipse.jface.action.IToolBarManager; | |
18 import org.eclipse.jface.action.IMenuManager; | |
19 import org.eclipse.jface.action.ToolBarContributionItem; | |
20 | |
21 import org.eclipse.core.runtime.Assert; | |
22 | |
23 import java.lang.all; | |
24 import java.util.Set; | |
25 | |
26 /** | |
27 * A <code>SubCoolBarManager</code> monitors the additional and removal of | |
28 * items from a parent manager so that visibility of the entire set can be changed as a | |
29 * unit. | |
30 * | |
31 * @since 3.0 | |
32 */ | |
33 public class SubCoolBarManager : SubContributionManager, | |
34 ICoolBarManager { | |
35 alias SubContributionManager.add add; | |
36 | |
37 /** | |
38 * Constructs a new manager. | |
39 * | |
40 * @param mgr the parent manager. All contributions made to the | |
41 * <code>SubCoolBarManager</code> are forwarded and appear in the | |
42 * parent manager. | |
43 */ | |
44 public this(ICoolBarManager mgr) { | |
45 super(mgr); | |
46 Assert.isNotNull(cast(Object)mgr); | |
47 } | |
48 | |
49 /* (non-Javadoc) | |
50 * @see org.eclipse.jface.action.ICoolBarManager#add(org.eclipse.jface.action.IToolBarManager) | |
51 */ | |
52 public void add(IToolBarManager toolBarManager) { | |
53 Assert.isNotNull(cast(Object)toolBarManager); | |
54 super.add(new ToolBarContributionItem(toolBarManager)); | |
55 } | |
56 | |
57 /* (non-Javadoc) | |
58 * @see org.eclipse.jface.action.ICoolBarManager#getStyle() | |
59 */ | |
60 public int getStyle() { | |
61 // It is okay to cast down since we only accept coolBarManager objects in the | |
62 // constructor | |
63 return (cast(ICoolBarManager) getParent()).getStyle(); | |
64 } | |
65 | |
66 /** | |
67 * Returns the parent cool bar manager that this sub-manager contributes to. | |
68 * | |
69 * @return the parent cool bar manager | |
70 */ | |
71 protected final ICoolBarManager getParentCoolBarManager() { | |
72 // Cast is ok because that's the only | |
73 // thing we accept in the construtor. | |
74 return cast(ICoolBarManager) getParent(); | |
75 } | |
76 | |
77 /* (non-Javadoc) | |
78 * @see org.eclipse.jface.action.ICoolBarManager#isLayoutLocked() | |
79 */ | |
80 public bool getLockLayout() { | |
81 return getParentCoolBarManager().getLockLayout(); | |
82 } | |
83 | |
84 /* (non-Javadoc) | |
85 * @see org.eclipse.jface.action.ICoolBarManager#lockLayout(bool) | |
86 */ | |
87 public void setLockLayout(bool value) { | |
88 } | |
89 | |
90 /* (non-Javadoc) | |
91 * SubCoolBarManagers do not have control of the global context menu. | |
92 */ | |
93 public IMenuManager getContextMenuManager() { | |
94 return null; | |
95 } | |
96 | |
97 /* (non-Javadoc) | |
98 * In SubCoolBarManager we do nothing. | |
99 */ | |
100 public void setContextMenuManager(IMenuManager menuManager) { | |
101 // do nothing | |
102 } | |
103 | |
104 /* (non-Javadoc) | |
105 * @see org.eclipse.jface.action.IContributionManager#update(bool) | |
106 */ | |
107 public void update(bool force) { | |
108 // This method is not governed by visibility. The client may | |
109 // call <code>setVisible</code> and then force an update. At that | |
110 // point we need to update the parent. | |
111 getParentCoolBarManager().update(force); | |
112 } | |
113 | |
114 } |