List of usage examples for org.eclipse.jface.resource JFaceResources getResources
public static ResourceManager getResources()
From source file:org.rssowl.ui.internal.OwlUI.java
License:Open Source License
/** * @param owner//from w w w . j a v a 2 s . c om * @param descriptor * @return Image */ public static Image getImage(Control owner, ImageDescriptor descriptor) { LocalResourceManager manager = new LocalResourceManager(JFaceResources.getResources(), owner); return getImage(manager, descriptor); }
From source file:org.rssowl.ui.internal.search.SearchConditionList.java
License:Open Source License
/** * @param parent The parent Composite.// w ww. j ava2 s. c om * @param style The Style as defined by SWT constants. * @param conditions The initial conditions this List is showing. * @param fieldsToExclude A list of search fields to exclude from the UI. */ public SearchConditionList(Composite parent, int style, List<ISearchCondition> conditions, List<Integer> fieldsToExclude) { super(parent, style | SWT.V_SCROLL); fItems = new ArrayList<SearchConditionItem>(); fFieldsToExclude = fieldsToExclude; fResources = new LocalResourceManager(JFaceResources.getResources(), this); initResources(); initComponents(conditions); }
From source file:org.rssowl.ui.internal.util.FolderChooser.java
License:Open Source License
/** * @param parent/*from ww w .ja va 2s . c o m*/ * @param initial * @param excludes * @param style * @param expandable * @param itemHeight */ public FolderChooser(Composite parent, IFolder initial, List<IFolder> excludes, int style, boolean expandable, int itemHeight) { super(parent, style); fParent = parent; fSelectedFolder = initial; fExcludes = excludes; fExpandable = expandable; fItemHeight = itemHeight; fResources = new LocalResourceManager(JFaceResources.getResources(), parent); initComponents(); addDisposeListener(this); }
From source file:org.rssowl.ui.internal.views.explorer.BookMarkLabelProvider.java
License:Open Source License
/** * @param indicateState/*from w w w . j a v a 2 s. c om*/ * @param useDialogFont */ public BookMarkLabelProvider(boolean indicateState, boolean useDialogFont) { fIndicateState = indicateState; fUseDialogFont = useDialogFont; fResources = new LocalResourceManager(JFaceResources.getResources()); createResources(); }
From source file:org.springframework.ide.eclipse.boot.dash.util.ToolbarPulldownContributionItem.java
License:Open Source License
/** * Updates the images for this action.//from w ww . j av a 2 s . c om * * @param forceImage * <code>true</code> if some form of image is compulsory, and * <code>false</code> if it is acceptable for this item to have * no image * @return <code>true</code> if there are images for this action, * <code>false</code> if not */ private boolean updateImages(boolean forceImage) { ResourceManager parentResourceManager = JFaceResources.getResources(); if (widget instanceof ToolItem) { if (USE_COLOR_ICONS) { ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); // performance: more efficient in SWT to set disabled and hot // image before regular image ((ToolItem) widget).setDisabledImage( disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); disposeOldImages(); imageManager = localManager; return image != null; } ImageDescriptor image = action.getImageDescriptor(); ImageDescriptor hoverImage = action.getHoverImageDescriptor(); ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); // If there is no regular image, but there is a hover image, // convert the hover image to gray and use it as the regular image. if (image == null && hoverImage != null) { image = ImageDescriptor.createWithFlags(action.getHoverImageDescriptor(), SWT.IMAGE_GRAY); } else { // If there is no hover image, use the regular image as the // hover image, // and convert the regular image to gray if (hoverImage == null && image != null) { hoverImage = image; image = ImageDescriptor.createWithFlags(action.getImageDescriptor(), SWT.IMAGE_GRAY); } } // Make sure there is a valid image. if (hoverImage == null && image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've // allocated for this tool item LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); // performance: more efficient in SWT to set disabled and hot image // before regular image ((ToolItem) widget).setDisabledImage( disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget) .setHotImage(hoverImage == null ? null : localManager.createImageWithDefault(hoverImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); // Now that we're no longer referencing the old images, clear them // out. disposeOldImages(); imageManager = localManager; return image != null; } else if (widget instanceof Item || widget instanceof Button) { // Use hover image if there is one, otherwise use regular image. ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've // allocated for this widget LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); if (widget instanceof Item) { ((Item) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); } else if (widget instanceof Button) { ((Button) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); } // Now that we're no longer referencing the old images, clear them // out. disposeOldImages(); imageManager = localManager; return image != null; } return false; }
From source file:org.universaal.tools.packaging.tool.api.WizardMod.java
License:Open Source License
/** * The <code>Wizard</code> implementation of this <code>IWizard</code> * method disposes all the pages controls using * <code>DialogPage.dispose</code>. Subclasses should extend this method * if the wizard instance maintains addition SWT resource that need to be * disposed.//from w w w . j av a 2s .co m */ public void dispose() { // notify pages for (int i = 0; i < pages.size(); i++) { try { ((IWizardPage) pages.get(i)).dispose(); } catch (Exception e) { Status status = new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR, e.getMessage(), e); Policy.getLog().log(status); } } // dispose of image if (defaultImage != null) { JFaceResources.getResources().destroyImage(defaultImageDescriptor); defaultImage = null; } }
From source file:org.xmind.cathy.internal.GeneralPrefPage.java
License:Open Source License
@Override public void createControl(Composite parent) { resources = new LocalResourceManager(JFaceResources.getResources(), parent); super.createControl(parent); }
From source file:org.xmind.ui.color.ColorPicker.java
License:Open Source License
/** * Updates the images for this action.// w w w. jav a 2 s .c o m * * @param forceImage * <code>true</code> if some form of image is compulsory, and * <code>false</code> if it is acceptable for this item to have * no image * @return <code>true</code> if there are images for this action, * <code>false</code> if not */ private boolean updateImages(boolean forceImage) { ResourceManager parentResourceManager = JFaceResources.getResources(); if (widget instanceof ToolItem) { if (USE_COLOR_ICONS) { ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); // performance: more efficient in SWT to set disabled and hot image before regular image ((ToolItem) widget).setDisabledImage( disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); disposeOldImages(); imageManager = localManager; return image != null; } ImageDescriptor image = action.getImageDescriptor(); ImageDescriptor hoverImage = action.getHoverImageDescriptor(); ImageDescriptor disabledImage = action.getDisabledImageDescriptor(); // If there is no regular image, but there is a hover image, // convert the hover image to gray and use it as the regular image. if (image == null && hoverImage != null) { image = ImageDescriptor.createWithFlags(action.getHoverImageDescriptor(), SWT.IMAGE_GRAY); } else { // If there is no hover image, use the regular image as the hover image, // and convert the regular image to gray if (hoverImage == null && image != null) { hoverImage = image; image = ImageDescriptor.createWithFlags(action.getImageDescriptor(), SWT.IMAGE_GRAY); } } // Make sure there is a valid image. if (hoverImage == null && image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've allocated for this tool item LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); // performance: more efficient in SWT to set disabled and hot image before regular image ((ToolItem) widget).setDisabledImage( disabledImage == null ? null : localManager.createImageWithDefault(disabledImage)); ((ToolItem) widget) .setHotImage(hoverImage == null ? null : localManager.createImageWithDefault(hoverImage)); ((ToolItem) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); // Now that we're no longer referencing the old images, clear them out. disposeOldImages(); imageManager = localManager; return image != null; } else if (widget instanceof Item || widget instanceof Button) { // Use hover image if there is one, otherwise use regular image. ImageDescriptor image = action.getHoverImageDescriptor(); if (image == null) { image = action.getImageDescriptor(); } // Make sure there is a valid image. if (image == null && forceImage) { image = ImageDescriptor.getMissingImageDescriptor(); } // Create a local resource manager to remember the images we've allocated for this widget LocalResourceManager localManager = new LocalResourceManager(parentResourceManager); if (widget instanceof Item) { ((Item) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); } else if (widget instanceof Button) { ((Button) widget).setImage(image == null ? null : localManager.createImageWithDefault(image)); } // Now that we're no longer referencing the old images, clear them out. disposeOldImages(); imageManager = localManager; return image != null; } return false; }
From source file:org.xmind.ui.internal.decorators.InformationDecorator.java
License:Open Source License
@Override public void decorate(IGraphicalPart part, IFigure figure) { super.decorate(part, figure); if (part instanceof InfoPart) { figure.setVisible(((InfoPart) part).hasActions()); }/* w w w.ja v a2 s . co m*/ if (figure instanceof DecoratedShapeFigure) { DecoratedShapeFigure fig = (DecoratedShapeFigure) figure; IShapeDecorationEx decoration = fig.getDecoration(); IInfoDecoration shape = null; if (decoration instanceof IInfoDecoration) shape = (IInfoDecoration) decoration; if (shape == null) shape = new RectangleInfoDecration(); shape.setLeftMargin(figure, H_MARGIN); shape.setTopMargin(figure, V_MARGIN); shape.setRightMargin(figure, H_MARGIN); shape.setBottomMargin(figure, V_MARGIN); shape.setLineColor(figure, new LocalResourceManager(JFaceResources.getResources()).createColor(new RGB(248, 227, 137))); shape.setFillColor(figure, getColor(getSheetPart(part), getStyleSelector(getSheetPart(part)), Styles.YellowBoxFillColor, shape.getId(), Styles.DEF_YELLOWBOX_FILL_COLOR)); shape.setLineAlpha(figure, 255); shape.setLineWidth(figure, LINEWIDTH); shape.setLineStyle(figure, SWT.LINE_SOLID); fig.setDecoration(shape); } }
From source file:org.xmind.ui.internal.dialogs.HyperlinkDialog.java
License:Open Source License
public HyperlinkDialog(Shell parentShell, IEditorPart editor, IStructuredSelection selection) { super(parentShell); resources = new LocalResourceManager(JFaceResources.getResources(), parentShell); this.editor = editor; this.selection = selection; setShellStyle(SWT.RESIZE | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); }