List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.
Click Source Link
From source file:cu.uci.abos.core.util.MessageDialogUtil.java
License:Open Source License
private static String[] getButtonLabels(int kind) { String[] dialogButtonLabels;//from www . j a v a 2 s . co m switch (kind) { case MessageDialog.ERROR: case MessageDialog.INFORMATION: case MessageDialog.WARNING: { dialogButtonLabels = new String[] { AbosMessages.get().BUTTON_CLOSE }; break; } case MessageDialog.CONFIRM: { dialogButtonLabels = new String[] { AbosMessages.get().BUTTON_ACCEPT, AbosMessages.get().BUTTON_CANCEL }; break; } case MessageDialog.QUESTION: { dialogButtonLabels = new String[] { AbosMessages.get().BUTTON_ACCEPT, AbosMessages.get().BUTTON_CANCEL }; break; } case MessageDialog.QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { AbosMessages.get().BUTTON_ACCEPT, AbosMessages.get().BUTTON_CANCEL, AbosMessages.get().BUTTON_CLOSE }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); } } return dialogButtonLabels; }
From source file:de.blizzy.backup.BackupApplication.java
License:Open Source License
@Override public Object start(IApplicationContext context) { display = Display.getDefault();//from ww w . jav a2s. c o m boolean restartNecessary = false; File runLockFile = new File(BackupPlugin.getDefault().getStateLocation().toFile(), "runLock"); //$NON-NLS-1$ RunLock runLock = new RunLock(runLockFile); if (runLock.tryLock()) { setupDefaultPreferences(); Image image16 = AbstractUIPlugin.imageDescriptorFromPlugin(BackupPlugin.ID, "etc/logo/logo_16.png") //$NON-NLS-1$ .createImage(display); Image image32 = AbstractUIPlugin.imageDescriptorFromPlugin(BackupPlugin.ID, "etc/logo/logo_32.png") //$NON-NLS-1$ .createImage(display); Image image48 = AbstractUIPlugin.imageDescriptorFromPlugin(BackupPlugin.ID, "etc/logo/logo_48.png") //$NON-NLS-1$ .createImage(display); windowImages = new Image[] { image16, image32, image48 }; settingsManager = new SettingsManager(); settingsManager.addListener(new ISettingsListener() { @Override public void settingsChanged() { if (backupRun == null) { scheduleBackupRun(false); } } }); timer = new Timer(); scheduleBackupRun(false); trayIcon = new TrayIcon(display); context.applicationRunning(); if (!BackupPlugin.getDefault().isHidden()) { showShell(); } try { Shell shell = (backupShell != null) ? backupShell.getShell() : null; if (new Updater(false, false).update(shell)) { running = false; restartNecessary = true; } } catch (Throwable e) { BackupPlugin.getDefault().logError("error while updating application", e); //$NON-NLS-1$ } while (running && !display.isDisposed()) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (RuntimeException e) { BackupPlugin.getDefault().logError("error in event loop", e); //$NON-NLS-1$ } } trayIcon.dispose(); timer.cancel(); timer = null; image16.dispose(); image32.dispose(); image48.dispose(); if (backupRun != null) { backupRun.stopBackupAndWait(); } } else { new MessageDialog(null, Messages.Title_ProgramRunning, null, Messages.ProgramRunning, MessageDialog.ERROR, new String[] { IDialogConstants.CLOSE_LABEL }, 0).open(); } return restartNecessary ? EXIT_RESTART : EXIT_OK; }
From source file:de.bmw.yamaica.common.ui.dialogs.YamaicaWizardNewFilePage.java
License:Mozilla Public License
/** * Display an error dialog with the specified message. * /* w w w . j av a 2 s. co m*/ * @param message * the error message */ protected void displayErrorDialog(String message) { MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), INTERNAL_ERROR, message, SWT.SHEET); }
From source file:de.jcup.egradle.eclipse.ide.MissingRootProjectDialog.java
License:Apache License
public MissingRootProjectDialog(Shell parentShell, String detailmessage) { super(parentShell, "EGradle root project missing", null, detailmessage, MessageDialog.ERROR, 0); this.detailmessage = detailmessage; }
From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.DeleteAllOperation.java
License:Open Source License
@Override public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { featureList = new LinkedList<Feature>(); containedFeatureList = new LinkedList<Feature>(); LinkedList<Feature> list = new LinkedList<Feature>(); list.add(feature);//from www . j ava2 s.co m getFeaturesToDelete(list); if (containedFeatureList.isEmpty()) { for (Feature feat : featureList) { AbstractFeatureModelOperation op = new FeatureDeleteOperation(featureModel, feat); executeOperation(op); operations.add(op); } } else { final String containedFeatures = containedFeatureList.toString(); MessageDialog dialog = new MessageDialog(new Shell(), " Delete Error ", FEATURE_SYMBOL, "The following features are contained in constraints:" + '\n' + containedFeatures.substring(1, containedFeatures.length() - 1) + '\n' + '\n' + "Unable to delete this features until all relevant constraints are removed.", MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); } return Status.OK_STATUS; }
From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.DeleteOperation.java
License:Open Source License
/** * Opens an error dialog displaying the {@link Feature}s which could not be replaced by alternatives. * @param notDeletable The not deletable features *///from w w w. ja va2 s . c o m private void openErrorDialog(List<Feature> notDeletable) { String notDeletedFeatures = null; for (Feature f : notDeletable) { if (notDeletedFeatures == null) { notDeletedFeatures = "\"" + f.getName() + "\""; } else { notDeletedFeatures += ", \"" + f.getName() + "\""; } } MessageDialog dialog = new MessageDialog(new Shell(), " Delete Error ", FEATURE_SYMBOL, ((notDeletable.size() != 1) ? "The following features are contained in constraints:" : "The following feature is contained in constraints:") + "\n" + notDeletedFeatures + "\n" + ((notDeletable.size() != 1) ? "Select only one feature in order to replace it with an equivalent one." : "It can not be replaced with an equivalent one."), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); }
From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.ElementDeleteOperation.java
License:Open Source License
/** * Opens an error dialog displaying the {@link Feature}s which could not be replaced by alternatives. * /* w w w .j a va 2s . c o m*/ * @param notDeletable The not deletable features */ private void openErrorDialog(List<IFeature> notDeletable) { String notDeletedFeatures = null; for (IFeature f : notDeletable) { if (notDeletedFeatures == null) { notDeletedFeatures = "\"" + f.getName() + "\""; } else { notDeletedFeatures += ", \"" + f.getName() + "\""; } } MessageDialog dialog = new MessageDialog(new Shell(), DELETE_ERROR, FEATURE_SYMBOL, ((notDeletable.size() != 1) ? "The following features are contained in constraints:" : "The following feature is contained in constraints:") + "\n" + notDeletedFeatures + "\n" + ((notDeletable.size() != 1) ? SELECT_ONLY_ONE_FEATURE_IN_ORDER_TO_REPLACE_IT_WITH_AN_EQUIVALENT_ONE_ : IT_CAN_NOT_BE_REPLACED_WITH_AN_EQUIVALENT_ONE_), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); }
From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.FeatureTreeDeleteOperation.java
License:Open Source License
@Override protected void createSingleOperations() { featureList = new LinkedList<IFeature>(); containedFeatureList = new LinkedList<IFeature>(); LinkedList<IFeature> list = new LinkedList<IFeature>(); list.add(feature);/* w w w . ja va 2 s .c o m*/ getFeaturesToDelete(list); if (containedFeatureList.isEmpty()) { for (IFeature feat : featureList) { AbstractFeatureModelOperation op = new DeleteFeatureOperation(featureModel, feat); operations.add(op); } } else { final String containedFeatures = containedFeatureList.toString(); MessageDialog dialog = new MessageDialog(new Shell(), DELETE_ERROR, FEATURE_SYMBOL, "The following features are contained in constraints:" + '\n' + containedFeatures.substring(1, containedFeatures.length() - 1) + '\n' + '\n' + UNABLE_TO_DELETE_THIS_FEATURES_UNTIL_ALL_RELEVANT_CONSTRAINTS_ARE_REMOVED_, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); } }
From source file:de.ovgu.featureide.ui.actions.generator.configuration.SPLCAToolConfigurationGenerator.java
License:Open Source License
@SuppressWarnings("deprecation") private void runSPLCATool() { CoveringArray ca = null;//from ww w .j a va 2s . c o m final boolean casa = algorithm.equals(CASA.substring(0, CASA.indexOf(" "))); try { if (casa) { URL url = BundleUtility.find(UIPlugin.getDefault().getBundle(), "lib/cover.exe"); try { url = FileLocator.toFileURL(url); } catch (IOException e) { UIPlugin.getDefault().logError(e); } Path path = new Path(url.getFile()); CoveringArrayCASA.CASA_PATH = path.toOSString(); } ca = new GUIDSL(new de.ovgu.featureide.fm.core.FeatureModel(featureModel)).getSXFM().getCNF() .getCoveringArrayGenerator(algorithm, t); if (ca == null) { return; } ca.generate(); } catch (FeatureModelException | TimeoutException | CoveringArrayGenerationException e) { UIPlugin.getDefault().logError(e); return; } catch (final Exception e) { final Display display = Display.getDefault(); display.syncExec(new Runnable() { @Override public void run() { final String errorMessage = algorithm + " experienced an error during its execution.\n" + (casa ? "Maybe some dependent libraries are missing (e.g., libgcc_s_dw2-1.dll or libstdc++-6.dll)" : "Message:\n\t" + e.getMessage()); new MessageDialog(display.getActiveShell(), "External Execution Error", GUIDefaults.FEATURE_SYMBOL, errorMessage, MessageDialog.ERROR, new String[] { OK }, 0) .open(); } }); return; } List<List<String>> solutions = Collections.emptyList(); try { solutions = removeDuplicates(ca); } catch (Exception e) { UIPlugin.getDefault().logWarning("Problems occurred during the execution of " + algorithm); } builder.configurationNumber = solutions.size(); for (final List<String> solution : solutions) { configuration.resetValues(); for (final String selection : solution) { configuration.setManual(selection, Selection.SELECTED); } addConfiguration(configuration); } }
From source file:de.ovgu.featureide.ui.statistics.core.CsvExporter.java
License:Open Source License
/** * Puts the description of each selected node in the first row as header and * it's value in the second row./*from ww w .ja v a2 s . c om*/ * */ private void actualExport() { Job job = new Job("Export statistics into csv") { private StringBuilder firstBuffer; private StringBuilder secondBuffer; @Override protected IStatus run(IProgressMonitor monitor) { List<String> descs = new LinkedList<String>(); List<String> vals = new LinkedList<String>(); getExportData(descs, vals); firstBuffer = new StringBuilder(); secondBuffer = new StringBuilder(); prepareDataForExport(descs, vals, firstBuffer, secondBuffer); return actualWriting(); } /** * @param firstBuffer * @param secondBuffer * @return */ private IStatus actualWriting() { BufferedWriter writer = null; if (!returnVal.endsWith(".csv")) { returnVal += ".csv"; } File file = new File(returnVal); try { if (!file.exists()) { file.createNewFile(); } writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); writer.write(firstBuffer.toString()); writer.newLine(); writer.write(secondBuffer.toString()); } catch (FileNotFoundException e) { giveUserFeedback(true); return Status.CANCEL_STATUS; } catch (IOException e) { UIPlugin.getDefault().logError(e); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { UIPlugin.getDefault().logError(e); } } } giveUserFeedback(false); return Status.OK_STATUS; } /** * */ private void giveUserFeedback(final boolean error) { UIJob errorJob = new UIJob(error ? "show errordialog" : "show dialog") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { Shell shell = Display.getDefault().getActiveShell(); if (error) { MessageDialog dial = new MessageDialog(shell, "Error", GUIDefaults.FEATURE_SYMBOL, "The file cannot be accessed!\nTry again?", MessageDialog.ERROR, new String[] { "OK", "Cancel" }, 0); if (dial.open() == 0) { actualWriting(); } } else { // MessageDialog.openInformation(shell, , // "Data was successfully exported."); new MessageDialog(shell, "Success", GUIDefaults.FEATURE_SYMBOL, "Data was successfully exported", MessageDialog.INFORMATION, new String[] { "OK" }, 0).open(); } return Status.OK_STATUS; } }; errorJob.setPriority(INTERACTIVE); errorJob.schedule(); } /** * @param descs * @param vals * @param buffer * @param secBuf */ private void prepareDataForExport(List<String> descs, List<String> vals, StringBuilder buffer, StringBuilder secBuf) { for (String desc : descs) { buffer.append(desc); buffer.append(SEPARATOR); } for (String val : vals) { secBuf.append(val); secBuf.append(SEPARATOR); } } /** * @param descs * @param vals */ private void getExportData(List<String> descs, List<String> vals) { descs.add("Description: "); vals.add("Value: "); Parent last = null; for (Object o : visibleExpandedElements) { if (o instanceof Parent) { Parent parent = ((Parent) o); if (parent.getParent().equals(last)) { int end = descs.size() - 1; descs.set(end, descs.get(end) + ":"); } descs.add(parent.getDescription()); vals.add(parent.getValue() != null ? parent.getValue().toString() : ""); last = parent; } } } }; job.setPriority(Job.SHORT); job.schedule(); }