Example usage for org.eclipse.jface.resource StringConverter asPoint

List of usage examples for org.eclipse.jface.resource StringConverter asPoint

Introduction

In this page you can find the example usage for org.eclipse.jface.resource StringConverter asPoint.

Prototype

public static Point asPoint(String value, Point dflt) 

Source Link

Document

Converts the given value into an SWT point.

Usage

From source file:gov.redhawk.ui.splashHandlers.FeatureIconSplashHandler.java

License:Open Source License

@Override
public void init(final Shell splash) {
    // Store the shell
    super.init(splash);
    // Configure the shell layout
    //      configureUISplash();
    // Load all splash extensions
    loadFeatureIcons();//  ww w  . j  a v a  2  s  .co  m
    // If no splash extensions were loaded abort the splash handler
    if (this.featureIcons.isEmpty()) {
        return;
    }
    final IProduct product = Platform.getProduct();
    String locationStr = "";
    if (product != null) {
        locationStr = product.getProperty(FeatureIconSplashHandler.PROP_FEATURE_ICON);
    }
    final Point location = StringConverter.asPoint(locationStr, new Point(10, 10));
    getContent().addPaintListener(new PaintListener() {

        @Override
        public void paintControl(final PaintEvent e) {
            int xposition = location.x;
            final int yposition = location.y;
            for (final FeatureIcon icon : FeatureIconSplashHandler.this.featureIcons) {
                if (splash.getSize().x < xposition) {
                    break;
                }
                e.gc.drawImage(icon.img, xposition, yposition);
                xposition = icon.img.getBounds().width + 5 + xposition;
            }

        }
    });
    // Create UI
    //      createUI();
    // Configure the image panel bounds
    //      configureUICompositeIconPanelBounds();

    // Enter event loop and prevent the RCP application from 
    // loading until all work is done
    //      doEventLoop();
}

From source file:org.amanzi.awe.startup.splash.splashHandlers.InteractiveSplashHandler.java

License:Open Source License

@Override
public void init(Shell splash) {
    super.init(splash);
    String progressRectString = null;
    String messageRectString = null;
    String foregroundColorString = null;
    IProduct product = Platform.getProduct();
    if (product != null) {
        progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
        messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
        foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
    }/*from   www  . j  a va2 s  .c  o m*/
    Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15));
    setProgressRect(progressRect);

    Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15));
    setMessageRect(messageRect);

    int foregroundColorInteger;
    try {
        foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
    } catch (Exception ex) {
        foregroundColorInteger = 0xD2D7FF; // off white
    }

    setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
            foregroundColorInteger & 0xFF));
    // the following code will be removed for release time
    if (PrefUtil.getInternalPreferenceStore().getBoolean("SHOW_BUILDID_ON_STARTUP")) { //$NON-NLS-1$
        final String buildId = System.getProperty("eclipse.buildId", "Unknown Build"); //$NON-NLS-1$ //$NON-NLS-2$
        // find the specified location. Not currently API
        // hardcoded to be sensible with our current Europa Graphic
        String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$
        final Point buildIdPoint = StringConverter.asPoint(buildIdLocString, new Point(322, 190));
        getContent().addPaintListener(new PaintListener() {

            @Override
            public void paintControl(PaintEvent e) {
                e.gc.setForeground(getForeground());
                e.gc.drawText(buildId, buildIdPoint.x, buildIdPoint.y, true);
            }
        });
    } else {
        getContent(); // ensure creation of the progress
    }
    Activator.getDefault().setSplashMonitor(getBundleProgressMonitor());
}

From source file:org.bonitasoft.studio.application.splash.BOSSplashHandler.java

License:Open Source License

@Override
public void init(Shell splash) {
    super.init(splash);
    String progressRectString = null;
    String messageRectString = null;
    String foregroundColorString = null;
    IProduct product = Platform.getProduct();
    if (product != null) {
        progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
        messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
        foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
    }// ww w . ja  v  a2s .co  m

    Rectangle progressRect = StringConverter.asRectangle(progressRectString);
    setProgressRect(progressRect);

    Rectangle messageRect = StringConverter.asRectangle(messageRectString);
    setMessageRect(messageRect);

    int foregroundColorInteger;
    try {
        foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
    } catch (Exception ex) {
        foregroundColorInteger = 0xD2D7FF; // off white
    }

    setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
            foregroundColorInteger & 0xFF));

    setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
            foregroundColorInteger & 0xFF));

    // the following code will be removed for release time
    if (PrefUtil.getInternalPreferenceStore().getBoolean("SHOW_BUILDID_ON_STARTUP")) { //$NON-NLS-1$
        final String buildId = System.getProperty("eclipse.buildId", "Unknown Build"); //$NON-NLS-1$ //$NON-NLS-2$
        // find the specified location.  Not currently API
        // hardcoded to be sensible with our current splash Graphic
        String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$
        final Point buildIdPoint = StringConverter.asPoint(buildIdLocString, new Point(322, 190));
        getContent().addPaintListener(new PaintListener() {

            @Override
            public void paintControl(PaintEvent e) {
                e.gc.setForeground(getForeground());
                e.gc.setBackground(getForeground());
                e.gc.drawText(buildId, buildIdPoint.x, buildIdPoint.y, true);
            }
        });
    } else {
        getContent(); // ensure creation of the progress
    }
}

From source file:org.eclipse.stem.ui.splashhandler.SplashHandler.java

License:Open Source License

@Override
public void init(Shell splash) {
    super.init(splash);
    String progressRectString = "0,386,697,15"; //$NON-NLS-1$
    String messageRectString = "10,350,697,20"; //$NON-NLS-1$
    String buildIdLocString = "500,325"; //$NON-NLS-1$

    String foregroundColorString = null;

    Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(0, 165, 400, 15));
    setProgressRect(progressRect);/*  w w w .j a  v  a 2s . co m*/

    Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 150, 390, 50));
    setMessageRect(messageRect);

    final Point buildIdPoint = StringConverter.asPoint(buildIdLocString, new Point(322, 190));

    int foregroundColorInteger;
    try {
        foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
    } catch (Exception ex) {
        foregroundColorInteger = 0xD2D7FF; // off white
    }

    setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
            foregroundColorInteger & 0xFF));

    final String buildId = getBuildId();

    getContent().addPaintListener(new PaintListener() {
        @SuppressWarnings("synthetic-access")
        public void paintControl(PaintEvent e) {
            e.gc.setForeground(getForeground());
            e.gc.drawText(buildId, buildIdPoint.x, buildIdPoint.y, true);
        }
    });
}