/**
   * Returns the image assiciated with the given image descriptor.
   *
   * @param descriptor the image descriptor for which the registry manages an image
   * @return the image associated with the image descriptor or <code>null</code> if the image
   *     descriptor can't create the requested image.
   */
  public Image get(ImageDescriptor descriptor) {
    if (descriptor == null) descriptor = ImageDescriptor.getMissingImageDescriptor();

    Image result = fRegistry.get(descriptor);
    if (result != null) return result;

    Assert.isTrue(
        fDisplay == SWTUtil.getStandardDisplay(),
        "Allocating image for wrong display."); //$NON-NLS-1$
    result = descriptor.createImage();
    if (result != null) fRegistry.put(descriptor, result);
    return result;
  }
Example #2
0
  private void fireChanges(final IResource[] changes, final boolean markerChanged) {
    Display display = SWTUtil.getStandardDisplay();
    if (display != null && !display.isDisposed()) {
      display.asyncExec(
          new Runnable() {

            @Override
            public void run() {
              Object[] listeners = fListeners.getListeners();
              for (Object listener : listeners) {
                IProblemChangedListener curr = (IProblemChangedListener) listener;
                curr.problemsChanged(changes, markerChanged);
              }
            }
          });
    }
  }
  public HyperlinkSettings getHyperlinkSettings() {
    // #132723 cannot have null settings
    if (hyperlinkSettings == null) {
      Display display = SWTUtil.getStandardDisplay();
      hyperlinkSettings = new HyperlinkSettings(display);

      // Setting link foreground color for windows 7
      final String osName = System.getProperty("os.name"); // $NON-NLS-1$
      if (osName.toLowerCase().startsWith("windows 7")) { // $NON-NLS-1$
        activeForeground = new Color(display, LINK_FOREGROUND);
        hyperlinkSettings.setForeground(activeForeground);
      }
      enabledForeground = hyperlinkSettings.getForeground();
      // Bug 22782 - DCR - Need API to draw disabled text in native platform way
      disabledForeground = display.getSystemColor(SWT.COLOR_GRAY);
    }
    return hyperlinkSettings;
  }
 /** Creates a new image descriptor registry for the current or default display, respectively. */
 public ImageDescriptorRegistry() {
   this(SWTUtil.getStandardDisplay());
 }