comparison dwtx/jface/text/information/InformationPresenter.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
69 * 69 *
70 * @since 2.0 70 * @since 2.0
71 */ 71 */
72 public class InformationPresenter : AbstractInformationControlManager , IInformationPresenter, IInformationPresenterExtension, IWidgetTokenKeeper, IWidgetTokenKeeperExtension { 72 public class InformationPresenter : AbstractInformationControlManager , IInformationPresenter, IInformationPresenterExtension, IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
73 73
74 alias AbstractInformationControlManager.install install;
75 public override void showInformation(){
76 super.showInformation();
77 }
74 78
75 /** 79 /**
76 * Priority of the info controls managed by this information presenter. 80 * Priority of the info controls managed by this information presenter.
77 * Default value: <code>5</code>. 81 * Default value: <code>5</code>.
78 * 82 *
296 fProviders= new HashMap(); 300 fProviders= new HashMap();
297 301
298 if (provider is null) 302 if (provider is null)
299 fProviders.remove(contentType); 303 fProviders.remove(contentType);
300 else 304 else
301 fProviders.put(contentType, provider); 305 fProviders.put(contentType, cast(Object)provider);
302 } 306 }
303 307
304 /* 308 /*
305 * @see IInformationPresenter#getInformationProvider(String) 309 * @see IInformationPresenter#getInformationProvider(String)
306 */ 310 */
349 if ( cast(IInformationProviderExtension)provider ) { 353 if ( cast(IInformationProviderExtension)provider ) {
350 IInformationProviderExtension extension= cast(IInformationProviderExtension) provider; 354 IInformationProviderExtension extension= cast(IInformationProviderExtension) provider;
351 info= extension.getInformation2(fTextViewer, subject); 355 info= extension.getInformation2(fTextViewer, subject);
352 } else { 356 } else {
353 // backward compatibility code 357 // backward compatibility code
354 info= provider.getInformation(fTextViewer, subject); 358 info= stringcast(provider.getInformation(fTextViewer, subject));
355 } 359 }
356 360
357 if ( cast(IInformationProviderExtension2)provider ) 361 if ( cast(IInformationProviderExtension2)provider )
358 setCustomInformationControlCreator((cast(IInformationProviderExtension2) provider).getInformationPresenterControlCreator()); 362 setCustomInformationControlCreator((cast(IInformationProviderExtension2) provider).getInformationPresenterControlCreator());
359 else 363 else
360 setCustomInformationControlCreator(null); 364 setCustomInformationControlCreator(null);
361 365
376 IRegion widgetRegion= modelRange2WidgetRange(region); 380 IRegion widgetRegion= modelRange2WidgetRange(region);
377 if (widgetRegion !is null) { 381 if (widgetRegion !is null) {
378 start= widgetRegion.getOffset(); 382 start= widgetRegion.getOffset();
379 end= widgetRegion.getOffset() + widgetRegion.getLength(); 383 end= widgetRegion.getOffset() + widgetRegion.getLength();
380 } 384 }
381 385
382 StyledText styledText= fTextViewer.getTextWidget(); 386 StyledText styledText= fTextViewer.getTextWidget();
383 Rectangle bounds; 387 Rectangle bounds;
384 if (end > 0 && start < end) 388 if (end > 0 && start < end)
385 bounds= styledText.getTextBounds(start, end - 1); 389 bounds= styledText.getTextBounds(start, end - 1);
386 else { 390 else {
387 Point loc= styledText.getLocationAtOffset(start); 391 Point loc= styledText.getLocationAtOffset(start);
388 bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start)); 392 bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start));
389 } 393 }
390 394
391 return bounds; 395 return bounds;
392 } 396 }
393 397
394 /** 398 /**
395 * Translated the given range in the viewer's document into the corresponding 399 * Translated the given range in the viewer's document into the corresponding