org.eclipse.jface.text.contentassist.IContextInformation#org.eclipse.jface.resource.ImageRegistry源码实例Demo

下面列出了org.eclipse.jface.text.contentassist.IContextInformation#org.eclipse.jface.resource.ImageRegistry 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nebula   文件: XYGraphMediaFactory.java
/**
 * Private constructor to avoid instantiation.
 */
private XYGraphMediaFactory() {
	_colorRegistry = new ColorRegistry();
	_imageRegistry = new ImageRegistry();
	_fontRegistry = new FontRegistry();
	cursorRegistry = new HashMap<String, Cursor>();
	_imageCache = new HashMap<ImageDescriptor, Image>();

	// dispose all images from the image cache, when the display is disposed
	Display.getDefault().addListener(SWT.Dispose, new Listener() {
		public void handleEvent(final Event event) {
			for (Image img : _imageCache.values()) {
				img.dispose();
			}
			disposeResources();
		}
	});

}
 
源代码2 项目: bonita-studio   文件: LivingApplicationPlugin.java
public static Image getImage(final String imageName) {
    final ImageRegistry reg = getDefault().getImageRegistry();

    Image result = reg.get(imageName);

    if (result != null && !result.isDisposed()) {//prevent from bad dispose
        return result;
    }

    final ImageDescriptor descriptor = ImageDescriptor.createFromURL(getDefault().getBundle().getResource(imageName));
    if (descriptor != null) {
        result = descriptor.createImage();
    }

    reg.remove(imageName);
    if (result != null) {
        reg.put(imageName, result);
    }

    return result;
}
 
源代码3 项目: gef   文件: DotActivatorEx.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	for (String colorScheme : DotColors.getColorSchemes()) {
		for (String colorName : DotColors.getColorNames(colorScheme)) {
			String hex = DotColors.get(colorScheme, colorName);
			/*
			 * The same hex color code can belong to more than one color
			 * names (synonyms) within one color scheme
			 */
			if (reg.get(hex) == null) {
				Image image = createImage(hex);
				reg.put(hex, image);
			}
		}
	}
}
 
@Override
public Image getImage(Object element) {
    if (element instanceof IMappingFile) {
        // Add binary/mapping icons to the image registry if needed
        ImageRegistry registry = Activator.getDefault().getImageRegistry();
        Image binImage = registry.get(BIN_ICON.toString());
        if (binImage == null) {
            registry.put(BIN_ICON.toString(), BIN_ICON);
            binImage = registry.get(BIN_ICON.toString());
        }
        Image txtImage = registry.get(TXT_ICON.toString());
        if (txtImage == null) {
            registry.put(TXT_ICON.toString(), TXT_ICON);
            txtImage = registry.get(TXT_ICON.toString());
        }

        return ((IMappingFile) element).isBinaryFile() ? binImage : txtImage;
    }

    return null;
}
 
@Override
public Image getImage(Object element) {
    if (element instanceof IMappingFile) {
        // Add binary/mapping icons to the image registry if needed
        ImageRegistry registry = Objects.requireNonNull(Activator.getDefault()).getImageRegistry();
        Image binImage = registry.get(BIN_ICON.toString());
        if (binImage == null) {
            registry.put(BIN_ICON.toString(), BIN_ICON);
            binImage = registry.get(BIN_ICON.toString());
        }
        Image txtImage = registry.get(TXT_ICON.toString());
        if (txtImage == null) {
            registry.put(TXT_ICON.toString(), TXT_ICON);
            txtImage = registry.get(TXT_ICON.toString());
        }

        return ((IMappingFile) element).isBinaryFile() ? binImage : txtImage;
    }

    return null;
}
 
源代码6 项目: tesb-studio-se   文件: CamelDesignerPlugin.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    super.initializeImageRegistry(reg);
    reg.put(BEAN_WIZ_ICON, createImageDescriptor(BEAN_WIZ_ICON).createImage());

    reg.put(DEPEN_ICON, createImageDescriptor(DEPEN_ICON).createImage());
    reg.put(BUNDLE_CP_ICON, createImageDescriptor(BUNDLE_CP_ICON).createImage());
    reg.put(REQUIRE_BD_ICON, createImageDescriptor(REQUIRE_BD_ICON).createImage());
    reg.put(IMPORT_PKG_ICON, createImageDescriptor(IMPORT_PKG_ICON).createImage());
    reg.put(REFRESH_ICON, createImageDescriptor(REFRESH_ICON).createImage());
    reg.put(GRAY_REM_ICON, createImageDescriptor(GRAY_REM_ICON).createImage());
    reg.put(HIGHLIGHT_REM_ICON, createImageDescriptor(HIGHLIGHT_REM_ICON).createImage());
    reg.put(OPTIONAL_OVERLAY_ICON, createImageDescriptor(OPTIONAL_OVERLAY_ICON).createImage());
    reg.put(IMPORT_PACKAGE_OVERLAY_ICON, getOptionalOverlayIcon(getImage(IMPORT_PKG_ICON)));
    reg.put(REQUIRE_BUNDLE_OVERLAY_ICON, getOptionalOverlayIcon(getImage(REQUIRE_BD_ICON)));
}
 
源代码7 项目: APICloud-Studio   文件: ScriptingUIPlugin.java
/**
 * Returns the image on the specified path.
 * 
 * @param path
 *            the path to the image
 * @return Image the image object
 */
public static Image getImage(String path)
{
	ImageRegistry registry = getDefault().getImageRegistry();

	if (registry.get(path) == null)
	{
		ImageDescriptor id = getImageDescriptor(path);

		if (id != null)
		{
			registry.put(path, id);
		}
	}

	return registry.get(path);
}
 
源代码8 项目: APICloud-Studio   文件: SVGPlugin.java
/**
 * getImage
 * 
 * @param path
 * @return
 */
public static Image getImage(String path)
{
	ImageRegistry registry = plugin.getImageRegistry();
	Image image = registry.get(path);

	if (image == null)
	{
		ImageDescriptor id = getImageDescriptor(path);

		if (id != null)
		{
			registry.put(path, id);
			image = registry.get(path);
		}
	}

	return image;
}
 
源代码9 项目: bonita-studio   文件: BusinessObjectPlugin.java
public static Image getImage(final String imageName) {
    final ImageRegistry reg = getDefault().getImageRegistry();

    Image result = reg.get(imageName);

    if (result != null && !result.isDisposed()) {//prevent from bad dispose
        return result;
    }

    final ImageDescriptor descriptor = ImageDescriptor.createFromURL(getDefault().getBundle().getResource(imageName));
    if (descriptor != null) {
        result = descriptor.createImage();
    }

    reg.remove(imageName);
    if (result != null) {
        reg.put(imageName, result);
    }

    return result;
}
 
源代码10 项目: APICloud-Studio   文件: JSPlugin.java
/**
 * getImage
 * 
 * @param path
 * @return
 */
public static Image getImage(String path)
{
	ImageRegistry registry = PLUGIN.getImageRegistry();
	Image image = registry.get(path);
	if (image == null)
	{
		ImageDescriptor id = getImageDescriptor(path);
		if (id == null)
		{
			return null;
		}
		registry.put(path, id);
		image = registry.get(path);
	}
	return image;
}
 
源代码11 项目: APICloud-Studio   文件: ImageResource.java
private static void initializeImageRegistry() {
	imageRegistry = new ImageRegistry();

	// load Web browser images
	registerImage(IMG_OBJ_BROWSER, URL_OBJ + "browser.png"); //$NON-NLS-1$

	registerImage(IMG_ELCL_NAV_BACKWARD, URL_ELCL + "nav_backward.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_CONSOLE, URL_ELCL + "console.png"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_FORWARD, URL_ELCL + "nav_forward.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_STOP, URL_ELCL + "nav_stop.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_REFRESH, URL_ELCL + "nav_refresh.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_GO, URL_ELCL + "nav_go.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_HOME, URL_ELCL + "nav_home.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_COMMAND, URL_ELCL + "command.png"); //$NON-NLS-1$
	
	registerImage(IMG_DLCL_NAV_BACKWARD, URL_DLCL + "nav_backward.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_FORWARD, URL_DLCL + "nav_forward.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_STOP, URL_DLCL + "nav_stop.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_REFRESH, URL_DLCL + "nav_refresh.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_GO, URL_DLCL + "nav_go.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_HOME, URL_DLCL + "nav_home.gif"); //$NON-NLS-1$	
}
 
源代码12 项目: birt   文件: StaticHTMLPrviewPlugin.java
private void registerImage( ImageRegistry registry, String key,
		String fileName )
{
	try
	{
		IPath path = new Path( "icons/" + fileName ); //$NON-NLS-1$
		URL url = find( path );
		if ( url != null )
		{
			ImageDescriptor desc = ImageDescriptor.createFromURL( url );
			registry.put( key, desc );
		}
	}
	catch ( Exception e )
	{
	}
}
 
源代码13 项目: MergeProcessor   文件: LifeCycleHook.java
private static void initializeImage(final String name, final String path) {
	final ImageRegistry imageRegistry = JFaceResources.getImageRegistry();
	if (imageRegistry.get(name) == null) {
		URL imageClockUrl = FileLocator.find(Activator.getDefault().getBundle(), new Path(path), null);
		if (imageClockUrl != null) {
			imageRegistry.put(name, ImageDescriptor.createFromURL(imageClockUrl));
		}
	}
}
 
源代码14 项目: codewind-eclipse   文件: CodewindUIPlugin.java
@Override
protected ImageRegistry createImageRegistry() {
    ImageRegistry registry = new ImageRegistry();
    if (ICON_BASE_URL == null)
        ICON_BASE_URL = plugin.getBundle().getEntry(ICON_BASE_PATH);

    registerImage(registry, CODEWIND_ICON, ICON_BASE_URL + CODEWIND_ICON);
    registerImage(registry, CODEWIND_BANNER, ICON_BASE_URL + CODEWIND_BANNER);
    registerImage(registry, ADD_PROJECT_ICON, ICON_BASE_URL + ADD_PROJECT_ICON);
    registerImage(registry, BIND_PROJECT_ICON, ICON_BASE_URL + BIND_PROJECT_ICON);
    registerImage(registry, OPEN_APP_ICON, ICON_BASE_URL + OPEN_APP_ICON);
    registerImage(registry, BUILD_ICON, ICON_BASE_URL + BUILD_ICON);
    registerImage(registry, IMPORT_ICON, ICON_BASE_URL + IMPORT_ICON);
    registerImage(registry, LAUNCH_DEBUG_ICON, ICON_BASE_URL + LAUNCH_DEBUG_ICON);
    registerImage(registry, LAUNCH_RUN_ICON, ICON_BASE_URL + LAUNCH_RUN_ICON);
    registerImage(registry, REFRESH_ICON, ICON_BASE_URL + REFRESH_ICON);
    registerImage(registry, NEW_REMOTE_ICON, ICON_BASE_URL + NEW_REMOTE_ICON);
    registerImage(registry, REMOTE_CONNECT_ICON, ICON_BASE_URL + REMOTE_CONNECT_ICON);
    registerImage(registry, LOCAL_ACTIVE_ICON, ICON_BASE_URL + LOCAL_ACTIVE_ICON);
    registerImage(registry, LOCAL_INACTIVE_ICON, ICON_BASE_URL + LOCAL_INACTIVE_ICON);
    registerImage(registry, REMOTE_CONNECTED_ICON, ICON_BASE_URL + REMOTE_CONNECTED_ICON);
    registerImage(registry, REMOTE_DISCONNECTED_ICON, ICON_BASE_URL + REMOTE_DISCONNECTED_ICON);
    registerImage(registry, GO_ICON, ICON_BASE_URL + GO_ICON);
    registerImage(registry, JAVA_ICON, ICON_BASE_URL + JAVA_ICON);
    registerImage(registry, MICROPROFILE_ICON, ICON_BASE_URL + MICROPROFILE_ICON);
    registerImage(registry, NODE_ICON, ICON_BASE_URL + NODE_ICON);
    registerImage(registry, PYTHON_ICON, ICON_BASE_URL + PYTHON_ICON);
    registerImage(registry, SPRING_ICON, ICON_BASE_URL + SPRING_ICON);
    registerImage(registry, SWIFT_ICON, ICON_BASE_URL + SWIFT_ICON);
    registerImage(registry, GENERIC_PROJECT_ICON, ICON_BASE_URL + GENERIC_PROJECT_ICON);
    registerImage(registry, WELCOME_IMAGE, ICON_BASE_URL + WELCOME_IMAGE);

    return registry;
}
 
源代码15 项目: codewind-eclipse   文件: CodewindUIPlugin.java
private void registerImage(ImageRegistry registry, String key, String partialURL) {
    try {
        ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL));
        registry.put(key, id);
        imageDescriptors.put(key, id);
    } catch (Exception e) {
        Logger.logError("Error registering image", e);
    }
}
 
源代码16 项目: nebula   文件: LabelImageProvider.java
/**
 * Gets the ImageRegistry use by this LabelImageProvider
 * 
 * @return the
 */
protected ImageRegistry getImageRegistry() {
	if (imageRegistry == null) {
		imageRegistry = createImageRegistry();
	}
	return imageRegistry;
}
 
源代码17 项目: sarl   文件: AbstractGeneratorConfigurationBlock.java
/** Replies the image descriptor.
 *
 * @param imagePath the image path.
 * @return the image descriptor.
 */
@SuppressWarnings("static-method")
protected ImageDescriptor getImageDescriptor(String imagePath) {
	final LangActivator activator = LangActivator.getInstance();
	final ImageRegistry registry = activator.getImageRegistry();
	ImageDescriptor descriptor = registry.getDescriptor(imagePath);
	if (descriptor == null) {
		descriptor = ResourceLocator.imageDescriptorFromBundle(activator.getBundle().getSymbolicName(), imagePath).orElse(null);
		if (descriptor != null) {
			registry.put(imagePath, descriptor);
		}
	}
	return descriptor;
}
 
源代码18 项目: neoscada   文件: Activator.java
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );

    reg.put ( ImageConstants.IMG_MANUAL, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/manual.png" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_BLOCK, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/block.png" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_DISCONNECTED, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/disconnected.png" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_ERROR, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/error.png" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_ALARM, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/alarm.png" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_WARNING, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/warning.png" ) ); //$NON-NLS-1$
}
 
源代码19 项目: neoscada   文件: Activator.java
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );
    reg.put ( IMG_BLOCK_DEFAULT, ImageDescriptor.getMissingImageDescriptor () );
    reg.put ( IMG_BLOCK_LOCKED, ImageDescriptor.createFromFile ( Activator.class, "icons/locked.gif" ) ); //$NON-NLS-1$
    reg.put ( IMG_BLOCK_UNLOCKED, ImageDescriptor.createFromFile ( Activator.class, "icons/unlocked.gif" ) ); //$NON-NLS-1$
}
 
源代码20 项目: neoscada   文件: Activator.java
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );
    reg.put ( ImageConstants.IMG_EVENTS, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/events.png" ) );
    reg.put ( ImageConstants.IMG_MONITORS, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/monitors.png" ) );
}
 
源代码21 项目: neoscada   文件: Activator.java
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );
    reg.put ( IMG_CONTROLLER_BLOCKED, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/blocked.gif" ) ); //$NON-NLS-1$
    reg.put ( IMG_CONTROLLER_UNBLOCKED, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/unblocked.gif" ) ); //$NON-NLS-1$
    reg.put ( IMG_WARN_BIG, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/warn.gif" ) ); //$NON-NLS-1$
    reg.put ( IMG_TREND, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/trend_10.png" ) ); //$NON-NLS-1$
    reg.put ( IMG_ATTR_OK, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/ok.png" ) ); //$NON-NLS-1$
    reg.put ( IMG_EMPTY, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/empty.png" ) ); //$NON-NLS-1$
}
 
源代码22 项目: neoscada   文件: HivesPlugin.java
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );
    reg.put ( ImageConstants.IMG_ERROR, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/error.gif" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_STOPPED, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/stopped.gif" ) ); //$NON-NLS-1$
    reg.put ( ImageConstants.IMG_RUNNING, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/running.gif" ) ); //$NON-NLS-1$
}
 
源代码23 项目: scava   文件: CrossflowNavigatorLabelProvider.java
/**
* @generated
*/
private Image getImage(String key, IElementType elementType) {
	ImageRegistry imageRegistry = CrossflowDiagramEditorPlugin.getInstance().getImageRegistry();
	Image image = imageRegistry.get(key);
	if (image == null && elementType != null && CrossflowElementTypes.isKnownElementType(elementType)) {
		image = CrossflowElementTypes.getImage(elementType);
		imageRegistry.put(key, image);
	}

	if (image == null) {
		image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
		imageRegistry.put(key, image);
	}
	return image;
}
 
源代码24 项目: corrosion   文件: CorrosionPlugin.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	super.initializeImageRegistry(reg);
	declareRegistryImage(reg, "images/cargo.png"); //$NON-NLS-1$
	declareRegistryImage(reg, "images/cargo16.png"); //$NON-NLS-1$
	declareRegistryImage(reg, "icons/rustEditorIcon.png"); //$NON-NLS-1$
}
 
源代码25 项目: birt   文件: UIHelper.java
/**
 * This is a convenience method to get an imgIcon from a URL.
 * 
 * @param sPluginRelativePath
 *            The URL for the imgIcon.
 * @return The imgIcon represented by the given URL.
 * @see #setImageCached( boolean )
 */
public static Image getImage( String sPluginRelativePath )
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	Image image = registry.get( sPluginRelativePath );
	if ( image == null )
	{
		image = createImage( sPluginRelativePath );
		registry.put( sPluginRelativePath, image );
	}
	return image;
}
 
源代码26 项目: M2Doc   文件: Activator.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    try {
        reg.put(ADD_IMG_KEY, ImageDescriptor
                .createFromURL(new URL("platform:/plugin/org.obeonetwork.m2doc.ide.ui/icons/add.gif")));
        reg.put(DELETE_IMG_KEY, ImageDescriptor
                .createFromURL(new URL("platform:/plugin/org.obeonetwork.m2doc.ide.ui/icons/delete.gif")));
    } catch (MalformedURLException e) {
        getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e));
    }
}
 
源代码27 项目: xtext-eclipse   文件: XtextPluginImages.java
private static final void initialize() {
	PLUGIN_REGISTRY = new ImageRegistry();
	manage(OBJ_DESC_SERVICE_LOADED, DESC_SERVICE_LOADED_OBJ);
	manage(OBJ_DESC_SERVICE_NOT_LOADED, DESC_SERVICE_NOT_LOADED_OBJ);
	manage(OBJ_DESC_LANGUAGE, DESC_LANGUAGE_OBJ);
	manage(OBJ_CORRECTION_CHANGE, DESC_CORRECTION_CHANGE);
	manage(OBJ_FIXABLE_ERROR, DESC_FIXABLE_ERROR);
	manage(OBJ_FIXABLE_WARNING, DESC_FIXABLE_WARNING);
	manage(OBJ_FIXABLE_INFO, DESC_FIXABLE_INFO);
	
	initializeImageMaps();
}
 
源代码28 项目: uml2solidity   文件: Activator.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	ImageDescriptor image = imageDescriptorFromPlugin(PLUGIN_ID, "images/solidity16.png");
	reg.put("UML2Solidity", image);
	image = imageDescriptorFromPlugin(PLUGIN_ID, "images/script_wiz.gif");
	reg.put("JsCode", image);
	image = imageDescriptorFromPlugin(PLUGIN_ID, "images/help_topic.gif");
	reg.put("OtherFiles", image);
	image = imageDescriptorFromPlugin(PLUGIN_ID, "images/javabean_obj.gif");
	reg.put("JavaCode", image);
	
	super.initializeImageRegistry(reg);
}
 
源代码29 项目: xds-ide   文件: ImageUtils.java
public static ImageRegistry getImageRegistry() {
  	synchronized (monitor) {
  		if (imageRegistry == null) {
              initializeImageRegistry();
          }
          return imageRegistry;
}
  }
 
源代码30 项目: gef   文件: MvcFxUiBundle.java
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	// put action images into the registry
	Bundle bundle = getBundle();
	for (Entry<String, String> e : IMAGES.entrySet()) {
		reg.put(e.getKey(), ImageDescriptor.createFromURL(
				FileLocator.find(bundle, new Path(e.getValue()), null)));
	}
}