Example usage for org.eclipse.jface.window Window setDefaultImages

List of usage examples for org.eclipse.jface.window Window setDefaultImages

Introduction

In this page you can find the example usage for org.eclipse.jface.window Window setDefaultImages.

Prototype

public static void setDefaultImages(Image[] images) 

Source Link

Document

Sets the array of default images to use for newly opened windows.

Usage

From source file:au.com.cybersearch2.controls.PlatformTools.java

License:Open Source License

/**
 * Sets the array of default images to use for newly opened windows. It is
 * expected that the array will contain the same icon rendered at different
 * resolutions./*from  w  w w. j  av  a  2s  . c om*/
 * @param images List of image paths
 */
public void setDefaultImages(List<String> images) {
    // Window static method used to get logo in top left Cybertete windows 
    Image[] imageArray = new Image[images.size()];
    int index = 0;
    for (String image : images)
        imageArray[index++] = imageFactory.getImage(image);
    Window.setDefaultImages(imageArray);
}

From source file:org.eclipse.oomph.setup.internal.installer.InstallerApplication.java

License:Open Source License

protected Integer run(final IApplicationContext context) throws Exception {
    // This must come very early, before the first model is accessed, so that HTTPS can be authorized.
    P2Util.getCurrentProvisioningAgent().registerService(UIServices.SERVICE_NAME, Installer.SERVICE_UI);

    @SuppressWarnings("restriction")
    IProvisioningAgent agent = (IProvisioningAgent) org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper
            .getService(org.eclipse.equinox.internal.p2.repository.Activator.getContext(),
                    IProvisioningAgent.SERVICE_NAME);
    agent.registerService(UIServices.SERVICE_NAME, Installer.SERVICE_UI);

    final InstallerUI[] installerDialog = { null };

    Thread jreInitializer = new Thread("JRE Initializer") {
        @Override//from   w w w .ja v  a  2s.c  o  m
        public void run() {
            JREManager.INSTANCE.getJREs();

            for (;;) {
                InstallerUI installerUI = installerDialog[0];
                if (installerUI != null) {
                    installerUI.refreshJREs();
                    break;
                }

                try {
                    sleep(100);
                } catch (InterruptedException ex) {
                    return;
                }
            }
        }
    };

    jreInitializer.setDaemon(true);
    jreInitializer.start();

    int[] sizes = { 16, 32, 48, 64, 128, 256 };
    Image[] images = new Image[sizes.length];
    for (int i = 0; i < sizes.length; i++) {
        int size = sizes[i];
        images[i] = SetupInstallerPlugin.INSTANCE.getSWTImage("oomph" + size + ".png");
    }

    Window.setDefaultImages(images);

    boolean restarted = false;
    File restarting = new File(
            SetupContext.CONFIGURATION_STATE_LOCATION_URI.appendSegment("restarting").toFileString());
    SelectionMemento selectionMemento = null;

    if (restarting.exists()) {
        try {
            restarted = true;
            selectionMemento = (SelectionMemento) IOUtil.readObject(restarting, getClass().getClassLoader());
        } catch (Throwable ex) {
            //$FALL-THROUGH$
        } finally {
            try {
                restarting.delete();
            } catch (Throwable ex) {
                //$FALL-THROUGH$
            }
        }
    }

    final Display display = Display.getDefault();
    Display.setAppName(AbstractSetupDialog.SHELL_TEXT);
    handleCocoaMenu(display, installerDialog);

    if (context != null) {
        display.asyncExec(new Runnable() {
            public void run() {
                // End the splash screen once the dialog is up.
                context.applicationRunning();
            }
        });
    }

    String modeName = PropertiesUtil.getProperty(SetupProperties.PROP_SETUP_INSTALLER_MODE);
    if (modeName == null) {
        modeName = PREF_MODE.get(Mode.SIMPLE.name());
    }

    mode = Mode.valueOf(modeName.toUpperCase());

    for (;;) {
        if (selectionMemento == null) {
            selectionMemento = new SelectionMemento();
        }

        Installer installer = new Installer(selectionMemento);

        if (mode == Mode.ADVANCED) {
            if (KeepInstallerUtil.canKeepInstaller()) {
                Shell shell = new Shell(display);
                if (MessageDialog.openQuestion(shell, AbstractSetupDialog.SHELL_TEXT,
                        "As an advanced user, do you want to keep the installer in a permanent location?")) {
                    if (new KeepInstallerDialog(shell, true).open() == KeepInstallerDialog.OK) {
                        return EXIT_OK;
                    }
                }
            }

            installerDialog[0] = new InstallerDialog(null, installer, restarted);
        } else {
            SimpleInstallerDialog dialog = new SimpleInstallerDialog(display, installer, restarted);
            installer.setSimpleShell(dialog);
            installerDialog[0] = dialog;
        }

        final int retcode = installerDialog[0].show();
        if (retcode == InstallerUI.RETURN_SIMPLE) {
            setMode(Mode.SIMPLE);
            selectionMemento = null;
            continue;
        }

        if (retcode == InstallerUI.RETURN_ADVANCED) {
            setMode(Mode.ADVANCED);
            selectionMemento = null;
            continue;
        }

        if (retcode == InstallerUI.RETURN_RESTART) {
            try {
                IOUtil.writeObject(restarting, selectionMemento);
            } catch (Throwable ex) {
                //$FALL-THROUGH$
            }

            String launcher = getLauncher();
            if (launcher != null) {
                try {
                    // EXIT_RESTART often makes the new process come up behind other windows, so try a fresh native process first.
                    Runtime.getRuntime().exec(launcher);
                    return EXIT_OK;
                } catch (Throwable ex) {
                    //$FALL-THROUGH$
                }
            }

            return EXIT_RESTART;
        }

        return EXIT_OK;
    }
}

From source file:org.eclipse.ui.internal.Workbench.java

License:Open Source License

private static void initializeImages() {
    ImageDescriptor[] windowImages = WorkbenchPlugin.getDefault().getWindowImages();
    if (windowImages == null) {
        return;/*w w  w  .  ja va 2s. c o m*/
    }

    Image[] images = new Image[windowImages.length];
    for (int i = 0; i < windowImages.length; ++i) {
        images[i] = windowImages[i].createImage();
    }
    Window.setDefaultImages(images);
}