Example usage for org.eclipse.jface.resource JFaceResources getResources

List of usage examples for org.eclipse.jface.resource JFaceResources getResources

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getResources.

Prototype

public static ResourceManager getResources() 

Source Link

Document

Returns the ResourceManager for the current display.

Usage

From source file:org.eclipse.scada.vi.details.swt.widgets.DataItemToolTip.java

License:Open Source License

public DataItemToolTip(final Control control, final Item item) {
    super(control);

    this.resourceManager = new LocalResourceManager(JFaceResources.getResources());

    this.item = item;
}

From source file:org.eclipse.scada.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. ja v  a2  s.  co  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());

    if (component.getReloadTimer() != null) {
        triggerReload(component.getReloadTimer());
    }
}

From source file:org.eclipse.scada.vi.ui.draw2d.VisualInterfaceViewer.java

License:Open Source License

public VisualInterfaceViewer(final Composite parent, final int style, final SymbolLoader symbolLoader,
        final Map<String, Object> scriptObjects, final Map<String, String> properties,
        final FactoryContext factoryContext) {
    super(parent, style);

    final Profiler p = new Profiler("VisualInterfaceViewer");

    p.start("init");

    this.initialProperties = properties == null ? Collections.<String, String>emptyMap() : properties;
    this.scriptObjects = scriptObjects;

    this.factoryContext = factoryContext;

    p.start("rm");

    this.manager = new LocalResourceManager(JFaceResources.getResources());

    addDisposeListener(new DisposeListener() {

        @Override/*w w w . j ava 2 s  .  co m*/
        public void widgetDisposed(final DisposeEvent e) {
            internalDispose();
        }
    });

    setLayout(new FillLayout());
    this.canvas = createCanvas();
    setZooming(null);

    p.start("new factory");

    this.factory = new BasicViewElementFactory(this.canvas, this.manager, symbolLoader, this.factoryContext);

    try {
        p.start("create pane");
        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);

        p.start("load");
        this.symbol = symbolLoader.loadSymbol();
        p.start("create");
        create(symbolLoader);
        p.start("apply");
        applyColor(this.symbol);
        applyImage(this.symbol, symbolLoader);
    } 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));
    }
    p.stop().print();
}

From source file:org.eclipse.scada.vi.ui.user.SingleVisualInterfaceViewPart.java

License:Open Source License

@Override
public void createPartControl(final Composite parent) {
    this.manager = new LocalResourceManager(JFaceResources.getResources());

    parent.setLayout(new FillLayout());

    // selection/*from  w  w  w  . j av  a  2 s.c om*/
    this.selectionProvider = new AbstractSelectionProvider();
    getSite().setSelectionProvider(this.selectionProvider);

    final List<ExtensionDescriptor> extensions = Activator.getExtensionDescriptors();

    final Composite wrapper = new Composite(parent, SWT.NONE);
    final GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
    gridLayout.marginHeight = gridLayout.marginWidth = 0;
    wrapper.setLayout(gridLayout);

    final Composite topComposite = new Composite(wrapper, SWT.NONE);
    topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    topComposite.setLayout(createExtensionGridLayout());

    final Composite leftComposite = new Composite(wrapper, SWT.NONE);
    leftComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    leftComposite.setLayout(createExtensionGridLayout());

    // create main

    this.viewHolder = new Composite(wrapper, SWT.NONE);
    this.viewHolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    this.viewHolder.setLayout(this.stackLayout = new StackLayout());

    final Composite rightComposite = new Composite(wrapper, SWT.NONE);
    rightComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    rightComposite.setLayout(createExtensionGridLayout());

    final Composite bottomComposite = new Composite(wrapper, SWT.NONE);
    bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    bottomComposite.setLayout(createExtensionGridLayout());

    try {
        createExtensions(extensions, topComposite, "TOP", true);
        createExtensions(extensions, bottomComposite, "BOTTOM", true);
        createExtensions(extensions, leftComposite, "LEFT", false);
        createExtensions(extensions, rightComposite, "RIGHT", false);
    } catch (final CoreException e) {
        StatusManager.getManager().handle(e, Activator.PLUGIN_ID);
    }

    for (final ViewInstanceDescriptor descriptor : this.descriptors) {
        createAndAddView(descriptor);
    }
    activateNextMain();
}

From source file:org.eclipse.tcf.te.ui.notifications.internal.popup.AbstractNotificationPopup.java

License:Open Source License

/**
 * Constructor/*  www . j  a  v a 2  s  .  c  o m*/
 *
 * @param parent The parent shell or <code>null</code> to create a top level shell.
 * @param style The shell style.
 */
public AbstractNotificationPopup(Shell parent, int style) {
    super(parent);
    setShellStyle(style);

    resources = new LocalResourceManager(JFaceResources.getResources());

    color = new GradientColors(PlatformUI.getWorkbench().getDisplay(), resources);

    closeJob.setSystem(true);

    // Initialize the fadingEnabled flag
    fadingEnabled = UIPlugin.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_ENABLE_FADING);

    closed = false;
}

From source file:org.eclipse.tcf.te.ui.views.categories.Category.java

License:Open Source License

@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
        throws CoreException {
    super.setInitializationData(config, propertyName, data);

    // Read the icon attribute and create the image
    String attrIcon = config.getAttribute("icon");//$NON-NLS-1$
    if (attrIcon != null) {
        descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(config.getNamespaceIdentifier(), attrIcon);
        if (descriptor != null) {
            image = JFaceResources.getResources().createImageWithDefault(descriptor);
        }/*from w w  w  .j  a  v a2  s  .co  m*/
    }

    // Read the rank attribute
    String attrRank = config.getAttribute("rank"); //$NON-NLS-1$
    if (attrRank != null) {
        try {
            rank = Integer.valueOf(attrRank).intValue();
        } catch (NumberFormatException e) {
            /* ignored on purpose */ }
    }

    // Read the "enablement" sub element of the extension
    IConfigurationElement[] children = config.getChildren("enablement"); //$NON-NLS-1$
    // Only one "enablement" element is expected
    if (children != null && children.length > 0) {
        expression = ExpressionConverter.getDefault().perform(children[0]);
    }
}

From source file:org.eclipse.tcf.te.ui.views.categories.Category.java

License:Open Source License

@Override
public void dispose() {
    if (descriptor != null) {
        JFaceResources.getResources().destroyImage(descriptor);
        descriptor = null;
    }
    image = null;
}

From source file:org.eclipse.team.internal.ui.synchronize.ImageManager.java

License:Open Source License

private synchronized ResourceManager getResourceManager() {
    if (imageManager == null) {
        imageManager = new LocalResourceManager(JFaceResources.getResources());
    }// w w  w.  jav a 2  s  .com
    return imageManager;
}

From source file:org.eclipse.test.internal.performance.results.ui.ComponentResultsView.java

License:Open Source License

public void dispose() {
    this.tabFolder.dispose();
    int length = this.tabs == null ? 0 : this.tabs.length;
    for (int i = 0; i < length; i++) {
        this.tabs[i].dispose();
    }//from w  w  w.  j  a v  a 2s  .co m
    JFaceResources.getResources().destroyImage(this.fullSelectionImageDescriptor);
    super.dispose();
}

From source file:org.eclipse.ui.ide.markers.compatibility.internal.MarkerColumnLabelProvider.java

License:Open Source License

/**
 * Create a MarkerViewLabelProvider on a field.
 * /*w ww. j a v  a 2s .  c om*/
 * @param field
 * @param decorate
 *            <code>true</code> if annotations are to be shown.
 */
MarkerColumnLabelProvider(MarkerField field, boolean decorate) {
    FieldDecorationRegistry.getDefault();
    this.field = field;
    this.showAnnotations = decorate;
    imageManager = new LocalResourceManager(JFaceResources.getResources());
}