comparison dwtx/jface/text/AbstractReusableInformationControlCreator.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents f70d9508c95c
children
comparison
equal deleted inserted replaced
161:f8d52b926852 162:1a5b8f8129df
170 * 170 *
171 * @since 3.3 171 * @since 3.3
172 */ 172 */
173 public abstract class AbstractReusableInformationControlCreator : IInformationControlCreator, IInformationControlCreatorExtension, DisposeListener { 173 public abstract class AbstractReusableInformationControlCreator : IInformationControlCreator, IInformationControlCreatorExtension, DisposeListener {
174 174
175 private Map fInformationControls= new HashMap(); 175 private Map fInformationControls;
176 176
177 /** 177 /**
178 * Creates the control. 178 * Creates the control.
179 * 179 *
180 * @param parent the parent shell 180 * @param parent the parent shell
181 * @return the created information control 181 * @return the created information control
182 */ 182 */
183 protected abstract IInformationControl doCreateInformationControl(Shell parent); 183 protected abstract IInformationControl doCreateInformationControl(Shell parent);
184 184
185 this(){
186 fInformationControls= new HashMap();
187 }
188
185 /* 189 /*
186 * @see dwtx.jface.text.IInformationControlCreator#createInformationControl(dwt.widgets.Shell) 190 * @see dwtx.jface.text.IInformationControlCreator#createInformationControl(dwt.widgets.Shell)
187 */ 191 */
188 public IInformationControl createInformationControl(Shell parent) { 192 public IInformationControl createInformationControl(Shell parent) {
189 IInformationControl control= cast(IInformationControl)fInformationControls.get(parent); 193 IInformationControl control= cast(IInformationControl)fInformationControls.get(parent);
190 if (control is null) { 194 if (control is null) {
191 control= doCreateInformationControl(parent); 195 control= doCreateInformationControl(parent);
192 control.addDisposeListener(this); 196 control.addDisposeListener(this);
193 fInformationControls.put(parent, control); 197 fInformationControls.put(parent, cast(Object)control);
194 } 198 }
195 return control; 199 return control;
196 } 200 }
197 201
198 /* 202 /*
209 213
210 /* 214 /*
211 * @see dwtx.jface.text.IInformationControlCreatorExtension#canReuse(dwtx.jface.text.IInformationControl) 215 * @see dwtx.jface.text.IInformationControlCreatorExtension#canReuse(dwtx.jface.text.IInformationControl)
212 */ 216 */
213 public bool canReuse(IInformationControl control) { 217 public bool canReuse(IInformationControl control) {
214 return fInformationControls.containsValue(control); 218 return fInformationControls.containsValue(cast(Object)control);
215 } 219 }
216 220
217 /* 221 /*
218 * @see dwtx.jface.text.IInformationControlCreatorExtension#canReplace(dwtx.jface.text.IInformationControlCreator) 222 * @see dwtx.jface.text.IInformationControlCreatorExtension#canReplace(dwtx.jface.text.IInformationControlCreator)
219 */ 223 */
220 public bool canReplace(IInformationControlCreator creator) { 224 public bool canReplace(IInformationControlCreator creator) {
221 return creator.getClass() is getClass(); 225 return creator.classinfo is this.classinfo;
222 } 226 }
223 } 227 }