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

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

Introduction

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

Prototype

public static void setDefaultImage(Image image) 

Source Link

Document

Sets the default image.

Usage

From source file:com.mindquarry.desktop.client.MindClient.java

License:Open Source License

protected Control createContents(Composite parent) {
    initRegistries();//w  w  w  .  j  av  a 2  s.  c  o m

    sashForm = new SashForm(parent, SWT.HORIZONTAL);
    sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));

    teamList = new TeamlistWidget(sashForm, SWT.NONE, this);
    createCategoryWidget(sashForm);

    ((UpdateWorkspacesAction) getAction(UpdateWorkspacesAction.class.getName())).setTeamList(teamList);
    ((SynchronizeTasksAction) getAction(SynchronizeTasksAction.class.getName())).setTeamList(teamList);

    // initialize window shell
    Window.setDefaultImage(JFaceResources.getImage(CLIENT_IMG_KEY));
    getShell().addListener(SWT.Show, new Listener() {
        private boolean first = true;

        public void handleEvent(Event event) {
            if (first) {
                first = false;
                // TODO: send start event
                refreshOnStartup();
            }
            getShell().setActive();
        }

    });
    getShell().addShellListener(new IconifyingShellListener());
    getShell().addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            saveOptions();
        }
    });
    getShell().setImage(JFaceResources.getImage(CLIENT_IMG_KEY));
    getShell().setText(APPLICATION_NAME);
    getShell().setSize(800, 600);

    createTrayIconAndMenu(Display.getDefault());

    if (storedEvent != null) {
        EventBus.send(storedEvent);
    }
    return parent;
}

From source file:com.mindquarry.desktop.minutes.editor.MinutesEditor.java

License:Open Source License

/**
 * Creates the main window's contents//ww w .j  av a2  s.c o m
 * 
 * @param parent the main window
 * @return Control
 */
@Override
protected Control createContents(Composite parent) {
    initRegistries();

    SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
    sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));

    new PeopleWidget(sashForm, SWT.BORDER);
    new ConversationWidget(sashForm, SWT.BORDER);

    sashForm.setWeights(new int[] { 1, 3 });

    // init window shell
    Window.setDefaultImage(JFaceResources.getImage(EDITOR_IMG_KEY));
    getShell().setImage(JFaceResources.getImage(EDITOR_IMG_KEY));
    getShell().setText(EDITOR_TITLE);
    getShell().setSize(600, 400);

    setStatus("Ready.");
    return parent;
}

From source file:org.eclipse.andmore.internal.editors.manifest.model.UiPackageAttributeNode.java

License:Open Source License

/**
 * Handles response to the Browse button by creating a Package dialog.
 * *///from  w  w w . j  a  v a 2 s  .  c o m
private void doBrowseClick() {
    Text text = getTextWidget();

    // we need to get the project of the manifest.
    IProject project = getProject();
    if (project != null) {

        try {
            SelectionDialog dlg = JavaUI.createPackageDialog(text.getShell(), JavaCore.create(project), 0);
            dlg.setTitle("Select Android Package");
            dlg.setMessage("Select the package for the Android project.");
            Window.setDefaultImage(AndmoreAndroidPlugin.getAndroidLogo());

            if (dlg.open() == Window.OK) {
                Object[] results = dlg.getResult();
                if (results.length == 1) {
                    setPackageTextField((IPackageFragment) results[0]);
                }
            }
        } catch (JavaModelException e1) {
        }
    }
}

From source file:org.eclipse.ptp.gem.util.GemUtilities.java

License:Open Source License

/**
 * Sets the number of processes for the next run of GEM. Updates the drop
 * down list boxes in the GEM views if they are open.
 * //w  w w.  ja  va  2 s .  c  o m
 * @param none
 * @return void
 */
public static void setNumProcesses() {
    final Shell shell = Display.getCurrent().getActiveShell();
    final IPreferenceStore pstore = GemPlugin.getDefault().getPreferenceStore();
    Integer numProcs = pstore.getInt(PreferenceConstants.GEM_PREF_NUMPROCS);
    final String title = Messages.GemUtilities_9;
    final String message = Messages.GemUtilities_10;
    final InputDialog dlg = new InputDialog(shell, title, message, numProcs.toString(),
            new NumProcsValidator());
    Window.setDefaultImage(GemPlugin.getImageDescriptor("icons/processes.gif").createImage()); //$NON-NLS-1$
    dlg.open();

    // This avoids and ui event loop exception
    if (dlg.getReturnCode() == Window.CANCEL) {
        return;
    }

    numProcs = Integer.parseInt(dlg.getValue());
    pstore.setValue(PreferenceConstants.GEM_PREF_NUMPROCS, dlg.getValue());

    // Update the drop down in the Analyzer
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IViewPart gemViewPart = window.getActivePage().findView(GemAnalyzer.ID);
    if (gemViewPart != null) {
        final GemAnalyzer analyzer = (GemAnalyzer) gemViewPart;
        analyzer.updateDropDown();
    }

    // Update the drop down in the Issue Browser
    window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IViewPart browserViewPart = window.getActivePage().findView(GemBrowser.ID);
    if (browserViewPart != null) {
        final GemBrowser browser = (GemBrowser) browserViewPart;
        browser.updateDropDown();
    }
}

From source file:org.eclipse.ptp.internal.gem.util.GemUtilities.java

License:Open Source License

/**
 * Sets the number of processes for the next run of GEM. Updates the drop
 * down list boxes in the GEM views if they are open.
 * /*w ww  .j ava2 s.c o  m*/
 * @param none
 * @return void
 */
public static void setNumProcesses() {
    final Shell shell = Display.getCurrent().getActiveShell();
    final IPreferenceStore pstore = GemPlugin.getDefault().getPreferenceStore();
    Integer numProcs = pstore.getInt(PreferenceConstants.GEM_PREF_NUMPROCS);
    final String title = Messages.GemUtilities_9;
    final String message = Messages.GemUtilities_10;
    final InputDialog dlg = new InputDialog(shell, title, message, numProcs.toString(),
            new NumProcsValidator());
    Window.setDefaultImage(GemPlugin.getImageDescriptor("icons/processes.gif").createImage()); //$NON-NLS-1$
    dlg.open();

    // This avoids a UI event loop exception
    if (dlg.getReturnCode() == Window.CANCEL) {
        return;
    }

    numProcs = Integer.parseInt(dlg.getValue());
    pstore.setValue(PreferenceConstants.GEM_PREF_NUMPROCS, dlg.getValue());

    // Update the drop down in the Analyzer
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IViewPart gemViewPart = window.getActivePage().findView(GemAnalyzer.ID);
    if (gemViewPart != null) {
        final GemAnalyzer analyzer = (GemAnalyzer) gemViewPart;
        analyzer.updateDropDown();
    }

    // Update the drop down in the Issue Browser
    window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final IViewPart browserViewPart = window.getActivePage().findView(GemBrowser.ID);
    if (browserViewPart != null) {
        final GemBrowser browser = (GemBrowser) browserViewPart;
        browser.updateDropDown();
    }
}

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.jlibrary.client.JLibraryWorkbenchWindowAdvisor.java

License:Open Source License

public void postWindowOpen() {

    super.postWindowOpen();
    synchronized (RepositoryRegistry.getInstance()) {
        if (!RepositoryRegistry.getInstance().isReopenedRepositories()) {
            RepositoryRegistry.getInstance().reopenRepositories();
        }/*w  ww  .j a v a2s .  c om*/
    }
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    Window.setDefaultImage(SharedImages.getImage(SharedImages.IMAGE_JLIBRARY));

    configurer.setTitle(Messages.getMessage("jlibrary_title"));

    //TrayManager.initTray(configurer.getWindow());

    configurer.getWorkbenchConfigurer().getWorkbench().addWindowListener(new IWindowListener() {
        public void windowActivated(IWorkbenchWindow window) {
            if (RepositoryView.getInstance() != null) {
                RepositoryActionGroup group = RepositoryView.getInstance().getActionManager();
                CCPActionGroup ccp = group.getCCPActionGroup();
                ccp.getPasteAction().update(RepositoryView.getRepositoryViewer().getSelection());
            }
        }

        public void windowClosed(IWorkbenchWindow window) {
        }

        public void windowDeactivated(IWorkbenchWindow window) {
            if (RepositoryView.getInstance() != null) {
                RepositoryActionGroup group = RepositoryView.getInstance().getActionManager();
                CCPActionGroup ccp = group.getCCPActionGroup();
                ccp.getPasteAction().update(RepositoryView.getRepositoryViewer().getSelection());
            }
        }

        public void windowOpened(IWorkbenchWindow window) {
        }
    });

    Shell shell = configurer.getWindow().getShell();
    shell.setImage(SharedImages.getImage(SharedImages.IMAGE_JLIBRARY));
}

From source file:org.pentaho.pms.ui.MetaEditor.java

License:Open Source License

public static void main(String[] args) throws Exception {

    KettleEnvironment.init(false);//from w w  w  . ja  v a  2 s .  com

    System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory"); //$NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("org.osjava.sj.root", "simple-jndi"); //$NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("org.osjava.sj.delimiter", "/"); //$NON-NLS-1$ //$NON-NLS-2$
    LogWriter logwriter = LogWriter.getInstance(Const.META_EDITOR_LOG_FILE, false);

    LogChannel log = new LogChannel(APPLICATION_NAME);

    Display display = new Display();

    if (!Props.isInitialized()) {
        Const.checkPentahoMetadataDirectory();
        PropsUI.init(display, Const.getPropertiesFile()); // things to remember...
    }

    Window.setDefaultImage(Constants.getImageRegistry(Display.getCurrent()).get("pentaho-icon")); //$NON-NLS-1$

    Splash splash = new Splash(display);

    final MetaEditor win = new MetaEditor(log, display);

    // Read kettle transformation specified on command-line?
    if (args.length == 1 && !Const.isEmpty(args[0])) {
        if (CWM.exists(args[0])) // Only try to load the domain if it exists.
        {
            win.cwm = CWM.getInstance(args[0]);
            CwmSchemaFactoryInterface cwmSchemaFactory = Settings.getCwmSchemaFactory();
            win.schemaMeta = cwmSchemaFactory.getSchemaMeta(win.cwm);
            win.setDomainName(args[0]);
            win.schemaMeta.clearChanged();
        } else {
            win.newFile();
        }
    } else {
        if (win.props.openLastFile()) {
            String lastfiles[] = win.props.getLastFiles();
            if (lastfiles.length > 0) {
                try {
                    if (CWM.exists(lastfiles[0])) // Only try to load the domain if it exists.
                    {
                        win.cwm = CWM.getInstance(lastfiles[0]);
                        CwmSchemaFactoryInterface cwmSchemaFactory = Settings.getCwmSchemaFactory();
                        win.schemaMeta = cwmSchemaFactory.getSchemaMeta(win.cwm);
                        win.setDomainName(lastfiles[0]);
                        win.schemaMeta.clearChanged();
                    } else {
                        win.newFile();
                    }
                } catch (Exception e) {
                    log.logError(Messages.getString("MetaEditor.ERROR_0001_CANT_CHECK_DOMAIN_EXISTENCE", //$NON-NLS-1$
                            e.toString()));
                    log.logError(Const.getStackTracker(e));
                }
            } else {
                win.newFile();
            }
        } else {
            win.newFile();
        }
    }

    splash.hide();

    win.open();
    while (!win.isDisposed()) {
        if (!win.readAndDispatch())
            win.sleep();
    }
    win.dispose();

    // Close the logfile...
    logwriter.close();
}

From source file:org.pwsafe.passwordsafeswt.action.OptionsAction.java

License:Open Source License

/**
 * @see org.eclipse.jface.action.Action#run()
 *///  ww w  . j  ava  2  s . com
@Override
public void run() {
    final PasswordSafeJFace app = PasswordSafeJFace.getApp();

    // Create the preference manager
    PreferenceManager mgr = new PreferenceManager();

    // Create the nodes
    PreferenceNode displayPrefs = new PreferenceNode("display", Messages.getString("OptionsAction.DisplayNode"), //$NON-NLS-1$//$NON-NLS-2$
            null, DisplayPreferences.class.getName());
    PreferenceNode securityPrefs = new PreferenceNode("security", //$NON-NLS-1$
            Messages.getString("OptionsAction.SecurityNode"), null, SecurityPreferences.class //$NON-NLS-1$
                    .getName());
    PreferenceNode passwordPolicyPrefs = new PreferenceNode("policy", //$NON-NLS-1$
            Messages.getString("OptionsAction.PolicyNode"), null, //$NON-NLS-1$
            PasswordPolicyPreferences.class.getName());
    PreferenceNode usernamePrefs = new PreferenceNode("username", //$NON-NLS-1$
            Messages.getString("OptionsAction.UserNameNode"), null, UsernamePreferences.class //$NON-NLS-1$
                    .getName());
    PreferenceNode miscPrefs = new PreferenceNode("misc", Messages.getString("OptionsAction.MiscNode"), null, //$NON-NLS-1$//$NON-NLS-2$
            MiscPreferences.class.getName());

    // Add the nodes
    mgr.addToRoot(displayPrefs);
    mgr.addToRoot(securityPrefs);
    mgr.addToRoot(passwordPolicyPrefs);
    mgr.addToRoot(usernamePrefs);
    mgr.addToRoot(miscPrefs);

    // Create the preferences dialog
    PreferenceDialog dlg = new PreferenceDialog(app.getShell(), mgr);
    Window.setDefaultImage(
            IOUtils.getImage(PasswordSafeJFace.class, "/org/pwsafe/passwordsafeswt/images/clogo.gif")); //$NON-NLS-1$

    // Set the preference store
    dlg.setPreferenceStore(JFacePreferences.getPreferenceStore());

    // Open the dialog
    dlg.open();

    try {
        if (JFacePreferences.getPreferenceStore().needsSaving()) {
            // Be Paranoid - Save the preferences now
            UserPreferences.getInstance().savePreferences();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:org.pwsafe.passwordsafeswt.PasswordSafeJFace.java

License:Open Source License

/**
 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
 */// w ww  .  ja  va2s .  c  o  m
@Override
protected void configureShell(final Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(PasswordSafeJFace.APP_NAME);
    final Image jpwIcon = IOUtils.getImage(PasswordSafeJFace.class,
            "/org/pwsafe/passwordsafeswt/images/cpane.ico"); //$NON-NLS-1$
    newShell.setImage(jpwIcon);
    // provide it for the rest of jpwsafe:
    JFaceResources.getImageRegistry().put(JPW_ICON, jpwIcon);
    Window.setDefaultImage(jpwIcon);
    WidgetPreferences.tuneShell(newShell, getClass());
    startOpeningDialogThread(newShell);
}