当前位置: 首页>>代码示例>>Java>>正文


Java Program.getImageData方法代码示例

本文整理汇总了Java中org.eclipse.swt.program.Program.getImageData方法的典型用法代码示例。如果您正苦于以下问题:Java Program.getImageData方法的具体用法?Java Program.getImageData怎么用?Java Program.getImageData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.program.Program的用法示例。


在下文中一共展示了Program.getImageData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIconFromProgram

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
/**
    * Gets the icon from program.
    * 
    * @param program
    *            the program
    * @return the icon from program
    */
   public static ImageDescriptor getIconFromProgram(Program program) {

ImageData imageData = program.getImageData();
if (imageData != null) {
    return ImageDescriptor.createFromImageData(imageData);
}
return null;
   }
 
开发者ID:synergynet,项目名称:synergyview,代码行数:16,代码来源:ResourceLoader.java

示例2: getImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
	if (element instanceof ProjectResource) {
		ProjectResource proResource = (ProjectResource) element;
		String fileName = proResource.getLabel();
		if (proResource.isProject()) {
			return projectImg;
		} else if (proResource.isFolder()) {
			return folderImg;
		} else if (fileName.endsWith(".hsxliff")) {
			return hsXLiffImg;
		} else if (fileName.endsWith(".html")) {
			return htmlImg;
		} else {
			int index = fileName.lastIndexOf(".");
			if (index != -1) {
				String extension = fileName.substring(index, fileName.length());
				if (imgMap.containsKey(extension)) {
					return imgMap.get(extension);
				}
				Program program = Program.findProgram(extension);
				if (program != null) {
					ImageData imageData = program.getImageData();
					if (imageData != null) {
						Image img = new Image(getShell().getDisplay(), imageData);
						imgMap.put(extension, img);
						return img;
					}
				}
			}
		}
	}
	return defaultImg;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:35,代码来源:ImportProjectWizardPage2.java

示例3: getIconFromProgram

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
/**
 * Gets an image for a file associated with a given program
 *
 * @param program the Program
 */
public Image getIconFromProgram(Program program) {
	Image image = (Image) iconCache.get(program);
	if (image == null) {
		ImageData imageData = program.getImageData();
		if (imageData != null) {
			image = new Image(null, imageData, imageData.getTransparencyMask());
			iconCache.put(program, image);
		} else {
			image = stockImages[iconFile];
		}
	}
	return image;
}
 
开发者ID:lrscp,项目名称:AndroidFileExplorer,代码行数:19,代码来源:IconCache.java

示例4: getImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
	if (element instanceof ProjectResource) {
		ProjectResource proResource = (ProjectResource) element;
		String fileName = proResource.getLabel();
		if (proResource.isProject()) {
			return projectImg;
		}else if (proResource.isFolder()) {
			return folderImg;
		}else if (fileName.endsWith(".hsxliff")) {
			return hsXLiffImg;
		}else if (fileName.endsWith(".html")) {
			return htmlImg;
		}else {
			int index = fileName.lastIndexOf(".");
			if (index != -1) {
				String extension = fileName.substring(index, fileName.length());
				if (imgMap.containsKey(extension)) {
					return imgMap.get(extension);
				}
				Program program = Program.findProgram(extension);
				if (program != null) {
					ImageData imageData = program.getImageData();
					if (imageData != null) {
						Image img = new Image(getShell().getDisplay(), imageData);
						imgMap.put(extension, img);
						return img;
					}
				}
			}
		}
	}
	return defaultImg;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:35,代码来源:ImportProjectWizardPage2.java

示例5: loadImage

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
public Image loadImage(Program program) {
Image image = (Image) imageRegistry.get(program.getName());
if (image == null) {
    image = new Image(Display.getCurrent(), program.getImageData());
    imageRegistry.put(program.getName(), image);
}
return image;

   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:10,代码来源:ImageUtils.java

示例6: createMailTreeItems

import org.eclipse.swt.program.Program; //导入方法依赖的package包/类
private void createMailTreeItems(TreeItem currentRoot, SmtpMessagePart part)
{
	if (part != null && part.getParts() != null)
	{
		Iterator<SmtpMessagePart> it = part.getParts().iterator();
		while (it.hasNext())
		{
			SmtpMessagePart p = it.next();
			TreeItem item = new TreeItem(currentRoot, SWT.NONE);
			item.setText(p.getContentType());
			item.setData(p);

			if (SmimeUtilities.isEnvelopedData(p))
				item.setImage(SWTHelper.loadImage("smime.gif")); //$NON-NLS-1$
			else if (isSigned && "application/pkcs7-signature".equals(p.getContentType()))
				item.setImage(SWTHelper.loadImage("smime_sig.gif")); //$NON-NLS-1$
			else if (p.getFileName() != null && p.getFileName().lastIndexOf('.') > -1)
			{
				String fileName = p.getFileName();
				String ext = fileName.substring(fileName.lastIndexOf('.')); //$NON-NLS-1$
				Program program = Program.findProgram(ext);

				if (program != null && program.getImageData() != null)
					item.setImage(new Image(SWTHelper.getDisplay(), program.getImageData()));
				else
					item.setImage(SWTHelper.loadImage("attach.gif")); //$NON-NLS-1$
			}
			else
				item.setImage(SWTHelper.loadImage("part.gif")); //$NON-NLS-1$

			createMailTreeItems(item, p);
			item.setExpanded(true);
		}
	}
}
 
开发者ID:edeoliveira,项目名称:Mailster,代码行数:36,代码来源:OutLineView.java


注:本文中的org.eclipse.swt.program.Program.getImageData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。