本文整理汇总了Java中org.eclipse.jface.resource.JFaceResources.getImage方法的典型用法代码示例。如果您正苦于以下问题:Java JFaceResources.getImage方法的具体用法?Java JFaceResources.getImage怎么用?Java JFaceResources.getImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.JFaceResources
的用法示例。
在下文中一共展示了JFaceResources.getImage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisplayImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
@Override
public Image getDisplayImage() {
int done = getPercentDone();
if (done > 0) {
return super.getDisplayImage();
}
if (isBlocked()) {
return JFaceResources.getImage(ProgressManager.BLOCKED_JOB_KEY);
}
int state = getJob().getState();
if (state == Job.SLEEPING) {
return JFaceResources.getImage(ProgressManager.SLEEPING_JOB_KEY);
}
if (state == Job.WAITING) {
return JFaceResources.getImage(ProgressManager.WAITING_JOB_KEY);
}
//By default return the first progress image
return super.getDisplayImage();
}
示例2: getImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private static Image getImage(String bundleSymbolicName, String path, ImageDescriptor id)
{
String computedName = bundleSymbolicName + path;
Image image = JFaceResources.getImage(computedName);
if (image != null)
{
return image;
}
if (id == null)
{
id = AbstractUIPlugin.imageDescriptorFromPlugin(bundleSymbolicName, path);
}
if (id != null)
{
JFaceResources.getImageRegistry().put(computedName, id);
return JFaceResources.getImage(computedName);
}
return null;
}
示例3: getInfoImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Get the image for the info.
*
* @return Image
*/
private Image getInfoImage() {
if (!info.isJobInfo()) {
return JFaceResources.getImage(DEFAULT_JOB_KEY);
}
JobInfo jobInfo = (JobInfo) info;
ImageDescriptor descriptor = null;
Object property = jobInfo.getJob().getProperty(
IProgressConstants.ICON_PROPERTY);
if (property instanceof ImageDescriptor) {
descriptor = (ImageDescriptor) property;
} else if (property instanceof URL) {
descriptor = ImageDescriptor.createFromURL((URL) property);
}
Image image = null;
if (descriptor == null) {
image = progressService.getIconFor(jobInfo.getJob());
} else {
image = getResourceManager().createImageWithDefault(descriptor);
}
if (image == null)
image = jobInfo.getDisplayImage();
return image;
}
示例4: createContents
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Create the contents for the receiver.
*
* @param parent
* the Composite that the children will be created in
*/
public void createContents(final Composite parent) {
messageComposite = new Composite(parent, SWT.NONE);
final GridLayout messageLayout = new GridLayout();
messageLayout.numColumns = 2;
messageLayout.marginWidth = 0;
messageLayout.marginHeight = 0;
messageLayout.makeColumnsEqualWidth = false;
messageComposite.setLayout(messageLayout);
messageImageLabel = new Label(messageComposite, SWT.NONE);
final GridData imageData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
final Image sizingImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
Rectangle imageBounds;
if (sizingImage == null) {
imageBounds = new Rectangle(0,
0,
IDialogConstants.VERTICAL_MARGIN * 2,
IDialogConstants.VERTICAL_MARGIN * 2);
} else {
imageBounds = sizingImage.getBounds();
}
imageData.heightHint = imageBounds.height + IDialogConstants.VERTICAL_SPACING;
imageData.widthHint = imageBounds.width + IDialogConstants.HORIZONTAL_SPACING;
messageImageLabel.setLayoutData(imageData);
messageText = new Text(messageComposite, SWT.NONE);
messageText.setEditable(false);
messageText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
final GridData textData = new GridData(GridData.GRAB_HORIZONTAL
| GridData.FILL_HORIZONTAL
| GridData.VERTICAL_ALIGN_CENTER);
messageText.setLayoutData(textData);
hideRegion();
}
示例5: updateText
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Show the new message in the message text and update the image. Base the background color on
* whether or not there are errors.
*
* @param newMessage
* The new value for the message
* @param newType
* One of the IMessageProvider constants. If newType is IMessageProvider.NONE show
* the title.
* @see IMessageProvider
*/
public void updateText(final String newMessage, final int newType) {
Image newImage = null;
boolean showingError = false;
switch (newType) {
case IMessageProvider.NONE:
hideRegion();
return;
case IMessageProvider.INFORMATION:
newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
break;
case IMessageProvider.WARNING:
newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
break;
case IMessageProvider.ERROR:
newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
showingError = true;
break;
}
if (newMessage == null) {//No message so clear the area
hideRegion();
return;
}
showRegion();
// Any more updates required
if (newMessage.equals(messageText.getText()) && newImage == messageImageLabel.getImage()) {
return;
}
messageImageLabel.setImage(newImage);
messageText.setText(newMessage);
if (showingError) {
setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay()));
} else {
lastMessageText = newMessage;
setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay()));
}
}
示例6: getDisplayImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
@Override
public Image getDisplayImage() {
return JFaceResources.getImage(ProgressManager.WAITING_JOB_KEY);
}
示例7: getImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Return the image for the receiver.
*
* @return Image
*/
Image getImage() {
return JFaceResources.getImage(ProgressManager.ERROR_JOB_KEY);
}
示例8: getDisplayImage
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Get the image for the reciever.
*
* @return Image or <code>null</code>.
*/
public Image getDisplayImage() {
return JFaceResources.getImage(ProgressInfoItem.DEFAULT_JOB_KEY);
}