本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}