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.rap.examples.pages.MessageDialogUtil.java
License:Open Source License
private static String[] getButtonLabels(int kind) { String[] dialogButtonLabels;// w ww .java 2 s. c o m switch (kind) { case MessageDialog.ERROR: case MessageDialog.INFORMATION: case MessageDialog.WARNING: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL }; break; } case MessageDialog.CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } case MessageDialog.QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL }; break; } case MessageDialog.QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); } } return dialogButtonLabels; }
From source file:org.eclipse.rcptt.ui.dialogs.ChangesWarningDialog.java
License:Open Source License
@SuppressWarnings("deprecation") public ChangesWarningDialog(Shell parentShell) { super(parentShell, TITLE, null, MESSAGE_TEMPLATE, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0, TOGGLE_MESSAGE, false, PREF_KEY_DONT_SHOW_DIALOG_AGAIN, new InstanceScope().getNode(Q7UIPlugin.PLUGIN_ID)); }
From source file:org.eclipse.riena.internal.ui.ridgets.swt.MessageBoxRidget.java
License:Open Source License
private int getType(final Type type) { switch (type) { case PLAIN:/*from w w w . j a v a2s .c o m*/ return MessageDialog.NONE; case INFORMATION: return MessageDialog.INFORMATION; case WARNING: return MessageDialog.WARNING; case ERROR: return MessageDialog.ERROR; case HELP: return MessageDialog.INFORMATION; case QUESTION: return MessageDialog.QUESTION; default: return MessageDialog.NONE; } }
From source file:org.eclipse.riena.internal.ui.ridgets.swt.MessageBoxRidgetTest.java
License:Open Source License
public void testSetType() throws Exception { // show message box to transfer values set getRidget().show();/* w ww.java2s. co m*/ assertEquals(MessageDialog.NONE, getWidget().type); assertEquals(IMessageBoxRidget.Type.PLAIN, getRidget().getType()); getRidget().setType(IMessageBoxRidget.Type.ERROR); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.ERROR, getWidget().type); assertEquals(IMessageBoxRidget.Type.ERROR, getRidget().getType()); getRidget().setType(IMessageBoxRidget.Type.WARNING); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.WARNING, getWidget().type); assertEquals(IMessageBoxRidget.Type.WARNING, getRidget().getType()); getRidget().setType(IMessageBoxRidget.Type.INFORMATION); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.INFORMATION, getWidget().type); assertEquals(IMessageBoxRidget.Type.INFORMATION, getRidget().getType()); getRidget().setType(IMessageBoxRidget.Type.HELP); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.INFORMATION, getWidget().type); assertEquals(IMessageBoxRidget.Type.HELP, getRidget().getType()); getRidget().setType(IMessageBoxRidget.Type.QUESTION); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.QUESTION, getWidget().type); assertEquals(IMessageBoxRidget.Type.QUESTION, getRidget().getType()); getRidget().setType(null); // show message box to transfer values set getRidget().show(); assertEquals(MessageDialog.NONE, getWidget().type); assertEquals(IMessageBoxRidget.Type.PLAIN, getRidget().getType()); }
From source file:org.eclipse.riena.internal.ui.ridgets.swt.MessageBoxRidgetTest.java
License:Open Source License
public void testUsedInSharedView() throws Exception { getRidget().setText("TestMessageText1"); getRidget().setTitle("TestMessageTitle1"); getRidget().setType(IMessageBoxRidget.Type.QUESTION); getRidget().setOptions(IMessageBoxRidget.OPTIONS_OK_CANCEL); // show message box to transfer values set getRidget().show();//from w ww . ja va 2 s .c o m final IMessageBoxRidget ridget2 = new MessageBoxRidget(); ridget2.setText("TestMessageText2"); ridget2.setTitle("TestMessageTitle2"); ridget2.setType(IMessageBoxRidget.Type.WARNING); ridget2.setOptions(new IMessageBoxRidget.MessageBoxOption[] { new IMessageBoxRidget.MessageBoxOption("TestCustomOption") }); getRidget().setUIControl(null); ridget2.setUIControl(getWidget()); // show message box to transfer values set ridget2.show(); assertEquals("TestMessageText2", getWidget().text); assertEquals("TestMessageTitle2", getWidget().title); assertEquals(MessageDialog.WARNING, getWidget().type); assertEquals(1, getWidget().buttonLabels.length); assertEquals("TestCustomOption", getWidget().buttonLabels[0]); getRidget().setUIControl(getWidget()); // show message box to transfer values set getRidget().show(); ridget2.setUIControl(null); assertEquals("TestMessageText1", getWidget().text); assertEquals("TestMessageTitle1", getWidget().title); assertEquals(MessageDialog.QUESTION, getWidget().type); assertEquals(2, getWidget().buttonLabels.length); assertEquals(IDialogConstants.OK_LABEL, getWidget().buttonLabels[0]); assertEquals(IDialogConstants.CANCEL_LABEL, getWidget().buttonLabels[1]); }
From source file:org.eclipse.stem.core.Utility.java
License:Open Source License
/** * Displays a warning that the scenario composition may be invalid. * For example the graph nesting within a simulation may be invalid * An infector or inoculator may point to a node that does not exist. * @param message//from w w w . java 2 s . c o m */ public static void displayScenarioCompositionWarning(final String message) { try { if (Display.getDefault() != null) Display.getDefault().syncExec(new Runnable() { public void run() { try { final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // final IStatus warning = new Status(IStatus.WARNING, // CorePlugin.PLUGIN_ID, 1, message, null); // ErrorDialog.openError(window.getShell(), null, null, // warning); String[] labels = new String[2]; labels[1] = "Help"; labels[0] = "Okay"; MessageDialog dialog = new MessageDialog(window.getShell(), "Warning", null, message, MessageDialog.WARNING, labels, 0) { @Override protected void buttonPressed(int buttonId) { if (buttonId == 1) PlatformUI.getWorkbench().getHelpSystem() .displayHelp("org.eclipse.stem.doc.invalidnesting_contextid"); else super.buttonPressed(buttonId); } }; dialog.open(); } catch (Exception e) { // If we get this exception, it is because we're not running in // eclipse. } } // run }); else CorePlugin.logError(message, null); } catch (final Error ncdfe) { // Empty } // catch }
From source file:org.eclipse.team.internal.ccvs.ui.DateTagDialog.java
License:Open Source License
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { dateEntered = privateGetDate();//ww w .ja v a 2 s . c o m if (dateEntered.after(Calendar.getInstance().getTime())) { MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.DateTagDialog_6, null, CVSUIMessages.DateTagDialog_7, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, }, 1); if (dialog.open() == 1) return; } } super.buttonPressed(buttonId); }
From source file:org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.java
License:Open Source License
private int promptToIncludeBinary(IFile file) { MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.GenerateDiffFileWizard_11, null, // accept // the default window icon NLS.bind(CVSUIMessages.GenerateDiffFileWizard_12, file.getFullPath()), MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 1); // no is the default return dialog.open(); }
From source file:org.eclipse.team.svn.ui.action.local.CopyAction.java
License:Open Source License
public void runImpl(IAction action) { IResource[] AllResources = this.getSelectedResources(CopyAction.SF_EXCLUDE_DELETED_AND_PROJECTS); HashMap<String, IResource> resourcesWithoutEqualsNames = new HashMap<String, IResource>(); HashSet<String> conflictedResources = this.excludeResourcesWithEqualNames(resourcesWithoutEqualsNames, AllResources);/*ww w.j av a 2 s . com*/ if (resourcesWithoutEqualsNames.isEmpty()) { MessageDialog dialog = new MessageDialog(this.getShell(), SVNUIMessages.CopyAction_Conflict_Title, null, SVNUIMessages.CopyAction_Conflict_Message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); return; } //make new filtered resources list without resources with equal names final IResource[] resources = resourcesWithoutEqualsNames.values() .toArray(new IResource[resourcesWithoutEqualsNames.values().size()]); ContainerSelectionPanel panel = new ContainerSelectionPanel(resources, conflictedResources); DefaultDialog dialog = new DefaultDialog(this.getShell(), panel); if (dialog.open() == 0) { IPath path = panel.getSelectedPath(); boolean saveHistory = panel.isCopyWithHistorySelected(); CompositeOperation op = new CompositeOperation("Operation_CopyResources", SVNUIMessages.class); //$NON-NLS-1$ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IActionOperation addOp = null; if (panel.isOverrideResourceName()) { path = path.append(panel.getOverridenName()); if (resources.length == 1) { IResource destination = resources[0].getType() == IResource.FILE ? (IResource) root.getFile(path) : root.getFolder(path); String dirPath = FileUtility.getWorkingCopyPath(destination.getParent()); if (dirPath != null) { new File(dirPath).mkdirs(); } boolean[] checkSave = new boolean[] { saveHistory }; IActionOperation copyOp = this.getCopyOperation(resources[0], checkSave, destination); if (checkSave[0]) { IResource[] parents = FileUtility.getOperableParents(new IResource[] { destination }, IStateFilter.SF_UNVERSIONED, true); if (parents.length > 0) { addOp = new AddToSVNOperation(parents); } } if (addOp != null) { op.add(addOp); op.add(copyOp, new IActionOperation[] { addOp }); } else { op.add(copyOp); } } else { IResource destination = root.getFolder(path); String dirPath = FileUtility.getWorkingCopyPath(destination); if (dirPath != null) { new File(dirPath).mkdirs(); } IResource[] parents = FileUtility.addOperableParents(new IResource[] { destination }, IStateFilter.SF_UNVERSIONED, true); if (parents.length > 0) { addOp = new AddToSVNOperation(parents); op.add(addOp); } } } if (resources.length > 1 || !panel.isOverrideResourceName()) { for (int i = 0; i < resources.length; i++) { IPath tPath = path.append(resources[i].getName()); IResource target = resources[i].getType() == IResource.FILE ? (IResource) root.getFile(tPath) : root.getFolder(tPath); IActionOperation copyOp = this.getCopyOperation(resources[i], new boolean[] { saveHistory }, target); if (addOp != null) { op.add(copyOp, new IActionOperation[] { addOp }); } else { op.add(copyOp); } } } op.add(new RefreshResourcesOperation(new IResource[] { root.findMember(panel.getSelectedPath()) })); this.runScheduled(op); } }
From source file:org.eclipse.team.svn.ui.crashrecovery.DiscardedLocationHelper.java
License:Open Source License
public boolean acquireResolution(ErrorDescription description) { if (description.code == ErrorDescription.REPOSITORY_LOCATION_IS_DISCARDED) { Object[] context = (Object[]) description.context; final IRepositoryLocation location = (IRepositoryLocation) context[1]; // check if location is unavailable due to project is checked out with very old plug-in version if (location == null) { return false; }/* w ww . jav a 2 s .c o m*/ // check if already handled for any other project if (SVNRemoteStorage.instance().getRepositoryLocation(location.getId()) != null) { return true; } final IProject project = (IProject) context[0]; final boolean[] solved = new boolean[] { false }; UIMonitorUtility.parallelSyncExec(new Runnable() { public void run() { MessageDialog dlg = new MessageDialog(UIMonitorUtility.getShell(), SVNUIMessages.DiscardedLocationHelper_Dialog_Title, null, SVNUIMessages.format(SVNUIMessages.DiscardedLocationHelper_Dialog_Message, new String[] { project.getName(), location.getLabel() }), MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); solved[0] = dlg.open() == 0; } }); if (solved[0]) { AddRepositoryLocationOperation mainOp = new AddRepositoryLocationOperation(location); CompositeOperation op = new CompositeOperation(mainOp.getId(), mainOp.getMessagesClass()); op.add(mainOp); op.add(new SaveRepositoryLocationsOperation()); op.add(new RefreshRepositoryLocationsOperation(new IRepositoryLocation[] { location }, true)); UIMonitorUtility.doTaskBusyDefault(op); } return solved[0]; } return false; }