Mercurial > projects > dwt-addons
comparison dwtx/jface/text/information/InformationPresenter.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | 7d818bd32d63 |
children | 65801ad2b265 |
comparison
equal
deleted
inserted
replaced
133:7d818bd32d63 | 134:51e6e63f930e |
---|---|
306 */ | 306 */ |
307 public IInformationProvider getInformationProvider(String contentType) { | 307 public IInformationProvider getInformationProvider(String contentType) { |
308 if (fProviders is null) | 308 if (fProviders is null) |
309 return null; | 309 return null; |
310 | 310 |
311 return (IInformationProvider) fProviders.get(contentType); | 311 return cast(IInformationProvider) fProviders.get(contentType); |
312 } | 312 } |
313 | 313 |
314 /** | 314 /** |
315 * Sets a offset to override the selection. Setting the value to <code>-1</code> will disable | 315 * Sets a offset to override the selection. Setting the value to <code>-1</code> will disable |
316 * overriding. | 316 * overriding. |
345 if (subject is null) | 345 if (subject is null) |
346 return; | 346 return; |
347 | 347 |
348 Object info; | 348 Object info; |
349 if (provider instanceof IInformationProviderExtension) { | 349 if (provider instanceof IInformationProviderExtension) { |
350 IInformationProviderExtension extension= (IInformationProviderExtension) provider; | 350 IInformationProviderExtension extension= cast(IInformationProviderExtension) provider; |
351 info= extension.getInformation2(fTextViewer, subject); | 351 info= extension.getInformation2(fTextViewer, subject); |
352 } else { | 352 } else { |
353 // backward compatibility code | 353 // backward compatibility code |
354 info= provider.getInformation(fTextViewer, subject); | 354 info= provider.getInformation(fTextViewer, subject); |
355 } | 355 } |
356 | 356 |
357 if (provider instanceof IInformationProviderExtension2) | 357 if (provider instanceof IInformationProviderExtension2) |
358 setCustomInformationControlCreator(((IInformationProviderExtension2) provider).getInformationPresenterControlCreator()); | 358 setCustomInformationControlCreator((cast(IInformationProviderExtension2) provider).getInformationPresenterControlCreator()); |
359 else | 359 else |
360 setCustomInformationControlCreator(null); | 360 setCustomInformationControlCreator(null); |
361 | 361 |
362 setInformation(info, computeArea(subject)); | 362 setInformation(info, computeArea(subject)); |
363 } | 363 } |
399 * @return the corresponding widget range | 399 * @return the corresponding widget range |
400 * @since 2.1 | 400 * @since 2.1 |
401 */ | 401 */ |
402 private IRegion modelRange2WidgetRange(IRegion region) { | 402 private IRegion modelRange2WidgetRange(IRegion region) { |
403 if (fTextViewer instanceof ITextViewerExtension5) { | 403 if (fTextViewer instanceof ITextViewerExtension5) { |
404 ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer; | 404 ITextViewerExtension5 extension= cast(ITextViewerExtension5) fTextViewer; |
405 return extension.modelRange2WidgetRange(region); | 405 return extension.modelRange2WidgetRange(region); |
406 } | 406 } |
407 | 407 |
408 IRegion visibleRegion= fTextViewer.getVisibleRegion(); | 408 IRegion visibleRegion= fTextViewer.getVisibleRegion(); |
409 int start= region.getOffset() - visibleRegion.getOffset(); | 409 int start= region.getOffset() - visibleRegion.getOffset(); |
432 /* | 432 /* |
433 * @see AbstractInformationControlManager#showInformationControl(Rectangle) | 433 * @see AbstractInformationControlManager#showInformationControl(Rectangle) |
434 */ | 434 */ |
435 protected void showInformationControl(Rectangle subjectArea) { | 435 protected void showInformationControl(Rectangle subjectArea) { |
436 if (fTextViewer instanceof IWidgetTokenOwnerExtension && fTextViewer instanceof IWidgetTokenOwner) { | 436 if (fTextViewer instanceof IWidgetTokenOwnerExtension && fTextViewer instanceof IWidgetTokenOwner) { |
437 IWidgetTokenOwnerExtension extension= (IWidgetTokenOwnerExtension) fTextViewer; | 437 IWidgetTokenOwnerExtension extension= cast(IWidgetTokenOwnerExtension) fTextViewer; |
438 if (extension.requestWidgetToken(this, WIDGET_PRIORITY)) | 438 if (extension.requestWidgetToken(this, WIDGET_PRIORITY)) |
439 super.showInformationControl(subjectArea); | 439 super.showInformationControl(subjectArea); |
440 } else if (fTextViewer instanceof IWidgetTokenOwner) { | 440 } else if (fTextViewer instanceof IWidgetTokenOwner) { |
441 IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer; | 441 IWidgetTokenOwner owner= cast(IWidgetTokenOwner) fTextViewer; |
442 if (owner.requestWidgetToken(this)) | 442 if (owner.requestWidgetToken(this)) |
443 super.showInformationControl(subjectArea); | 443 super.showInformationControl(subjectArea); |
444 | 444 |
445 } else | 445 } else |
446 super.showInformationControl(subjectArea); | 446 super.showInformationControl(subjectArea); |
452 protected void hideInformationControl() { | 452 protected void hideInformationControl() { |
453 try { | 453 try { |
454 super.hideInformationControl(); | 454 super.hideInformationControl(); |
455 } finally { | 455 } finally { |
456 if (fTextViewer instanceof IWidgetTokenOwner) { | 456 if (fTextViewer instanceof IWidgetTokenOwner) { |
457 IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer; | 457 IWidgetTokenOwner owner= cast(IWidgetTokenOwner) fTextViewer; |
458 owner.releaseWidgetToken(this); | 458 owner.releaseWidgetToken(this); |
459 } | 459 } |
460 } | 460 } |
461 } | 461 } |
462 | 462 |
466 protected void handleInformationControlDisposed() { | 466 protected void handleInformationControlDisposed() { |
467 try { | 467 try { |
468 super.handleInformationControlDisposed(); | 468 super.handleInformationControlDisposed(); |
469 } finally { | 469 } finally { |
470 if (fTextViewer instanceof IWidgetTokenOwner) { | 470 if (fTextViewer instanceof IWidgetTokenOwner) { |
471 IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer; | 471 IWidgetTokenOwner owner= cast(IWidgetTokenOwner) fTextViewer; |
472 owner.releaseWidgetToken(this); | 472 owner.releaseWidgetToken(this); |
473 } | 473 } |
474 } | 474 } |
475 } | 475 } |
476 | 476 |