Java 类org.eclipse.ui.branding.IProductConstants 实例源码

项目:DICE-Platform    文件:DiceSplashHandler.java   
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);
    }
    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

    String[] mappings = loadMappings(product.getDefiningBundle());

    StringBuilder sbId = new StringBuilder();
    if (mappings.length >= 2) {
        String version = mappings[0];
        String timestamp = mappings[1];
        if (!version.startsWith("$") && !timestamp.startsWith("$")) {
            sbId.append(version);
            sbId.append(".");
            sbId.append(timestamp);
        } else {
            sbId.append("Unknown Build");
        }
    } else {
        sbId.append("Unknown Build");
    }

    String eclipseBaseVersion = "";
    if (mappings.length >= 3) {
        eclipseBaseVersion = mappings[2];
        if (eclipseBaseVersion.startsWith("$")) {
            eclipseBaseVersion = "Unknown Eclipse Base Version";
        }
    }

    Label idLabel = new Label(getContent(), SWT.LEFT);
    idLabel.setForeground(getForeground());
    idLabel.setBounds(new Rectangle(390, 105, 220, 40));
    idLabel.setText(sbId.toString());
    idLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID);

    Label basedOnLabel = new Label(getContent(), SWT.LEFT);
    basedOnLabel.setForeground(getForeground());
    basedOnLabel.setBounds(new Rectangle(190, 105, 220, 40));
    basedOnLabel.setText(eclipseBaseVersion);
    basedOnLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID);

    toString();
}
项目:mytourbook    文件:MyTourbookSplashHandler.java   
@Override
    public void init(final Shell splash) {

        super.init(splash);

        // keep the splash handler to be used outside of this splash handlers
        TourbookPlugin.setSplashHandler(this);

        String progressRectString = null;
        String messageRectString = null;
//      String foregroundColorString = null;

        final 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);
        }

        // set progressbar position
        Rectangle progressRect = parseRect(progressRectString);
        if (progressRect == null) {
            progressRect = new Rectangle(10, 0, 300, 15);
        }
        setProgressRect(progressRect);

        // set message position
        Rectangle messageRect = parseRect(messageRectString);
        if (messageRect == null) {
            messageRect = new Rectangle(10, 25, 300, 15);
        }
        setMessageRect(messageRect);

        // set message color
        int foregroundColorInteger;
//      try {
//          // debug color
//          foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
//      } catch (final Exception ex) {
//          // production color, debug is not using this color
//          foregroundColorInteger = 0x2d84f6;
//      }
//      foregroundColorInteger = 0x2d84f6;
//      foregroundColorInteger = 0x2a7ce7;
        foregroundColorInteger = 0xffffff;

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

//      final String buildId = "Version " + System.getProperty("eclipse.buildId", "Unknown Version"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

        getContent().addPaintListener(new PaintListener() {

            @Override
            public void paintControl(final PaintEvent e) {
                onPaint(e);
            }
        });
    }