List of usage examples for org.eclipse.jface.resource StringConverter asRectangle
public static Rectangle asRectangle(String value, Rectangle dflt)
From source file:com.ebmwebsourcing.petals.studio.splash.PetalsSplashHandler.java
License:Open Source License
@Override public void init(final Shell splash) { super.init(splash); // Get product properties 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 ww w . ja v a 2s.co 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 { if (foregroundColorString != null) foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); else foregroundColorInteger = 0xD2D7FF; // off white } catch (Exception ex) { foregroundColorInteger = 0xD2D7FF; // off white } setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); final Point buildIdPoint = new Point(350, 230); ImageDescriptor desc = PetalsStudioPlugin.getImageDescriptor("icons/prod/studio.png"); final ImageData imgData = desc.getImageData(); // Get the version to display final StringBuilder sb = new StringBuilder(VersionUtils.getProductVersion(false)); if (!sb.toString().contains(" ")) // No RC, milestone... Display a prefix. sb.insert(0, "Version "); // Paint it getContent().addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText(sb.toString(), buildIdPoint.x, buildIdPoint.y, true); imgData.alpha = PetalsSplashHandler.this.alphaValue; Image previousImg = PetalsSplashHandler.this.img; PetalsSplashHandler.this.img = new Image(e.display, imgData); if (previousImg != null) { previousImg.dispose(); previousImg = null; } e.gc.drawImage(PetalsSplashHandler.this.img, 233, 175); } }); Thread worker = new Thread() { @Override public void run() { DisplayAccess.accessDisplayDuringStartup(); getContent().getDisplay().syncExec(new Runnable() { public void run() { // 235: 255 - 20 while (PetalsSplashHandler.this.alphaValue < 235) { try { Thread.sleep(200); } catch (InterruptedException e) { // nothing } PetalsSplashHandler.this.alphaValue += 20; getContent().redraw(); getContent().update(); } } }); } }; worker.start(); }
From source file:com.liferay.ide.studio.ui.StudioSplashHandler.java
License:Open Source License
public void init(Shell splash) { super.init(splash); String progressRectString = null; String foregroundColorString = null; IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); }//w w w . j a va 2 s . co m Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15)); setProgressRect(progressRect); 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")) { String buildId = System.getProperty("eclipse.buildId", "Unknown Build"); String buildIdRect = product.getProperty("buildIdRect"); Rectangle buildIdRectangle = StringConverter.asRectangle(buildIdRect, new Rectangle(322, 190, 100, 40)); GridLayout layout = new GridLayout(1, false); layout.marginRight = 0; layout.horizontalSpacing = 0; layout.marginWidth = 0; Composite versionComposite = new Composite(getContent(), SWT.NONE); versionComposite.setBounds(buildIdRectangle); versionComposite.setLayout(layout); Label idLabel = new Label(versionComposite, SWT.NONE); idLabel.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, true, true, 1, 1)); idLabel.setForeground(getForeground()); Font initialFont = idLabel.getFont(); FontData[] fontData = initialFont.getFontData(); for (int i = 0; i < fontData.length; i++) { fontData[i].setHeight(14); fontData[i].setStyle(SWT.BOLD); } _newFont = new Font(idLabel.getDisplay(), fontData); idLabel.setFont(_newFont); idLabel.setText(buildId); versionComposite.layout(true); } else { getContent(); // ensure creation of the progress } }
From source file:jp.sourceforge.tmdmaker.rcp.TMDSplashHandler.java
License:Apache License
/** * {@inheritDoc}/*from www .j a v a2 s . co m*/ * * @see org.eclipse.ui.splash.AbstractSplashHandler#init(org.eclipse.swt.widgets.Shell) */ @Override public void init(Shell splash) { // ?EclipseSplashHandler?? 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)); // ? String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$ String buildId = product.getProperty("buildId"); //$NON-NLS-1$ Rectangle buildIdRectangle = StringConverter.asRectangle(buildIdLocString, new Rectangle(322, 190, 100, 40)); Label idLabel = new Label(getContent(), SWT.RIGHT); idLabel.setForeground(getForeground()); idLabel.setBounds(buildIdRectangle); idLabel.setText(buildId); }
From source file:net.openchrom.rcp.compilation.community.ui.splash.EnhancedSplashHandler.java
License:Open Source License
@Override public void init(Shell splash) { super.init(splash); String progressString = null; String messageString = null;//from ww w. ja v a2 s .c o m /* * Try to get the progress bar and message updater. */ IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, new Rectangle(5, 275, 445, 15)); setProgressRect(progressRect); Rectangle messageRect = StringConverter.asRectangle(messageString, new Rectangle(7, 252, 445, 20)); setMessageRect(messageRect); }
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 w ww. j ava 2 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.eclipse.koneki.ldt.branding.splash.internal.SplashHandler.java
License:Open Source License
public void init(Shell splash) { super.init(splash); // get product information 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 . jav a 2 s. com // set message position Rectangle messageRect = StringConverter.asRectangle(messageRectString, DEFAULT_MESSAGE_RECT); setMessageRect(messageRect); // set progress position Rectangle progressRect = StringConverter.asRectangle(progressRectString, DEFAULT_PROGRESS_RECT); setProgressRect(progressRect); // get foreground color int foregroundColorInteger; try { foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); } catch (NumberFormatException ex) { foregroundColorInteger = DEFAULT_FOREGROUND_COLOR; } setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); String version = System.getProperty(Activator.PRODUCT_VERSION_PROPERTY); int lastIndexOf = version.lastIndexOf('.'); if (lastIndexOf != -1) version = version.substring(0, lastIndexOf); final String buildId = "Version: " + version; //$NON-NLS-1$ final Point position = new Point(280, 150); font = new Font(Display.getDefault(), new FontData("Helvetica", (Platform.getOS().equals(Platform.OS_MACOSX) ? 9 : 7), SWT.BOLD)); //$NON-NLS-1$ getContent().addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.setFont(font); e.gc.drawText(buildId, position.x, position.y, true); } }); }
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);//from w ww.ja 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); } }); }
From source file:org.eclipse.tracecompass.internal.tracing.rcp.ui.SplashHandler.java
License:Open Source License
@Override public void init(Shell splash) { super.init(splash); String progressString = null; // Try to get the progress bar and message updater. IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); }/*from ww w . j a v a2 s . com*/ Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE); setProgressRect(progressRect); // Set font color. setForeground(FOREGROUND_COLOR); // Set the software version. getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }
From source file:org.eclipse.ui.internal.splash.EclipseSplashHandler.java
License:Open Source License
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 ww w. j av a 2s. co 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 splash Graphic String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$ String buildIdSize = product.getProperty("buildIdSize"); //$NON-NLS-1$ if (buildIdLocString != null) { if (buildIdSize != null) { buildIdLocString += "," + buildIdSize; //$NON-NLS-1$ } else { buildIdLocString += ",100,40"; //$NON-NLS-1$ } } Rectangle buildIdRectangle = StringConverter.asRectangle(buildIdLocString, new Rectangle(322, 190, 100, 40)); Label idLabel = new Label(getContent(), SWT.RIGHT); idLabel.setForeground(getForeground()); idLabel.setBounds(buildIdRectangle); idLabel.setText(buildId); } else { getContent(); // ensure creation of the progress } }
From source file:org.jkiss.dbeaver.core.application.DBeaverSplashHandler.java
License:Open Source License
@Override public void init(Shell splash) { super.init(splash); 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); }/*from ww w. ja v a 2 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 = 0xD2D7FF; try { if (foregroundColorString != null) { foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); } } catch (Exception ex) { // ignore } setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); normalFont = getContent().getFont(); boldFont = UIUtils.makeBoldFont(normalFont); getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { String productVersion = ""; if (product != null) { productVersion = DBeaverCore.getProductTitle(); } String osVersion = Platform.getOS() + " " + Platform.getOSArch(); if (boldFont != null) { e.gc.setFont(boldFont); } Color fg = getForeground(); if (fg != null) { e.gc.setForeground(fg); } e.gc.drawText(productVersion, 20, 180, true); e.gc.drawText(osVersion, 115, 200, true); e.gc.setFont(normalFont); } }); getBundleProgressMonitor().beginTask("Loading", TOTAL_LOADING_TASKS); }