Example usage for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID.

Prototype

int CLOSE_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID.

Click Source Link

Document

Button id for a "Close" button (value 12).

Usage

From source file:org.jkiss.dbeaver.ui.dialogs.sql.SQLScriptStatusDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CLOSE_ID) {
        okPressed();/*from  www. j a va 2  s .co  m*/
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:org.jkiss.dbeaver.ui.dialogs.sql.SQLScriptStatusDialog.java

License:Open Source License

@Override
public void endScriptProcessing() {
    getButton(IDialogConstants.CLOSE_ID).setEnabled(true);

    Composite progressPanel = progressBar.getParent();
    progressPanel.setVisible(false);/* w  w  w . j av  a  2  s . c o m*/
    ((GridData) progressPanel.getLayoutData()).exclude = true;

    finishLabel.setVisible(true);
    ((GridData) finishLabel.getLayoutData()).exclude = false;
    finishLabel.setText("Finished - " + processedCount + " object(s) processed");

    progressPanel.getParent().layout();
}

From source file:org.jkiss.dbeaver.ui.dialogs.VersionUpdateDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (newVersion != null) {
        createButton(parent, INFO_ID, CoreMessages.dialog_version_update_button_more_info, true);
    }//from ww w  .  jav  a  2s.  c  om

    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, newVersion == null);
}

From source file:org.pentaho.ui.xul.swt.tags.SwtDialog.java

License:Open Source License

public void hide() {
    // dialog.getShell().removeListener(SWT.Dispose, listener);
    if (closing || dialog.getMainArea().isDisposed() || getParentShell(getParent()).isDisposed()
            || (getParent() instanceof SwtDialog && ((SwtDialog) getParent()).isDisposing())) {
        return;/*from www  . j  a  va 2 s  .  c  om*/
    }
    closing = true;
    if (settingsManager != null) {
        settingsManager.storeSetting(getId() + ".Left", "" + dialog.getShell().getLocation().x);
        settingsManager.storeSetting(getId() + ".Top", "" + dialog.getShell().getLocation().y);
        settingsManager.storeSetting(getId() + ".Height", "" + dialog.getShell().getSize().y);
        settingsManager.storeSetting(getId() + ".Width", "" + dialog.getShell().getSize().x);
        try {
            settingsManager.save();
        } catch (IOException e) {
            logger.error(e);
        }
    }

    returnCode = IDialogConstants.CLOSE_ID;

    BasicDialog newDialog = createDialog(getParent());
    Control[] controlz = newDialog.getMainArea().getChildren();
    for (Control c : controlz) {
        c.dispose();
    }

    Control[] controls = dialog.getMainArea().getChildren();
    for (Control c : controls) {
        c.setParent(newDialog.getMainArea());
    }
    setButtons(newDialog);
    setAppicon(this.appIcon);

    newDialog.getShell().layout();
    BasicDialog outgoingDialog = dialog;
    dialog = newDialog;

    outgoingDialog.close();

    isDialogHidden = true;

    setManagedObject(dialog.getMainArea());
    closing = false;
}

From source file:org.qsos.interfaces.RadarDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OPEN_ID, Messages.getString("RadarDialog.buttonCreateRadar"), true); //$NON-NLS-1$

    createButton(parent, IDialogConstants.CLOSE_ID, Messages.getString("RadarDialog.close"), false); //$NON-NLS-1$

}

From source file:org.qsos.interfaces.RadarDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CLOSE_ID) {
        setReturnCode(buttonId);/*from   ww  w.  jav a 2s  . c o  m*/
        close();
    } else if (buttonId == IDialogConstants.OPEN_ID) {
        // When you push the button a new Image of the radar is create
        generateRadar.createRadar();
        close();
    }
}

From source file:org.rssowl.ui.internal.dialogs.PreviewFeedDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    Composite buttonBar = new Composite(parent, SWT.NONE);
    buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    buttonBar.setLayout(layout);/*from  w  ww  .j  av a  2 s . c o m*/

    /* Status Label */
    fStatusLabel = new Link(buttonBar, SWT.NONE);
    applyDialogFont(fStatusLabel);
    fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    if (StringUtils.isSet(fBookmark.getName()))
        fStatusLabel.setText(fBookmark.getName());

    /* Close */
    Button closeButton = createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
            false);
    closeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
        }
    });

    return buttonBar;
}

From source file:org.rssowl.ui.internal.dialogs.SearchNewsDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    Composite buttonBar = new Composite(parent, SWT.NONE);
    buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    buttonBar.setLayout(layout);/*from www.  ja v a2  s  .c  o m*/

    /* Status Label */
    fStatusLabel = new Link(buttonBar, SWT.NONE);
    fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fStatusLabel.setText(""); //$NON-NLS-1$
    applyDialogFont(fStatusLabel);
    fStatusLabel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onSave();
        }
    });

    /* Search */
    Button searchButton = createButton(buttonBar, BUTTON_SEARCH, Messages.SearchNewsDialog_SEARCH, true);
    ((GridData) searchButton.getLayoutData()).horizontalAlignment = SWT.END;
    ((GridData) searchButton.getLayoutData()).grabExcessHorizontalSpace = false;

    /* Clear */
    createButton(buttonBar, BUTTON_CLEAR, Messages.SearchNewsDialog_CLEAR, false);

    /* Close */
    Button closeButton = createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
            false);
    closeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
        }
    });

    return buttonBar;
}

From source file:org.rssowl.ui.internal.dialogs.StartupErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (!Application.IS_MAC && !Application.IS_LINUX) { //Somehow a restart fails on Linux/Mac if invoked early on startup
        createButton(parent, IDialogConstants.RETRY_ID, Messages.StartupErrorDialog_RESTART_RSSOWL, true);
        createButton(parent, IDialogConstants.CLOSE_ID, Messages.StartupErrorDialog_QUIT_RSSOWL, false);
        getButton(IDialogConstants.RETRY_ID).setFocus();
    } else {/*  ww  w  .  j av a 2  s .c om*/
        createButton(parent, IDialogConstants.CLOSE_ID, Messages.StartupErrorDialog_QUIT_RSSOWL, true);
        getButton(IDialogConstants.CLOSE_ID).setFocus();
    }
}

From source file:org.rubypeople.rdt.internal.ui.text.ruby.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in the default content
 * assist set and shows a link to the preferences.
 * //from  w  w  w  .  j av  a 2s .com
 * @since 3.3
 */
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = RubyPlugin.getActiveWorkbenchShell();
        String title = RubyTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = RubyTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                RubyTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        close();
                        PreferencesUtil.createPreferenceDialogOn(shell,
                                "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                                .open();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        if (restoreId == dialog.open()) {
            IPreferenceStore store = RubyPlugin.getDefault().getPreferenceStore();
            store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
            store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}