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

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

Introduction

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

Prototype

public static Image[] getDefaultImages() 

Source Link

Document

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

Usage

From source file:de.volanakis.ribbonide.internal.app.RibbonIDEApplication.java

License:Open Source License

@SuppressWarnings("deprecation")
@Override// w  w  w. ja v  a 2 s .  co m
public Object start(IApplicationContext appContext) throws Exception {
    Display display = createDisplay();

    try {

        // look and see if there's a splash shell we can parent off of
        Shell shell = WorkbenchPlugin.getSplashShell(display);
        if (shell != null) {
            // should should set the icon and message for this shell to be
            // the
            // same as the chooser dialog - this will be the guy that lives
            // in
            // the task bar and without these calls you'd have the default
            // icon
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Window.getDefaultImages());
        }

        if (!checkInstanceLocation(shell)) {
            WorkbenchPlugin.unsetSplashShell(display);
            Platform.endSplash();
            return EXIT_OK;
        }

        // create the workbench with this advisor and run it until it exits
        // N.B. createWorkbench remembers the advisor, and also registers
        // the workbench globally so that all UI plug-ins can find it using
        // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
        int returnCode = PlatformUI.createAndRunWorkbench(display, new RibbonIDEWorkbenchAdvisor());

        // the workbench doesn't support relaunch yet (bug 61809) so
        // for now restart is used, and exit data properties are checked
        // here to substitute in the relaunch return code if needed
        if (returnCode != PlatformUI.RETURN_RESTART) {
            return EXIT_OK;
        }

        // if the exit code property has been set to the relaunch code, then
        // return that code now, otherwise this is a normal restart
        return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH : EXIT_RESTART;
    } finally {
        if (display != null) {
            display.dispose();
        }
        Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc != null)
            instanceLoc.release();
    }
}

From source file:eu.numberfour.n4js.product.N4JSApplication.java

License:Open Source License

@Override
public Object start(final IApplicationContext appContext) throws Exception {
    final Display display = createDisplay();

    try {/*from  w w w  .  ja va2  s. co m*/

        // look and see if there's a splash shell we can parent off of
        final Shell shell = WorkbenchPlugin.getSplashShell(display);
        if (shell != null) {
            // should should set the icon and message for this shell to be the
            // same as the chooser dialog - this will be the guy that lives in
            // the task bar and without these calls you'd have the default icon
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Window.getDefaultImages());
        }

        final Object instanceLocationCheck = checkInstanceLocation(shell, appContext.getArguments());
        if (instanceLocationCheck != null) {
            WorkbenchPlugin.unsetSplashShell(display);
            appContext.applicationRunning();
            return instanceLocationCheck;
        }

        // create the workbench with this advisor and run it until it exits
        // N.B. createWorkbench remembers the advisor, and also registers
        // the workbench globally so that all UI plug-ins can find it using
        // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
        final int returnCode = createAndRunWorkbench(display, new N4JSApplicationWorkbenchAdvisor());

        // the workbench doesn't support relaunch yet (bug 61809) so
        // for now restart is used, and exit data properties are checked
        // here to substitute in the relaunch return code if needed
        if (returnCode != PlatformUI.RETURN_RESTART) {
            return EXIT_OK;
        }

        // if the exit code property has been set to the relaunch code, then
        // return that code now, otherwise this is a normal restart
        return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH : EXIT_RESTART;
    } finally {
        if (display != null) {
            display.dispose();
        }
        final Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc != null)
            instanceLoc.release();
    }
}

From source file:net.yatomiya.e4.ui.workbench.renderers.swt.WBWRenderer.java

License:Open Source License

@Override
public Object createWidget(MUIElement element, Object parent) {
    final Widget newWidget;

    if (!(element instanceof MWindow) || (parent != null && !(parent instanceof Control)))
        return null;

    MWindow wbwModel = (MWindow) element;

    MApplication appModel = wbwModel.getContext().get(MApplication.class);
    Boolean rtlMode = (Boolean) appModel.getTransientData().get(E4Workbench.RTL_MODE);
    int rtlStyle = (rtlMode != null && rtlMode.booleanValue()) ? SWT.RIGHT_TO_LEFT : 0;

    Shell parentShell = parent == null ? null : ((Control) parent).getShell();

    final Shell wbwShell;

    int styleOverride = getStyleOverride(wbwModel) | rtlStyle;
    if (parentShell == null) {
        int style = styleOverride == -1 ? SWT.SHELL_TRIM | rtlStyle : styleOverride;
        wbwShell = new Shell(display, style);
        wbwModel.getTags().add("topLevel"); //$NON-NLS-1$
    } else {//from  w  w w .ja v a2 s.  c om
        int style = SWT.TITLE | SWT.RESIZE | SWT.MAX | SWT.CLOSE | rtlStyle;
        style = styleOverride == -1 ? style : styleOverride;
        if (wbwModel.getTags().contains(IPresentationEngine.WINDOW_TOP_LEVEL))
            wbwShell = new Shell(display, style);
        else
            wbwShell = new Shell(parentShell, style);

        // Prevent ESC from closing the DW
        wbwShell.addTraverseListener(new TraverseListener() {
            @Override
            public void keyTraversed(TraverseEvent e) {
                if (e.detail == SWT.TRAVERSE_ESCAPE) {
                    e.doit = false;
                }
            }
        });
    }

    wbwShell.setBackgroundMode(SWT.INHERIT_DEFAULT);

    Rectangle modelBounds = wbwShell.getBounds();
    if (wbwModel instanceof EObject) {
        EObject wbw = (EObject) wbwModel;
        EClass wbwclass = wbw.eClass();
        // use eIsSet rather than embed sentinel values
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("x"))) { //$NON-NLS-1$
            modelBounds.x = wbwModel.getX();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("y"))) { //$NON-NLS-1$
            modelBounds.y = wbwModel.getY();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("height"))) { //$NON-NLS-1$
            modelBounds.height = wbwModel.getHeight();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("width"))) { //$NON-NLS-1$
            modelBounds.width = wbwModel.getWidth();
        }
    }
    // Force the shell onto the display if it would be invisible otherwise
    Rectangle displayBounds = Display.getCurrent().getBounds();
    if (!modelBounds.intersects(displayBounds)) {
        Rectangle clientArea = Display.getCurrent().getClientArea();
        modelBounds.x = clientArea.x;
        modelBounds.y = clientArea.y;
    }
    wbwShell.setBounds(modelBounds);

    setCSSInfo(wbwModel, wbwShell);

    // set up context
    IEclipseContext localContext = getContext(wbwModel);

    // We need to retrieve specific CSS properties for our layout.
    CSSEngineHelper helper = new CSSEngineHelper(localContext, wbwShell);
    TrimmedPartLayout tl = new TrimmedPartLayout(wbwShell);
    tl.gutterTop = helper.getMarginTop(0);
    tl.gutterBottom = helper.getMarginBottom(0);
    tl.gutterLeft = helper.getMarginLeft(0);
    tl.gutterRight = helper.getMarginRight(0);

    wbwShell.setLayout(tl);
    newWidget = wbwShell;
    bindWidget(element, newWidget);

    // Add the shell into the WBW's context
    localContext.set(Shell.class, wbwShell);
    localContext.set(E4Workbench.LOCAL_ACTIVE_SHELL, wbwShell);
    setCloseHandler(wbwModel);
    localContext.set(IShellProvider.class, new IShellProvider() {
        @Override
        public Shell getShell() {
            return wbwShell;
        }
    });
    final PartServiceSaveHandler saveHandler = new PartServiceSaveHandler() {
        @Override
        public Save promptToSave(MPart dirtyPart) {
            Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            Object[] elements = promptForSave(shell, Collections.singleton(dirtyPart));
            if (elements == null) {
                return Save.CANCEL;
            }
            return elements.length == 0 ? Save.NO : Save.YES;
        }

        @Override
        public Save[] promptToSave(Collection<MPart> dirtyParts) {
            List<MPart> parts = new ArrayList<>(dirtyParts);
            Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            Save[] response = new Save[dirtyParts.size()];
            Object[] elements = promptForSave(shell, parts);
            if (elements == null) {
                Arrays.fill(response, Save.CANCEL);
            } else {
                Arrays.fill(response, Save.NO);
                for (int i = 0; i < elements.length; i++) {
                    response[parts.indexOf(elements[i])] = Save.YES;
                }
            }
            return response;
        }
    };
    saveHandler.logger = logger;
    localContext.set(ISaveHandler.class, saveHandler);

    if (wbwModel.getLabel() != null)
        wbwShell.setText(wbwModel.getLocalizedLabel());

    if (wbwModel.getIconURI() != null && wbwModel.getIconURI().length() > 0) {
        wbwShell.setImage(getImage(wbwModel));
    } else {
        // TODO: This should be added to the model, see bug 308494
        // it allows for a range of icon sizes that the platform gets to
        // choose from
        wbwShell.setImages(Window.getDefaultImages());
    }

    return newWidget;
}

From source file:org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.java

License:Open Source License

public Object createWidget(MUIElement element, Object parent) {
    final Widget newWidget;

    if (!(element instanceof MWindow) || (parent != null && !(parent instanceof Control)))
        return null;

    MWindow wbwModel = (MWindow) element;

    MApplication appModel = wbwModel.getContext().get(MApplication.class);
    Boolean rtlMode = (Boolean) appModel.getTransientData().get(E4Workbench.RTL_MODE);
    int rtlStyle = (rtlMode != null && rtlMode.booleanValue()) ? SWT.RIGHT_TO_LEFT : 0;

    Shell parentShell = parent == null ? null : ((Control) parent).getShell();

    final Shell wbwShell;
    if (parentShell == null) {
        wbwShell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM | rtlStyle);
        wbwModel.getTags().add("topLevel"); //$NON-NLS-1$
    } else if (wbwModel.getTags().contains("dragHost")) { //$NON-NLS-1$
        wbwShell = new Shell(parentShell, SWT.BORDER | rtlStyle);
        wbwShell.setAlpha(110);/*from w w w  .j a v  a 2  s  .com*/
    } else {
        wbwShell = new Shell(parentShell, SWT.TITLE | SWT.RESIZE | SWT.MAX | SWT.CLOSE | rtlStyle);

        // Prevent ESC from closing the DW
        wbwShell.addTraverseListener(new TraverseListener() {
            public void keyTraversed(TraverseEvent e) {
                if (e.detail == SWT.TRAVERSE_ESCAPE) {
                    e.doit = false;
                }
            }
        });
    }

    wbwShell.setBackgroundMode(SWT.INHERIT_DEFAULT);

    Rectangle modelBounds = wbwShell.getBounds();
    if (wbwModel instanceof EObject) {
        EObject wbw = (EObject) wbwModel;
        EClass wbwclass = wbw.eClass();
        // use eIsSet rather than embed sentinel values
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("x"))) { //$NON-NLS-1$
            modelBounds.x = wbwModel.getX();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("y"))) { //$NON-NLS-1$
            modelBounds.y = wbwModel.getY();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("height"))) { //$NON-NLS-1$
            modelBounds.height = wbwModel.getHeight();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("width"))) { //$NON-NLS-1$
            modelBounds.width = wbwModel.getWidth();
        }
    }
    // Force the shell onto the display if it would be invisible otherwise
    Rectangle displayBounds = Display.getCurrent().getBounds();
    if (!modelBounds.intersects(displayBounds)) {
        Rectangle clientArea = Display.getCurrent().getClientArea();
        modelBounds.x = clientArea.x;
        modelBounds.y = clientArea.y;
    }
    wbwShell.setBounds(modelBounds);

    setCSSInfo(wbwModel, wbwShell);

    // set up context
    IEclipseContext localContext = getContext(wbwModel);

    // We need to retrieve specific CSS properties for our layout.
    CSSEngineHelper helper = new CSSEngineHelper(localContext, wbwShell);
    TrimmedPartLayout tl = new TrimmedPartLayout(wbwShell);
    tl.gutterTop = helper.getMarginTop(0);
    tl.gutterBottom = helper.getMarginBottom(0);
    tl.gutterLeft = helper.getMarginLeft(0);
    tl.gutterRight = helper.getMarginRight(0);

    wbwShell.setLayout(tl);
    newWidget = wbwShell;
    bindWidget(element, newWidget);

    // Add the shell into the WBW's context
    localContext.set(Shell.class.getName(), wbwShell);
    localContext.set(E4Workbench.LOCAL_ACTIVE_SHELL, wbwShell);
    setCloseHandler(wbwModel);
    localContext.set(IShellProvider.class.getName(), new IShellProvider() {
        public Shell getShell() {
            return wbwShell;
        }
    });
    localContext.set(ISaveHandler.class, new ISaveHandler() {
        public Save promptToSave(MPart dirtyPart) {
            Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            Object[] elements = promptForSave(shell, Collections.singleton(dirtyPart));
            if (elements == null) {
                return Save.CANCEL;
            }
            return elements.length == 0 ? Save.NO : Save.YES;
        }

        public Save[] promptToSave(Collection<MPart> dirtyParts) {
            List<MPart> parts = new ArrayList<MPart>(dirtyParts);
            Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            Save[] response = new Save[dirtyParts.size()];
            Object[] elements = promptForSave(shell, parts);
            if (elements == null) {
                Arrays.fill(response, Save.CANCEL);
            } else {
                Arrays.fill(response, Save.NO);
                for (int i = 0; i < elements.length; i++) {
                    response[parts.indexOf(elements[i])] = Save.YES;
                }
            }
            return response;
        }
    });

    if (wbwModel.getLabel() != null)
        wbwShell.setText(wbwModel.getLocalizedLabel());

    if (wbwModel.getIconURI() != null && wbwModel.getIconURI().length() > 0) {
        wbwShell.setImage(getImage(wbwModel));
    } else {
        // TODO: This should be added to the model, see bug 308494
        // it allows for a range of icon sizes that the platform gets to
        // choose from
        wbwShell.setImages(Window.getDefaultImages());
    }

    return newWidget;
}

From source file:org.eclipse.jubula.app.Launcher.java

License:Open Source License

/**
 * {@inheritDoc}// w w w .j a  va 2  s. c o m
 */
public Object start(IApplicationContext context) throws Exception {
    Display.setAppName(getAppName());
    Display display = createDisplay();

    try {

        // look and see if there's a splash shell we can parent off of
        Shell shell = WorkbenchPlugin.getSplashShell(display);
        if (shell != null) {
            // should should set the icon and message for this shell to be the 
            // same as the chooser dialog - this will be the guy that lives in
            // the task bar and without these calls you'd have the default icon 
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Window.getDefaultImages());
        }

        Object instanceLocationCheck = checkInstanceLocation(shell);
        if (instanceLocationCheck != null) {
            WorkbenchPlugin.unsetSplashShell(display);
            context.applicationRunning();
            return instanceLocationCheck;
        }

        // create the workbench with this advisor and run it until it exits
        // N.B. createWorkbench remembers the advisor, and also registers
        // the workbench globally so that all UI plug-ins can find it using
        // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
        int returnCode = PlatformUI.createAndRunWorkbench(display, getWorkbenchAdvisor());

        // the workbench doesn't support relaunch yet (bug http://eclip.se/61809) so
        // for now restart is used, and exit data properties are checked
        // here to substitute in the relaunch return code if needed
        if (returnCode != PlatformUI.RETURN_RESTART) {
            return EXIT_OK;
        }

        // if the exit code property has been set to the relaunch code, then
        // return that code now, otherwise this is a normal restart
        return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH : EXIT_RESTART;
    } finally {
        if (display != null && !display.isDisposed()) {
            display.dispose();
        }
        Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc != null) {
            instanceLoc.release();
        }
    }
}

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

License:Open Source License

public AbstractSimpleDialog(Display display, int style, int width, int height) {
    super(display, style);

    GridLayout verticalLayout = UIUtil.createGridLayout(1);
    verticalLayout.marginWidth = 1;/*from   w w w . j  av  a2s.c o m*/
    verticalLayout.marginHeight = 1;
    verticalLayout.verticalSpacing = 0;

    setLayout(verticalLayout);
    setSize(width, height);
    setImages(Window.getDefaultImages());
    setText(AbstractSetupDialog.SHELL_TEXT);

    setBackground(SetupInstallerPlugin.getColor(207, 207, 207));

    Rectangle bounds = display.getPrimaryMonitor().getBounds();
    setLocation(bounds.x + (bounds.width - width) / 2, bounds.y + (bounds.height - height) / 2);

    addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_ESCAPE) {
                exitSelected();
                e.detail = SWT.TRAVERSE_NONE;
                e.doit = false;
            }
        }
    });

    GridLayout titleLayout = UIUtil.createGridLayout(2);
    titleLayout.horizontalSpacing = 0;
    titleLayout.verticalSpacing = 0;
    titleLayout.marginLeft = 20;
    titleLayout.marginRight = 14;

    titleComposite = new Composite(this, SWT.NONE);
    titleComposite
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 72).create());
    titleComposite.setLayout(titleLayout);
    titleComposite.setBackgroundMode(SWT.INHERIT_FORCE);
    titleComposite.setBackground(AbstractSimpleDialog.COLOR_LIGHTEST_GRAY);

    Label titleImage = new Label(titleComposite, SWT.NONE);
    titleImage.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).indent(SWT.DEFAULT, 26)
            .align(SWT.BEGINNING, SWT.BEGINNING).create());
    titleImage.setImage(SetupInstallerPlugin.INSTANCE.getSWTImage("simple/title.png"));
}

From source file:org.eclipse.riena.e4.launcher.rendering.RienaWBWRenderer.java

License:Open Source License

@Override
public Object createWidget(final MUIElement element, final Object parent) {
    final Widget newWidget;

    if (!(element instanceof MWindow) || (parent != null && !(parent instanceof Control))) {
        return null;
    }/* w ww. j  av a  2  s.  c o m*/

    final MWindow wbwModel = (MWindow) element;

    final MApplication appModel = wbwModel.getContext().get(MApplication.class);
    final Boolean rtlMode = (Boolean) appModel.getTransientData().get(E4Workbench.RTL_MODE);
    final int rtlStyle = (rtlMode != null && rtlMode.booleanValue()) ? SWT.RIGHT_TO_LEFT : 0;

    final Shell parentShell = parent == null ? null : ((Control) parent).getShell();

    final Shell wbwShell;
    if (parentShell == null) {
        wbwShell = rienaCreateShell(rtlStyle, wbwModel);
        wbwModel.getTags().add("topLevel"); //$NON-NLS-1$
    } else if (wbwModel.getTags().contains("dragHost")) { //$NON-NLS-1$
        wbwShell = new Shell(parentShell, SWT.BORDER | rtlStyle);
        wbwShell.setAlpha(110);
    } else {
        wbwShell = new Shell(parentShell, SWT.TOOL | SWT.TITLE | SWT.RESIZE | rtlStyle);
    }

    wbwShell.setBackgroundMode(SWT.INHERIT_DEFAULT);

    final Rectangle modelBounds = wbwShell.getBounds();
    if (wbwModel instanceof EObject) {
        final EObject wbw = (EObject) wbwModel;
        final EClass wbwclass = wbw.eClass();
        // use eIsSet rather than embed sentinel values
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("x"))) { //$NON-NLS-1$
            modelBounds.x = wbwModel.getX();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("y"))) { //$NON-NLS-1$
            modelBounds.y = wbwModel.getY();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("height"))) { //$NON-NLS-1$
            modelBounds.height = wbwModel.getHeight();
        }
        if (wbw.eIsSet(wbwclass.getEStructuralFeature("width"))) { //$NON-NLS-1$
            modelBounds.width = wbwModel.getWidth();
        }
    }
    // Force the shell onto the display if it would be invisible otherwise
    final Rectangle displayBounds = Display.getCurrent().getBounds();
    if (!modelBounds.intersects(displayBounds)) {
        final Rectangle clientArea = Display.getCurrent().getClientArea();
        modelBounds.x = clientArea.x;
        modelBounds.y = clientArea.y;
    }
    wbwShell.setBounds(modelBounds);

    setCSSInfo(wbwModel, wbwShell);

    // set up context
    final IEclipseContext localContext = getContext(wbwModel);

    // We need to retrieve specific CSS properties for our layout.
    final CSSEngineHelper helper = new CSSEngineHelper(localContext, wbwShell);
    //      final TrimmedPartLayout tl = new TrimmedPartLayout(wbwShell);
    //      tl.gutterTop = helper.getMarginTop(0);
    //      tl.gutterBottom = helper.getMarginBottom(0);
    //      tl.gutterLeft = helper.getMarginLeft(0);
    //      tl.gutterRight = helper.getMarginRight(0);

    rienaCreateContents(wbwShell);

    //      wbwShell.setLayout(tl);
    newWidget = wbwShell;
    bindWidget(element, newWidget);

    // Add the shell into the WBW's context
    localContext.set(Shell.class.getName(), wbwShell);
    localContext.set(E4Workbench.LOCAL_ACTIVE_SHELL, wbwShell);
    setCloseHandler(wbwModel);
    localContext.set(IShellProvider.class.getName(), new IShellProvider() {
        public Shell getShell() {
            return wbwShell;
        }
    });
    localContext.set(ISaveHandler.class, new PartServiceSaveHandler() {
        @Override
        public Save promptToSave(final MPart dirtyPart) {
            final Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            final Object[] elements = promptForSave(shell, Collections.singleton(dirtyPart));
            if (elements == null) {
                return Save.CANCEL;
            }
            return elements.length == 0 ? Save.NO : Save.YES;
        }

        @Override
        public Save[] promptToSave(final Collection<MPart> dirtyParts) {
            final List<MPart> parts = new ArrayList<MPart>(dirtyParts);
            final Shell shell = (Shell) context.get(IServiceConstants.ACTIVE_SHELL);
            final Save[] response = new Save[dirtyParts.size()];
            final Object[] elements = promptForSave(shell, parts);
            if (elements == null) {
                Arrays.fill(response, Save.CANCEL);
            } else {
                Arrays.fill(response, Save.NO);
                for (int i = 0; i < elements.length; i++) {
                    response[parts.indexOf(elements[i])] = Save.YES;
                }
            }
            return response;
        }
    });

    if (wbwModel.getLabel() != null) {
        wbwShell.setText(wbwModel.getLocalizedLabel());
    }

    wbwShell.setImage(getImage(wbwModel));
    // TODO: This should be added to the model, see bug 308494
    wbwShell.setImages(Window.getDefaultImages());

    applicationView.doInitialBinding();

    return newWidget;
}

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

License:Open Source License

private void uninitializeImages() {
    WorkbenchImages.dispose();//from  w w w  .  j a  v  a  2 s .  co m
    Image[] images = Window.getDefaultImages();
    Window.setDefaultImage(null);
    for (int i = 0; i < images.length; i++) {
        images[i].dispose();
    }
}

From source file:org.kalypso.contribs.eclipse.ide.application.IDEApplicationCopy.java

License:Open Source License

@Override
public final Object start(final IApplicationContext appContext) throws Exception {
    // Kalypso specific: Set look and feel in case we are using SWT-AWT
    try {/*from  w  ww.j  av  a  2 s.  c  o  m*/
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (final Exception e) {
        e.printStackTrace();
    }

    final Display display = createDisplay();
    // processor must be created before we start event loop
    final DelayedEventsProcessor processor = new DelayedEventsProcessor(display);

    try {
        // look and see if there's a splash shell we can parent off of
        final Shell shell = WorkbenchPlugin.getSplashShell(display);
        if (shell != null) {
            // should should set the icon and message for this shell to be the
            // same as the chooser dialog - this will be the guy that lives in
            // the task bar and without these calls you'd have the default icon
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Window.getDefaultImages());
        }

        if (!checkInstanceLocation(shell)) {
            WorkbenchPlugin.unsetSplashShell(display);
            Platform.endSplash();
            return EXIT_OK;
        }

        // KALYPSO: let the real implementation decide which adivsor to use
        final WorkbenchAdvisor advisor = createWorkbenchAdvisor(processor);

        // create the workbench with this advisor and run it until it exits
        // N.B. createWorkbench remembers the advisor, and also registers
        // the workbench globally so that all UI plug-ins can find it using
        // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
        final int returnCode = PlatformUI.createAndRunWorkbench(display, advisor);

        // the workbench doesn't support relaunch yet (bug 61809) so
        // for now restart is used, and exit data properties are checked
        // here to substitute in the relaunch return code if needed
        if (returnCode != PlatformUI.RETURN_RESTART) {
            return EXIT_OK;
        }

        // if the exit code property has been set to the relaunch code, then
        // return that code now, otherwise this is a normal restart
        return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH : EXIT_RESTART;
    } finally {
        if (display != null) {
            display.dispose();
        }
        final Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc != null)
            instanceLoc.release();
    }
}

From source file:phasereditor.ide.intro.PhaserIDE.java

License:Open Source License

@Override
public Object start(IApplicationContext appContext) throws Exception {
    javafx.application.Platform.setImplicitExit(false);

    LicCore.startEvaluationThread();/*from   w  w w . j ava2  s.  c  o  m*/

    Display display = createDisplay();
    // processor must be created before we start event loop
    DelayedEventsProcessor processor = new DelayedEventsProcessor(display);

    try {

        // look and see if there's a splash shell we can parent off of
        Shell shell = WorkbenchPlugin.getSplashShell(display);
        if (shell != null) {
            // should should set the icon and message for this shell to be
            // the
            // same as the chooser dialog - this will be the guy that lives
            // in
            // the task bar and without these calls you'd have the default
            // icon
            // with no message.
            shell.setText(ChooseWorkspaceDialog.getWindowTitle());
            shell.setImages(Window.getDefaultImages());
        }

        Object instanceLocationCheck = checkInstanceLocation(shell, appContext.getArguments());
        if (instanceLocationCheck != null) {
            WorkbenchPlugin.unsetSplashShell(display);
            appContext.applicationRunning();
            return instanceLocationCheck;
        }

        // create the workbench with this advisor and run it until it exits
        // N.B. createWorkbench remembers the advisor, and also registers
        // the workbench globally so that all UI plug-ins can find it using
        // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench()
        int returnCode = PlatformUI.createAndRunWorkbench(display, new PhaserWorkbenchAdvisor(processor));

        // the workbench doesn't support relaunch yet (bug 61809) so
        // for now restart is used, and exit data properties are checked
        // here to substitute in the relaunch return code if needed
        if (returnCode != PlatformUI.RETURN_RESTART) {
            return EXIT_OK;
        }

        // if the exit code property has been set to the relaunch code, then
        // return that code now, otherwise this is a normal restart
        return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH : EXIT_RESTART;
    } finally {
        if (display != null) {
            display.dispose();
        }
        Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc != null)
            instanceLoc.release();
    }
}