List of usage examples for org.eclipse.jface.resource JFaceResources getImage
public static Image getImage(String key)
null
if none. From source file:org.eclipse.ui.ide.markers.compatibility.internal.MarkerColumnLabelProvider.java
License:Open Source License
public Image getImage(Object element) { // if (showAnnotations && element instanceof MarkerEntry) { // MarkerItem item = (MarkerItem) element; // IMarker marker = item.getMarker(); // if (marker != null) { // String contextId = IDE.getMarkerHelpRegistry().getHelp(marker); ///* w w w . j a v a 2 s . c o m*/ // if (contextId != null) // return JFaceResources.getImage(Dialog.DLG_IMG_HELP); // } // } MarkerItem item = (MarkerItem) element; Image image = field.getImage(item); ImageDescriptor[] descriptors = new ImageDescriptor[5]; if (showAnnotations && item.isConcrete()) { IMarker marker = item.getMarker(); // If there is no image get the full image rather than the decorated // one if (marker != null) { String contextId = IDE.getMarkerHelpRegistry().getHelp(marker); if (contextId != null) { if (image == null) image = JFaceResources.getImage(Dialog.DLG_IMG_HELP); else descriptors[IDecoration.TOP_RIGHT] = IDEWorkbenchPlugin.getIDEImageDescriptor( MarkerSupportInternalUtilities.IMG_MARKERS_HELP_DECORATION_PATH); } if (IDE.getMarkerHelpRegistry().hasResolutions(marker)) { if (image == null) image = imageManager.createImage(IDEInternalWorkbenchImages .getImageDescriptor(IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED)); else descriptors[IDecoration.BOTTOM_RIGHT] = IDEWorkbenchPlugin.getIDEImageDescriptor( MarkerSupportInternalUtilities.IMG_MARKERS_QUICK_FIX_DECORATION_PATH); } if (descriptors[IDecoration.TOP_RIGHT] != null || descriptors[IDecoration.BOTTOM_RIGHT] != null) image = imageManager.createImage(new DecorationOverlayIcon(image, descriptors)); } } return image; }
From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java
License:Open Source License
/** * Create message area./*from www . j a va2 s .c om*/ * * @param parent */ Control createMessageArea(Composite parent) { msgParent = new Composite(parent, SWT.BORDER); msgParent.setBackground(getMessageBackground()); msgParent.setLayout(new GridLayout(2, false)); imageLabel = new Label(msgParent, SWT.NONE); imageLabel.setBackground(msgParent.getBackground()); imageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO)); imageLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); messageArea = new Text(msgParent, SWT.READ_ONLY | SWT.NONE | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL); messageArea.setEditable(false); messageArea.setBackground(msgParent.getBackground()); messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); return msgParent; }
From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java
License:Open Source License
/** */ protected Image getInfoImage() { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); }
From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java
License:Open Source License
/** */ protected Image getWarningImage() { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); }
From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java
License:Open Source License
/** */ protected Image getErrorImage() { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); }
From source file:org.eclipse.ui.texteditor.MessageRegion.java
License:Open Source License
/** * Create the contents for the receiver. * * @param parent the Composite that the children will be created in *///from w w w . ja va 2s. com public void createContents(Composite parent) { messageComposite = new Composite(parent, SWT.NONE); 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); GridData imageData = new GridData(GridData.VERTICAL_ALIGN_CENTER); 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)); GridData textData = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); messageText.setLayoutData(textData); hideRegion(); }
From source file:org.eclipse.ui.texteditor.MessageRegion.java
License:Open Source License
/** * Show the new message in the message text and update the image. Base the background color on * whether or not there are errors.// w w w . j a va2s .co m * * @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(String newMessage, 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())); } }
From source file:org.eclipse.ui.trace.internal.TracingPreferencePage.java
License:Open Source License
/** * Add a section for a check button to be displayed like "[] Enable Tracing" * /*from w ww .ja v a 2s . c o m*/ * @param parent * The parent composite */ protected void addEnableTracingSection(Composite parent) { // If the preferences are being overridden by debug mode at launch time, warn the user if (DebugOptionsHandler.isLaunchInDebugMode()) { Composite warningComp = new Composite(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false); warningComp.setLayoutData(gd); GridLayout gl = new GridLayout(2, false); gl.marginWidth = gl.marginHeight = 0; warningComp.setLayout(gl); Label warningImage = new Label(warningComp, SWT.NONE); warningImage .setImage(JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING)); gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false); warningImage.setLayoutData(gd); Label warningText = new Label(warningComp, SWT.WRAP); warningText.setText(Messages.TracingPreferencePage_applicationLaunchedInDebugModeWarning); gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false); gd.widthHint = 200; warningText.setLayoutData(gd); } enableTracingButton = new Button(parent, SWT.CHECK); enableTracingButton.setText(Messages.enableTracingButtonLabel); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).grab(true, false) .applyTo(enableTracingButton); enableTracingButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { enableTracingButtonSelected(true); } }); }
From source file:org.eclipse.ui.views.markers.MarkerField.java
License:Open Source License
/** * Annotate the image with indicators for whether or not help or quick fix * are available.//from w w w.java2 s. c o m * * @param item * the item being decorated * @param image * the image being overlaid * @return Image */ public Image annotateImage(MarkerItem item, Image image) { ImageDescriptor[] descriptors = new ImageDescriptor[5]; if (item.getMarker() != null) { IMarker marker = item.getMarker(); // If there is no image get the full image rather than the decorated // one if (marker != null) { String contextId = IDE.getMarkerHelpRegistry().getHelp(marker); if (contextId != null) { if (image == null) image = JFaceResources.getImage(Dialog.DLG_IMG_HELP); else { descriptors[IDecoration.TOP_RIGHT] = getIDEImageDescriptor( MarkerSupportInternalUtilities.IMG_MARKERS_HELP_DECORATION_PATH); } } if (IDE.getMarkerHelpRegistry().hasResolutions(marker)) { if (image == MarkerSupportInternalUtilities.getSeverityImage(IMarker.SEVERITY_WARNING)) { image = WorkbenchPlugin.getDefault().getSharedImages() .getImage(IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING); } else if (image == MarkerSupportInternalUtilities.getSeverityImage(IMarker.SEVERITY_ERROR)) { image = WorkbenchPlugin.getDefault().getSharedImages() .getImage(IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_ERROR); } else if (image != null) { descriptors[IDecoration.BOTTOM_RIGHT] = getIDEImageDescriptor( MarkerSupportInternalUtilities.IMG_MARKERS_QUICK_FIX_DECORATION_PATH); } if (image == null) { image = WorkbenchPlugin.getDefault().getSharedImages() .getImage(IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED); } } if (descriptors[IDecoration.TOP_RIGHT] != null || descriptors[IDecoration.BOTTOM_RIGHT] != null) image = getImageManager().createImage(new DecorationOverlayIcon(image, descriptors)); } } return image; }
From source file:org.eclipse.xtext.xtext.ui.wizard.project.StatusWidget.java
License:Open Source License
private Image imageFor(final int type) { Image _switchResult = null;//from w w w . ja v a 2 s.co m switch (type) { case IMessageProvider.NONE: _switchResult = null; break; case IMessageProvider.INFORMATION: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; } return _switchResult; }