List of usage examples for org.eclipse.jface.dialogs MessageDialogWithToggle ALWAYS
String ALWAYS
To view the source code for org.eclipse.jface.dialogs MessageDialogWithToggle ALWAYS.
Click Source Link
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 .j a va 2 s.c om*/ } // 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.core.ui.DialogUtils.java
License:Open Source License
/** * openIgnoreMessageDialogInformation/* w w w .j a v a2s.c om*/ * * @param shell * @param title * @param message * @param store * @param key * @return int */ public static int openIgnoreMessageDialogInformation(Shell shell, String title, String message, IPreferenceStore store, String key) { if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle d = MessageDialogWithToggle.openInformation(shell, title, message, Messages.DialogUtils_HideThisMessageInFuture, false, store, key); if (d.getReturnCode() == 3) { return MessageDialog.CANCEL; } else { return MessageDialog.OK; } } else { return MessageDialog.OK; } }
From source file:com.aptana.ide.core.ui.DialogUtils.java
License:Open Source License
/** * openIgnoreMessageDialogConfirm//from www . j a va2s . c om * * @param shell * @param title * @param message * @param store * @param key Key to store the show/hide this message. Message will be hidden if true * @return int */ public static int openIgnoreMessageDialogConfirm(Shell shell, String title, String message, IPreferenceStore store, String key) { if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS)) { MessageDialogWithToggle d = MessageDialogWithToggle.openYesNoQuestion(shell, title, message, Messages.DialogUtils_HideThisMessageInFuture, false, store, key); if (d.getReturnCode() == 3) { return MessageDialog.CANCEL; } else { return MessageDialog.OK; } } else { return MessageDialog.OK; } }
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) *//*from w w w .ja v a 2 s.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.ide.debug.internal.ui.Startup.java
License:Open Source License
private ILaunchConfiguration getOrCreateDefaultLaunchConfiguration(String nature) { ILaunchConfigurationType configType = getLaunchConfigType(); ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); try {//from w w w.j ava2s . co m ILaunchConfiguration[] configs = manager.getLaunchConfigurations(configType); for (int i = 0; i < configs.length; ++i) { ILaunchConfiguration config = configs[i]; if (nature.equals(config.getAttribute(ILaunchConfigurationConstants.CONFIGURATION_BROWSER_NATURE, StringUtils.EMPTY))) { return config; } } ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault() .getLaunchManager().generateUniqueLaunchConfigurationNameFrom(nature + " - Internal Server")); //$NON-NLS-1$ JSLaunchConfigurationHelper.setDefaults(wc, nature); boolean showDownload = true; while (!JSLaunchConfigurationHelper.isBrowserDebugCompatible(wc.getAttribute( ILaunchConfigurationConstants.CONFIGURATION_BROWSER_EXECUTABLE, StringUtils.EMPTY))) { String browserPath = null; if (nature.equals(JSLaunchConfigurationHelper.FIREFOX)) { IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore(); String pref = store .getString(com.aptana.ide.debug.internal.ui.IDebugUIConstants.PREF_SKIP_FIREFOX_CHECK); if (pref == null || !pref.equals(MessageDialogWithToggle.ALWAYS)) { browserPath = showBrowserNotFoundDialog(showDownload); } } if (browserPath == null) { wc.delete(); return null; } if (browserPath.length() == 0) { JSLaunchConfigurationHelper.setBrowserDefaults(wc, nature); } else { wc.setAttribute(ILaunchConfigurationConstants.CONFIGURATION_BROWSER_EXECUTABLE, browserPath); } showDownload = false; } return wc.doSave(); } catch (CoreException e) { DebugUiPlugin.log(e); } return null; }
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. */// w ww. ja v a 2 s. 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.server.jetty.ShowPerspectiveClient.java
License:Open Source License
private boolean shouldAutoOpen(final String id) { String value = JettyPlugin.getDefault().getPreferenceStore().getString(getPrefKey(id)); if (value == null) return false; return value.equals(MessageDialogWithToggle.ALWAYS); }
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 w ww .j a v a2 s. c om 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.aptana.ui.dialogs.SaveAndLaunchPromptDialog.java
License:Open Source License
protected void okPressed() { IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String val = (savePref.getSelection() ? MessageDialogWithToggle.ALWAYS : MessageDialogWithToggle.PROMPT); store.setValue(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, val); super.okPressed(); }
From source file:com.aptana.ui.dialogs.SaveAndLaunchPromptDialog.java
License:Open Source License
@Override public int open() { String saveDirty = Platform.getPreferencesService().getString(IDebugUIConstants.PLUGIN_ID, IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, StringUtil.EMPTY, new IScopeContext[] { InstanceScope.INSTANCE, DefaultScope.INSTANCE }); if (saveDirty.equals(MessageDialogWithToggle.ALWAYS)) { setResult(dirtyResources);/*from w ww . ja v a 2 s.c o m*/ return Window.OK; } return super.open(); }