List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:org.jcryptool.games.divide.dialogs.SaveRecordConfirmation.java
License:Open Source License
public int open() { String dialog;/*from w ww.j ava 2s . c o m*/ int dialogImageType; if (success) { dialog = Messages.SaveRecordConfirmation_0; dialogImageType = MessageDialog.INFORMATION; } else { dialog = Messages.SaveRecordConfirmation_1 + System.lineSeparator() + error; dialogImageType = MessageDialog.ERROR; } String[] labels = new String[] { "OK" }; MessageDialog dialogWindow = new MessageDialog(parent, null, null, dialog, dialogImageType, labels, -1); return dialogWindow.open(); }
From source file:org.kalypso.core.status.AbstractStatusDialog.java
License:Open Source License
private static int toMessageType(final int severity) { switch (severity) { case IStatus.OK: return MessageDialog.NONE; case IStatus.INFO: return MessageDialog.INFORMATION; case IStatus.WARNING: return MessageDialog.WARNING; case IStatus.ERROR: return MessageDialog.ERROR; case IStatus.CANCEL: // hm, better cancel icon? return MessageDialog.NONE; default:/* ww w. ja va2 s.c o m*/ return MessageDialog.NONE; } }
From source file:org.kalypso.ui.rrm.internal.scenarios.MergeScenariosWizard.java
License:Open Source License
@Override public boolean performFinish() { /* Were all selected scenarios verified? */ final boolean scenariosVerified = wereSelectedScenariosVerified(); /* Determine the properties of the message dialog. */ int kind = MessageDialog.INFORMATION; String message = Messages.getString("MergeScenariosWizard_2"); //$NON-NLS-1$ if (!scenariosVerified) { kind = MessageDialog.WARNING;/* w ww. j ava 2 s . c o m*/ message = Messages.getString("MergeScenariosWizard_3"); //$NON-NLS-1$ } /* Open the message dialog. */ // FIXME: use, confirm dialog! final MessageDialog dialog = new MessageDialog(getShell(), getWindowTitle(), null, message, kind, new String[] { Messages.getString("MergeScenariosWizard_4"), //$NON-NLS-1$ Messages.getString("MergeScenariosWizard_5") }, //$NON-NLS-1$ 1); if (dialog.open() != 0) return false; /* Create the operation. */ final MergeScenariosOperation operation = new MergeScenariosOperation(m_scenariosData); /* Execute the operation. */ final IStatus status = RunnableContextHelper.execute(getContainer(), true, false, operation); if (!status.isOK()) { /* Log the error message. */ KalypsoUIRRMPlugin.getDefault().getLog().log(status); /* Show a status dialog. */ final StatusDialog statusDialog = new StatusDialog(getShell(), status, getWindowTitle()); statusDialog.open(); return false; } return true; }
From source file:org.kalypso.ui.rrm.internal.simulations.InitialValueAction.java
License:Open Source License
@Override public void runWithEvent(final Event event) { /* Get the shell. */ final Display display = event.widget.getDisplay(); final Shell shell = display.getActiveShell(); /* Longterm simulations may not have start conditions. */ final NAControl simulation = (NAControl) m_control.getFeature(); if (SimulationUtilities.isLongterm(simulation)) { MessageDialog.open(MessageDialog.INFORMATION, shell, getText(), Messages.getString("InitialValueAction.1"), SWT.NONE); //$NON-NLS-1$ return;// www . ja v a2 s. co m } /* Get the old initial value. */ final String oldInitialValue = simulation.getInitialValueSource(); /* Create the dialog. */ final ListDialog dialog = new ListDialog(shell); dialog.setTitle(getText()); dialog.setMessage(Messages.getString("InitialValueAction.2")); //$NON-NLS-1$ dialog.setLabelProvider(new LabelProvider()); dialog.setContentProvider(new ArrayContentProvider()); /* Create the input. */ final List<String> input = new ArrayList<>(); input.add(RESET_CONSTANT); /* Add all longterm simulations. */ final String[] longtermSimulations = SimulationUtilities.getLongtermSimulations(simulation); for (final String longtermSimulation : longtermSimulations) input.add(longtermSimulation); /* Set the input. */ dialog.setInput(input); /* Set the old initial value as selection. */ if (oldInitialValue != null && input.contains(oldInitialValue)) dialog.setInitialSelections(new String[] { oldInitialValue }); else dialog.setInitialSelections(new String[] { RESET_CONSTANT }); /* Open the dialog. */ final int open = dialog.open(); if (open != Window.OK) return; /* Get the result. */ final Object[] result = dialog.getResult(); if (result == null || result.length == 0) return; /* Get the new initial value. */ String newInitialValue = (String) result[0]; /* HINT: It may be a the reset constant. */ if (RESET_CONSTANT.equals(newInitialValue)) newInitialValue = ""; //$NON-NLS-1$ /* Only change, if the old initial value is different from the new initial value. */ if (!ObjectUtils.equals(oldInitialValue, newInitialValue)) { final IPropertyType pt = m_control.getFeatureTypeProperty(); m_control.fireFeatureChanges(new ChangeFeatureCommand(simulation, pt, newInitialValue)); } }
From source file:org.larz.dom4.FixIds.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { MessageDialog overwriteDialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("FixIDsDialog.title"), null, Messages.getString("FixIDsDialog.text"), MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); // 'No' is the default if (overwriteDialog.open() != Window.OK) { return null; }//from w w w .j av a 2s. c o m IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); ((DmEditor) page.getActiveEditor()).fixIdNumbers(); return null; }
From source file:org.locationtech.udig.ui.TestZoomDialogAction.java
License:Open Source License
@Override public void run(IAction action) { MessageDialog d = new MessageDialog(Display.getDefault().getActiveShell(), "Test", null, "Test zoom dialog", MessageDialog.INFORMATION, new String[] { "OK" }, 1); ZoomingDialog zd = new ZoomingDialog(Display.getDefault().getActiveShell(), d, new Rectangle(0, 0, 10, 10)); zd.open();// ww w . j ava 2s . co m }
From source file:org.netxms.ui.eclipse.tools.MessageDialogHelper.java
License:Open Source License
/** * Convenience method to open a standard information dialog. * //from w w w.j a v a 2s. c o m * @param parent the parent shell of the dialog, or <code>null</code> if none * @param title the dialog's title, or <code>null</code> if none * @param message the message */ public static void openInformation(Shell parent, String title, String message) { open(MessageDialog.INFORMATION, parent, title, message); }
From source file:org.obeonetwork.dsl.uml2.design.api.services.ProfileDiagramServices.java
License:Open Source License
/** * Dialog message to define a profile.// w ww. j a va2s . co m * * @param rootProfile * to define * @param allContentProfile * to define */ private void defineProfileDialog(final Profile rootProfile, final List<Profile> allContentProfile) { boolean result = false; final String[] buttonYes = { OK }; final Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog msgDialogYes = null; result = ProfileServices.INSTANCE.defineProfile(rootProfile, allContentProfile); if (result) { msgDialogYes = new MessageDialog(activeShell, "Define the Profile", null, //$NON-NLS-1$ "The profile is defined", MessageDialog.INFORMATION, buttonYes, 0); //$NON-NLS-1$ msgDialogYes.open(); } }
From source file:org.obeonetwork.dsl.uml2.design.api.services.ProfileDiagramServices.java
License:Open Source License
/** * Find the imported metaclass to the profile. * * @param profile/*ww w.ja va 2 s . co m*/ * to test. * @return a list of class. */ public List<PackageableElement> importMetaclass(final Profile profile) { final List<PackageableElement> alreadyOnProfile = new ArrayList<PackageableElement>(); final List<String> alreadyOnProfileNames = new ArrayList<String>(); final ImportMetaclassDialog dialog = new ImportMetaclassDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), profile, true); dialog.setHeaderMessageText("Select the UML Metaclasses to import."); //$NON-NLS-1$ dialog.open(); if (dialog.getResult() != null) { final List<Object> selectedObjects = Arrays.asList(dialog.getResult()); for (final Object object : selectedObjects) { if (object instanceof Class) { final Class selectedMetaclass = (Class) object; final PackageableElement importedMember = profile .getImportedMember(selectedMetaclass.getName()); if (importedMember == null) { profile.createMetaclassReference(selectedMetaclass); } else { // reserved for a future utilisation alreadyOnProfile.add(importedMember); alreadyOnProfileNames.add(importedMember.getName()); } } } } if (alreadyOnProfile.size() > 0) { final String[] buttonList = { "Ok" }; //$NON-NLS-1$ final MessageDialog msgDialog = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Already imported Metaclasses", null, //$NON-NLS-1$ "The following Metaclasses are already imported:" + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + alreadyOnProfileNames, MessageDialog.INFORMATION, buttonList, 0); msgDialog.open(); } return alreadyOnProfile; }
From source file:org.obeonetwork.dsl.uml2.design.api.services.ProfileDiagramServices.java
License:Open Source License
/** * Dialog message to undefine the profile. * * @param rootProfile//from w w w. j a v a 2 s . c om * to undefine */ public void undefineProfileDialog(final Profile rootProfile) { final String[] buttonYesNo = { YES, NO }; final String[] buttonYes = { OK }; final Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog msgDialogYesNo = null; MessageDialog msgDialogYes = null; if (rootProfile.getDefinition() != null) { msgDialogYesNo = new MessageDialog(activeShell, UNDEFINE_PROFILE, null, "Would you like to undefine this profile ?", MessageDialog.QUESTION, buttonYesNo, 1); //$NON-NLS-1$ final int diagResult = msgDialogYesNo.open(); if (diagResult == 0) { undefineProfile(rootProfile); msgDialogYes = new MessageDialog(activeShell, UNDEFINE_PROFILE, null, "The profile is undefined", //$NON-NLS-1$ MessageDialog.INFORMATION, buttonYes, 0); msgDialogYes.open(); } } else { msgDialogYes = new MessageDialog(activeShell, UNDEFINE_PROFILE, null, "The profile is not defined !", //$NON-NLS-1$ MessageDialog.WARNING, buttonYes, 0); msgDialogYes.open(); } }