Package org.eclipse.jface.resource

Examples of org.eclipse.jface.resource.ImageRegistry


            case Project:
            case Marker:
                return wbProvider.getImage(group.getData());
            case BugRank: {
                FindBugsMarker.MarkerRank prio = group.getPriority();
                ImageRegistry imageRegistry = FindbugsPlugin.getDefault().getImageRegistry();
                return imageRegistry.get(prio.iconName());
            }
            case Confidence: {
                int confidence = (Integer) group.getData();
                FindBugsMarker.MarkerRank mr = FindBugsMarker.MarkerRank.values()[confidence-1];
                ImageRegistry imageRegistry = FindbugsPlugin.getDefault().getImageRegistry();
                return imageRegistry.get(mr.iconName());
            }
            default:
                FindBugsMarker.MarkerRank prio = group.getPriority();
                ImageRegistry imageRegistry = FindbugsPlugin.getDefault().getImageRegistry();
                return imageRegistry.get(prio.iconName());
            }

        }
        if (element instanceof IMarker) {
            IMarker marker = (IMarker) element;
View Full Code Here


  }

  @Override
  protected void createPages() {
    final Composite composite = new Composite(getContainer(), SWT.FILL);
    ImageRegistry reg = MeclipsePlugin.getDefault().getImageRegistry();

    composite.setLayout(new MigLayout("wrap 9",
        "[][][][40px!][][40px!][][][]", "[30px!][]"));
    Label find = new Label(composite, SWT.FILL);
    find.setLayoutData("w 30!");
    find.setText(getCaption("collectionEditor.find"));

    query = new Text(composite, SWT.FILL);
    query.setLayoutData("w 100: 500: 600");
    query.setText("{}");

    Label skip = new Label(composite, SWT.FILL);
    skip.setText(getCaption("collectionEditor.skip"));

    skipV = new Text(composite, SWT.FILL);
    skipV.setText("0");
    skipV.setLayoutData("w 40px!");
    skipV.addListener(SWT.DefaultSelection, runQuery);

    Label limit = new Label(composite, SWT.FILL);
    limit.setText(getCaption("collectionEditor.limit"));

    limitV = new Text(composite, SWT.FILL);
    limitV.setText("10");
    limitV.setLayoutData("w 40px!");
    limitV.addListener(SWT.DefaultSelection, runQuery);

    search = new Button(composite, SWT.PUSH);
    search.setToolTipText(getCaption("collectionEditor.tooltip.search"));
    search.setImage(reg.get(MeclipsePlugin.FIND_IMG_ID));
    search.addListener(SWT.Selection, runQuery);

    more = new Button(composite, SWT.PUSH);
    more.setToolTipText(getCaption("collectionEditor.tooltip.next"));
    more.setImage(reg.get(MeclipsePlugin.GET_NEXT_IMG_ID));
    more.setEnabled(false);
    more.addListener(SWT.Selection, new Listener() {

      @Override
      public void handleEvent(Event arg0) {
        loadEntries(false);
      }

    });

    all = new Button(composite, SWT.PUSH);
    all.setToolTipText(String.format(
        getCaption("collectionEditor.tooltip.getAll"), maxElements));
    all.setImage(reg.get(MeclipsePlugin.GET_ALL_IMG_ID));
    all.setEnabled(false);
    all.addListener(SWT.Selection, new Listener() {

      @Override
      public void handleEvent(Event arg0) {
View Full Code Here

        action.setImageDescriptor(descriptor);
    }

    private static ImageRegistry getImageRegistry() {
        if (fgImageRegistry == null) {
            fgImageRegistry = new ImageRegistry();
            for (Iterator<String> iter = fgAvoidSWTErrorMap.keySet().iterator(); iter
                    .hasNext();) {
                String key = iter.next();
                fgImageRegistry.put(key, fgAvoidSWTErrorMap.get(key));
            }
View Full Code Here

   * @return the image or <code>null</code>
   * @since 3.0
   */
  private Image getImage(Annotation annotation, AnnotationPreference preference, String annotationType) {

    ImageRegistry registry= EditorsPlugin.getDefault().getImageRegistry();

    IAnnotationImageProvider annotationImageProvider = preference.getAnnotationImageProvider();
    if (annotationImageProvider != null) {

      Image image= annotationImageProvider.getManagedImage(annotation);
      if (image != null)
        return image;

      String id= annotationImageProvider.getImageDescriptorId(annotation);
      if (id != null) {
        image= registry.get(id);
        if (image == null) {
          ImageDescriptor descriptor= annotationImageProvider.getImageDescriptor(id);
          registry.put(id, descriptor);
          image= registry.get(id);
        }
        return image;
      }
    }

    if (annotationType == null)
      return null;

    if (hasQuickFix(annotation)) {
      ImageDescriptor quickFixImageDesc= preference.getQuickFixImageDescriptor();
      if (quickFixImageDesc != null) {
        Image image= registry.get(quickFixImageDesc.toString());
        if (image == null) {
          registry.put(quickFixImageDesc.toString(), quickFixImageDesc);
          image= registry.get(quickFixImageDesc.toString());
        }
        if (image != null)
          return image;
      }
    }

    Image image= registry.get(annotationType);
    if (image == null) {
      ImageDescriptor descriptor= preference.getImageDescriptor();
      if (descriptor != null) {
        registry.put(annotationType, descriptor);
        image= registry.get(annotationType);
      } else {
        String key= translateSymbolicImageName(preference.getSymbolicImageName());
        if (key != null) {
          ISharedImages sharedImages= PlatformUI.getWorkbench().getSharedImages();
          image= sharedImages.getImage(key);
View Full Code Here

   * @return the image or <code>null</code>
   * @since 3.1
   */
  private Image getImage(AnnotationPreference preference) {

    ImageRegistry registry= EditorsPlugin.getDefault().getImageRegistry();

    String annotationType= (String) preference.getAnnotationType();
    if (annotationType == null)
      return null;

    String customImage= annotationType + "__AnnotationsConfigurationBlock_Image"; //$NON-NLS-1$

    Image image;
    image= registry.get(customImage);
    if (image != null)
      return image;

    image= registry.get(annotationType);
    if (image == null) {
      ImageDescriptor descriptor= preference.getImageDescriptor();
      if (descriptor != null) {
        registry.put(annotationType, descriptor);
        image= registry.get(annotationType);
      } else {
        String key= translateSymbolicImageName(preference.getSymbolicImageName());
        if (key != null) {
          ISharedImages sharedImages= PlatformUI.getWorkbench().getSharedImages();
          image= sharedImages.getImage(key);
        }
      }
    }

    if (image == null)
      return image;

    // create custom image
    final int SIZE= 16; // square images
    ImageData data= image.getImageData();
    Image copy;
    if (data.height > SIZE || data.width > SIZE) {
      // scale down to icon size
      copy= new Image(Display.getCurrent(), data.scaledTo(SIZE, SIZE));
    } else {
      // don't scale up, but rather copy into the middle and mark everything else transparent
      ImageData mask= data.getTransparencyMask();
      ImageData resized= new ImageData(SIZE, SIZE, data.depth, data.palette);
      ImageData resizedMask= new ImageData(SIZE, SIZE, mask.depth, mask.palette);

      int xo= Math.max(0, (SIZE - data.width) / 2);
      int yo= Math.max(0, (SIZE - data.height) / 2);

      for (int y= 0; y < SIZE; y++) {
        for (int x= 0; x < SIZE; x++) {
          if (y >= yo && x >= xo && y < yo + data.height && x < xo + data.width) {
            resized.setPixel(x, y, data.getPixel(x - xo, y - yo));
            resizedMask.setPixel(x, y, mask.getPixel(x - xo, y - yo));
          }
        }
      }

      copy= new Image(Display.getCurrent(), resized, resizedMask);
    }

    fImageKeys.add(customImage);
    registry.put(customImage, copy);
    return copy;
  }
View Full Code Here

  /*
   * @see IPreferenceConfigurationBlock#dispose()
   */
  public void dispose() {
    ImageRegistry registry= EditorsPlugin.getDefault().getImageRegistry();

    for (Iterator it= fImageKeys.iterator(); it.hasNext();) {
      String string= (String) it.next();
      registry.remove(string);
    }

    fImageKeys.clear();
  }
View Full Code Here

        // enable the save/restore windows size & position feature
        configurer.setSaveAndRestore(true);

        // enable help button in dialogs
        TrayDialog.setDialogHelpAvailable(true);
        ImageRegistry reg = JFaceResources.getImageRegistry();
        ImageDescriptor helpImage = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
                ISharedImages.IMG_LCL_LINKTO_HELP);
        reg.put(Dialog.DLG_IMG_HELP, helpImage);
    }
View Full Code Here

   * The constructor
   */
  public Activator() {
    plugin = this;

    ImageRegistry registry = getImageRegistry();
    registry.put(FILE_ICON, getImageDescriptor(FILE_ICON));
    registry.put(GWT_ICON, getImageDescriptor(GWT_ICON));
    registry.put(PARAMETERS_ICON, getImageDescriptor(PARAMETERS_ICON));

  }
View Full Code Here

   * The constructor
   */
  public Activator() {
    plugin = this;
   
    ImageRegistry registry = getImageRegistry();
    registry.put(FILE_ICON,  getImageDescriptor(FILE_ICON));
    registry.put(GWT_ICON,  getImageDescriptor(GWT_ICON));
    registry.put(PARAMETERS_ICON,  getImageDescriptor(PARAMETERS_ICON));
   
  }
View Full Code Here

  public Image getImage(String name) {
    if (name == null) {
      return null;
    }

    ImageRegistry images = getImageRegistry();
    Image image = images.get(name);
    if (image == null) {
      getImageDescriptor(name);   
      image = images.get(name);
    }
    return image;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.resource.ImageRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.