本文整理匯總了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);
}