Mercurial > projects > dwt2
comparison org.eclipse.jface/src/org/eclipse/jface/action/SubStatusLineManager.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) 2000, 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.SubStatusLineManager; | |
14 | |
15 import org.eclipse.jface.action.SubContributionManager; | |
16 import org.eclipse.jface.action.IStatusLineManager; | |
17 | |
18 import org.eclipse.swt.graphics.Image; | |
19 import org.eclipse.core.runtime.IProgressMonitor; | |
20 | |
21 import java.lang.all; | |
22 import java.util.Set; | |
23 | |
24 /** | |
25 * A <code>SubStatusLineManager</code> is used to define a set of contribution | |
26 * items within a parent manager. Once defined, the visibility of the entire set can | |
27 * be changed as a unit. | |
28 */ | |
29 public class SubStatusLineManager : SubContributionManager, | |
30 IStatusLineManager { | |
31 /** | |
32 * Current status line message. | |
33 */ | |
34 private String message; | |
35 | |
36 /** | |
37 * Current status line error message. | |
38 */ | |
39 private String errorMessage; | |
40 | |
41 /** | |
42 * Current status line message image. | |
43 */ | |
44 private Image messageImage; | |
45 | |
46 /** | |
47 * Current status line error image | |
48 */ | |
49 private Image errorImage; | |
50 | |
51 /** | |
52 * Constructs a new manager. | |
53 * | |
54 * @param mgr the parent manager. All contributions made to the | |
55 * <code>SubStatusLineManager</code> are forwarded and appear in the | |
56 * parent manager. | |
57 */ | |
58 public this(IStatusLineManager mgr) { | |
59 super(mgr); | |
60 } | |
61 | |
62 /** | |
63 * @return the parent status line manager that this sub-manager contributes | |
64 * to | |
65 */ | |
66 protected final IStatusLineManager getParentStatusLineManager() { | |
67 // Cast is ok because that's the only | |
68 // thing we accept in the construtor. | |
69 return cast(IStatusLineManager) getParent(); | |
70 } | |
71 | |
72 /* (non-Javadoc) | |
73 * Method declared on IStatusLineManager. | |
74 */ | |
75 public IProgressMonitor getProgressMonitor() { | |
76 return getParentStatusLineManager().getProgressMonitor(); | |
77 } | |
78 | |
79 /* (non-Javadoc) | |
80 * Method declared on IStatusLineManager. | |
81 */ | |
82 public bool isCancelEnabled() { | |
83 return getParentStatusLineManager().isCancelEnabled(); | |
84 } | |
85 | |
86 /* (non-Javadoc) | |
87 * Method declared on IStatusLineManager. | |
88 */ | |
89 public void setCancelEnabled(bool enabled) { | |
90 getParentStatusLineManager().setCancelEnabled(enabled); | |
91 } | |
92 | |
93 /* (non-Javadoc) | |
94 * Method declared on IStatusLineManager. | |
95 */ | |
96 public void setErrorMessage(String message) { | |
97 this.errorImage = null; | |
98 this.errorMessage = message; | |
99 if (isVisible()) { | |
100 getParentStatusLineManager().setErrorMessage(errorMessage); | |
101 } | |
102 } | |
103 | |
104 /* (non-Javadoc) | |
105 * Method declared on IStatusLineManager. | |
106 */ | |
107 public void setErrorMessage(Image image, String message) { | |
108 this.errorImage = image; | |
109 this.errorMessage = message; | |
110 if (isVisible()) { | |
111 getParentStatusLineManager().setErrorMessage(errorImage, | |
112 errorMessage); | |
113 } | |
114 } | |
115 | |
116 /* (non-Javadoc) | |
117 * Method declared on IStatusLineManager. | |
118 */ | |
119 public void setMessage(String message) { | |
120 this.messageImage = null; | |
121 this.message = message; | |
122 if (isVisible()) { | |
123 getParentStatusLineManager().setMessage(message); | |
124 } | |
125 } | |
126 | |
127 /* (non-Javadoc) | |
128 * Method declared on IStatusLineManager. | |
129 */ | |
130 public void setMessage(Image image, String message) { | |
131 this.messageImage = image; | |
132 this.message = message; | |
133 if (isVisible()) { | |
134 getParentStatusLineManager().setMessage(messageImage, message); | |
135 } | |
136 } | |
137 | |
138 /* (non-Javadoc) | |
139 * Method declared on SubContributionManager. | |
140 */ | |
141 public override void setVisible(bool visible) { | |
142 super.setVisible(visible); | |
143 if (visible) { | |
144 getParentStatusLineManager().setErrorMessage(errorImage, | |
145 errorMessage); | |
146 getParentStatusLineManager().setMessage(messageImage, message); | |
147 } else { | |
148 getParentStatusLineManager().setMessage(null, null); | |
149 getParentStatusLineManager().setErrorMessage(null, null); | |
150 } | |
151 } | |
152 | |
153 /* (non-Javadoc) | |
154 * Method declared on IStatusLineManager. | |
155 */ | |
156 public void update(bool force) { | |
157 // This method is not governed by visibility. The client may | |
158 // call <code>setVisible</code> and then force an update. At that | |
159 // point we need to update the parent. | |
160 getParentStatusLineManager().update(force); | |
161 } | |
162 } |