List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.
Click Source Link
From source file:org.eclipse.debug.internal.ui.launchConfigurations.CompileErrorPromptStatusHandler.java
License:Open Source License
public Object handleStatus(IStatus status, Object source) throws CoreException { if (source instanceof ILaunchConfiguration) { ILaunchConfiguration config = (ILaunchConfiguration) source; if (DebugUITools.isPrivate(config)) { return Boolean.TRUE; }/*from w w w . j ava2 s . c o m*/ } Shell shell = DebugUIPlugin.getShell(); String title = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_0; String message = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_1; IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String pref = store.getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR); if (pref != null) { if (pref.equals(MessageDialogWithToggle.ALWAYS)) { return Boolean.TRUE; } } MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1, LaunchConfigurationsMessages.CompileErrorProjectPromptStatusHandler_1, false); dialog.setPrefKey(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR); dialog.setPrefStore(store); dialog.open(); int returnValue = dialog.getReturnCode(); if (returnValue == IDialogConstants.YES_ID) { return Boolean.TRUE; } return Boolean.FALSE; }
From source file:org.eclipse.dltk.mod.ui.text.completion.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 .c o m*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell(); String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title; String message = ScriptTextMessages.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( ScriptTextMessages.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.dltk.mod.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.dltk.mod.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; } 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 = getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.dltk.ui.text.completion.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 a v a 2s . co m private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell(); String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title; String message = ScriptTextMessages.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( ScriptTextMessages.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.dltk.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.dltk.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; } 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()) { /* * FIXME Restore default settings in DLTKUIPlugin preferences, * since at the moment this is the only IPreferenceStore these * preferences are read from. */ IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.ease.discovery.ui.internal.common.DiscoveryUiUtil.java
License:Open Source License
public static void displayStatus(Shell shell, final String title, final IStatus status, boolean showLinkToErrorLog) { String message = status.getMessage(); if (showLinkToErrorLog) { message += " \n see error log"; }/*from w w w.ja v a 2 s . c om*/ switch (status.getSeverity()) { case IStatus.CANCEL: case IStatus.INFO: createDialog(shell, title, message, MessageDialog.INFORMATION).open(); break; case IStatus.WARNING: createDialog(shell, title, message, MessageDialog.WARNING).open(); break; case IStatus.ERROR: default: createDialog(shell, title, message, MessageDialog.ERROR).open(); break; } }
From source file:org.eclipse.eclipsemonkey.ScriptMetadata.java
License:Open Source License
private String notifyMissingDOMs(String missing_plugin_names) { String plural = (missing_plugin_names.indexOf("\n") >= 0 ? "s" : ""); String[] choices = new String[] { "Cancel Script", "Edit Script", "Install Plug-in" + plural }; MessageDialog dialog = new MessageDialog(null, "Missing DOM" + plural, null, "The script " + this.path.toFile().getName() + " requires " + (missing_plugin_names.indexOf("\n") >= 0 ? "these" : "this") + " missing DOM plug-in" + plural + ":\n" + missing_plugin_names, MessageDialog.WARNING, choices, 2); int result = dialog.open(); String choice = choices[result]; return choice; }
From source file:org.eclipse.edt.ide.rui.visualeditor.internal.util.BrowserManager.java
License:Open Source License
/** * Displays a messages box with an ok button recommending that the editor be closed. *//* w ww . ja v a 2 s . c o m*/ public void showOutOfResourcesMessage(String message) { String[] straButtons = new String[] { IDialogConstants.OK_LABEL }; MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.NL_EGL_Rich_UI_Editor, null, message, MessageDialog.WARNING, straButtons, 0); dialog.open(); }
From source file:org.eclipse.edt.ide.ui.internal.actions.FormattingAction.java
License:Open Source License
public void run() { // RATLC01446894 - Reset fSelection to match fEditor.editorInput. // Could be different if >1 file is open from Search results, in which case // formatting was performed on the wrong file. if (fEditor != null) { IEditorInput editorInput = fEditor.getEditorInput(); // Could be a VirtualEditorInput if coming from PageDesigners QEV if (editorInput instanceof IFileEditorInput) { IResource resource = ((IFileEditorInput) editorInput).getFile(); IEGLElement element = EGLCore.create(resource); init(element, fEditor.getSite()); }/*w w w .ja v a 2s. co m*/ } if (fSelection != null) { List eglFiles = getEGLFiles(fSelection); int selCnt = eglFiles.size(); if (selCnt == 0) return; if (selCnt > 1 && fSite != null) { int returnCode = OptionalMessageDialog.open("EGLFormat", //$NON-NLS-1$ fSite.getShell(), UINlsStrings.FormatTitle, null, UINlsStrings.UndoNotSupportedMsg, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); if (returnCode != OptionalMessageDialog.NOT_SHOWN && returnCode != Window.OK) return; } // runOnMultiple(eglFiles, null); if (selCnt > 1) runOnMultiple(eglFiles, null); else runOnSingle((IEGLFile) eglFiles.get(0)); } super.run(); }
From source file:org.eclipse.edt.ide.ui.internal.contentassist.EGLContentAssistProcessor.java
License:Open Source License
private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = EDTUIPlugin.getActiveWorkbenchShell(); String title = EGLTextMessages.ContentAssistProcessor_all_disabled_title; String message = EGLTextMessages.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( EGLTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; 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) { /*// w w w.java 2 s . c o m * @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) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); super.createCustomArea(parent); return parent; } 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); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = EDTUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.edt.ide.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); fComputerRegistry.reload(); return true; } } return false; }
From source file:org.eclipse.edt.ide.ui.internal.handlers.FormattingHandler.java
License:Open Source License
public void run() { List eglFiles = getEGLFiles(fSelection); int selCnt = eglFiles.size(); if (selCnt == 0) return;/*from w w w . java 2 s . c om*/ if (selCnt > 1 && fSite != null) { int returnCode = OptionalMessageDialog.open("EGLFormat", //$NON-NLS-1$ fSite.getShell(), UINlsStrings.FormatTitle, null, UINlsStrings.UndoNotSupportedMsg, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); if (returnCode != OptionalMessageDialog.NOT_SHOWN && returnCode != Window.OK) { return; } } if (selCnt > 1) { runOnMultiple(eglFiles, null); } else { runOnSingle((IEGLFile) eglFiles.get(0)); } }
From source file:org.eclipse.emf.cdo.ui.internal.admin.actions.DeleteRepositoryAction.java
License:Open Source License
@Override protected void preRun() throws Exception { final int NO_BUTTON = 1; String message = MessageFormat.format(Messages.DeleteRepositoryAction_4, target.getName()); MessageDialog dlg = new MessageDialog(getShell(), getText(), null, message, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, NO_BUTTON); if (dlg.open() == NO_BUTTON) { cancel();//from w ww . j av a 2 s .c o m } }