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:com.liferay.ide.server.tomcat.ui.CleanAppServerAction.java
License:Open Source License
protected void cleanAppServer(IProject project, String bundleZipLocation) throws CoreException { String[] labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; MessageDialog dialog = new MessageDialog(getDisplay().getActiveShell(), getTitle(), null, Msgs.deleteEntireTomcatDirectory, MessageDialog.WARNING, labels, 1); int retval = dialog.open(); if (retval == MessageDialog.OK) { new CleanAppServerJob(project, bundleZipLocation).schedule(); }//from w w w .j a va 2 s . c o m }
From source file:com.mentor.nucleus.bp.core.util.UIUtil.java
License:Open Source License
/** * Note this "MessageDialog" currently only supports an array of 2 dialog button * labels. This is why the result is a boolean. It simply behaves in * a similar manner as if a yes/no question had been asked (offset 0 is * yes and offset 1 is no). If additional buttons are ever needed this * will need to be modified to handle it. *//* w w w . ja v a2 s.c om*/ public static boolean openMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, BPMessageTypes dialogType, String[] dialogButtonLabels, int defaultIndex) { int standardDialogType = MessageDialog.WARNING; if (dialogType == BPMessageTypes.ERROR) { standardDialogType = MessageDialog.ERROR; } else if ((dialogType == BPMessageTypes.INFORMATION)) { standardDialogType = MessageDialog.INFORMATION; } boolean result = (defaultIndex == MessageDialog.OK); if (CoreUtil.IsRunningHeadless) { outputTextForheadlessRun(dialogType, dialogTitle, dialogMessage, ""); } else { MessageDialog dialog = new MessageDialog(parentShell, dialogTitle, dialogTitleImage, dialogMessage, standardDialogType, dialogButtonLabels, defaultIndex); dialog.setBlockOnOpen(true); int actualResult = dialog.open(); result = MessageDialog.OK == actualResult; } return result; }
From source file:com.mercatis.lighthouse3.ui.environment.wizards.NewProcessTaskWizard.java
License:Apache License
public void addPages() { page = new WizardNewProcessTaskPage("ProjectCreationPage"); page.setLighthouseDomain(lighthouseDomain); page.setParentEntity(parentProcessTask); List<Deployment> deps = CommonBaseActivator.getPlugin().getDomainService() .getAllDeployments(lighthouseDomain); deploymentsPage = new WizardProcessTaskAddDeploymentsPage("AddDeploymentsPage", deps); addPage(page);// ww w.j a va 2s . co m addPage(deploymentsPage); statusMainPage = new StatusWizardMainPage("Status"); statusMainPage.setTitle("Status"); statusMainPage.setDescription("Edit details of the Status."); try { statusOkPage = new WizardEventTemplatePage("OK Template", lighthouseDomain, WizardEventTemplatePage.EventType.OK); statusOkPage.setTitle("OK Template"); statusOkPage.setDescription("Define details of OK Template"); statusErrorPage = new WizardEventTemplatePage("Error Template", lighthouseDomain, WizardEventTemplatePage.EventType.ERROR); statusErrorPage.setTitle("Error Template"); statusErrorPage.setDescription("Define details of Error Template"); statusNotificationPage = new StatusWizardNotificationPage("Notification Channel", lighthouseDomain); statusNotificationPage.setTitle("Notification Channel"); statusNotificationPage.setDescription("Edit the template for email notification"); addPage(statusMainPage); addPage(statusOkPage); addPage(statusErrorPage); addPage(statusNotificationPage); } catch (Exception e) { new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "New Status Wizard", null, e.getMessage(), MessageDialog.WARNING, new String[] { "OK" }, 0).open(); //This RuntimeException will be catched by the UI framework and prevents this wizard from opening throw new RuntimeException("wizardkillerexception", null); } }
From source file:com.microsoft.tfs.client.common.ui.helpers.UndoHelper.java
License:Open Source License
private static int promptForChange(final Shell shell, final PendingChange change) { final String message = MessageFormat.format( Messages.getString("UndoHelper.ConfirmUndoAndDiscardChangesFormat"), //$NON-NLS-1$ change.getLocalItem());/* w ww.ja v a2 s . com*/ final MessageDialog dialog = new MessageDialog(shell, Messages.getString("UndoHelper.ConfirmDialogTitle"), //$NON-NLS-1$ null, message, MessageDialog.WARNING, DIALOG_BUTTON_LABELS, YES); return dialog.open(); }
From source file:com.mobilesorcery.sdk.internal.launch.EmulatorLaunchConfigurationDelegate.java
License:Open Source License
private boolean showSwitchConfigDialog(MoSyncProject mosyncProject, String mode, final IBuildConfiguration activeCfg, String[] requiredTypes) { if (isDebugMode(mode)) { Display d = PlatformUI.getWorkbench().getDisplay(); final boolean[] result = new boolean[1]; d.syncExec(new Runnable() { @Override/*from ww w .j a v a2 s . c om*/ public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog dialog = new MessageDialog(shell, "Incompatible build configuration", null, MessageFormat.format( "The build configuration \"{0}\" is not intended for debugging. Debug anyway?", activeCfg.getId()), MessageDialog.WARNING, new String[] { "Debug", "Cancel" }, 1); result[0] = dialog.open() == 0; } }); return result[0]; } return true; }
From source file:com.motorola.studio.android.emulator.service.reset.ResetServiceHandler.java
License:Apache License
public IStatus singleInit(List<IInstance> instances) { int reset = EclipseUtils.showInformationDialog(EmulatorNLS.GEN_Warning, EmulatorNLS.QUESTION_AndroidEmulatorReseter_ConfirmationText, new String[] { EmulatorNLS.QUESTION_AndroidEmulatorReseter_Yes, EmulatorNLS.QUESTION_AndroidEmulatorReseter_No }, MessageDialog.WARNING); userAgreed = reset == Dialog.OK; return Status.OK_STATUS; }
From source file:com.mountainminds.eclemma.internal.ui.launching.InplaceInstrumentationHandler.java
License:Open Source License
public Object handleStatus(IStatus status, Object source) throws CoreException { ILaunchConfiguration config = (ILaunchConfiguration) source; Shell parent = EclEmmaUIPlugin.getInstance().getShell(); String title = UIMessages.InstrumentationWarning_title; String message = NLS.bind(UIMessages.InstrumentationWarning_message, config.getName()); IPreferenceStore store = EclEmmaUIPlugin.getInstance().getPreferenceStore(); if (MessageDialogWithToggle.ALWAYS .equals(store.getString(UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION))) { return Boolean.TRUE; }// w ww.j a v a2s . com MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent, title, null, message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, null, false); dialog.setPrefKey(UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION); dialog.setPrefStore(store); dialog.open(); return Boolean.valueOf(dialog.getReturnCode() == IDialogConstants.OK_ID); }
From source file:com.nokia.sdt.editor.SourceGenProblemsDialog.java
License:Open Source License
/** * @param shell/*from w w w.j ava 2 s. c om*/ * @param displayName * @param messages * @return */ public static SourceGenProblemsDialog create(Shell shell, String displayName, Collection<IMessage> messages) { boolean anyErrors = false; for (Iterator iter = messages.iterator(); iter.hasNext();) { IMessage message = (IMessage) iter.next(); if (message.getSeverity() == IMessage.ERROR) { anyErrors = true; break; } } StringBuffer buffer = new StringBuffer(); buffer.append(MessageFormat.format( Messages.getString("SourceGenProblemsDialog.SourceGenProblemsEncounteredMessage"), //$NON-NLS-1$ displayName)); SourceGenProblemsDialog dialog = new SourceGenProblemsDialog(shell, Messages.getString("SourceGenProblemsDialog.SourceGenProblemsEncounteredTitle"), null, //$NON-NLS-1$ buffer.toString(), (anyErrors ? MessageDialog.ERROR : MessageDialog.WARNING), new String[] { IDialogConstants.OK_LABEL }, IDialogConstants.OK_ID); dialog.setMessages(messages); return dialog; }
From source file:com.nokia.tools.s60ct.javaversionchecker.ui.ShowDialogJob.java
License:Open Source License
/** * Shows JRE warning dialog./*from w w w . ja v a2 s. c o m*/ * @return state of toggle */ private static boolean showDialog() { MessageDialogWithToggle dialog = new MessageDialogWithToggle( PlatformUI.getWorkbench().getDisplay().getActiveShell(), MessageGenerator.generateTitle(), null, MessageGenerator.generateMessage(), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0, "Do not warn again", false) { protected Control createMessageArea(Composite composite) { Image image = getImage(); if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } Link link = new Link(composite, getMessageLabelStyle()); link.setText(message); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if ("Download JRE".equals(e.text)) { try { IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport() .getExternalBrowser(); browser.openURL(new URL(SupportedJavaVersions.sunJre1_6_0_DownloadSite)); } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (PartInitException ex) { ex.printStackTrace(); } } else { try { IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport() .getExternalBrowser(); browser.openURL(new URL( "http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm")); } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (PartInitException ex) { ex.printStackTrace(); } } } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(link); return composite; } }; dialog.open(); return dialog.getToggleState(); }
From source file:com.persistent.winazureroles.WARGeneral.java
License:Open Source License
private void handleSmallVMCacheConf() { try {/* w w w .j a v a 2 s . c o m*/ if (Messages.txtExtraSmallVM.equals(comboVMSize.getText()) && windowsAzureRole.getCacheMemoryPercent() > 0) { // If extra small VM and cache is enabled MessageDialog dialog = new MessageDialog(getShell(), Messages.cacheConfTitle, null, Messages.cacheConfMsg, MessageDialog.WARNING, new String[] { "Yes", "No" }, 2); int choice = dialog.open(); switch (choice) { case 0: // Yes - Disable cache windowsAzureRole.setCacheMemoryPercent(0); break; case 1: // No or if dialog is closed directly then reset VM size back to original case -1: comboVMSize.setText(arrVMSize[getVMSizeIndex()]); break; } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(getShell(), Messages.cachErrTtl, Messages.cachGetErMsg, e); } }