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

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

Introduction

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

Prototype

int NO_ID

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

Click Source Link

Document

Button id for a "No" button (value 3).

Usage

From source file:ch.elexis.core.ui.dialogs.KontaktSelektor.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (enableEmptyField) {
        parent.setLayout(new GridLayout(3, false));
        Button btnClear = createButton(parent, IDialogConstants.NO_ID, Messages.KontaktSelector_clearField,
                false);/*from   w w w  .j  ava2  s  . c  om*/
        btnClear.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                selection = null;
                vc.getContentProvider().stopListening();
                close();
            }
        });
    } else {
        parent.setLayout(new GridLayout(2, false));
    }

    createButton(parent, IDialogConstants.OK_ID, "OK", false);
    createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
}

From source file:ch.elexis.core.ui.importer.div.importers.dialog.QueryOverwriteDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//  www  . j a  va  2  s .c  o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button buttonNo = createButton(parent, IDialogConstants.NO_ID, IDialogConstants.OK_LABEL, true);
    buttonNo.setText(Messages.QueryOverwriteDialog_NO);
    Button buttonYesToAll = createButton(parent, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.CANCEL_LABEL,
            false);
    buttonYesToAll.setText(Messages.QueryOverwriteDialog_YESTOALL);
    Button buttonYes = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.CANCEL_LABEL, false);
    buttonYes.setText(Messages.QueryOverwriteDialog_YES);
}

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private int isOveride(String name, String obTypeName) {

    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_12, null,
            Messages.ImportItemsWizard_13 + obTypeName + Messages.ImportItemsWizard_14 + name
                    + Messages.ImportItemsWizard_15,
            MessageDialog.QUESTION,/* www  . j  a va  2  s .com*/
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            0);
    dialog.open();
    int result = dialog.getReturnCode();
    if (result == 0) {
        return IDialogConstants.YES_ID;
    }
    if (result == 1) {
        return IDialogConstants.YES_TO_ALL_ID;
    }
    if (result == 2) {
        return IDialogConstants.NO_ID;
    }
    return IDialogConstants.CANCEL_ID;

}

From source file:com.android.ide.eclipse.adt.internal.editors.layout.properties.XmlPropertyEditor.java

License:Open Source License

@Override
protected boolean setEditorText(Property property, String text) throws Exception {
    Object oldValue = property.getValue();
    String old = oldValue != null ? oldValue.toString() : null;

    // If users enters a new id without specifying the @id/@+id prefix, insert it
    boolean isId = isIdProperty(property);
    if (isId && !text.startsWith(PREFIX_RESOURCE_REF)) {
        text = NEW_ID_PREFIX + text;/*from  w  w  w. ja v  a 2  s .co  m*/
    }

    // Handle id refactoring: if you change an id, may want to update references too.
    // Ask user.
    if (isId && property instanceof XmlProperty && old != null && !old.isEmpty() && text != null
            && !text.isEmpty() && !text.equals(old)) {
        XmlProperty xmlProperty = (XmlProperty) property;
        IPreferenceStore store = AdtPlugin.getDefault().getPreferenceStore();
        String refactorPref = store.getString(AdtPrefs.PREFS_REFACTOR_IDS);
        boolean performRefactor = false;
        Shell shell = AdtPlugin.getShell();
        if (refactorPref == null || refactorPref.isEmpty()
                || refactorPref.equals(MessageDialogWithToggle.PROMPT)) {
            MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(shell,
                    "Update References?",
                    "Update all references as well? "
                            + "This will update all XML references and Java R field references.",
                    "Do not show again", false, store, AdtPrefs.PREFS_REFACTOR_IDS);
            switch (dialog.getReturnCode()) {
            case IDialogConstants.CANCEL_ID:
                return false;
            case IDialogConstants.YES_ID:
                performRefactor = true;
                break;
            case IDialogConstants.NO_ID:
                performRefactor = false;
                break;
            }
        } else {
            performRefactor = refactorPref.equals(MessageDialogWithToggle.ALWAYS);
        }
        if (performRefactor) {
            CommonXmlEditor xmlEditor = xmlProperty.getXmlEditor();
            if (xmlEditor != null) {
                IProject project = xmlEditor.getProject();
                if (project != null && shell != null) {
                    RenameResourceWizard.renameResource(shell, project, ResourceType.ID, stripIdPrefix(old),
                            stripIdPrefix(text), false);
                }
            }
        }
    }

    property.setValue(text);

    return true;
}

From source file:com.aptana.ide.debug.internal.ui.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *//* ww w . j a  v a2s  . c  o  m*/
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = DebugUiPlugin.getActiveWorkbenchShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtils.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/pro/pdm.php", "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ //$NON-NLS-2$
            /* continue */
        case 1:
            return new Boolean(true);
        case 3:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/docs/index.php/Installing_the_IE_debugger"); //$NON-NLS-1$
            return new Boolean(true);
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning,
                        new String[] { ((String) source).substring(5) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        new String[] { ((String) source).substring(10) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                    ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                    : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
        }
    }
    IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return new Boolean(true);
        }
    }
    String message = StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            new String[] { (String) source });

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return new Boolean(true);
        case IDialogConstants.NO_ID:
            return new Boolean(false);
        default:
            break;
        }
        WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
    }
}

From source file:com.aptana.js.debug.ui.internal.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *///from ww w  .  j  a v a2 s  .  com
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = UIUtils.getActiveShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtil.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_INSTALL_PDM, "org.eclipse.ui.browser.ie"); //$NON-NLS-1$
            return Boolean.TRUE;
        case 1:
            return Boolean.TRUE;
        case 3:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_DOCS_INSTALL_IE_DEBUGGER);
            return Boolean.TRUE;
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title, MessageFormat.format(
                Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, ((String) source).substring(5)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        ((String) source).substring(10)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                    ? URL_DOCS_INSTALL_IE_DEBUGGER
                    : URL_DOCS_INSTALL_DEBUGGER;
            WorkbenchBrowserUtil.launchExternalBrowser(urlString);
        }
    }
    IPreferenceStore store = JSDebugUIPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return Boolean.TRUE;
        }
    }
    String message = MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            (String) source);

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return Boolean.TRUE;
        case IDialogConstants.NO_ID:
            return Boolean.FALSE;
        default:
            break;
        }
        String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                ? URL_DOCS_INSTALL_IE_DEBUGGER
                : URL_DOCS_INSTALL_DEBUGGER;
        WorkbenchBrowserUtil.launchExternalBrowser(urlString);
    }
}

From source file:com.astra.ses.spell.gui.dialogs.PromptDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*from w ww .ja v  a 2 s.co  m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    if (m_type == OPT_OK)
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    else if (m_type == OPT_YES)
        createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    else if (m_type == OPT_NO)
        createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    else if (m_type == OPT_CANCEL)
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    else if (m_type == OPT_NUM || m_type == OPT_ALPHA || m_type == OPT_ANY) {
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    } else if (m_type == OPT_YES_NO) {
        createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
        createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    } else if (m_type == OPT_OK_CANCEL) {
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    }
}

From source file:com.astra.ses.spell.gui.dialogs.PromptDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * /*from  w  w  w .  ja v  a2s  .c  o m*/
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
    case IDialogConstants.CANCEL_ID:
    case IDialogConstants.YES_ID:
    case IDialogConstants.NO_ID:
        if (m_input == null) {
            if (buttonId == IDialogConstants.OK_ID)
                m_future.set("TRUE");
            if (buttonId == IDialogConstants.YES_ID)
                m_future.set("TRUE");
            if (buttonId == IDialogConstants.CANCEL_ID)
                m_future.set("FALSE");
            if (buttonId == IDialogConstants.NO_ID)
                m_future.set("FALSE");
        } else {
            String txt = m_input.getText();
            m_future.set(txt);
        }
    }
    close();
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.VersionableSaveDialog.java

License:Apache License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.NO_ID) {
        setReturnCode(CLOSE_WITHOUT_SAVE);
        close();/*from   w  w w.  j av a2  s. c o  m*/
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:com.centurylink.mdw.plugin.designer.dialogs.VersionableSaveDialog.java

License:Apache License

protected void createButtonsForButtonBar(Composite parent) {
    saveButton = createButton(parent, IDialogConstants.OK_ID, "Save", true);
    if (versionable.getProject().isProduction())
        saveButton.setEnabled(false);//from  w  w w .  j a v a  2s.c o m

    if (hasCloseWithoutSaveOption)
        createButton(parent, IDialogConstants.NO_ID, "Don't Save", false);

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}