List of usage examples for org.eclipse.jface.resource JFaceResources getResources
public static ResourceManager getResources()
From source file:org.openscada.vi.details.swt.widgets.URLImageLabel.java
License:Open Source License
public URLImageLabel(final Composite parent, final int style, final DataItemDescriptor descriptor, final URLImageComponent component) { super(parent, style, null, null); this.component = component; final GridLayout layout = new GridLayout(2, false); layout.marginHeight = layout.marginWidth = 3; layout.horizontalSpacing = layout.verticalSpacing = 3; setLayout(layout);/*from ww w . j a v a 2 s. c o m*/ this.resourceManager = new LocalResourceManager(JFaceResources.getResources()); this.controlImage = new ControlImage(this, this.registrationManager); this.label = new Label(this, SWT.NONE); final GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true); if (component.getHeight() != null && component.getWidth() != null) { gd.minimumHeight = component.getHeight(); gd.minimumWidth = component.getWidth(); // this.label.setLayoutData ( new GridData ( component.getWidth (), component.getHeight () ) ); this.label.setSize(component.getWidth(), component.getHeight()); } this.label.setLayoutData(gd); if (descriptor != null) { this.controlImage.setDetailItem(descriptor.asItem()); this.registrationManager.registerItem("value", descriptor.getItemId(), descriptor.getConnectionInformation(), false, false); } showUrl(component.getFallbackImageUrl()); }
From source file:org.openscada.vi.ui.draw2d.VisualInterfaceViewer.java
License:Open Source License
public VisualInterfaceViewer(final Composite parent, final int style, final SymbolLoader loader, final Map<String, Object> scriptObjects, final Map<String, String> properties) { super(parent, style); this.initialProperties = properties == null ? Collections.<String, String>emptyMap() : properties; this.scriptObjects = scriptObjects; this.manager = new LocalResourceManager(JFaceResources.getResources()); addDisposeListener(new DisposeListener() { @Override/* w ww . j a v a 2 s .c o m*/ public void widgetDisposed(final DisposeEvent e) { internalDispose(); } }); setLayout(new FillLayout()); this.canvas = createCanvas(); setZooming(null); this.factory = new BasicViewElementFactory(this.canvas, this.manager); try { this.pane = createPane(); this.layer = new Layer(); this.connectionLayer = new ConnectionLayer(); this.connectionLayer.setConnectionRouter(new ManhattanConnectionRouter()); this.layer.setLayoutManager(new StackLayout()); this.pane.add(this.connectionLayer); this.pane.add(this.layer); loader.load(); this.symbol = loader.getSymbol(); create(loader.getSourceName(), loader.getSymbol(), loader.getClassLoader()); applyColor(loader.getSymbol()); } catch (final Exception e) { logger.warn("Failed to create view", e); StatusManager.getManager().handle(StatusHelper.convertStatus(Activator.PLUGIN_ID, e)); this.canvas.setContents(Helper.createErrorFigure(e)); } }
From source file:org.opentravel.schemas.views.propertyview.PropertySheetPage.java
License:Apache License
@Override public void createControl(Composite parent) { form = toolkit.createScrolledForm(parent); resManager = new LocalResourceManager(JFaceResources.getResources(), form); GridLayoutFactory.fillDefaults().extendedMargins(10, 10, 10, 10).numColumns(2).applyTo(form.getBody()); toolkit.paintBordersFor(form.getBody()); if (source != null) { initForm(form.getBody(), source); } else {/*from www . ja v a2 s .c o m*/ createEmptyForm(form.getBody()); } }
From source file:org.ow2.mindEd.adl.editor.graphic.ui.custom.wizards.CustomWizard.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 ww .j a v a 2 s . com */ public void dispose() { // notify pages for (int i = 0; i < pages.size(); i++) { ((IWizardPage) pages.get(i)).dispose(); } // dispose of image if (defaultImage != null) { JFaceResources.getResources().destroyImage(defaultImageDescriptor); defaultImage = null; } }
From source file:org.ow2.mindEd.adl.editor.graphic.ui.custom.wizards.CustomWizard.java
License:Open Source License
public Image getDefaultPageImage() { if (defaultImage == null) { defaultImage = JFaceResources.getResources().createImageWithDefault(defaultImageDescriptor); }//from ww w. j ava 2 s .c om return defaultImage; }
From source file:org.python.copiedfromeclipsesrc.CopiedWorkbenchLabelProvider.java
License:Open Source License
/** * Creates a new workbench label provider. *///w w w . java 2s .co m public CopiedWorkbenchLabelProvider() { PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener); this.resourceManager = new LocalResourceManager(JFaceResources.getResources()); }
From source file:org.python.pydev.editor.PyEdit.java
License:Open Source License
public synchronized LocalResourceManager getResourceManager() { if (resourceManager == null) { resourceManager = new LocalResourceManager(JFaceResources.getResources()); }/*from w w w . ja v a 2 s.co m*/ return resourceManager; }
From source file:org.python.pydev.ui.MenuManagerCopiedToAddCreateMenuWithMenuParent.java
License:Open Source License
public void fill(Menu parent, int index) { if (menuItem == null || menuItem.isDisposed()) { if (index >= 0) { menuItem = new MenuItem(parent, SWT.CASCADE, index); } else {//from w w w . ja v a 2s . co m menuItem = new MenuItem(parent, SWT.CASCADE); } String text = getMenuText(); if (text != null) { menuItem.setText(text); } if (image != null) { LocalResourceManager localManager = new LocalResourceManager(JFaceResources.getResources()); menuItem.setImage(localManager.createImage(image)); disposeOldImages(); imageManager = localManager; } if (!menuExist()) { menu = new Menu(parent); } menuItem.setMenu(menu); initializeMenu(); setDirty(true); } }
From source file:org.python.pydev.ui.MenuManagerCopiedToAddCreateMenuWithMenuParent.java
License:Open Source License
public void update(String property) { IContributionItem items[] = getItems(); for (int i = 0; i < items.length; i++) { items[i].update(property);//ww w .j av a 2 s .c o m } if (menu != null && !menu.isDisposed() && menu.getParentItem() != null) { if (IAction.TEXT.equals(property)) { String text = getOverrides().getText(this); if (text == null) { text = getMenuText(); } if (text != null) { ExternalActionManager.ICallback callback = ExternalActionManager.getInstance().getCallback(); if (callback != null) { int index = text.indexOf('&'); if (index >= 0 && index < text.length() - 1) { char character = Character.toUpperCase(text.charAt(index + 1)); if (callback.isAcceleratorInUse(SWT.ALT | character)) { if (index == 0) { text = text.substring(1); } else { text = text.substring(0, index) + text.substring(index + 1); } } } } menu.getParentItem().setText(text); } } else if (IAction.IMAGE.equals(property) && image != null) { LocalResourceManager localManager = new LocalResourceManager(JFaceResources.getResources()); menu.getParentItem().setImage(localManager.createImage(image)); disposeOldImages(); imageManager = localManager; } } }
From source file:org.review_board.ereviewboard.ui.editor.AbstractFormPagePart.java
License:Open Source License
public AbstractFormPagePart() { super();/* w w w . j a v a 2 s . c o m*/ resources = new LocalResourceManager(JFaceResources.getResources()); titleFont = resources.createFont(FontDescriptor.createFrom("Sans", 13, SWT.NORMAL)); attributeNameColor = resources.createColor(new RGB(87, 80, 18)); }