Java 类org.eclipse.jface.resource.ImageDescriptor 实例源码

项目:n4js    文件:XpectLabelProvider.java   
/**
 * get icon based on item type (test/suite) and its status (pass/failed/exception/skip/in progress...)
 */
private ImageDescriptor getImageDescriptor(Object element) throws RuntimeException {
    ImageDescriptor descriptor = null;
    if (element instanceof Description == false) {
        String msg = "Unknown type of element in tree of type " + element.getClass().getName();
        Exception e = new RuntimeException(msg);
        N4IDEXpectUIPlugin.logError("cannot obtain image descriptor, fallback to default", e);
        return getImageDescriptor("n4_logo.png");
    }

    Description desc = (Description) element;

    if (desc.isTest()) {
        descriptor = getTestImageDescriptor(executionStatus.getStatus(desc));
    } else if (desc.isSuite()) {
        descriptor = getSuiteImageDescriptor(desc, executionStatus.getStatus(desc));
    } else {
        descriptor = getImageDescriptor("n4_logo.png");
    }
    return descriptor;
}
项目:bdf2    文件:GraphicalPalette.java   
public GraphicalPalette(){
    PaletteDrawer tools=new PaletteDrawer("节点列表");
    PanningSelectionToolEntry selectionTool=new PanningSelectionToolEntry();
    tools.add(selectionTool);
    this.setDefaultEntry(selectionTool);
    ImageDescriptor transitionDescriptor=ImageDescriptor.createFromImage(Activator.getImageFromPlugin(Constants.TRANSITION_NODE_ICON_SMALL));
    ConnectionCreationToolEntry connection=new ConnectionCreationToolEntry("Transition","Create a Transition",null,transitionDescriptor,transitionDescriptor);
    tools.add(connection);
    tools.add(this.createToolEntry(StartNode.class,"Start","Create a start node",70,40));
    tools.add(this.createToolEntry(EndNode.class,"End","Create a end node",70,40));
    tools.add(this.createToolEntry(TaskNode.class,"Task","Create a task node",80,40));
    tools.add(this.createToolEntry(ForkNode.class,"Fork","Create a fork node",80,40));
    tools.add(this.createToolEntry(JoinNode.class,"Join","Create a join node",80,40));
    tools.add(this.createToolEntry(ForeachNode.class,"Foreach","Create a foreach node",80,40));
    tools.add(this.createToolEntry(DecisionNode.class,"Decision","Create a decision node",80,40));
    tools.add(this.createToolEntry(SubprocessNode.class,"Subprocess","Create a subprocess node",100,40));
    tools.add(this.createToolEntry(EndCancelNode.class,"End Cancel","Create a end cancel node",100,40));
    tools.add(this.createToolEntry(EndErrorNode.class,"End Error","Create a end error node",100,40));
    tools.add(this.createToolEntry(StateNode.class,"State","Create a state node",80,40));
    tools.add(this.createToolEntry(CustomNode.class,"Custom","Create a custom node",80,40));
    this.add(tools);
}
项目:n4js    文件:ProjectTypeLabelDecorator.java   
@Override
public void decorate(final Object element, final IDecoration decoration) {
    try {
        if (element instanceof IProject) {
            final URI uri = createPlatformResourceURI(((IProject) element).getName(), true);
            final IN4JSProject project = core.findProject(uri).orNull();
            if (null != project) {
                final ImageRef imageRef = IMAGE_REF_CACHE.get(project.getProjectType());
                if (null != imageRef) {
                    final ImageDescriptor descriptor = imageRef.asImageDescriptor().orNull();
                    if (null != descriptor) {
                        decoration.addOverlay(descriptor);
                    }
                }
            }
        }
    } catch (final Exception e) {
        // Exception should not propagate from here, otherwise the lightweight decorator stops working once till
        // next application startup.
        LOGGER.error("Error while trying to get decorator for " + element, e);
    }
}
项目:bdf2    文件:GraphicalPalette.java   
private CreationToolEntry createToolEntry(final Class<?> nodeClass,final String name,String desc,final int width,final int height){
    SimpleFactory nodeFactory=new SimpleFactory(nodeClass){
        @Override
        public Object getNewObject() {
            AbstractNodeElement node=instanceNode(nodeClass,name,width,height);
            return node;
        }
    };
    String nodeName=instanceNode(nodeClass,name,width,height).nodeName();
    NodeImageConfig config=Activator.getPreference().getNodeImageConfigByName(nodeName);
    if(config==null){
        throw new RuntimeException("当前没有为名为"+nodeName+"的节点预定义配置信息!");
    }
    ImageDescriptor descriptor=ImageDescriptor.createFromImage(config.getSmallImage());
    return new CombinedTemplateCreationEntry(name,desc,nodeFactory,descriptor,descriptor);
}
项目:Tarski    文件:MasterViewLabelProvider.java   
public static ImageDescriptor getImageDescriptor(final String bundleID, final String path) {
  assert bundleID != null : "No bundle defined";
  assert path != null : "No path defined";

  // if the bundle is not ready then there is no image
  final Bundle bundle = Platform.getBundle(bundleID);
  final int bundleState = bundle.getState();
  if (bundleState != Bundle.ACTIVE && bundleState != Bundle.STARTING
      && bundleState != Bundle.RESOLVED) {
    return null;
  }

  // look for the image (this will check both the plugin and fragment
  // folders
  final URL imagePath = FileLocator.find(bundle, new Path(path), null);

  if (imagePath != null) {
    return ImageDescriptor.createFromURL(imagePath);
  }

  return null;
}
项目:eclipse-bash-editor    文件:EclipseUtil.java   
public static ImageDescriptor createImageDescriptor(String path, String pluginId) {
    if (path == null) {
        /* fall back if path null , so avoid NPE in eclipse framework */
        return ImageDescriptor.getMissingImageDescriptor();
    }
    if (pluginId == null) {
        /* fall back if pluginId null , so avoid NPE in eclipse framework */
        return ImageDescriptor.getMissingImageDescriptor();
    }
    Bundle bundle = Platform.getBundle(pluginId);
    if (bundle == null) {
        /*
         * fall back if bundle not available, so avoid NPE in eclipse
         * framework
         */
        return ImageDescriptor.getMissingImageDescriptor();
    }
    URL url = FileLocator.find(bundle, new Path(path), null);

    ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
    return imageDesc;
}
项目:eclipse-batch-editor    文件:EclipseUtil.java   
/**
 * Get image by path from image registry. If not already registered a new
 * image will be created and registered. If not createable a fallback image
 * is used instead
 * 
 * @param path
 * @param pluginId
 *            - plugin id to identify which plugin image should be loaded
 * @return image
 */
public static Image getImage(String path, String pluginId) {
    ImageRegistry imageRegistry = getImageRegistry();
    if (imageRegistry == null) {
        return null;
    }
    Image image = imageRegistry.get(path);
    if (image == null) {
        ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
        image = imageDesc.createImage();
        if (image == null) {
            image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
        }
        imageRegistry.put(path, image);
    }
    return image;
}
项目:neoscada    文件:ConnectionLabelProvider.java   
private void updateItem ( final StyledViewerLabel label, final DataItemEntry dataItemEntry )
{
    String itemName = dataItemEntry.getName ();
    if ( itemName == null || itemName.length () == 0 )
    {
        itemName = " ";
    }
    label.setText ( itemName );

    if ( dataItemEntry.getIODirections ().containsAll ( Arrays.asList ( IODirection.INPUT, IODirection.OUTPUT ) ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_io.gif" ) ) );
    }
    else if ( dataItemEntry.getIODirections ().contains ( IODirection.INPUT ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_i.gif" ) ) );
    }
    else if ( dataItemEntry.getIODirections ().contains ( IODirection.OUTPUT ) )
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item_o.gif" ) ) );
    }
    else
    {
        label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/item.gif" ) ) );
    }
}
项目:eclipse-bash-editor    文件:EclipseUtil.java   
/**
 * Get image by path from image registry. If not already registered a new
 * image will be created and registered. If not createable a fallback image
 * is used instead
 * 
 * @param path
 * @param pluginId
 *            - plugin id to identify which plugin image should be loaded
 * @return image
 */
public static Image getImage(String path, String pluginId) {
    ImageRegistry imageRegistry = getImageRegistry();
    if (imageRegistry == null) {
        return null;
    }
    Image image = imageRegistry.get(path);
    if (image == null) {
        ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
        image = imageDesc.createImage();
        if (image == null) {
            image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
        }
        imageRegistry.put(path, image);
    }
    return image;
}
项目:Tarski    文件:ContextualViewTreeLabelProvider.java   
public static ImageDescriptor getImageDescriptor(final String bundleID, final String path) {
  assert(bundleID != null) : "No bundle defined";
  assert(path != null) : "No path defined";

  // if the bundle is not ready then there is no image
  final Bundle bundle = Platform.getBundle(bundleID);
  final int bundleState = bundle.getState();
  if ((bundleState != Bundle.ACTIVE) && (bundleState != Bundle.STARTING)
      && (bundleState != Bundle.RESOLVED)) {
    return null;
  }

  // look for the image (this will check both the plugin and fragment
  // folders
  final URL imagePath = FileLocator.find(bundle, new Path(path), null);

  if (imagePath != null) {
    return ImageDescriptor.createFromURL(imagePath);
  }

  return null;
}
项目:n4js    文件:GHOLD_170_ImageCaching_PluginUITest.java   
/**
 * Checks the direct {@link ImageDescriptor image descriptor} caching.
 */
@Test
public void testDirectImageDescriptorCaching() {
    final ImageDescriptor desc1 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
    final ImageDescriptor desc2 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
    assertTrue("Expected exactly same reference of image descriptors.", desc1 == desc2);
}
项目:Tarski    文件:FileDecorator.java   
@Override
public void decorate(Object resource, IDecoration decoration) {
  int markers = MarkerFactory.findMarkers((IResource) resource).size();
  if (markers > 0) {
    decoration.addOverlay(ImageDescriptor.createFromFile(FileDecorator.class, ICON),
        IDecoration.TOP_RIGHT);
    decoration.setForegroundColor(color);
  } else {
    decoration.addOverlay(null);
    decoration.setForegroundColor(new Color(null, 0, 0, 0, 0));
  }
}
项目:n4js    文件:XpectLabelProvider.java   
/** obtain {@link ImageDescriptor} for suite} */
private ImageDescriptor getSuiteImageDescriptor(Description desc, ExecutionStatus st) {
    ImageDescriptor descriptor;
    switch (st) {
    case PENDING:
        descriptor = getImageDescriptor("testsuite.png");
        break;
    case STARTED:
        descriptor = getImageDescriptor("testsuite_running.png");
        break;
    case IGNORED:
        descriptor = getImageDescriptor("testsuite_ignored.png");
        break;
    case PASSED:
        descriptor = getImageDescriptor("testsuite_pass.png");
        Optional<XpectFileContentAccess> fileContentAccess = XpectFileContentsUtil
                .getXpectFileContentAccess(desc);
        if (fileContentAccess.isPresent()) {
            if (fileContentAccess.get().containsFixme()) {
                descriptor = getImageDescriptor("testsuite_fixme.png");
            }
        }
        break;
    case FAILED:
        descriptor = getImageDescriptor("testsuite_fail.png");
        break;
    case ERROR:
        descriptor = getImageDescriptor("testsuite_error.png");
        break;

    default:
        descriptor = getImageDescriptor("n4_logo.png");
        break;
    }
    return descriptor;
}
项目:n4js    文件:N4JSEditorErrorTickUpdater.java   
@Override
public void scheduleUpdateEditor(ImageDescriptor titleImageDescription) {
    if (editor instanceof N4JSEditor && titleImageDescription != null) {
        titleImageDescription = ((N4JSEditor) editor).applyTitleImageOverlays(titleImageDescription);
    }
    super.scheduleUpdateEditor(titleImageDescription);
}
项目:n4js    文件:N4JSOutlineNodeFactory.java   
/**
 * Returns N4JSEObjectNode instead of simple EObjectNode to allow for attaching additional information such as
 * inheritance state of members.
 */
@Override
public N4JSEObjectNode createEObjectNode(IOutlineNode parentNode, EObject modelElement,
        ImageDescriptor imageDescriptor,
        Object text,
        boolean isLeaf) {
    N4JSEObjectNode eObjectNode = new N4JSEObjectNode(modelElement, parentNode, imageDescriptor, text, isLeaf);
    ICompositeNode parserNode = NodeModelUtils.getNode(modelElement);
    if (parserNode != null)
        eObjectNode.setTextRegion(parserNode.getTextRegion());
    if (isLocalElement(parentNode, modelElement))
        eObjectNode.setShortTextRegion(getLocationInFileProvider().getSignificantTextRegion(modelElement));
    return eObjectNode;
}
项目:avro-schema-editor    文件:SwitchSchemaViewerDisplayModeAction.java   
@Override
public ImageDescriptor getImageDescriptor() {
    if (getDisplayMode() == DisplayMode.WITH_COLUMNS) {
        return AvroSchemaEditorActivator.getImageDescriptor(AvroSchemaEditorImages.WITH_COLUMNS_DISPLAY_MODE);
    } else {
        return AvroSchemaEditorActivator.getImageDescriptor(AvroSchemaEditorImages.WITHOUT_COLUMNS_DISPLAY_MODE);
    }
}
项目:n4js    文件:TestResultsView.java   
/**
 * Creates a single action.
 */
protected Action createAction(String text, int style, String tooltip, ImageDescriptor imageDescriptor,
        Runnable runnable) {
    final Action a = new Action(text, style) {
        @Override
        public void run() {
            if (runnable != null)
                runnable.run();
        }
    };
    a.setToolTipText(tooltip);
    a.setImageDescriptor(imageDescriptor);
    return a;
}
项目:orientdb-oda-birt    文件:CustomDataSetWizardPage.java   
/**
    * Constructor
 * @param pageName
 * @param title
 * @param titleImage
 */
public CustomDataSetWizardPage( String pageName, String title,
        ImageDescriptor titleImage )
{
       super( pageName, title, titleImage );
       setMessage( DEFAULT_MESSAGE );
}
项目:vertigo-chroma-kspplugin    文件:AboutDialog.java   
private Image getImage() {
    String path = "icons/ksp.gif";
    Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
    URL url = FileLocator.find(bundle, new Path(path), null);
    ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
    return imageDesc.createImage();
}
项目:Hydrograph    文件:CustomPaletteViewer.java   
private CombinedTemplateCreationEntry getComponentToAddInContainer(ELTGraphicalEditor eLEtlGraphicalEditor,
        Component componentConfig) {
    Class<?> clazz = DynamicClassProcessor.INSTANCE.createClass(componentConfig);

    CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(componentConfig.getNameInPalette(),
            null, clazz, new SimpleFactory(clazz),
            ImageDescriptor.createFromURL(eLEtlGraphicalEditor.prepareIconPathURL(componentConfig
                    .getPaletteIconPath())), ImageDescriptor.createFromURL(eLEtlGraphicalEditor
                    .prepareIconPathURL(componentConfig.getPaletteIconPath())));
    return component;
}
项目:gemoc-studio-modeldebugging    文件:DisposeStoppedEngineAction.java   
public DisposeStoppedEngineAction()
{
    setText("Dispose stopped engine");
    setToolTipText("Dispose stopped engine");
    ImageDescriptor id = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, ISharedImages.IMG_ELCL_REMOVE);
    setImageDescriptor(id);
}
项目:gw4e.project    文件:PreferenceManager.java   
/**
 * @return the imageblocked
 */
public static Image getImageBlocked() {
    if (imageBlocked==null) {
        try {
            imageBlocked = ImageDescriptor.createFromURL(
                    new URL("platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/fatalerror_obj.png")).createImage();
        } catch (MalformedURLException e) {
        }
    }
    return imageBlocked;        
}
项目:pgcodekeeper    文件:Activator.java   
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    reg.put(FILE.ICONAPPSMALL, ImageDescriptor.createFromURL(
            context.getBundle().getResource(FILE.ICONAPPSMALL)));

    for (DbObjType dbObjType : DbObjType.values()) {
        reg.put(dbObjType.name(), ImageDescriptor.createFromURL(context.getBundle()
                .getResource(FILE.ICONPGADMIN + dbObjType.name().toLowerCase() + ".png"))); //$NON-NLS-1$
    }
}
项目:ec4e    文件:EditorConfigImages.java   
private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
    URL url = null;
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        if (url != null) {
            desc = ImageDescriptor.createFromURL(url);
        }
    }
    imageRegistry.put(key, desc);
}
项目:pgcodekeeper    文件:NewProjWizard.java   
public NewProjWizard() {
    this.mainPrefStore = Activator.getDefault().getPreferenceStore();

    setWindowTitle(Messages.newProjWizard_new_pg_db_project);
    setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(
            Activator.getDefault().getBundle().getResource(FILE.ICONAPPWIZ)));
    setNeedsProgressMonitor(true);
}
项目:neoscada    文件:ToolBarNavigatorItem.java   
private Image createImage ( final String key )
{
    try
    {
        final String uri = Activator.getDefault ().getPreferenceStore ().getString ( key );
        return this.manager.createImageWithDefault ( ImageDescriptor.createFromURL ( new URL ( uri ) ) );
    }
    catch ( final MalformedURLException e )
    {
        return this.manager.createImageWithDefault ( ImageDescriptor.getMissingImageDescriptor () );
    }
}
项目:pandionj    文件:PandionJView.java   
private void addToolbarAction(String name, boolean toggle, String imageName, String description, Action action) {
    IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
    action.setImageDescriptor(ImageDescriptor.createFromImage(PandionJUI.getImage(imageName)));
    String tooltip = name;
    if(description != null)
        tooltip += "\n" + description;
    action.setToolTipText(tooltip);
    menuManager.add(action);
}
项目:neoscada    文件:SystemMessageExtension.java   
private ImageDescriptor makeDescriptor ( final String icon )
{
    if ( "info".equalsIgnoreCase ( icon ) )
    {
        return ImageDescriptor.createFromFile ( SystemMessageExtension.class, "icons/information.png" );
    }
    else if ( "warning".equalsIgnoreCase ( icon ) )
    {
        return ImageDescriptor.createFromFile ( SystemMessageExtension.class, "icons/exclamation.png" );
    }

    return ImageDescriptor.getMissingImageDescriptor ();
}
项目:neoscada    文件:NameLabelProvider.java   
private Image makeImage ( final Object image )
{
    if ( image == null )
    {
        return null;
    }

    if ( image instanceof URL )
    {
        return this.resourceManager.createImage ( ImageDescriptor.createFromURL ( (URL)image ) );
    }

    return null;
}
项目:neoscada    文件:ConnectionLabelProvider.java   
private void updateFolder ( final StyledViewerLabel label, final FolderEntry folderEntry )
{
    label.setImage ( this.resource.createImage ( ImageDescriptor.createFromFile ( ConnectionLabelProvider.class, "icons/folder.gif" ) ) );

    String folderName = folderEntry.getName ();
    if ( folderName == null || folderName.length () == 0 )
    {
        folderName = " ";
    }
    label.setText ( folderName );
}
项目:pgsqlblocks    文件:DBModelsViewLabelProvider.java   
private Image getImage(DBController controller) {
    Image image = ImageUtils.getImage(controller.getStatus().getStatusImage());

    if (controller.isBlocked()) {
        String decoratorBlockedPath = Images.DECORATOR_BLOCKED.getImageAddr();
        ImageDescriptor decoratorBlockedImageDesc = decoratorsMap.computeIfAbsent(decoratorBlockedPath, path -> {
            Image blockedImage = new Image(null, getClass().getClassLoader().getResourceAsStream(path));
            return ImageDescriptor.createFromImage(blockedImage);
        });
        image = ImageUtils.decorateImage(image, decoratorBlockedImageDesc, BLOCKED_ICON_QUADRANT);
    }
    return image;
}
项目:gw4e.project    文件:Activator.java   
public static ImageDescriptor getDefaultImageDescriptor() {
    return imageDescriptorFromPlugin(PLUGIN_ID, "icons/wizban/gw_64.png");
}
项目:n4js    文件:XpectLabelProvider.java   
public static ImageDescriptor getImageDescriptor(String name) {
    String iconPath = "icons/";
    return AbstractUIPlugin.imageDescriptorFromPlugin(N4IDEXpectUIPlugin.PLUGIN_ID, iconPath + name);
}
项目:solidity-ide    文件:CustomCSSHelpHoverProvider.java   
public OpenInHelpAction() {
    setText("Open user guide");
    setImageDescriptor(ImageDescriptor.createFromImage(PlatformUI
            .getWorkbench().getSharedImages()
            .getImage(ISharedImages.IMG_LCL_LINKTO_HELP)));
}
项目:gw4e.project    文件:ModelSearchResultPage.java   
private ImageDescriptor createImageDescriptor() {
    Bundle bundle = FrameworkUtil.getBundle(ViewLabelProvider.class);
    URL url = FileLocator.find(bundle, new Path("icons/folder.png"), null);
    return ImageDescriptor.createFromURL(url);
}
项目:gw4e.project    文件:DSLPoliciesLabelProvider.java   
protected ImageDescriptor _imageDescriptor(final StopCondition pgsc) {
  return DSLPoliciesLabelProvider.getDefaultImageDescriptor("org.eclipse.ui.navigator", "icons/full/elcl16/filter_ps.gif");
}
项目:bdf2    文件:PropertiesOutlinePage.java   
private ImageDescriptor getDescriptor() {
    if (imageAz == null) {
        imageAz = Activator.getImageDescriptor("icons/alphab_sort_co.gif");
    }
    return imageAz;
}
项目:gw4e.project    文件:DSLPoliciesLabelProvider.java   
public static ImageDescriptor getDefaultImageDescriptor(final String pluginid, final String path) {
  return AbstractUIPlugin.imageDescriptorFromPlugin(pluginid, path);
}
项目:convertigo-eclipse    文件:ViewLabelDecorator.java   
public OverlayImageIcon(Image baseImage, ImageDescriptor overlay) {
    this(baseImage, overlay, BOTTOM_RIGHT);
}
项目:pgcodekeeper    文件:Activator.java   
/**
 * @return Shared {@link ImageDescriptor}, registered with this plugin with the <code>name</code> key.
 */
public static ImageDescriptor getRegisteredDescriptor(String name) {
    Activator a = plugin;
    return a == null ? null : a.getImageRegistry().getDescriptor(name);
}