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:org.apache.felix.sigil.ui.eclipse.ui.util.ProjectUtils.java

License:Apache License

private static int checkRebuild(Shell shell) {
    if (SigilCore.getRoot().getProjects().isEmpty()) {
        return IDialogConstants.NO_ID;
    } else {//from   ww w .j  a  v  a 2  s.com
        return OptionalPrompt.optionallyPromptWithCancel(SigilCore.getDefault().getPreferenceStore(),
                SigilCore.PREFERENCES_REBUILD_PROJECTS, "Rebuild", "Do you wish to rebuild all Sigil projects",
                shell);
    }
}

From source file:org.apache.syncope.ide.eclipse.plugin.dialogs.LoginDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "Login", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    resetbutton = createButton(parent, IDialogConstants.NO_ID, "Reset Fields", false);
    resetbutton.addSelectionListener(new SelectionAdapter() {
        @Override//from   ww w .  j  a  va  2s  .  c o m
        public void widgetSelected(final SelectionEvent e) {
            deploymentUrlInp.setText("");
            usernameInp.setText("");
            passwordInp.setText("");

            // add to preferences
            saveInput();
        }
    });
}

From source file:org.bonitasoft.studio.common.jface.MessageDialogWithPrompt.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);

    boolean toggleState = getToggleState();
    IPreferenceStore prefStore = getPrefStore();
    String prefKey = getPrefKey();
    if (buttonId != IDialogConstants.CANCEL_ID && toggleState && prefStore != null && prefKey != null) {
        switch (buttonId) {
        case IDialogConstants.YES_ID:
        case IDialogConstants.YES_TO_ALL_ID:
        case IDialogConstants.PROCEED_ID:
        case IDialogConstants.OK_ID:
            prefStore.setValue(prefKey, toggleState);
            break;
        case IDialogConstants.NO_ID:
        case IDialogConstants.NO_TO_ALL_ID:
            break;
        }/*from  www.j  a va 2  s  .  c o m*/
    }
}

From source file:org.continuousassurance.swamp.eclipse.dialogs.AdvancedSettingsDialog.java

License:Apache License

@Override
/**/*w w w . j  a va  2 s.  c o m*/
 * Adds buttons to the buttons bar
 * @param parent Composite on which these buttons will be placed
 */
protected void createButtonsForButtonBar(Composite parent) {

    parent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    Button button = createButton(parent, IDialogConstants.NO_ID, DialogUtil.CLEAR_CAPTION, false);
    button.addSelectionListener(new ClearButtonSelectionListener());
    createButton(parent, IDialogConstants.OK_ID, DialogUtil.OK_CAPTION, true);
    createButton(parent, IDialogConstants.CANCEL_ID, DialogUtil.CANCEL_CAPTION, false);
}

From source file:org.continuousassurance.swamp.eclipse.dialogs.ConfigDialog.java

License:Apache License

@Override
/**/*from w  w w.j a v  a2  s . c om*/
 * Places buttons on ConfigDialog's button bar
 * @param parent Composite on which button bar will be placed
 */
protected void createButtonsForButtonBar(Composite parent) {

    parent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    Button advancedButton = createButton(parent, IDialogConstants.NO_ID, ADVANCED_SETTINGS, false);
    advancedButton.addSelectionListener(new AdvancedButtonSelectionListener(this));

    Button clearButton = createButton(parent, IDialogConstants.NO_ID, DialogUtil.CLEAR_CAPTION, false);
    clearButton.addSelectionListener(new ClearButtonSelectionListener());
    createButton(parent, IDialogConstants.OK_ID, DialogUtil.OK_CAPTION, true);
    createButton(parent, IDialogConstants.CANCEL_ID, DialogUtil.CANCEL_CAPTION, false);
}

From source file:org.continuousassurance.swamp.eclipse.dialogs.PlatformDialog.java

License:Apache License

/**
 * Creates buttons for the window's button bar
 *
 * @param parent the parent Composite that the buttons will be placed on 
 * top of//from   w w  w  .ja  v  a2 s  .c om
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    Button clear = createButton(parent, IDialogConstants.NO_ID, DialogUtil.CLEAR_CAPTION, false);
    clear.addSelectionListener(new ClearButtonSelectionListener());
    createButton(parent, IDialogConstants.BACK_ID, DialogUtil.BACK_CAPTION, false);
    createButton(parent, IDialogConstants.OK_ID, DialogUtil.OK_CAPTION, true);
    createButton(parent, IDialogConstants.CANCEL_ID, DialogUtil.CANCEL_CAPTION, false);
}

From source file:org.dawb.passerelle.common.perspective.WorkflowChecking.java

License:Open Source License

private void createWorkflowsPerspectiveListener() {

    final IWorkbenchPage page = EclipseUtils.getPage();
    if (page != null) {
        page.addPartListener(new IPartListener() {

            @Override/*  w ww  .j  a va 2 s. c o  m*/
            public void partOpened(IWorkbenchPart part) {
                checkWorkflowPerspective(part);
            }

            private void checkWorkflowPerspective(IWorkbenchPart part) {
                if (part instanceof IPasserelleMultiPageEditor) {

                    final String id = page.getPerspective().getId();
                    if (!id.equals(WorkflowPerspective.ID)) {

                        final IPreferenceStore store = Activator.getDefault().getPreferenceStore();

                        final String setting = store
                                .getString(PreferenceConstants.REMEMBER_WORKFLOWS_PERSPECTIVE);
                        boolean openWorkflows = false;
                        if (setting.equals(MessageDialogWithToggle.PROMPT)
                                && System.getProperty("org.dawb.test.session") == null) {
                            MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(
                                    page.getWorkbenchWindow().getShell(), "Open Workflow Perspective",
                                    "This kind of file is associated with the 'Workflow' Perspective.\n\nWould you like to switch to the workflow perspective now?",
                                    "Remember my decision", false, store,
                                    PreferenceConstants.REMEMBER_WORKFLOWS_PERSPECTIVE);

                            switch (dialog.getReturnCode()) {
                            case IDialogConstants.CANCEL_ID:
                                return;
                            case IDialogConstants.YES_ID:
                                openWorkflows = true;
                                break;
                            case IDialogConstants.NO_ID:
                                openWorkflows = false;
                                break;
                            }
                        } else if (setting.equals(MessageDialogWithToggle.ALWAYS)) {
                            openWorkflows = true;
                        }

                        if (openWorkflows) {
                            try {
                                PlatformUI.getWorkbench().showPerspective(WorkflowPerspective.ID,
                                        page.getWorkbenchWindow());
                            } catch (Exception ne) {
                                logger.error(ne.getMessage(), ne);
                            }
                        }
                    }
                }
            }

            @Override
            public void partDeactivated(IWorkbenchPart part) {
                // TODO Auto-generated method stub

            }

            @Override
            public void partClosed(IWorkbenchPart part) {
                // TODO Auto-generated method stub

            }

            @Override
            public void partBroughtToTop(IWorkbenchPart part) {
                // TODO Auto-generated method stub

            }

            @Override
            public void partActivated(IWorkbenchPart part) {
                // TODO Auto-generated method stub

            }
        });
    }
    ;
}

From source file:org.ebayopensource.vjet.eclipse.internal.ui.dialogs.UnknownContentTypeDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);

    // overwritten so that value stored is boolean, not string
    if (buttonId != IDialogConstants.CANCEL_ID && getToggleState() && getPrefStore() != null
            && getPrefKey() != null) {
        switch (buttonId) {
        case IDialogConstants.YES_ID:
        case IDialogConstants.YES_TO_ALL_ID:
        case IDialogConstants.PROCEED_ID:
        case IDialogConstants.OK_ID:
            getPrefStore().setValue(getPrefKey(), false);
            break;
        case IDialogConstants.NO_ID:
        case IDialogConstants.NO_TO_ALL_ID:
            getPrefStore().setValue(getPrefKey(), true);
            break;
        }/*from w  w w . j a  va 2s  .  c o m*/
    }

}

From source file:org.eclipse.andmore.android.common.utilities.EclipseUtils.java

License:Apache License

/**
 * Show a question message using the given title and message
 * //from  w w w.  ja  va  2s.c om
 * @param title
 *            of the dialog
 * @param message
 *            to be displayed in the dialog.
 */
public static int showQuestionYesAllCancelDialog(final String title, final String message) {
    class IntWrapper {
        public int diagReturn = 0;
    }

    final IntWrapper intWrapper = new IntWrapper();
    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            IWorkbench workbench = PlatformUI.getWorkbench();
            IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow();
            Shell shell = ww.getShell();
            MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                            IDialogConstants.NO_LABEL },
                    0);
            int diagResults = dialog.open();
            switch (diagResults) {
            case 0:
                intWrapper.diagReturn = IDialogConstants.YES_ID;
                break;
            case 1:
                intWrapper.diagReturn = IDialogConstants.YES_TO_ALL_ID;
                break;
            case 2:
            default:
                intWrapper.diagReturn = IDialogConstants.NO_ID;
                break;
            }
        }
    });

    return intWrapper.diagReturn;
}

From source file:org.eclipse.andmore.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;//ww  w  . j a va2  s . com
    }

    // 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 = AndmoreAndroidPlugin.getDefault().getPreferenceStore();
        String refactorPref = store.getString(AdtPrefs.PREFS_REFACTOR_IDS);
        boolean performRefactor = false;
        Shell shell = AndmoreAndroidPlugin.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;
}