List of usage examples for org.eclipse.jface.dialogs MessageDialog QUESTION
int QUESTION
To view the source code for org.eclipse.jface.dialogs MessageDialog QUESTION.
Click Source Link
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; }/*www. jav a 2 s . c o m*/ return Result.YES; }
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 ww . j a va 2 s. c o m*/ 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 w w w. ja v a2 s . c o m // 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++;// w ww. j ava2s .c o 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./*from w w w .j a va2 s . 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); }// www .j ava2s . 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; }
From source file:com.ge.research.sadl.ui.editor.SadlEditorCallback.java
License:Open Source License
private void handleNatureAdding(XtextEditor editor) { IResource resource = editor.getResource(); if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) { String title = Messages.NatureAddingEditorCallback_MessageDialog_Title; String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1; MessageDialog dialog = new MessageDialog( editor.getEditorSite().getShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/*from ww w . j a v a 2 s . c om*/ int open = dialog.open(); if (open == 0) { toggleNature.toggleNature(resource.getProject()); } } }
From source file:com.generalrobotix.ui.item.GrxSimulationItem.java
License:Open Source License
private boolean _setupController(GrxModelItem model, ControllerAttribute deactivatedController) { String controllerName = model.getProperty("controller"); //$NON-NLS-1$ if (controllerName == null || controllerName.equals("")) //$NON-NLS-1$ return true; double step = model.getDbl("controlTime", 0.005); //$NON-NLS-1$ if (stepTime_ > step) { MessageDialog.openInformation(GrxUIPerspectiveFactory.getCurrentShell(), "", //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.message.errorControlTime")); //$NON-NLS-1$ return false; }/*from ww w . jav a2 s . c o m*/ String optionAdd = null; if (!isTrue("integrate", true)) optionAdd = " -nosim"; //$NON-NLS-1$ GrxDebugUtil.println("model name = " + model.getName() + " : controller = " + controllerName //$NON-NLS-1$//$NON-NLS-2$ + " : cycle time[s] = " + step); //$NON-NLS-1$ GrxProcessManager pManager = (GrxProcessManager) manager_.getItem("processManager"); ; boolean doRestart = false; org.omg.CORBA.Object cobj = GrxCorbaUtil.getReference(controllerName); AProcess proc = pManager.get(controllerName); String dir = model.getStr("setupDirectory", ""); //$NON-NLS-1$ //$NON-NLS-2$ String com = model.getStr("setupCommand", ""); //$NON-NLS-1$ //$NON-NLS-2$ if (cobj != null) { try { cobj._non_existent(); if (isInteractive_ && (!com.equals("") || proc != null)) { // ask only in case being abled to restart process //$NON-NLS-1$ MessageDialog dialog = new MessageDialog(GrxUIPerspectiveFactory.getCurrentShell(), MessageBundle.get("GrxOpenHRPView.dialog.title.restartController"), null, //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.message.restartController0") + controllerName //$NON-NLS-1$ + MessageBundle.get("GrxOpenHRPView.dialog.message.restartController1") //$NON-NLS-1$ + MessageBundle.get("GrxOpenHRPView.dialog.message.restartController2"), //$NON-NLS-1$ MessageDialog.QUESTION, new String[] { MessageBundle.get("GrxOpenHRPView.dialog.button.yes"), //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.button.no"), //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.button.cancel") }, //$NON-NLS-1$ 2); switch (dialog.open()) { case 0: // 0 == "YES" doRestart = true; break; case 1: // 1 == "NO" if (deactivatedController != null) deactivatedController.active(); break; default: return false; } } else { if ((!com.equals("") || proc != null) && deactivatedController != null) deactivatedController.active(); } } catch (Exception e) { cobj = null; } } if (cobj == null || doRestart) { if (proc != null) proc.stop(); if (!com.equals("")) { //$NON-NLS-1$ com = dir + java.io.File.separator + com; String osname = System.getProperty("os.name"); //$NON-NLS-1$ if (osname.indexOf("Windows") >= 0) { //$NON-NLS-1$ com = "\"" + com + "\""; //$NON-NLS-1$ //$NON-NLS-2$ } ProcessInfo pi = new ProcessInfo(); pi.id = controllerName; pi.dir = dir; pi.com.add(com); pi.waitCount = 2000; pi.isCorbaServer = true; pi.hasShutdown = true; pi.doKillall = false; pi.autoStart = false; pi.autoStop = true; if (proc != null) pManager.unregister(proc.pi_.id); pManager.register(pi); proc = pManager.get(controllerName); } if (proc != null) { GrxDebugUtil.println("Executing controller process ..."); //$NON-NLS-1$ GrxDebugUtil.println("dir: " + dir); //$NON-NLS-1$ GrxDebugUtil.println("command: " + com); //$NON-NLS-1$ proc.start(optionAdd); } } Date before = new Date(); for (int j = 0;; j++) { cobj = GrxCorbaUtil.getReference(controllerName); if (cobj != null) { try { Controller controller = ControllerHelper.narrow(cobj); controller.setModelName(model.getName()); controller.setDynamicsSimulator(currentDynamics_); if (isTrue("viewsimulate")) {//simParamPane_.isSimulatingView()) { cobj = GrxCorbaUtil.getReference("ViewSimulator"); //$NON-NLS-1$ ViewSimulator viewsim = ViewSimulatorHelper.narrow(cobj); controller.setViewSimulator(viewsim); } ControllerAttribute refAttr = _getControllerFromControllerName(controllerName); if (refAttr == null) { controllers_ .add(new ControllerAttribute(model.getName(), controllerName, controller, step)); } else { refAttr.reset(controller, step); } GrxDebugUtil.println(" connected to the Controller(" + controllerName + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ controller.setTimeStep(step); controller.initialize(); controller.start(); break; } catch (ControllerException e) { System.out.println("setupController:" + e.description); MessageDialog.openInformation(GrxUIPerspectiveFactory.getCurrentShell(), e.description, MessageBundle.get("GrxOpenHRPView.dialog.message.failedController")); if (proc != null) proc.stop(); return false; } catch (Exception e) { GrxDebugUtil.printErr("setupController:", e); //$NON-NLS-1$ } } if (j > WAIT_COUNT_ || (new Date().getTime() - before.getTime() > WAIT_COUNT_ * 1000)) { GrxDebugUtil.println(" failed to setup controller:" + controllerName); //$NON-NLS-1$ //??????????EE??E??????null???? MessageDialog dialog = new MessageDialog(GrxUIPerspectiveFactory.getCurrentShell(), MessageBundle.get("GrxOpenHRPView.dialog.title.setupController"), null, //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.message.setupController0") + controllerName //$NON-NLS-1$ + ").\n" + MessageBundle.get("GrxOpenHRPView.dialog.message.setupController1"), //$NON-NLS-1$//$NON-NLS-2$ MessageDialog.QUESTION, new String[] { MessageBundle.get("GrxOpenHRPView.dialog.button.yes"), //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.button.no"), //$NON-NLS-1$ MessageBundle.get("GrxOpenHRPView.dialog.button.cancel") }, //$NON-NLS-1$ 2); int ans = dialog.open(); if (ans == 0) { before = new Date(); j = 0; } else if (ans == 1) { MessageDialog.openInformation(GrxUIPerspectiveFactory.getCurrentShell(), "", MessageBundle.get("GrxOpenHRPView.dialog.message.failedController")); return false; } else { MessageDialog.openInformation(GrxUIPerspectiveFactory.getCurrentShell(), "", MessageBundle.get("GrxOpenHRPView.dialog.message.failedController")); return false; } } else { try { Thread.sleep(1000); } catch (Exception e) { } } } return true; }
From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchOperationUI.java
License:Open Source License
private String getTargetWithCheckoutRemoteTrackingDialog() { String[] buttons = new String[] { UIText.BranchOperationUI_CheckoutRemoteTrackingAsLocal, UIText.BranchOperationUI_CheckoutRemoteTrackingCommit, IDialogConstants.CANCEL_LABEL }; MessageDialog questionDialog = new MessageDialog(getShell(), UIText.BranchOperationUI_CheckoutRemoteTrackingTitle, null, UIText.BranchOperationUI_CheckoutRemoteTrackingQuestion, MessageDialog.QUESTION, buttons, 0); int result = questionDialog.open(); if (result == 0) { // Check out as new local branch CreateBranchWizard wizard = new CreateBranchWizard(repository, target); WizardDialog createBranchDialog = new WizardDialog(getShell(), wizard); createBranchDialog.open();/* w w w.ja v a 2s . com*/ return null; } else if (result == 1) { // Check out commit return target; } else { // Cancel return null; } }
From source file:com.google.appengine.eclipse.core.preferences.ui.GaePreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { noDefaultAndApplyButton();// w ww . jav a 2s. c o m sdkSet = GaePreferences.getSdks(); return new SdkTable<GaeSdk>(parent, SWT.NONE, sdkSet, null, this) { @Override protected IStatus doAddSdk() { AddSdkDialog<GaeSdk> addGaeSdkDialog = new AddSdkDialog<GaeSdk>(getShell(), sdkSet, AppEngineCorePlugin.PLUGIN_ID, "Add App Engine SDK", GaeSdk.getFactory()); if (addGaeSdkDialog.open() == Window.OK) { GaeSdk newSdk = addGaeSdkDialog.getSdk(); if (newSdk != null) { sdkSet.add(newSdk); } return Status.OK_STATUS; } return Status.CANCEL_STATUS; } @Override protected IStatus doDownloadSdk() { MessageDialog dialog = new MessageDialog(AppEngineCorePlugin.getActiveWorkbenchShell(), "Google Eclipse Plugin", null, "Would you like to open the Google App Engine download page in your " + "web browser?\n\nFrom there, you can " + "download the latest App Engine SDK and extract it to the" + " location of your choice. Add it to Eclipse" + " with the \"Add...\" button.", MessageDialog.QUESTION, new String[] { "Open Browser", IDialogConstants.CANCEL_LABEL }, 0); if (dialog.open() == Window.OK) { if (BrowserUtilities .launchBrowserAndHandleExceptions(AppEngineCorePlugin.SDK_DOWNLOAD_URL) == null) { return Status.CANCEL_STATUS; } } else { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; }