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.sapphire.ui.forms.swt.SapphireWizard.java

License:Open Source License

@Override
public void dispose() {
    if (this.element != null) {
        if (this.elementInstantiatedLocally) {
            this.element.dispose();
        }// ww  w  .ja  va 2 s. c o m

        this.element = null;
    }

    if (this.part != null) {
        this.part.dispose();
        this.part = null;
    }

    if (this.definition != null) {
        this.definition.dispose();
        this.definition = null;
    }

    if (this.defaultPageImage != null) {
        JFaceResources.getResources().destroyImage(this.defaultPageImageDescriptor);
        this.defaultPageImage = null;
    }

    this.defaultPageImageDescriptor = null;
    this.container = null;
    this.pages = null;
}

From source file:org.eclipse.scada.ae.ui.views.contributions.AlarmNotifier.java

License:Open Source License

@Override
protected Control createControl(final Composite parent) {
    this.display = parent.getDisplay();

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

    initMonitorStates();/*from   w  w  w  .j  av  a 2 s  .  c om*/

    this.panel = new Composite(parent, SWT.NONE);
    final GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = layout.marginWidth = 0;
    this.panel.setLayout(layout);
    this.panel.setCursor(this.display.getSystemCursor(SWT.CURSOR_HAND));
    // this.panel.addMouseListener ( this );

    this.label = new Label(this.panel, SWT.NONE);
    this.label.setText(getLabel());
    this.label.setAlignment(SWT.CENTER);
    GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true);
    gd.widthHint = gd.minimumWidth = 110;
    this.label.setLayoutData(gd);
    this.label.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(final MouseEvent e) {
            triggerMainCommand();
        };
    });

    this.bellIcon = new Label(this.panel, SWT.NONE);
    this.bellIcon.setAlignment(SWT.CENTER);
    gd = new GridData(SWT.FILL, SWT.FILL, false, true);
    gd.widthHint = gd.minimumWidth = getBellIcon().getBounds().width;
    this.bellIcon.setLayoutData(gd);
    this.bellIcon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(final MouseEvent e) {
            triggerBellSwitch();
        }
    });

    this.blinker = new StyleBlinker() {
        @Override
        public void update(final CurrentStyle style) {
            handleStyleUpdate(style);
        }
    };
    this.blinker.setStyle(null);

    this.styler = new StateStyler(this.blinker);

    loadConfiguration();

    return this.panel;
}

From source file:org.eclipse.scada.core.ui.styles.generator.SimpleRuleStyleGenerator.java

License:Open Source License

public SimpleRuleStyleGenerator() {
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources());

    this.colorBgDisconnected = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.disconnected.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_DISCONNECTED_BG);
    this.colorBgError = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.error.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_ERROR_BG);
    this.colorBgAlarm = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.alarm.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_ALARM_BG);
    this.colorBgWarning = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.warning.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_WARNING_BG);
    this.colorBgManual = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.manual.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_MANUAL_BG);
    this.colorBgBlock = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.block.bg", //$NON-NLS-1$
            this.resourceManager, COLOR_BLOCK_BG);

    this.colorFgBlock = new ColorUpdater("org.eclipse.scada.core.ui.styles.alarming.block.fg", //$NON-NLS-1$
            this.resourceManager, COLOR_BLOCK_FG);

    JFaceResources.getColorRegistry().addListener(this.listener);
}

From source file:org.eclipse.scada.da.client.dataitem.details.extra.Activator.java

License:Open Source License

public void start(final BundleContext context) throws Exception {
    resources = new LocalResourceManager(JFaceResources.getResources());
    super.start(context);

    plugin = this;
}

From source file:org.eclipse.scada.da.client.dataitem.details.extra.part.ManualOverride.java

License:Open Source License

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

    super.createPart(parent);
}

From source file:org.eclipse.scada.ide.hd.hdsspy.editors.EntryLabelProvider.java

License:Open Source License

public EntryLabelProvider() {
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources());
}

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

License:Open Source License

public BoolLEDComposite(final Composite parent, final int style, final DataItemDescriptor descriptor,
        final String format, final boolean expectedValue, final boolean isAlarm, final boolean isOnOff,
        final String attribute) {
    super(parent, style, null, null);

    this.resourceManager = new LocalResourceManager(JFaceResources.getResources());
    this.imageGreen = this.resourceManager.createImageWithDefault(
            ImageDescriptor.createFromFile(BoolLEDComposite.class, "icons/ledGreen.png")); //$NON-NLS-1$
    this.imageGray = this.resourceManager.createImageWithDefault(
            ImageDescriptor.createFromFile(BoolLEDComposite.class, "icons/ledGray.png")); //$NON-NLS-1$
    this.imageRed = this.resourceManager
            .createImageWithDefault(ImageDescriptor.createFromFile(BoolLEDComposite.class, "icons/ledRed.png")); //$NON-NLS-1$
    this.imageOn = this.resourceManager
            .createImageWithDefault(ImageDescriptor.createFromFile(BoolLEDComposite.class, "icons/on.png")); //$NON-NLS-1$
    this.imageOff = this.resourceManager
            .createImageWithDefault(ImageDescriptor.createFromFile(BoolLEDComposite.class, "icons/off.png")); //$NON-NLS-1$

    final RowLayout layout = new RowLayout();
    layout.wrap = false;/*  w  w w.j a  v a 2s .  co m*/
    layout.center = true;
    layout.spacing = 3;
    setLayout(layout);

    this.expectedValue = expectedValue;
    this.isAlarm = isAlarm;
    this.isOnOff = isOnOff;
    this.attribute = attribute;

    this.controlImage = new ControlImage(this, this.registrationManager);
    this.controlImage.setDetailItem(descriptor.asItem());

    this.signalLabel = new Label(this, SWT.NONE);
    this.signalLabel.setImage(this.imageGray);
    new DescriptorLabel(this, SWT.NONE, format, descriptor);

    if (descriptor != null) {
        this.registrationManager.registerItem("value", descriptor.getItemId(), //$NON-NLS-1$
                descriptor.getConnectionInformation(), false, false);
    }

    if (Boolean.getBoolean("org.eclipse.scada.developer")) //$NON-NLS-1$
    {

        if (this.isAlarm == true) {
            this.signalLabel.setToolTipText("Red");
        } else {
            this.signalLabel.setToolTipText("Green");
        }
    }
}

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

License:Open Source License

public BrowserComponent(final Composite parent, final int style, final DataItemDescriptor descriptor,
        final org.eclipse.scada.vi.details.model.BrowserComponent 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);//w w w . j  a  v a 2s.c  om

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

    this.controlImage = new ControlImage(this, this.registrationManager);

    this.browser = new Browser(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.browser.setSize(component.getWidth(), component.getHeight());
    }
    this.browser.setLayoutData(gd);

    if (descriptor != null) {
        this.controlImage.setDetailItem(descriptor.asItem());
        this.registrationManager.registerItem("value", descriptor.getItemId(),
                descriptor.getConnectionInformation(), false, false);
    }

    showUrl(makeUrl());
    if (component.getReloadTimer() != null && component.getReloadTimer() > 0) {
        triggerReload(component.getReloadTimer());
    }
}

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

License:Open Source License

public BlockControlImage(final ControlImage controlImage, final int style,
        final RegistrationManager registrationManager) {
    super(controlImage.getClientSpace(), style);

    this.controlImage = controlImage;

    this.registrationManager = registrationManager;

    setLayout(new FillLayout());

    this.icon = new Label(this, SWT.NONE);
    this.icon.setImage(getEmptyImage());
    this.icon.addMouseListener(new MouseAdapter() {
        @Override/*from   ww  w. j  a v a  2s .co m*/
        public void mouseUp(final MouseEvent e) {
            toggleBlock();
        }
    });

    this.registrationManager.addListener(this);

    final LocalResourceManager resources = new LocalResourceManager(JFaceResources.getResources(), this.icon);

    this.boldFont = resources.createFont(JFaceResources.getDefaultFontDescriptor().withStyle(SWT.BOLD));
    this.boldStyler = new Styler() {

        @Override
        public void applyStyles(final TextStyle textStyle) {
            textStyle.font = BlockControlImage.this.boldFont;
        }
    };
}

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

License:Open Source License

public DataItemToolTip(final Control control, final int style, final boolean manualActivation,
        final Item item) {
    super(control, style, manualActivation);

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

    this.item = item;
}