Example usage for org.eclipse.jface.dialogs MessageDialogWithToggle NEVER

List of usage examples for org.eclipse.jface.dialogs MessageDialogWithToggle NEVER

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialogWithToggle NEVER.

Prototype

String NEVER

To view the source code for org.eclipse.jface.dialogs MessageDialogWithToggle NEVER.

Click Source Link

Document

The value of the preference when the user has asked that the answer to the question always be "no".

Usage

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

License:Open Source License

/**
 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
 */// ww  w . j  a v a2 s. co  m
public void initializeDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope()
            .getNode(DebugUiPlugin.getDefault().getBundle().getSymbolicName());

    // default preferences
    node.putBoolean(IDebugUIConstants.PREF_CONFIRM_EXIT_DEBUGGER, true);
    node.put(IDebugUIConstants.PREF_SHOW_DETAILS, IDebugUIConstants.DETAIL_PANE);
    node.putBoolean(IDebugUIConstants.PREF_SHOW_CONSTANTS, false);

    // override default org.eclipse.debug.ui options
    node = new DefaultScope().getNode(DebugUIPlugin.getDefault().getBundle().getSymbolicName());
    if (MessageDialogWithToggle.NEVER
            .equals(node.get(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, ""))) {
        node.put(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, "prompt"); //$NON-NLS-1$
    }
}

From source file:com.aptana.ide.editors.preferences.AdvancedPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
 * types of preferences. Each field editor knows how to save and restore itself.
 *//*from   ww  w. j av  a  2s .  c om*/
public void createFieldEditors() {
    addTab(Messages.AdvancedPreferencePage_User);
    Composite appearanceComposite = getFieldEditorParent();
    addField(new StringFieldEditor(com.aptana.ide.core.ui.preferences.IPreferenceConstants.PREF_USER_NAME,
            com.aptana.ide.core.ui.preferences.Messages.GeneralPreferencePage_EmailAddressForBugReports,
            appearanceComposite));
    switchPerspectiveField = new RadioGroupFieldEditor(IPreferencesConstants2.SWITCH_TO_APTANA_PRESPECTIVE,
            Messages.AdvancedPreferencePage_switchToAptanaPerspective, 3,
            new String[][] { { Messages.AdvancedPreferencePage_Always, MessageDialogWithToggle.ALWAYS },
                    { Messages.AdvancedPreferencePage_Never, MessageDialogWithToggle.NEVER },
                    { Messages.AdvancedPreferencePage_Prompt, MessageDialogWithToggle.PROMPT } },
            appearanceComposite, true);
    addField(switchPerspectiveField);
    if (Platform.OS_WIN32.equals(Platform.getOS())) {
        Group ieGroup = new Group(appearanceComposite, SWT.NONE);
        GridData ieData = new GridData(SWT.FILL, SWT.FILL, true, true);
        ieData.horizontalSpan = 2;
        ieGroup.setLayoutData(ieData);
        ieGroup.setLayout(new GridLayout(1, true));
        ieGroup.setText(Messages.AdvancedPreferencePage_IESettings);

        notepad = new Button(ieGroup, SWT.RADIO);
        notepad.setText(Messages.AdvancedPreferencePage_AssociateWithNotepad);
        notepad.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                setErrorMessage(null);
                setValid(true);
            }

        });

        otherButton = new Button(ieGroup, SWT.RADIO);
        otherButton.setText(Messages.AdvancedPreferencePage_AssociateWithOther);

        Composite other = new Composite(ieGroup, SWT.NONE);
        GridLayout otherLayout = new GridLayout(2, false);
        otherLayout.marginHeight = 0;
        other.setLayout(otherLayout);
        other.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

        text = new Text(other, SWT.BORDER | SWT.SINGLE);
        text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        text.setEditable(false);
        text.setEnabled(false);
        browse = new Button(other, SWT.PUSH);
        browse.setEnabled(false);
        browse.setText(StringUtils.ellipsify(CoreStrings.BROWSE));
        browse.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                FileDialog dialog = new FileDialog(browse.getShell(), SWT.OPEN);
                String program = dialog.open();
                if (program != null) {
                    text.setText(program);
                    setErrorMessage(null);
                    setValid(true);
                }
            }

        });
        otherButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                boolean selection = otherButton.getSelection();
                browse.setEnabled(selection);
                text.setEnabled(selection);
                if (!selection) {
                    text.setText(""); //$NON-NLS-1$
                } else {
                    if (text.getText().length() < 1) {
                        setErrorMessage(Messages.AdvancedPreferencePage_PleaseSpecifyApplication);
                        setValid(false);
                    }
                }
            }

        });
        String current = null;
        try {
            current = PlatformUtils.queryRegestryStringValue(IE_PREVIEW_KEY, null);
        } catch (Exception e) {
            IdeLog.logError(UnifiedEditorsPlugin.getDefault(),
                    Messages.AdvancedPreferencePage_ERR_ErrorGettingRegistryValue, e);
        }
        if (current != null) {
            if (current.equalsIgnoreCase(IE_PREVIEW_NOTEPAD_VALUE)
                    || current.endsWith(IE_PREVIEW_NOTEPAD_VALUE)) {
                notepad.setSelection(true);
            } else {
                otherButton.setSelection(true);
                browse.setEnabled(true);
                text.setEnabled(true);
                text.setText(current);
            }
        }
    }
    addTab(Messages.AdvancedPreferencePage_Debugging);

    appearanceComposite = getFieldEditorParent();
    Composite group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.AdvancedPreferencePage_LBL_AdvancedFunctionality);

    addField(new BooleanFieldEditor(IPreferenceConstants.SHOW_DEBUG_HOVER,
            Messages.AdvancedPreferencePage_ShowDebugInformation, group));

    //      addField(new BooleanFieldEditor(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP,
    //            "Show live help", group));

    addField(new BooleanFieldEditor(IPreferenceConstants.PARSER_OFF_UI,
            Messages.AdvancedPreferencePage_LBL_ParserOffUI, group));

    group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.AdvancedPreferencePage_LBL_DebuggingOutputLevel);

    //addField(new BooleanFieldEditor(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_ENABLE_DEBUGGING,
    //      Messages.AdvancedPreferencePage_LogDebuggingMessages, appearanceComposite));

    Composite debugComp = new Composite(group, SWT.NONE);
    GridLayout pkcLayout = new GridLayout(3, false);
    pkcLayout.marginWidth = 0;
    pkcLayout.marginHeight = 0;
    debugComp.setLayout(pkcLayout);
    debugComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label pianoKeyLabel = new Label(debugComp, SWT.LEFT);
    pianoKeyLabel.setText(Messages.AdvancedPreferencePage_LBL_ControlDebugInformationAmountHelp);
    GridData pklData = new GridData(SWT.FILL, SWT.FILL, true, false);
    pklData.horizontalSpan = 3;
    pianoKeyLabel.setLayoutData(pklData);
    Label less = new Label(debugComp, SWT.LEFT);

    less.setText(Messages.AdvancedPreferencePage_LBL_Errors);
    debugSlider = new Scale(debugComp, SWT.HORIZONTAL);
    debugSlider.setIncrement(1);
    debugSlider.setMinimum(1);
    debugSlider.setMaximum(3);

    Preferences p = AptanaCorePlugin.getDefault().getPluginPreferences();
    debugSlider.setSelection(p.getInt(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_DEBUG_LEVEL));
    Label more = new Label(debugComp, SWT.LEFT);
    more.setText(Messages.AdvancedPreferencePage_LBL_All);

    final Label currentValue = new Label(debugComp, SWT.LEFT);
    currentValue.setText(getValueLabel(debugSlider.getSelection()));
    currentValue.setFont(SWTUtils.getDefaultSmallFont());
    pklData = new GridData(SWT.FILL, SWT.FILL, true, false);
    pklData.horizontalSpan = 3;
    currentValue.setLayoutData(pklData);

    debugSlider.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent selectionevent) {
            currentValue.setText(getValueLabel(debugSlider.getSelection()));
        }

        public void widgetSelected(SelectionEvent selectionevent) {
            currentValue.setText(getValueLabel(debugSlider.getSelection()));
        }

    });
}

From source file:com.aptana.ide.intro.IntroStartup.java

License:Open Source License

/**
 * Install any missing features//from   w w  w. j  av  a 2 s  . c  o  m
 */
protected void installFeatures() {
    final IPreferenceStore store = IntroPlugin.getDefault().getPreferenceStore();
    boolean check = store.getBoolean(IPreferenceConstants.INSTALL_PRO_AND_REQUIRED_FEATURES);
    if (!check) {
        return;
    }

    List<FeatureDescriptor> features = new ArrayList<FeatureDescriptor>();
    List<IPlugin> installedFeatures = FeatureUtil.getInstalledFeatures();
    String[] installedFeatureIds = new String[installedFeatures.size()];
    int index = 0;
    for (IPlugin feature : installedFeatures) {
        installedFeatureIds[index++] = feature.getId();
    }

    // Using the list of installed and ignored features, filter out
    // possible install items that were previously ignored, or would
    // conflict with currently installed items.
    String[] ignored = store.getString(IPreferenceConstants.IGNORE_INSTALL_FEATURES).split(","); //$NON-NLS-1$
    final List<FeatureDescriptor> featuresToInstall = new ArrayList<FeatureDescriptor>();
    for (Iterator<FeatureDescriptor> iterator = features.iterator(); iterator.hasNext();) {
        FeatureDescriptor featureDescriptor = iterator.next();
        if (!FeatureRegistry.isFeatureIgnored(featureDescriptor.getId(), ignored)
                && !FeatureRegistry.doesFeatureConflict(featureDescriptor, installedFeatureIds)) {
            featuresToInstall.add(featureDescriptor);
        }
    }

    // Don't show dialog if user has previously opted not to see if
    // again
    if (featuresToInstall.size() > 0 && !store.getString(IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT)
            .equals(MessageDialogWithToggle.NEVER)) {
        String tmp_str = ""; //$NON-NLS-1$
        for (FeatureDescriptor featureDesc : featuresToInstall) {
            tmp_str += "\n\t" + featureDesc.getName(); //$NON-NLS-1$
        }
        final String str_features = tmp_str;
        UIJob job = new UIJob(Messages.IntroStartup_Job_InstallFeatures) {
            public IStatus runInUIThread(IProgressMonitor monitor) {
                int returnCode = DialogUtils.openIgnoreMessageDialogConfirm(
                        Display.getCurrent().getActiveShell(), Messages.IntroStartup_InstallTitle,
                        MessageFormat.format(Messages.IntroStartup_InstallMessage, str_features), store,
                        IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT);

                if (returnCode == MessageDialog.CANCEL) {
                    return Status.OK_STATUS;
                }
                new FeatureInstallJob(featuresToInstall).schedule(0);
                return Status.OK_STATUS;
            }
        };
        job.setRule(MutexJobRule.getInstance());
        job.schedule(20000);
    }

    final List<FeatureDescriptor> featuresToUpdate = FeatureRegistry.gatherInstalledRequiredFeatures();
    if (featuresToUpdate.size() > 0) {
        final StringBuilder featureToUpdateStr = new StringBuilder();
        for (FeatureDescriptor featureDesc : featuresToUpdate) {
            featureToUpdateStr.append("\n\t" + featureDesc.getName()); //$NON-NLS-1$
        }
        UIJob job = new UIJob(Messages.IntroStartup_Job_UpdateFeatures) {
            public IStatus runInUIThread(IProgressMonitor monitor) {
                boolean returnCode = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
                        Messages.IntroStartup_UpdateTitle, MessageFormat
                                .format(Messages.IntroStartup_UpdateMessage, featureToUpdateStr.toString()));
                if (!returnCode) {
                    return Status.OK_STATUS;
                }

                new FeatureInstallJob(featuresToUpdate).schedule(0);
                return Status.OK_STATUS;
            }
        };
        job.setRule(MutexJobRule.getInstance());
        job.schedule(20000);
    }
}

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

License:Open Source License

/**
 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
 *//*from w  w w.j a  va 2s .  c  om*/
public void initializeDefaultPreferences() {
    IEclipsePreferences node = EclipseUtil.defaultScope().getNode(JSDebugUIPlugin.PLUGIN_ID);

    // default preferences
    node.putBoolean(IJSDebugUIConstants.PREF_CONFIRM_EXIT_DEBUGGER, true);
    node.put(IJSDebugUIConstants.PREF_SHOW_DETAILS, IJSDebugUIConstants.DETAIL_PANE);
    node.putBoolean(IJSDebugUIConstants.PREF_SHOW_CONSTANTS, false);
    node.put(IJSDebugUIConstants.CONSOLE_WARN_COLOR, StringConverter.asString(new RGB(255, 215, 0)));

    // override default org.eclipse.debug.ui options
    node = EclipseUtil.defaultScope().getNode(DebugUIPlugin.getDefault().getBundle().getSymbolicName());
    if (MessageDialogWithToggle.NEVER
            .equals(node.get(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, StringUtil.EMPTY))) {
        node.put(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, MessageDialogWithToggle.PROMPT);
    }
}

From source file:com.ebmwebsourcing.petals.server.PetalsServerBehavior.java

License:Open Source License

/**
 * Adds the server libraries in the launch class path.
 * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate
 * #setupLaunchConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.core.runtime.IProgressMonitor)
 *//*www .j a  v a2s .c  o  m*/
@Override
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor)
        throws CoreException {

    // Add the server libraries in the class path
    List<String> classpath = new ArrayList<String>();
    for (Object o : workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
            Collections.emptyList())) {

        if (o instanceof String)
            classpath.add((String) o);
    }

    List<File> serverLibs = getPetalsServer().getPetalsServerLibraries();
    for (File serverLib : serverLibs) {
        Path path = new Path(serverLib.getAbsolutePath());
        IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry(path);
        entry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
        classpath.add(entry.getMemento());
    }

    // Update and force the use of this class path in the launch configuration
    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);

    // Get the server arguments
    String args = null;
    final IPreferenceStore store = PetalsServerPlugin.getDefault().getPreferenceStore();
    if (store.contains(PetalsServerPreferencePage.START_IN_CONSOLE_MODE)) {
        String startMode = store.getString(PetalsServerPreferencePage.START_IN_CONSOLE_MODE);
        if (MessageDialogWithToggle.ALWAYS.equals(startMode))
            args = "start -console";
        else if (MessageDialogWithToggle.NEVER.equals(startMode))
            args = "start";
    }

    if (args == null) {
        Display.getDefault().syncExec(new Runnable() {
            @Override
            public void run() {
                MessageDialogWithToggle.openYesNoQuestion(new Shell(), "Start Mode",
                        "Do you want to start in console mode?", "Do not ask again", false, store,
                        PetalsServerPreferencePage.START_IN_CONSOLE_MODE);
            };
        });

        String startMode = store.getString(PetalsServerPreferencePage.START_IN_CONSOLE_MODE);
        if (MessageDialogWithToggle.ALWAYS.equals(startMode))
            args = "start -console";
        else
            args = "start";
    }

    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
}

From source file:com.ebmwebsourcing.petals.server.ui.preferences.PetalsServerPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginTop = 20;/*from w  w w.  j  a v  a2  s  . co m*/
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    String[][] labelAndValues = new String[][] { new String[] { "Yes", MessageDialogWithToggle.ALWAYS },
            new String[] { "No", MessageDialogWithToggle.NEVER },
            new String[] { "Prompt", MessageDialogWithToggle.PROMPT } };

    this.startModeField = new RadioGroupFieldEditor(START_IN_CONSOLE_MODE, "Start in Console mode", 3,
            labelAndValues, container, true);

    return container;
}

From source file:com.google.dart.tools.ui.wizard.AbstractDartWizard.java

License:Open Source License

/**
 * Prompt the user to open the Dart perspective, if not already open
 *//*from  w w w .ja  v  a  2  s  .co  m*/
protected void openDartPerspective() {

    // Check to see if the Dart perspective is already open
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    IPerspectiveDescriptor perspective = window.getActivePage().getPerspective();
    if (perspective != null && DART_PERSPECTIVE_ID.equals(perspective.getId())) {
        return;
    }

    // Prompt the user to open the Dart perspective
    Shell shell = window.getShell();
    IPreferenceStore prefs = DartToolsPlugin.getDefault().getPreferenceStore();
    String open = prefs.getString(OPEN_PERSPECTIVE);
    if (MessageDialogWithToggle.NEVER.equals(open)) {
        return;
    }
    if (!MessageDialogWithToggle.ALWAYS.equals(open)) {
        MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(shell, "Open Perspective",
                "Would you like to open the Dart perspective?", "Don't show this again", false, prefs,
                OPEN_PERSPECTIVE);
        if (dialog.getReturnCode() != IDialogConstants.YES_ID) {
            return;
        }
    }

    // Open the perspective
    try {
        workbench.showPerspective(DART_PERSPECTIVE_ID, window);
    } catch (WorkbenchException e) {
        String message = "Failed to open Dart perspective";
        DartToolsPlugin.log(message, e);
        MessageDialog.openError(getShell(), "Open Perspective Exception", message);
    }
}

From source file:com.liferay.ide.kaleo.ui.editor.WorkflowDefinitionEditor.java

License:Open Source License

@Override
protected void createPages() {
    super.createPages();

    try {/*from  www. java  2 s .co  m*/
        String id = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective()
                .getId();

        if (WorkflowDesignerPerspectiveFactory.ID.equals(id)) {
            return;
        }
    } catch (Exception e) {
    }

    String perspectiveSwitch = KaleoUI.getDefault().getPreferenceStore()
            .getString(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH);

    boolean remember = false;
    boolean openPerspective = false;

    if (MessageDialogWithToggle.PROMPT.equals(perspectiveSwitch)) {
        MessageDialogWithToggle toggleDialog = MessageDialogWithToggle.openYesNoQuestion(
                this.getSite().getShell(), "Open Kaleo Designer Perspective?",
                "This kind of file is associated with the Kaleo Designer perspective.\n\n"
                        + "This perspective is designed to support Kaleo Workflow development. "
                        + "It places the Properties and Palette views in optimal location relative to the editor area.\n\n"
                        + "Do you want to open this perspective now?",
                "Remember my decision", false, KaleoUI.getDefault().getPreferenceStore(),
                KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH);

        remember = toggleDialog.getToggleState();
        openPerspective = toggleDialog.getReturnCode() == IDialogConstants.YES_ID;

        if (remember) {
            KaleoUI.getPrefStore().setValue(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH,
                    openPerspective ? MessageDialogWithToggle.ALWAYS : MessageDialogWithToggle.NEVER);
        }
    } else if (MessageDialogWithToggle.ALWAYS.equals(perspectiveSwitch)) {
        openPerspective = true;
    }

    if (openPerspective) {
        switchToKaleoDesignerPerspective();
    }
}

From source file:com.liferay.ide.kaleo.ui.KaleoUIPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final String[][] labelAndValues = new String[][] { { "Always", MessageDialogWithToggle.ALWAYS },
            { "Never", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } };

    addField(new RadioGroupFieldEditor(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH,
            "Open the Kaleo Designer perspective when opening kaleo workflow files.", 3, labelAndValues,
            getFieldEditorParent(), true));
}

From source file:com.liferay.ide.sdk.ui.SDKsPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    FieldEditor edit = new RadioGroupFieldEditor(SDKUIPlugin.PREF_KEY_OVERWRITE_USER_BUILD_FILE,
            NLS.bind(Msgs.updateProperties, System.getProperty("user.name")), //$NON-NLS-1$
            3, new String[][] { { Msgs.always, MessageDialogWithToggle.ALWAYS },
                    { Msgs.never, MessageDialogWithToggle.NEVER } },
            parent, true);/*from w w  w .jav a  2s .  co  m*/
    edit.setPreferenceStore(getPreferenceStore());
    addField(edit);
}