Java Code Examples for org.eclipse.jface.resource.ImageDescriptor

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/rca/editor/.

Source file: DrawingEditor.java

  22 
vote

/** 
 * @param path The path to the cursor image.
 * @return The created cursor or null if the image couldn't be found.
 */
private static Cursor createCursor(String path){
  ImageDescriptor imageDescriptor=Activator.getImageDescriptor(path);
  Cursor openHandCursor=null;
  if (imageDescriptor != null) {
    ImageData openHand=imageDescriptor.getImageData();
    openHandCursor=new Cursor(Display.getCurrent(),openHand,12,12);
  }
  return openHandCursor;
}
 

Example 2

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.datatools.enablement.simpledb.editor.ui/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/wizard/.

Source file: SDBTableDataWizard.java

  22 
vote

@Override public void addPages(){
  this.page=new SDBTableDataWizardPage(this.editor);
  ImageDescriptor image=AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID,"icons/sdb-wizard-75x66-shadow.png");
  this.page.setImageDescriptor(image);
  addPage(this.page);
}
 

Example 3

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/.

Source file: Activator.java

  22 
vote

/** 
 * Get an image given a path relative to this plugin.
 * @param path the image {@link String path}
 * @return an {@link Image image} located at the path
 */
public static Image getImage(String path){
  Image image=getDefault().getImageRegistry().get(path);
  if (image != null) {
    return image;
  }
  ImageDescriptor descriptor=getImageDescriptor(path);
  if (descriptor != null) {
    getDefault().getImageRegistry().put(path,descriptor);
    return getDefault().getImageRegistry().get(path);
  }
  return null;
}
 

Example 4

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/.

Source file: ImageManager.java

  22 
vote

public ImageDescriptor getImageDescriptor(ICONS icon){
  ImageDescriptor descriptor=registry.getDescriptor(icon.getFileName());
  if (descriptor == null) {
    descriptor=BioPEPAPlugin.getImageDescriptor(ICON_PATH + icon.getFileName());
    registry.put(icon.getFileName(),descriptor);
  }
  return descriptor;
}
 

Example 5

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/action/contribution/.

Source file: AddMetadataAction.java

  22 
vote

public AddMetadataAction(SpectrumEditorContributor contributor){
  this.contributor=contributor;
  URL url=Platform.getBundle("net.bioclipse.spectrum").getEntry("/icons/add_metadata.gif");
  ImageDescriptor imageDesc=ImageDescriptor.createFromURL(url);
  this.setImageDescriptor(imageDesc);
}
 

Example 6

From project bndtools, under directory /bndtools.core/src/bndtools/editor/.

Source file: BndSourceEditorPage.java

  22 
vote

public BndSourceEditorPage(String id,BndEditor formEditor){
  this.id=id;
  this.formEditor=formEditor;
  setSourceViewerConfiguration(new BndSourceViewerConfiguration(getSharedColors()));
  formEditor.getEditModel().addPropertyChangeListener(propChangeListener);
  ImageDescriptor iconDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID,"icons/page_white_text.png");
  icon=iconDescriptor.createImage();
}
 

Example 7

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/explorer/.

Source file: JavaElementImageProvider.java

  22 
vote

/** 
 * Returns an image descriptor for a java element. The descriptor includes overlays, if specified.
 * @param element the Java element
 * @param flags the image flags
 * @return returns the image descriptor
 */
public ImageDescriptor getJavaImageDescriptor(IJavaElement element,int flags){
  Point size=useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
  ImageDescriptor baseDesc=getBaseImageDescriptor(element,flags);
  if (baseDesc != null) {
    int adornmentFlags=computeJavaAdornmentFlags(element,flags);
    return new JavaElementImageDescriptor(baseDesc,adornmentFlags,size);
  }
  return new JavaElementImageDescriptor(JavaPluginImages.DESC_OBJS_GHOST,0,size);
}
 

Example 8

From project cilia-workbench, under directory /cilia-workbench-common/src/fr/liglab/adele/cilia/workbench/common/ui/view/.

Source file: CiliaLabelProvider.java

  22 
vote

private static Image createImageFromPath(String imagePath){
  org.osgi.framework.Bundle bundle=Activator.getInstance().getBundle();
  URL url=FileLocator.find(bundle,new Path(imagePath),null);
  try {
    url=new URL("platform:/plugin/fr.liglab.adele.cilia.workbench.common/" + imagePath);
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
  ImageDescriptor imageDesc=ImageDescriptor.createFromURL(url);
  return imageDesc.createImage();
}
 

Example 9

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/editor/actions/.

Source file: RenameAction.java

  22 
vote

protected void init(){
  setText("Rename...");
  setToolTipText("Rename");
  setId(ActionFactory.RENAME.getId());
  ImageDescriptor icon=AbstractUIPlugin.imageDescriptorFromPlugin("TutoGEF","icons/rename-icon.png");
  if (icon != null)   setImageDescriptor(icon);
  setEnabled(false);
}
 

Example 10

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/tools/history/.

Source file: HistoryTool.java

  22 
vote

public HistoryLabelProvider(){
  ImageDescriptor id=Activator.getImageDescriptor("icons/ticked.png");
  checkedIcon=id.createImage();
  id=Activator.getImageDescriptor("icons/unticked.gif");
  uncheckedIcon=id.createImage();
}
 

Example 11

From project Diver, under directory /ca.uvic.chisel.javasketch/src/ca/uvic/chisel/javasketch/ui/internal/views/.

Source file: TraceNavigatorLabelProvider.java

  22 
vote

/** 
 * @param baseImage
 * @param key
 * @return
 */
private ImageDescriptor overlayStop(ImageDescriptor baseImage,String key){
  ImageDescriptor image=SketchPlugin.getDefault().getImageRegistry().getDescriptor(key);
  if (image == null) {
    ImageDescriptor overlay=SketchPlugin.getDefault().getImageRegistry().getDescriptor(ISketchImageConstants.OVERLAY_STOP);
    image=new OverlayIcon(baseImage,overlay,OverlayIcon.LEFT,OverlayIcon.BOTTOM);
    SketchPlugin.getDefault().getImageRegistry().put(key,image);
  }
  return image;
}
 

Example 12

From project dolphin, under directory /com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/.

Source file: TomcatProjectCreationWizard.java

  22 
vote

public TomcatProjectCreationWizard(){
  super();
  TomcatLauncherPlugin.checkTomcatSettingsAndWarn();
  ImageDescriptor banner=this.getBannerImg();
  if (banner != null)   setDefaultPageImageDescriptor(banner);
  setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
  setWindowTitle(WIZARD_PROJECT_TITLE);
}
 

Example 13

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/.

Source file: DroolsEclipsePlugin.java

  22 
vote

/** 
 * Returns an image descriptor for the image file at the given plug-in relative path. Uses the plug ins image registry to "cache" it.
 * @param path the path
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String path){
  DroolsEclipsePlugin plugin=getDefault();
  ImageRegistry reg=plugin.getImageRegistry();
  ImageDescriptor des=reg.getDescriptor(path);
  if (des == null) {
    des=AbstractUIPlugin.imageDescriptorFromPlugin("org.drools.eclipse",path);
    reg.put(path,des);
  }
  return des;
}
 

Example 14

From project Eclipse, under directory /com.mobilesorcery.sdk.core/src/com/mobilesorcery/sdk/core/templates/.

Source file: ProjectTemplateExtension.java

  22 
vote

@Override public ImageDescriptor getImage(){
  String ns=element.getDeclaringExtension().getNamespaceIdentifier();
  String icon=element.getAttribute("image");
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(ns,icon);
  return imageDescriptor;
}
 

Example 15

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/ui/.

Source file: ResultLabelProvider.java

  22 
vote

private Image getFileImage(SearchResultDoc doc){
  String ext=doc.getFileExtension();
  Image fileImage=imageRegistry.get(ext);
  if (fileImage == null) {
    ImageDescriptor imageDescriptor=PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(doc.getFileName());
    fileImage=imageDescriptor.createImage(true);
    imageRegistry.put(ext,fileImage);
  }
  return fileImage;
}
 

Example 16

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/.

Source file: CloudSpacesSelectionPart.java

  22 
vote

public CloudSpacesSelectionPart(CloudSpaceChangeListener spaceChangeListener,CloudFoundryServer cloudServer,WizardPage wizardPage){
  this.spaceChangeListener=spaceChangeListener;
  String serverTypeId=cloudServer.getServer().getServerType().getId();
  wizardPage.setTitle("Organizations and Spaces");
  wizardPage.setDescription(DEFAULT_DESCRIPTION);
  ImageDescriptor banner=CloudFoundryImages.getWizardBanner(serverTypeId);
  if (banner != null) {
    wizardPage.setImageDescriptor(banner);
  }
}
 

Example 17

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/wizards/.

Source file: ProjectCreationWizard.java

  22 
vote

private void initializePageImageDescriptor(){
  ImageDescriptor bannerImage=getBannerImage();
  if (bannerImage != null) {
    setDefaultPageImageDescriptor(bannerImage);
  }
}
 

Example 18

From project grails-ide, under directory /org.grails.ide.eclipse.editor.groovy/src/org/grails/ide/eclipse/editor/groovy/.

Source file: EditorPluginImageHelper.java

  22 
vote

/** 
 * Creates an image from the given resource and adds the image to the image registry.
 * @param resource
 * @return Image
 */
private Image createImage(String resource){
  ImageDescriptor desc=getImageDescriptor(resource);
  Image image=null;
  if (desc != null) {
    image=desc.createImage();
    if (!desc.equals(ImageDescriptor.getMissingImageDescriptor()))     getImageRegistry().put(resource,image);
  }
  return image;
}
 

Example 19

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/.

Source file: ResourceSupport.java

  22 
vote

public static ImageDescriptor imageDescriptorFromPlugin(String pluginId,Class<?> clazz,String imageFilePath){
  try {
    final ImageDescriptor d=AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,imageFilePath);
    if (d != null)     return d;
  }
 catch (  Throwable t) {
  }
  final ImageDescriptor d=ImageDescriptor.createFromFile(clazz,imageFilePath);
  if (d != null)   return d;
  return ImageDescriptor.getMissingImageDescriptor();
}
 

Example 20

From project interactive-self-assessment, under directory /org.eclipse.ui.examples.javaeditor/templateeditorexamplesrc/org/eclipse/ui/examples/templateeditor/template/.

Source file: XMLCompletionProcessor.java

  22 
vote

/** 
 * Always return the default image.
 * @param template the template, ignored in this implementation
 * @return the default template image
 */
protected Image getImage(Template template){
  ImageRegistry registry=TemplateEditorUI.getDefault().getImageRegistry();
  Image image=registry.get(DEFAULT_IMAGE);
  if (image == null) {
    ImageDescriptor desc=TemplateEditorUI.imageDescriptorFromPlugin("org.eclipse.ui.examples.javaeditor",DEFAULT_IMAGE);
    registry.put(DEFAULT_IMAGE,desc);
    image=registry.get(DEFAULT_IMAGE);
  }
  return image;
}
 

Example 21

From project libra, under directory /plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/.

Source file: FrameworkUIPlugin.java

  22 
vote

/** 
 * Register an image with the registry.
 * @param key java.lang.String
 * @param partialURL java.lang.String
 */
private void registerImage(ImageRegistry registry,String key,String partialURL){
  if (ICON_BASE_URL == null) {
    String pathSuffix="icons/";
    ICON_BASE_URL=singleton.getBundle().getEntry(pathSuffix);
  }
  try {
    ImageDescriptor id=ImageDescriptor.createFromURL(new URL(ICON_BASE_URL,partialURL));
    registry.put(key,id);
    imageDescriptors.put(key,id);
  }
 catch (  Exception e) {
    Trace.trace(Trace.WARNING,"Error registering image",e);
  }
}
 

Example 22

From project m2eclipse-hudson, under directory /org.sonatype.m2e.hudson.ui/src/main/java/com/sonatype/buildserver/eclipse/ui/.

Source file: HudsonUIActivator.java

  22 
vote

/** 
 * Returns an image descriptor for the image file at the given plug-in relative path
 * @param path the path
 * @return the image descriptor
 */
public ImageDescriptor getImageDescriptor(String path){
  ImageRegistry imageRegistry=getImageRegistry();
  if (imageRegistry != null) {
    ImageDescriptor imageDescriptor=imageRegistry.getDescriptor(path);
    if (imageDescriptor == null) {
      imageDescriptor=imageDescriptorFromPlugin(PLUGIN_ID,path);
      imageRegistry.put(path,imageDescriptor);
    }
    return imageDescriptor;
  }
  return null;
}
 

Example 23

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/.

Source file: WebbyImages.java

  22 
vote

private static ImageDescriptor createImageDescriptor(String key){
  WebbyPlugin plugin=WebbyPlugin.getDefault();
  String pluginId=WebbyPlugin.getPluginId();
  ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,"icons/" + key);
  if (imageDescriptor == null) {
    plugin.getLog().log(new Status(IStatus.ERROR,pluginId,IStatus.ERROR,"Could not locate image " + key,null));
    return null;
  }
  return imageDescriptor;
}
 

Example 24

From project bundlemaker, under directory /main/org.bundlemaker.core.ui.artifact/src/org/bundlemaker/core/ui/artifact/internal/.

Source file: Activator.java

  21 
vote

public Image getIcon(String icon){
  ImageRegistry registry=getImageRegistry();
  Image image=registry.get(icon);
  if (image != null) {
    return image;
  }
  URL url=null;
  try {
    url=new URL(getFile("icons/" + icon));
  }
 catch (  MalformedURLException e) {
  }
  ImageDescriptor myImage=ImageDescriptor.createFromURL(url);
  image=myImage.createImage();
  getImageRegistry().put(icon,image);
  return image;
}
 

Example 25

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/.

Source file: DataGUIItem.java

  21 
vote

public static Image getImage(String name,String brandPluginID){
  if (Platform.isRunning()) {
    String imageLocation=String.format("%sicons%s%s",File.separator,File.separator,name);
    ImageDescriptor imageDescriptor=AbstractUIPlugin.imageDescriptorFromPlugin(brandPluginID,imageLocation);
    if (imageDescriptor != null) {
      return imageDescriptor.createImage();
    }
 else {
      String errorMessage=String.format("Could not find the icon '%s' in '%s'. Using the default image instead.",imageLocation,brandPluginID);
      System.err.println(errorMessage);
      return getDefaultImage();
    }
  }
 else {
    String format="Could not obtain the image '%s' in '%s', since the platform was not " + "running (?). Using the default image instead.";
    String errorMessage=String.format(format,name,brandPluginID);
    System.err.println(errorMessage);
    return getDefaultImage();
  }
}
 

Example 26

From project dawn-common, under directory /org.dawb.gda.extensions/src/org/dawb/gda/extensions/util/.

Source file: ImageThumbnailCreator.java

  21 
vote

public Image getIconForFile(File file){
  if (file.isDirectory()) {
    return getFolderImage(file);
  }
  final String ext=FileUtils.getFileExtension(file);
  if (imageRegistry == null)   imageRegistry=new ImageRegistry();
  Image returnImage=imageRegistry.get(ext);
  if (returnImage != null)   return returnImage;
  ECLISPE_BLOCK:   if (returnImage == null) {
    final IEditorDescriptor desc=PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getAbsolutePath());
    if (desc == null)     break ECLISPE_BLOCK;
    final ImageDescriptor imageDescriptor=desc.getImageDescriptor();
    if (imageDescriptor == null)     break ECLISPE_BLOCK;
    returnImage=imageDescriptor.createImage();
  }
  if (returnImage == null) {
    final Program program=Program.findProgram(ext);
    if (program != null) {
      ImageData iconData=Program.findProgram(ext).getImageData();
      returnImage=new Image(Display.getCurrent(),iconData);
    }
  }
  if (returnImage == null)   returnImage=getImageSWT(file);
  imageRegistry.put(ext,returnImage);
  return returnImage;
}
 

Example 27

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/.

Source file: DozerPlugin.java

  21 
vote

private void registerImage(ImageRegistry registry,String key,String fileName,String overlayFileName){
  try {
    IPath path=new Path("icons/" + fileName);
    URL url=find(path);
    if (url != null) {
      ImageDescriptor desc=ImageDescriptor.createFromURL(url);
      if (overlayFileName != null) {
        path=new Path("icons/" + overlayFileName);
        url=find(path);
        ImageDescriptor descOverlay=ImageDescriptor.createFromURL(url);
        Image overlayImg=createOverlayImg(desc.createImage(),descOverlay.createImage());
        desc=ImageDescriptor.createFromImage(overlayImg);
      }
      registry.put(key,desc);
    }
  }
 catch (  Exception e) {
  }
}
 

Example 28

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/icons/.

Source file: IconManager.java

  21 
vote

public Image getIcon(IIcon key){
  if (key == null) {
    return null;
  }
  ImageDescriptor descriptor=icons.get(key);
  if (descriptor == null) {
    try {
      String location=key.getIconLocation();
      URL url=new URL(location);
      if (location != null) {
        descriptor=ImageDescriptor.createFromURL(url);
        icons.put(key,descriptor);
      }
    }
 catch (    MalformedURLException e) {
      FrameworkUIActivator.log(new Status(IStatus.ERROR,FrameworkUIActivator.PLUGIN_ID,"Invalid URL: " + key.getIconLocation()));
    }
  }
  return descriptor != null ? descriptor.createImage() : null;
}
 

Example 29

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/.

Source file: GitLightweightDecorator.java

  21 
vote

private void decorateIcons(IDecoration decoration,IDecoratableResource resource){
  ImageDescriptor overlay=null;
  if (resource.isTracked()) {
    if (store.getBoolean(UIPreferences.DECORATOR_SHOW_TRACKED_ICON))     overlay=trackedImage;
    if (store.getBoolean(UIPreferences.DECORATOR_SHOW_ASSUME_VALID_ICON) && resource.isAssumeValid())     overlay=assumeValidImage;
    Staged staged=resource.staged();
    if (store.getBoolean(UIPreferences.DECORATOR_SHOW_STAGED_ICON) && staged != Staged.NOT_STAGED) {
      if (staged == Staged.ADDED)       overlay=stagedAddedImage;
 else       if (staged == Staged.REMOVED)       overlay=stagedRemovedImage;
 else       overlay=stagedImage;
    }
    if (store.getBoolean(UIPreferences.DECORATOR_SHOW_CONFLICTS_ICON) && resource.hasConflicts())     overlay=conflictImage;
  }
 else   if (store.getBoolean(UIPreferences.DECORATOR_SHOW_UNTRACKED_ICON)) {
    overlay=untrackedImage;
  }
  decoration.addOverlay(overlay);
}
 

Example 30

From project m2eclipse-wtp, under directory /org.maven.ide.eclipse.wtp/src/org/maven/ide/eclipse/wtp/internal/.

Source file: WTPResourcesImages.java

  21 
vote

private static ImageDescriptor create(String key){
  try {
    ImageRegistry imageRegistry=getImageRegistry();
    if (imageRegistry != null) {
      ImageDescriptor imageDescriptor=imageRegistry.getDescriptor(key);
      if (imageDescriptor == null) {
        imageDescriptor=createDescriptor(key);
        imageRegistry.put(key,imageDescriptor);
      }
      return imageDescriptor;
    }
  }
 catch (  Exception ex) {
    LOG.error("Error creating ImageDescriptor {}",key,ex);
  }
  return null;
}
 

Example 31

From project mylyn.builds, under directory /org.eclipse.mylyn.builds.ui/src/org/eclipse/mylyn/internal/builds/ui/view/.

Source file: BuildLabelProvider.java

  21 
vote

@Override public Image getImage(Object element){
  ImageDescriptor descriptor=null;
  ImageDescriptor bottomLeftDecoration=null;
  ImageDescriptor bottomRightDecoration=null;
  ImageDescriptor topRightDecoration=null;
  if (element instanceof IBuildElement) {
    bottomLeftDecoration=getBottomLeftDecoration((IBuildElement)element);
  }
  if (element instanceof IBuildServer) {
    if (((IBuildServer)element).getLocation().isOffline()) {
      descriptor=BuildImages.SERVER_DISABLED;
    }
 else {
      descriptor=BuildImages.SERVER;
    }
  }
 else   if (element instanceof IBuildPlan) {
    descriptor=getImageDescriptor(((IBuildPlan)element).getStatus());
    bottomRightDecoration=getBottomRightDecoration(((IBuildPlan)element).getState());
    topRightDecoration=getTopRightDecoration(((IBuildPlan)element).getFlags());
  }
 else   if (element instanceof IBuild) {
    descriptor=BuildLabelProvider.getImageDescriptor(((IBuild)element).getStatus());
    bottomRightDecoration=getBottomRightDecoration(((IBuild)element).getState());
  }
  if (descriptor != null) {
    if (bottomRightDecoration != null || bottomLeftDecoration != null || topRightDecoration != null) {
      descriptor=new DecorationOverlayIcon(CommonImages.getImage(descriptor),new ImageDescriptor[]{null,topRightDecoration,bottomLeftDecoration,bottomRightDecoration});
    }
    return CommonImages.getImage(descriptor);
  }
  return null;
}
 

Example 32

From project ccw, under directory /ccw.core/src/java/ccw/.

Source file: CCWPlugin.java

  19 
vote

@Override protected void initializeImageRegistry(ImageRegistry reg){
  reg.put(NS,ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/package_obj.gif")));
  reg.put(PUBLIC_FUNCTION,ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/methpub_obj.gif")));
  reg.put(PRIVATE_FUNCTION,ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/methpri_obj.gif")));
  reg.put(CLASS,ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/class_obj.gif")));
  reg.put(SORT,ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/alphab_sort_co.gif")));
}
 

Example 33

From project dawn-tango, under directory /org.dawb.tango.extensions/src/org/dawb/tango/extensions/console/.

Source file: TangoSpecConsole.java

  19 
vote

public TangoSpecConsole(final String name,final ImageDescriptor imageDescriptor,final boolean autoLifecycle){
  super(name,TangoSpecConsole.class.getName(),imageDescriptor,autoLifecycle);
  partitioner=new TangoSpecPartitioner(TangoUtils.getSpecName());
  getDocument().addPositionCategory(TangoSpecPartitioner.PROMPT_CATEGORY);
  getDocument().addPositionCategory(TangoSpecPartitioner.COMMENT_CATEGORY);
  getDocument().addPositionCategory(TangoSpecPartitioner.SCAN_CATEGORY);
  getDocument().addPositionCategory(TangoSpecPartitioner.COMMAND_CATEGORY);
  getDocument().setDocumentPartitioner(partitioner);
  partitioner.connect(getDocument());
  final String promptRegEx="\\d+\\." + TangoUtils.getSpecName().toUpperCase() + ">";
  addPatternMatchListener(new RegExListener(promptRegEx,TangoSpecPartitioner.PROMPT_CATEGORY));
  addPatternMatchListener(new RegExListener(SpecSyntax.COMMENT.pattern(),TangoSpecPartitioner.COMMENT_CATEGORY));
  addPatternMatchListener(new RegExListener(SpecSyntax.SCAN_LINE.pattern(),TangoSpecPartitioner.SCAN_CATEGORY));
  addPatternMatchListener(new RegExListener(SpecSyntax.CMD.pattern(),TangoSpecPartitioner.COMMAND_CATEGORY));
}
 

Example 34

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/util/.

Source file: XYGraphMediaFactory.java

  19 
vote

/** 
 * Private constructor to avoid instantiation.
 */
private XYGraphMediaFactory(){
  _colorRegistry=new ColorRegistry();
  _imageRegistry=new ImageRegistry();
  _fontRegistry=new FontRegistry();
  _imageCache=new HashMap<ImageDescriptor,Image>();
  Display.getDefault().addListener(SWT.Dispose,new Listener(){
    public void handleEvent(    final Event event){
      for (      Image img : _imageCache.values()) {
        img.dispose();
      }
      disposeResources();
    }
  }
);
}
 

Example 35

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swt/src/com/toedter/e4/ui/workbench/renderers/swt/.

Source file: SWTRenderer.java

  19 
vote

public ImageDescriptor getImageDescriptor(MUILabel element){
  String iconURI=element.getIconURI();
  if (iconURI != null && iconURI.length() > 0) {
    return imageDescriptorFromURI(URI.createURI(iconURI));
  }
  return null;
}
 

Example 36

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/ui/.

Source file: FoglynImages.java

  19 
vote

private static ImageDescriptor create(String name){
  try {
    return ImageDescriptor.createFromURL(makeIconFileURL(name));
  }
 catch (  MalformedURLException e) {
    return ImageDescriptor.getMissingImageDescriptor();
  }
}
 

Example 37

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/com/swtdesigner/.

Source file: ResourceManager.java

  19 
vote

/** 
 * Returns an image descriptor stored in the file at the specified path
 * @param path String The path to the image file
 * @return ImageDescriptor The image descriptor stored in the file at the specified path
 */
public static ImageDescriptor getImageDescriptor(String path){
  try {
    return ImageDescriptor.createFromURL((new File(path)).toURI().toURL());
  }
 catch (  MalformedURLException e) {
    return null;
  }
}
 

Example 38

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/views/.

Source file: ClusterAdapterFactory.java

  19 
vote

@SuppressWarnings("rawtypes") @Override public ImageDescriptor getImageDescriptor(Object object){
  String iconPath=null;
  if (object instanceof GlusterDataModel || object instanceof Cluster) {
    iconPath=IImageKeys.CLUSTER_16x16;
  }
  if (object instanceof EntityGroup) {
    Class<? extends Entity> entityType=((EntityGroup)object).getEntityType();
    if (entityType == Volume.class) {
      iconPath=IImageKeys.VOLUMES_16x16;
    }
 else {
      iconPath=IImageKeys.SERVERS_16x16;
    }
  }
  if (object instanceof Volume) {
    iconPath=IImageKeys.VOLUME_16x16;
  }
  if (object instanceof Server || object instanceof GlusterServer) {
    iconPath=IImageKeys.SERVER_16x16;
  }
  return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID,iconPath);
}
 

Example 39

From project ivyde, under directory /org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/.

Source file: DecorationOverlayIcon.java

  19 
vote

protected void drawCompositeImage(int width,int height){
  drawImage(baseImage.getImageData(),0,0);
  ImageData overlayData=overlayImage.getImageData();
  if (overlayData == null) {
    overlayData=ImageDescriptor.getMissingImageDescriptor().getImageData();
  }
  drawImage(overlayData,0,size.y - overlayData.height);
}
 

Example 40

From project JsTestDriver, under directory /eclipse-plugin/plugins/com.google.eclipse.javascript.jstestdriver.test/src/com/google/eclipse/javascript/jstestdriver/ui/view/actions/.

Source file: ServerStartStopViewActionDelegateTest.java

  19 
vote

public void testClickingOnActionToglesIconAndTextBetweenStartStop(){
  Server server=Server.getInstance(4224);
  ServerStartStopViewActionDelegate delegate=new ServerStartStopViewActionDelegate(server,new Icons(){
    @Override public ImageDescriptor startServerIcon(){
      startServerIconCalled=true;
      stopServerIconCalled=false;
      return null;
    }
    @Override public ImageDescriptor stopServerIcon(){
      startServerIconCalled=false;
      stopServerIconCalled=true;
      return null;
    }
  }
);
  Action action=new Action(){
  }
;
  delegate.run(action);
  assertEquals("Stop Server",action.getText());
  assertTrue(stopServerIconCalled);
  assertFalse(startServerIconCalled);
  delegate.run(action);
  assertEquals("Start Server",action.getText());
  assertTrue(startServerIconCalled);
  assertFalse(stopServerIconCalled);
}
 

Example 41

From project koneki.ldt, under directory /plugins/org.eclipse.koneki.ldt.ui/src/org/eclipse/koneki/ldt/ui/internal/editor/completion/.

Source file: LuaCompletionProposalLabelProvide.java

  19 
vote

/** 
 * @see org.eclipse.dltk.ui.text.completion.CompletionProposalLabelProvider#createImageDescriptor(org.eclipse.dltk.core.CompletionProposal)
 */
@Override public ImageDescriptor createImageDescriptor(CompletionProposal proposal){
  if (proposal.getModelElement() instanceof IMember) {
    IMember member=(IMember)proposal.getModelElement();
    try {
      if (member.exists()) {
        if (member instanceof IType) {
          if (LuaDLTKModelUtils.isModule(member)) {
            return Activator.getDefault().getImageRegistry().getDescriptor(ImageConstants.MODULE_OBJ16);
          }
 else           if (LuaDLTKModelUtils.isGlobalTable(member)) {
            return Activator.getDefault().getImageRegistry().getDescriptor(ImageConstants.GLOBAL_TABLE_OBJ16);
          }
 else           if (LuaDLTKModelUtils.isLocalTable(member)) {
            return Activator.getDefault().getImageRegistry().getDescriptor(ImageConstants.LOCAL_TABLE_OBJ16);
          }
        }
 else         if (LuaDLTKModelUtils.isModuleFunction(member)) {
          return Activator.getDefault().getImageRegistry().getDescriptor(ImageConstants.MODULE_FUNCTION_OBJ16);
        }
      }
    }
 catch (    ModelException e) {
      Activator.logError(Messages.LuaCompletionProvidersFlags,e);
      return super.createImageDescriptor(proposal);
    }
  }
  return super.createImageDescriptor(proposal);
}
 

Example 42

From project logsaw-app, under directory /net.sf.logsaw.ui/src/net/sf/logsaw/ui/model/.

Source file: LogResourceEditorInputAdapter.java

  19 
vote

@Override public ImageDescriptor getImageDescriptor(){
  IWorkbenchAdapter adapter=(IWorkbenchAdapter)log.getAdapter(IWorkbenchAdapter.class);
  if (adapter != null) {
    return adapter.getImageDescriptor(null);
  }
  return null;
}
 

Example 43

From project mylyn-mantis, under directory /com.itsolut.mantis.ui/src/com/itsolut/mantis/ui/internal/.

Source file: MantisImages.java

  19 
vote

private static ImageDescriptor create(String prefix,String name){
  try {
    return ImageDescriptor.createFromURL(makeIconFileURL(prefix,name));
  }
 catch (  MalformedURLException e) {
    return ImageDescriptor.getMissingImageDescriptor();
  }
}