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.graphiq.pdi.coalesce.CoalesceDialog.java
License:Apache License
/** * This helper method takes the information configured in the dialog controls * and stores it into the step configuration meta object *//*from ww w . j a va 2 s . c om*/ private void populateMetaWithInfo() { meta.setTreatEmptyStringsAsNulls(wEmptyStringsCheck.getSelection()); int noKeys = wFields.nrNonEmpty(); meta.allocate(noKeys); if (log.isDebug()) { logDebug(BaseMessages.getString(PKG, "CoalesceDialog.Log.FoundFields", String.valueOf(noKeys))); } List<String> nonEmptyFieldsNames = new ArrayList<String>(); //CHECKSTYLE:Indentation:OFF for (int i = 0; i < noKeys; i++) { TableItem item = wFields.getNonEmpty(i); meta.getOutputFields()[i] = item.getText(1); int emptyFields = 0; for (int j = 0; j < CoalesceMeta.noInputFields; j++) { meta.getInputFields()[i][j] = item.getText(2 + j); if (meta.getInputFields()[i][j].isEmpty()) { emptyFields++; } } String typeValueText = item.getText(2 + CoalesceMeta.noInputFields); meta.getValueType()[i] = typeValueText.isEmpty() ? ValueMeta.TYPE_NONE : ValueMeta.getType(typeValueText); String isRemoveText = item.getText(3 + CoalesceMeta.noInputFields); meta.getDoRemoveInputFields()[i] = !isRemoveText.isEmpty() && CoalesceMeta.getBooleanFromString(isRemoveText); if (emptyFields > 2) { // Ex.: OutColumn has 2 empty fields nonEmptyFieldsNames.add(Const.CR + " Output Field [" + meta.getOutputFields()[i] + "] has " + emptyFields + " empty fields"); } } if (!nonEmptyFieldsNames.isEmpty()) { MessageDialogWithToggle md = new MessageDialogWithToggle(shell.getShell(), BaseMessages.getString(PKG, "CoalesceDialog.Validations.DialogTitle"), null, BaseMessages.getString(PKG, "CoalesceDialog.Validations.DialogMessage", Const.CR, Const.CR) + nonEmptyFieldsNames.toString() + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "CoalesceDialog.Validations.Option.1") }, 0, BaseMessages.getString(PKG, "CoalesceDialog.Validations.Option.2"), false); MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon()); md.open(); } }
From source file:com.hilotec.elexis.messwerte.v2.views.ExportDialog.java
License:Open Source License
@Override protected void okPressed() { try {//from w w w. j a va2 s.c o m if (btnPatFromTo.getSelection()) { int from = Integer.parseInt(patNumberFrom.getText()); int to = Integer.parseInt(patNumberTo.getText()); if (to < from) { throw new Exception(Messages.ExportDialog_Exception_PatNumber); } expData.setPatientNumberFrom(from); expData.setPatientNumberTo(to); } else { if (patNrMin == -1 || patNrMax == -1) { calcMinMaxPatNumbers(); } expData.setPatientNumberFrom(patNrMin); expData.setPatientNumberTo(patNrMax); } if (btnDateFromTo.getSelection()) { Date from = dateFrom.getDate(); Date to = dateTo.getDate(); if (to.before(from)) { throw new Exception(Messages.ExportDialog_Exception_Datum); } expData.setDateFrom(new TimeTool(from.getTime())); expData.setDateTo(new TimeTool(to.getTime())); expData.setCheckDate(true); } else { expData.setDateFrom(new TimeTool(TimeTool.BEGINNING_OF_UNIX_EPOCH)); expData.setDateTo(new TimeTool(TimeTool.END_OF_UNIX_EPOCH)); expData.setCheckDate(false); } close(); } catch (Exception e) { MessageDialog md = new MessageDialog(parent, Messages.ExportDialog_ExceptionDialog, null, e.getMessage(), MessageDialog.WARNING, new String[] { "Ok" //$NON-NLS-1$ }, 0); md.open(); } }
From source file:com.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java
License:Open Source License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI./*w w w.j av a 2s.c om*/ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { if (exists(getBinDirectoryFromPreferenceStore())) { doCreateNotesJavaApiProject(); return; } int status = new MessageDialog(window.getShell(), "Question", null, "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { @Override protected Control createCustomArea(Composite parent) { Link link = new Link(parent, SWT.NONE); link.setFont(parent.getFont()); link.setText("<A>Domino Debug Plugin Preferences....</A>"); link.addSelectionListener(new SelectionListener() { /* * (non-Javadoc) * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent e) { doLinkActivated(); } /* * Open the appropriate preference page */ private void doLinkActivated() { String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage"; PreferencesUtil.createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null) .open(); updateButtons(); } public void widgetDefaultSelected(SelectionEvent e) { doLinkActivated(); } }); return link; } private void updateButtons() { getButton(0).setEnabled(exists(getBinDirectoryFromPreferenceStore())); } protected Control createContents(Composite parent) { Control ctrl = super.createContents(parent); updateButtons(); return ctrl; }; }.open(); if (status == MessageDialog.OK) { doCreateNotesJavaApiProject(); } }
From source file:com.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java
License:Open Source License
private void doCreateNotesJavaApiProject() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject project = root.getProject(JAVA_API_PROJECT_NAME); if (project.exists()) { boolean bContinue = MessageDialog.openQuestion(window.getShell(), "Debug plug-in for Domino OSGi", MessageFormat.format("Project {0} already exists. Would you like to update it?", JAVA_API_PROJECT_NAME)); if (!bContinue) { return; }/*from w ww . j a va 2 s. c o m*/ } String binDirectory = Activator.getDefault().getPreferenceStore() .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR); if (binDirectory == null || binDirectory.length() == 0) { int ret = new MessageDialog(window.getShell(), "Question", null, "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { /* * (non-Javadoc) * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite parent) { Link link = new Link(parent, SWT.NONE); link.setFont(parent.getFont()); link.setText("<A>Domino Debug Plugin Preferences....</A>"); link.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { doLinkActivated(); } private void doLinkActivated() { String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage"; PreferencesUtil .createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null) .open(); } public void widgetDefaultSelected(SelectionEvent e) { doLinkActivated(); } }); return link; } }.open(); if (ret == 1) { return; } } binDirectory = Activator.getDefault().getPreferenceStore() .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR); if (binDirectory == null || binDirectory.length() == 0) { MessageDialog.openError(window.getShell(), "Error", "Domino Bin directory not set"); return; } try { final String sBinDir = binDirectory; new ProgressMonitorDialog(window.getShell()).run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { if (!project.exists()) { project.create(monitor); } project.open(monitor); IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 2]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = JavaCore.NATURE_ID; newNatures[natures.length + 1] = "org.eclipse.pde.PluginNature"; description.setNatureIds(newNatures); project.setDescription(description, monitor); //Copy the resources under res copyOneLevel(project, monitor, "res", ""); //Copy notes.jar File notesJar = new File(sBinDir + "/jvm/lib/ext/Notes.jar"); if (!notesJar.exists() || !notesJar.isFile()) { MessageDialog.openError(window.getShell(), "Error", MessageFormat.format("{0} does not exist", notesJar.getAbsolutePath())); return; } copyFile(notesJar, project.getFile("Notes.jar"), monitor); } catch (Throwable t) { throw new InvocationTargetException(t); } } }); } catch (Throwable t) { MessageDialog.openError(window.getShell(), "error", t.getMessage()); t.printStackTrace(); } }
From source file:com.ibm.xsp.extlib.designer.tooling.palette.applicationlayout.ApplicationLayoutDropAction.java
License:Open Source License
private boolean showWarning() { IPreferenceStore prefs = ExtLibToolingPlugin.getDefault().getPreferenceStore(); boolean bHidePrompt = true; if (prefs != null) { bHidePrompt = prefs.getBoolean(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING); }/*from w w w.j ava 2 s. c o m*/ if (bHidePrompt) return true; Shell shell = getControl().getShell(); String msg = "You are placing the Application Layout control on an XPage.\n\nThe Application Layout control is most effective when placed in a custom control, where you can configure the layout once and then use the custom control on multiple pages."; // $NLX-ApplicationLayoutDropAction.YouareplacingtheApplicationLayout-1$ MessageDialogWithToggle dlg = new MessageDialogWithToggle(shell, "Application Layout", // $NLX-ApplicationLayoutDropAction.ApplicationLayout-1$ null, // image msg, MessageDialog.WARNING, new String[] { "Continue", "Cancel" }, // $NLX-ApplicationLayoutDropAction.Continue-1$ $NLX-ApplicationLayoutDropAction.Cancel-2$ 1, "Do not show this message again", // $NLX-ApplicationLayoutDropAction.Donotshowthismessageagain-1$ bHidePrompt) { // this is necessary because "Continue" maps to IDialogConstants.INTERNAL_ID, // (and prefs are stored as "always" or "never" by the dialog) // if "Continue" text changes, the use of IDialogConstants.INTERNAL_ID may need to change. protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); if (buttonId == IDialogConstants.INTERNAL_ID && getPrefStore() != null && getPrefKey() != null) { getPrefStore().setValue(getPrefKey(), getToggleState()); } } }; dlg.setPrefKey(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING); dlg.setPrefStore(prefs); int code = dlg.open(); boolean bShouldContinue = (code == IDialogConstants.INTERNAL_ID); return bShouldContinue; }
From source file:com.ibm.xsp.extlib.designer.tooling.panels.applicationlayout.ApplicationLayoutBasicsPanel.java
License:Open Source License
private boolean showConfigWarning() { String msg = "If you change the configuration, all attribute values associated with the current configuration will be lost. Do you want to continue?"; // $NLX-ApplicationLayoutBasicsPanel.Youareabouttochangetheconfigurati-1$ MessageDialog dlg = new MessageDialog(getShell(), "Domino Designer", // $NLX-ApplicationLayoutDropDialog.Dominodesigner-1$ null, // image msg, MessageDialog.WARNING, new String[] { "Continue", "Cancel" }, // $NLX-ApplicationLayoutBasicsPanel.Continue-1$ $NLX-ApplicationLayoutBasicsPanel.Cancel-2$ 1);/*w w w . j av a 2s . c o m*/ int code = dlg.open(); // "Continue" was returning 256.. but then started returning 0 at some point...did SWT version change (it was pending)? boolean bShouldContinue = (code == MessageDialog.OK); //Only continue if 'OK' (Continue) is pressed - otherwise bail out return bShouldContinue; }
From source file:com.ibm.xsp.extlib.designer.tooling.utils.WizardUtils.java
License:Open Source License
public static boolean displayContinueDialog(Shell shell, String title, String msg) { MessageDialog dialog = new MessageDialog(shell, title, null, msg, MessageDialog.WARNING, new String[] { "Continue", "Cancel" }, 0); // $NLX-WizardUtils.Continue-1$ $NLX-WizardUtils.Cancel-2$ return (dialog.open() == 0); }
From source file:com.javapathfinder.vjp.config.editors.userdefined.UserDefinedPropertiesTab.java
License:Open Source License
private Composite createButtons(Composite parent, int style) { Composite main = new Composite(parent, style); main.setLayout(new FillLayout(SWT.VERTICAL)); add = new Button(main, SWT.PUSH); add.setText("Add Property"); add.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { AddPropertyDialog addDialog = new AddPropertyDialog(getShell()); Property property = addDialog.open(); if (property == null) return; if (properties.isDefaultProperty(property.getName())) { new MessageDialog(getParent().getShell(), "Property is already defined.", null, "The property '" + property.getName() + "' is" + " already defined in the default properties." + " Please change its value there.", MessageDialog.WARNING, new String[] { "OK" }, 0).open(); return; }//from w w w. j av a 2 s.co m properties.setProperty(property); viewer.repackColumns(); viewer.refresh(); } }); remove = new Button(main, SWT.PUSH); remove.setText("Remove Property"); remove.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { for (TableItem item : viewer.getTable().getSelection()) { Property p = ((Property) item.getData()); properties.removeProperty(p); } viewer.refresh(); } }); return main; }
From source file:com.liferay.ide.portlet.ui.action.BuildLanguagesAction.java
License:Open Source License
protected boolean checkLanguageFileEncoding(IFile langFile) throws CoreException { IProgressMonitor monitor = new NullProgressMonitor(); try {/* w w w .ja va 2 s .c om*/ langFile.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (Exception e) { PortletUIPlugin.logError(e); } String charset = langFile.getCharset(true); if (!"UTF-8".equals(charset)) //$NON-NLS-1$ { String dialogMessage = NLS.bind(Msgs.languageFileCharacterSet, charset); MessageDialog dialog = new MessageDialog(getDisplay().getActiveShell(), Msgs.incompatibleCharacterSet, getDisplay().getSystemImage(SWT.ICON_WARNING), dialogMessage, MessageDialog.WARNING, new String[] { Msgs.yes, Msgs.no, Msgs.cancel }, 0); int retval = dialog.open(); if (retval == 0) { langFile.setCharset("UTF-8", monitor); //$NON-NLS-1$ String question = NLS.bind(Msgs.forcedEditFile, langFile.getName()); if (MessageDialog.openQuestion(getDisplay().getActiveShell(), Msgs.previewFile, question)) { IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), langFile); } return false; } else if (retval == 2) { return false; } } return true; }
From source file:com.liferay.ide.portlet.ui.handlers.BuildLangHandler.java
License:Open Source License
protected boolean checkLanguageFileEncoding(IFile langFile) throws CoreException { IProgressMonitor monitor = new NullProgressMonitor(); try {// ww w . j av a 2 s . c om langFile.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (Exception e) { PortletUIPlugin.logError(e); } String charset = langFile.getCharset(true); if (!"UTF-8".equals(charset)) { String dialogMessage = NLS.bind(Msgs.languageFileCharacterSet, charset); MessageDialog dialog = new MessageDialog(UIUtil.getActiveShell(), Msgs.incompatibleCharacterSet, UIUtil.getActiveShell().getDisplay().getSystemImage(SWT.ICON_WARNING), dialogMessage, MessageDialog.WARNING, new String[] { Msgs.yes, Msgs.no, Msgs.cancel }, 0); int retval = dialog.open(); if (retval == 0) { langFile.setCharset("UTF-8", monitor); //$NON-NLS-1$ String question = NLS.bind(Msgs.forcedEditFile, langFile.getName()); if (MessageDialog.openQuestion(UIUtil.getActiveShell(), Msgs.previewFile, question)) { IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), langFile); } return false; } else if (retval == 2) { return false; } } return true; }