List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:com.arc.intro.ImportSampleProjectAction.java
License:Open Source License
private boolean promptForDelete(final IProject p) { final boolean result[] = new boolean[1]; getShell().getDisplay().syncExec(new Runnable() { public void run() { result[0] = MessageDialog.openConfirm(getShell(), "Confirmation", "Overwrite existing project " + p.getName() + "?"); }//from w w w . j av a 2s.c om }); return result[0]; }
From source file:com.asakusafw.shafu.internal.ui.wizards.NewProjectWizard.java
License:Apache License
@Override public boolean performFinish() { final File projectDirectory = computeProjectDirectory(); if (projectDirectory.exists()) { boolean delete = MessageDialog.openConfirm(getShell(), Messages.NewProjectWizard_dialogOverwriteTitle, MessageFormat.format(Messages.NewProjectWizard_dialogOverwriteMessage, projectDirectory)); if (delete == false) { return false; }/*from w w w .ja v a 2 s . c om*/ } final IWorkingSet[] workingSets = informationPage.getSelectedWorkingSets(); final List<String> taskNames = templatePage.getTaskNames(); final ShafuConsole console = templatePage.getConsole(); final AtomicReference<Stage> stageRef = new AtomicReference<Stage>(Stage.INIT); final Archive templateArchive = new Archive(templatePage.getTargetFile(), templatePage.getTargetUrl()); try { ProgressUtils.run(getContainer(), new IRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { SubMonitor sub = SubMonitor.convert(monitor); try { perform(sub, projectDirectory, workingSets, templateArchive, taskNames, console, stageRef); } finally { monitor.done(); } } }); } catch (RuntimeException e) { IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewProjectWizard_errorUnknown, e); LogUtil.log(status); ErrorDialog.openError(getShell(), null, null, status); templatePage.setPageComplete(false); return false; } catch (CoreException e) { if (StatusUtils.hasCancel(e.getStatus())) { return false; } switch (stageRef.get()) { case BUILD: templatePage.setErrorMessage(Messages.NewProjectWizard_errorTemplateBuild); templatePage.openConsole(); break; default: templatePage.setErrorMessage(e.getStatus().getMessage()); LogUtil.log(e.getStatus()); break; } templatePage.setPageComplete(false); return false; } finally { templateArchive.close(); } return true; }
From source file:com.ashigeru.eclipse.internal.codereading.ui.dialogs.LogEditDialog.java
License:Apache License
@Override protected void okPressed() { this.resultFile = new File(fieldLogFile.getText()); if (resultFile.exists() == false) { boolean create = MessageDialog.openConfirm(getShell(), "New Log File", "Log file does not exist. Do you create it?"); if (create == false) { return; }// w w w .ja v a 2 s .c o m } super.okPressed(); }
From source file:com.astra.ses.spell.gui.dialogs.ConnectionDialog.java
License:Open Source License
/*************************************************************************** * Destroy the selected context//from w ww.j a va2 s . c o m **************************************************************************/ private void destroySelectedContext() { String ctxName = m_contexts.getSelectedContext(); if (ctxName != null) { boolean proceed = MessageDialog.openConfirm(this.getShell(), "Destroy context", "WARNING: destroying a context will kill ALL its associated executors. Proceed?"); if (proceed) { ContextInfo info = s_lstProxy.getContextInfo(ctxName); s_cfg.setSelection(IConfig.ID_CONTEXT_SELECTION, info); CommandHelper.execute(DestroyContext.ID); updateServer(false); } } }
From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java
License:Open Source License
/*************************************************************************** * //from w w w . jav a2 s . c o m **************************************************************************/ private void doRevert() { if (MessageDialog.openConfirm(getShell(), "Revert changes", "Revert all changes made to variables?")) { m_varTable.setSelection(null); m_container.revert(); m_varTable.refresh(); if (m_fileTable != null) { m_fileTable.setSelection(null); } update(); } }
From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java
License:Open Source License
/*************************************************************************** * Called when one of the buttons of the button bar is pressed. * /* ww w .j av a2s . co m*/ * @param buttonId * The button identifier. **************************************************************************/ @Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { if (m_container.hasChanges()) { boolean mergeNew = false; // The button can be null for dialogs without file import if (m_chkMergeNew != null) { m_chkMergeNew.getSelection(); } UpdateDataContainerJob job = new UpdateDataContainerJob(m_procId, m_container, mergeNew); CommandHelper.executeInProgress(job, true, true); m_varTable.refresh(); if (job.result == CommandResult.FAILED) { MessageDialog.openError(getShell(), "Update Error", "Failed to update changes to dictionary:\n" + job.error); return; } } } else if (buttonId == IDialogConstants.BACK_ID) { doRevert(); return; } else if (buttonId == IDialogConstants.CANCEL_ID) { if (m_container.hasChanges()) { if (!MessageDialog.openConfirm(getShell(), "Changes made", "There are changes made to the data container variables.\n\n" + "If you close the dialog, these changes will be lost. ")) return; } if (!m_fileContainer.getVariables().isEmpty()) { if (!MessageDialog.openConfirm(getShell(), "File loaded", "There are NO changes made to the data container variables, but an input file was loaded.\n\n" + "If you close the dialog, no changes will be applied. Are you sure to close?")) return; } } close(); }
From source file:com.astra.ses.spell.gui.model.commands.CloseProcedure.java
License:Open Source License
/*************************************************************************** * The command has been executed, so extract extract the needed information * from the application context./* w w w . j ava2 s .c o m*/ **************************************************************************/ public CommandResult execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); String procId = (String) cfg.getSelection(IConfig.ID_PROCEDURE_SELECTION); boolean doClose = MessageDialog.openConfirm(window.getShell(), "Close procedure " + procId, "Do you really want to close this procedure?"); if (doClose) { CloseProcedureJob job = new CloseProcedureJob(procId); CommandHelper.executeInProgress(job, false, false); if (job.result != CommandResult.SUCCESS) { MessageDialog.openError(window.getShell(), "Close error", job.message); } return job.result; } else { return CommandResult.NO_EFFECT; } }
From source file:com.astra.ses.spell.gui.model.commands.KillProcedure.java
License:Open Source License
/*************************************************************************** * The command has been executed, so extract extract the needed information * from the application context.//from ww w .j a v a 2s . c o m **************************************************************************/ public CommandResult execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); String procId = (String) cfg.getSelection(IConfig.ID_PROCEDURE_SELECTION); boolean doKill = MessageDialog.openConfirm(window.getShell(), "Kill procedure " + procId, "Do you really want to kill this procedure?"); if (doKill) { KillProcedureJob job = new KillProcedureJob(procId); CommandHelper.executeInProgress(job, false, false); if (job.result != CommandResult.SUCCESS) { MessageDialog.openError(window.getShell(), "Kill error", job.message); } return job.result; } else { return CommandResult.NO_EFFECT; } }
From source file:com.astra.ses.spell.gui.model.commands.OpenProcedureBase.java
License:Open Source License
/*************************************************************************** * Check preconditions/*from w w w .ja v a 2 s.co m*/ **************************************************************************/ private boolean preconditions(final IWorkbenchWindow window) { final AtomicBoolean confirm = new AtomicBoolean(true); if (checkBackgroundProcedures()) { Display.getDefault().syncExec(new Runnable() { public void run() { confirm.set(MessageDialog.openConfirm(window.getShell(), "Background procedures", "There are procedures running in background in the current context.\n\n" + "If you open a procedure now it could interfere with the operations being performed" + "by the background procedures.\n\n" + "Do you want to continue anyway?.")); } }); } return confirm.get(); }
From source file:com.astra.ses.spell.gui.model.commands.ReleaseProcedure.java
License:Open Source License
/*************************************************************************** * The command has been executed, so extract extract the needed information * from the application context./*from w w w. j av a 2s .c om*/ **************************************************************************/ public CommandResult execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ConfigurationManager cfg = (ConfigurationManager) ServiceManager.get(ConfigurationManager.ID); String procId = (String) cfg.getSelection(IConfig.ID_PROCEDURE_SELECTION); boolean doRelease = MessageDialog.openConfirm(window.getShell(), "Release procedure " + procId, "Do you really want to detach from this procedure?"); if (doRelease) { ReleaseProcedureJob job = new ReleaseProcedureJob(procId); CommandHelper.executeInProgress(job, false, false); if (job.result != CommandResult.SUCCESS) { MessageDialog.openError(window.getShell(), "Detach error", job.message); } return job.result; } else { return CommandResult.NO_EFFECT; } }