List of usage examples for org.eclipse.jface.dialogs MessageDialog MessageDialog
public MessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, int defaultIndex, String... dialogButtonLabels)
From source file:com.drgarbage.visualgraphic.model.ControlFlowGraphDiagramFactory.java
License:Apache License
public static int openConfirm(Shell parent, String title, String message) { MessageDialog dialog = new MessageDialog(parent, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(), message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, 3); /*/* ww w . jav a 2s. c o m*/ * OK is the * default */ return dialog.open(); }
From source file:com.drgarbage.visualgraphic.model.ControlFlowGraphDiagramFactory.java
License:Apache License
public static int openStop(Shell parent, String title, String message) { MessageDialog dialog = new MessageDialog(parent, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(), message, MessageDialog.QUESTION, new String[] { IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL }, 1); /* * YES is the * default */ return dialog.open(); }
From source file:com.ecfeed.ui.dialogs.basic.YesNoDialog.java
License:Open Source License
public static Result open(String question, Shell shell) { MessageDialog fDialog = new MessageDialog(shell, "Question", null, question, MessageDialog.QUESTION, new String[] { "No", "Yes" }, 0); int result = fDialog.open(); if (result == 0) { return Result.NO; }// ww w .j av a 2 s .c o m return Result.YES; }
From source file:com.ecfeed.ui.wizards.NewEctFileCreationPage.java
License:Open Source License
public boolean performFinish() { IFile file = fPage.createNewFile();/*from w ww .j a va 2 s.co m*/ try { if (file.getContents().read() != -1) { MessageDialog dialog = new MessageDialog(getShell(), Messages.WIZARD_FILE_EXISTS_TITLE, Display.getDefault().getSystemImage(SWT.ICON_QUESTION), Messages.WIZARD_FILE_EXISTS_MESSAGE, MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, IDialogConstants.OK_ID); if (dialog.open() != IDialogConstants.OK_ID) { return false; } } final IPath newFileFullPath = fPage.getContainerFullPath().append(fPage.getFileName()); String modelName = newFileFullPath.removeFileExtension().lastSegment(); RootNode model = new RootNode(modelName != null ? modelName : Constants.DEFAULT_NEW_ECT_MODEL_NAME, ModelVersionDistributor.getCurrentVersion()); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); new EctSerializer(ostream, ModelVersionDistributor.getCurrentVersion()).serialize(model); ByteArrayInputStream istream = new ByteArrayInputStream(ostream.toByteArray()); file.setContents(istream, true, true, null); //open new file in an ect editor IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.openEditor(new FileEditorInput(file), Constants.ECT_EDITOR_ID); } catch (Exception e) { e.printStackTrace(); } return true; }
From source file:com.elphel.vdt.core.options.OptionsCore.java
License:Open Source License
private static void checkVersionCompatibility(Context context, IPreferenceStore store) { if (OptionsUtils.isVersionCompatible(context.getVersion(), context.getName(), store)) return;//w ww.j av a 2s .com Shell shell = VerilogPlugin.getActiveWorkbenchShell(); String message = "Version of TSL description has been changed.\nDo you wish to delete stored values?"; MessageDialog messageBox = new MessageDialog(shell, "Warning", null, message, MessageDialog.WARNING, new String[] { "Yes", "No" }, 1); messageBox.open(); if (messageBox.getReturnCode() == 0) { OptionsUtils.clearStore(context.getName(), store); finalizeDoStore(store); } }
From source file:com.elphel.vdt.ui.views.ClearAction.java
License:Open Source License
public void run() { Shell shell = VerilogPlugin.getActiveWorkbenchShell(); MessageDialog messageBox = new MessageDialog(shell, "Warning", null, message, MessageDialog.QUESTION, buttonText, 1);/*from w w w .j a v a 2 s.c om*/ messageBox.open(); if (messageBox.getReturnCode() == 0) { clear(); } }
From source file:com.elphel.vdt.ui.views.ClearLogFiles.java
License:Open Source License
public void clear() { String msg = "The following files will be deleted:\n\n"; Set<IFile> toRemove = toolSequence.getOldFiles(toolSequence.getLogDirs()); int index = 0; for (IFile file : toRemove) { index++;//from ww w. ja v a2 s .c om // msg+=file.getLocation().toOSString()+"\n"; msg += file.getName() + "\n"; if (index > 25) { msg += "\n... and more"; break; } } if (toRemove.size() == 0) { msg = "There are no files to be deleted"; } Shell shell = VerilogPlugin.getActiveWorkbenchShell(); MessageDialog messageBox = new MessageDialog(shell, "Warning", null, msg, MessageDialog.QUESTION, buttonText, 1); messageBox.open(); if (messageBox.getReturnCode() == 0) { for (IFile file : toRemove) { try { // file.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT ,null); file.delete(true, null); // force } catch (CoreException e) { System.out.println("Could not delete " + file.getLocation().toOSString() + ", exception:" + e); } } } }
From source file:com.elphel.vdt.ui.views.ClearStateFiles.java
License:Open Source License
public void clear() { String msg = "The following files will be deleted:\n\n"; Set<IFile> toRemove = toolSequence.getOldFiles(toolSequence.getStateDirs()); int index = 0; for (IFile file : toRemove) { index++;/*from w w w. j av a 2s . co m*/ msg += file.getName() + "\n"; if (index > 25) { msg += "\n... and more"; break; } } if (toRemove.size() == 0) { msg = "There are no files to be deleted"; } Shell shell = VerilogPlugin.getActiveWorkbenchShell(); MessageDialog messageBox = new MessageDialog(shell, "Warning", null, msg, MessageDialog.QUESTION, buttonText, 1); messageBox.open(); if (messageBox.getReturnCode() == 0) { for (IFile file : toRemove) { try { file.delete(true, null); // force - in log files was needed } catch (CoreException e) { System.out.println("Could not delete " + file.getLocation().toOSString()); } } } }
From source file:com.essiembre.eclipse.rbe.model.workbench.files.FragmentPropertiesFileCreator.java
License:Apache License
/** * Ask the user where to create the new file * the fragment or the host plugin./* w w w.j a v a 2s. c o m*/ * @return Whether the user decided to create the file in the fragment. */ public static boolean shouldFileBeCreatedInFragment(IProject fragment) { if (PDEUtils.getFragmentHost(fragment) == null) { return true; // there is no host plugin, can not create something there } if (RBEPreferences.getLoadOnlyFragmentResources()) return true; // TODO externalize/translate this messages MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "File creation", null, // accept "Resources where loaded from both the host and the fragment " + "plugin. Where do you want to create the new bundle?", MessageDialog.QUESTION, // Fragment is the default new String[] { "Fragment", "Host plugin" }, 0); int result = dialog.open(); return result == 0; }
From source file:com.freescale.deadlockpreventer.agent.LauncherView.java
License:Open Source License
protected int handleConflict(Conflict conflictItem) { if (!passFilters(conflictItem)) return IConflictListener.CONTINUE; int flag = 0; if (Boolean.parseBoolean(InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).get(PREF_PRINT_TO_STDOUT, Boolean.toString(false)))) flag |= IConflictListener.LOG_TO_CONSOLE; if (logAndContinue.getSelection()) return flag | IConflictListener.CONTINUE; if (throwsException.getSelection()) return flag | IConflictListener.EXCEPTION; if (terminate.getSelection()) return flag | IConflictListener.ABORT; if (interactive.getSelection()) { final String conflictMessage = conflictItem.message; MessageDialog dialog = new MessageDialog(getSite().getShell(), "Deadlock confict occured", null, "An incorrect synchronization primitive acquisition order has occured.", MessageDialog.QUESTION, new String[] { "Continue", "Throw exception", "Terminate process" }, 0) { protected Control createCustomArea(Composite parent) { parent.setLayout(new GridLayout()); Text text = new Text(parent, SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); text.setText(conflictMessage); text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); text.setLayoutData(layoutData); return super.createCustomArea(parent); }//from w w w . j a va 2 s. c o m protected Point getInitialSize() { Point pt = super.getInitialSize(); pt.x = Math.min(pt.x, 600); pt.y = Math.min(pt.y, 600); return pt; } }; int index = dialog.open(); if (index == 1) return flag | IConflictListener.EXCEPTION; if (index == 2) return flag | IConflictListener.ABORT; } return flag | IConflictListener.CONTINUE; }