當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。