Java源码示例:org.eclipse.jface.resource.ResourceLocator

示例1
/**
 * Constructor for TabDescriptor.
 *
 * @param configurationElement
 *            the configuration element for the tab descriptor.
 */
public TabDescriptor(IConfigurationElement configurationElement) {
	super();
	if (configurationElement != null) {
		id = configurationElement.getAttribute(ATT_ID);
		label = configurationElement.getAttribute(ATT_LABEL);
		String imageString = configurationElement.getAttribute(ATT_IMAGE);
		if (imageString != null) {
			String name = configurationElement.getDeclaringExtension().getContributor().getName();
			ResourceLocator.imageDescriptorFromBundle(name, imageString).ifPresent(d -> image = d.createImage());
		}
		String indentedString = configurationElement.getAttribute(ATT_INDENTED);
		indented = indentedString != null && indentedString.equals("true"); //$NON-NLS-1$
		category = configurationElement.getAttribute(ATT_CATEGORY);
		afterTab = configurationElement.getAttribute(ATT_AFTER_TAB);
		if (id == null || label == null || category == null) {
			// the tab id, label and category are mandatory - log error
			handleTabError(configurationElement, null);
		}
	}
	selected = false;
}
 
示例2
/** Replies the image descriptor for the given image path.
 *
 * @param imagePath path of the image.
 * @return the image descriptor.
 */
public ImageDescriptor getImageDescriptor(String imagePath) {
	ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath);
	if (descriptor == null) {
		descriptor = ResourceLocator.imageDescriptorFromBundle(SARLEclipsePlugin.PLUGIN_ID, imagePath).orElse(null);
		if (descriptor != null) {
			getImageRegistry().put(imagePath, descriptor);
		}
	}
	return descriptor;
}
 
示例3
/** 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;
}
 
示例4
/** Replies the image descriptor for the given image path.
 *
 * @param imagePath path of the image.
 * @return the image descriptor.
 */
public ImageDescriptor getImageDescriptor(String imagePath) {
	ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath);
	if (descriptor == null) {
		descriptor = ResourceLocator.imageDescriptorFromBundle(PLUGIN_ID, imagePath).orElse(null);
		if (descriptor != null) {
			getImageRegistry().put(imagePath, descriptor);
		}
	}
	return descriptor;
}
 
示例5
public static ImageDescriptor getImageDescriptor(String name) {
	String iconPath = "icons/";
	return ResourceLocator.imageDescriptorFromBundle(N4IDEXpectUIPlugin.PLUGIN_ID, iconPath + name).orElse(null);
}
 
示例6
public ImageDescriptor imageDescriptor(final String path) {
	return ResourceLocator.imageDescriptorFromBundle(PLUGIN_ID, PATH_TO_ICONS + path).orElse(null);
}
 
示例7
/**
 * Returns an image descriptor for the image file at the given plug-in relative path.
 *
 * @param path
 *            the path.
 * @return the image descriptor.
 */
public static ImageDescriptor getImageDescriptor(final String path) {
	return ResourceLocator.imageDescriptorFromBundle(PLUGIN_ID, path).orElse(null);
}