Java Code Examples for org.eclipse.jface.resource.ImageDescriptor#getImageData()

The following examples show how to use org.eclipse.jface.resource.ImageDescriptor#getImageData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OverlayIcon.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected void drawOverlays(ImageDescriptor[] overlays, int[] locations) {
	Point size = getSize();
	for (int i = 0; i < overlays.length; i++) {
		ImageDescriptor overlay = overlays[i];
		ImageData overlayData = overlay.getImageData();
		switch (locations[i]) {
			case TOP_LEFT:
				drawImage(overlayData, 0, 0);			
				break;
			case TOP_RIGHT:
				drawImage(overlayData, size.x - overlayData.width, 0);			
				break;
			case BOTTOM_LEFT:
				drawImage(overlayData, 0, size.y - overlayData.height);			
				break;
			case BOTTOM_RIGHT:
				drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height);			
				break;
		}
	}
}
 
Example 2
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 3
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 4
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 5
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 6
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 7
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 8
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 9
Source File: ImageManager.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an image from the file at the given plug-in relative path.
 *
 * @param path
 * @return image; the returned image <b>MUST be disposed after usage</b> to free up memory
 */
public static Image getImage(final String path) {
  ImageDescriptor descriptor = getImageDescriptor(path);

  if (descriptor == null) {
    log.warn(
        "could not create image for path '"
            + path
            + "', either the file does not exists or the format is not supported");
    descriptor = ImageDescriptor.getMissingImageDescriptor();
  }

  return new Image(Display.getDefault(), descriptor.getImageData());
}
 
Example 10
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 11
Source File: Activator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
 * @param path
 *            the path
 * @return the icon descriptor
 */
public static ImageDescriptor getIconDescriptor(String path) {
	ImageDescriptor image = getImageDescriptor(path);
	ImageData data = image.getImageData();
	data = data.scaledTo(16, 16);
	image = ImageDescriptor.createFromImageData(data);
	return image;
}
 
Example 12
Source File: LabelImageLoadJob.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
protected IStatus run(IProgressMonitor monitor) {
  ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageUrl);
  imageData = descriptor.getImageData();
  if (imageData != null) {
    LabelImageLoader.storeInCache(imageUrl.toString(), imageData);
    display.syncExec(new SetImageRunnable());
  }
  return Status.OK_STATUS;
}
 
Example 13
Source File: FocusDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ImageData getImageData(ImageDescriptor descriptor) {
	ImageData data= descriptor.getImageData(); // see bug 51965: getImageData can return null
	if (data == null) {
		data= DEFAULT_IMAGE_DATA;
		JavaPlugin.logErrorMessage("Image data not available: " + descriptor.toString()); //$NON-NLS-1$
	}
	return data;
}
 
Example 14
Source File: ImagesOnFileSystemRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public URL getImageURL(ImageDescriptor descriptor) {
	if (fTempDir == null)
		return null;

	URL url= fURLMap.get(descriptor);
	if (url != null)
		return url;

	File imageFile= getNewFile();
	ImageData imageData= descriptor.getImageData();
	if (imageData == null) {
		return null;
	}

	ImageLoader loader= new ImageLoader();
	loader.data= new ImageData[] { imageData };
	loader.save(imageFile.getAbsolutePath(), SWT.IMAGE_PNG);

	try {
		url= imageFile.toURI().toURL();
		fURLMap.put(descriptor, url);
		return url;
	} catch (MalformedURLException e) {
		JavaPlugin.log(e);
	}
	return null;
}
 
Example 15
Source File: CallHierarchyImageDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ImageData getImageData(ImageDescriptor descriptor) {
	ImageData data= descriptor.getImageData(); // see bug 51965: getImageData can return null
	if (data == null) {
		data= DEFAULT_IMAGE_DATA;
		JavaPlugin.logErrorMessage("Image data not available: " + descriptor.toString()); //$NON-NLS-1$
	}
	return data;
}
 
Example 16
Source File: ReportImageDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private ImageData getImageData( ImageDescriptor descriptor )
{
	ImageData data = descriptor.getImageData( ); // null
	if ( data == null )
	{
		data = DEFAULT_IMAGE_DATA;
	}
	return data;
}
 
Example 17
Source File: ImageDecoratorUtil.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a new CenteredCompositeImageDescriptor
 * 
 * @param baseImage
 * @param overlayImage
 */
CenteredCompositeImageDescriptor(ImageDescriptor baseImage, ImageDescriptor overlayImage)
{
	this.baseImageData = baseImage.getImageData();
	this.overlayImageData = overlayImage.getImageData();
	this.size = new Point(baseImageData.width, baseImageData.height);
}
 
Example 18
Source File: LibraryImageDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private ImageData getImageData( ImageDescriptor descriptor )
{
	ImageData data = descriptor.getImageData( ); // null
	if ( data == null )
	{
		data = DEFAULT_IMAGE_DATA;
	}
	return data;
}
 
Example 19
Source File: TypeScriptUIImageResource.java    From typescript.java with MIT License 5 votes vote down vote up
public static URL getImageURL(ImageDescriptor descriptor) {
	if (fTempDir == null)
		return null;

	URL url = fURLMap.get(descriptor);
	if (url != null)
		return url;

	File imageFile = getNewFile();
	ImageData imageData = descriptor.getImageData();
	if (imageData == null) {
		return null;
	}

	ImageLoader loader = new ImageLoader();
	loader.data = new ImageData[] { imageData };
	loader.save(imageFile.getAbsolutePath(), SWT.IMAGE_PNG);

	try {
		url = imageFile.toURI().toURL();
		fURLMap.put(descriptor, url);
		return url;
	} catch (MalformedURLException e) {
		TypeScriptUIPlugin.log("Failed to create image directory ", e); //$NON-NLS-1$
	}
	return null;
}
 
Example 20
Source File: TypeScriptCompositeImageDescriptor.java    From typescript.java with MIT License 5 votes vote down vote up
private ImageData getImageData(ImageDescriptor descriptor) {
	ImageData data = descriptor.getImageData(); // see bug 51965:
												// getImageData can return
												// null
	if (data == null) {
		data = DEFAULT_IMAGE_DATA;
		//		JavaScriptPlugin.logErrorMessage("Image data not available: " + descriptor.toString()); //$NON-NLS-1$
	}
	return data;
}