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.microsoft.azureexplorer.helpers.UIHelperImpl.java
License:Open Source License
@Override public boolean showConfirmation(@NotNull String message, @NotNull String title, @NotNull String[] options, String defaultOption) {// w w w . j av a2 s .c om boolean choice = MessageDialog.openConfirm(new Shell(), title, message); return choice; }
From source file:com.microsoft.azuretools.azureexplorer.helpers.UIHelperImpl.java
License:Open Source License
@Override public boolean showConfirmation(@NotNull String message, @NotNull String title, @NotNull String[] options, String defaultOption) {//from ww w . j av a 2s .c o m boolean choice = MessageDialog.openConfirm(PluginUtil.getParentShell(), title, message); return choice; }
From source file:com.microsoft.azuretools.container.handlers.DockerRunHandler.java
License:Open Source License
@Override public Object onExecute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); IProject project = PluginUtil.getSelectedProject(); if (project == null) { ConsoleLogger.error(Constant.ERROR_NO_SELECTED_PROJECT); return null; }/*from w w w .j a v a2 s .c o m*/ String destinationPath = project.getLocation() + Constant.DOCKER_CONTEXT_FOLDER + project.getName() + ".war"; final DockerClient docker; try { // Initialize docker client according to env DOCKER_HOST & DOCKER_CERT_PATH ConsoleLogger.info(Constant.MESSAGE_DOCKER_CONNECTING); Builder dockerBuilder = Runtime.getInstance().getDockerBuilder(); docker = dockerBuilder.build(); // Stop running container String runningContainerId = Runtime.getInstance().getRunningContainerId(); if (containerExists(docker, runningContainerId)) { boolean stop = MessageDialog.openConfirm(window.getShell(), "Stop", Constant.MESSAGE_CONFIRM_STOP_CONTAINER); if (stop) { Runtime.getInstance().cleanRuningContainer(); } else { return null; } } } catch (Exception e) { e.printStackTrace(); ConsoleLogger.error(String.format(Constant.ERROR_RUNNING_DOCKER, e.getMessage())); return null; } DefaultLoader.getIdeHelper().runInBackground(project, Constant.MESSAGE_EXECUTE_DOCKER_RUN, true, true, Constant.MESSAGE_EXECUTE_DOCKER_RUN, () -> { try { // export WAR file DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(String.format(Constant.MESSAGE_EXPORTING_PROJECT, destinationPath)); }); export(project, destinationPath); // build image based on WAR file DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(Constant.MESSAGE_BUILDING_IMAGE); }); String imageName = build(docker, project, project.getLocation() + Constant.DOCKER_CONTEXT_FOLDER); DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(String.format(Constant.MESSAGE_IMAGE_INFO, imageName)); }); // create a container String containerId = createContainer(docker, project, imageName); DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(Constant.MESSAGE_CREATING_CONTAINER); ConsoleLogger.info(String.format(Constant.MESSAGE_CONTAINER_INFO, containerId)); }); // start container DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(Constant.MESSAGE_STARTING_CONTAINER); }); String webappUrl = runContainer(docker, containerId); DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.info(String.format(Constant.MESSAGE_CONTAINER_STARTED, webappUrl, project.getName())); }); } catch (Exception e) { e.printStackTrace(); DefaultLoader.getIdeHelper().invokeAndWait(() -> { ConsoleLogger.error(String.format(Constant.ERROR_RUNNING_DOCKER, e.getMessage())); }); } }); return null; }
From source file:com.microsoft.tfs.client.common.ui.framework.helper.MessageBoxHelpers.java
License:Open Source License
public static boolean dialogConfirmPrompt(Shell parent, String dialogTitle, final String confirmMessage) { parent = ShellUtils.getBestParent(parent); dialogTitle = sanitizeTitle(dialogTitle); return MessageDialog.openConfirm(parent, dialogTitle, confirmMessage); }
From source file:com.microsoft.tfs.client.common.ui.prefs.ComparePreferencePage.java
License:Open Source License
@Override protected boolean removePressed() { final ExternalToolAssociation selected = getSelection(); if (selected == null) { return false; }//from w ww .j a va 2 s .co m final String extenstions = ExternalToolDialog.combineExtensions(selected.getExtensions()); final String messageFormat = Messages.getString("ComparePreferencePage.ConfirmRemoveFilesDialogTextFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, extenstions); if (!MessageDialog.openConfirm(getShell(), Messages.getString("ComparePreferencePage.ConfirmRemoveDialogTitle"), //$NON-NLS-1$ message)) { return false; } toolset.remove(selected); save(); return true; }
From source file:com.microsoft.tfs.client.common.ui.prefs.ComparePreferencePage.java
License:Open Source License
@Override protected boolean dirRemovePressed() { final ExternalToolAssociation selected = getToolset().getDirectoryAssociation(); if (selected == null) { return false; }/* w w w . j a v a2 s .c o m*/ final String confirmation = Messages.getString("ComparePreferencePage.ConfirmRemoveDialogText"); //$NON-NLS-1$ if (!MessageDialog.openConfirm(getShell(), Messages.getString("ComparePreferencePage.ConfirmRemoveDialogTitle"), //$NON-NLS-1$ confirmation)) { return false; } getToolset().remove(selected); save(); return true; }
From source file:com.microsoft.tfs.client.common.ui.prefs.MergePreferencePage.java
License:Open Source License
@Override protected boolean removePressed() { final ExternalToolAssociation selected = getSelection(); if (selected == null) { return false; }/*from w w w . j a v a2 s. c o m*/ final String extensions = ExternalToolDialog.combineExtensions(selected.getExtensions()); final String messageFormat = Messages.getString("MergePreferencePage.ConfirmRemoveDialogTextFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, extensions); if (!MessageDialog.openConfirm(getShell(), Messages.getString("MergePreferencePage.ConfirmRemoveDialogTitle"), //$NON-NLS-1$ message)) { return false; } toolset.remove(selected); save(); return true; }
From source file:com.microsoft.tfs.client.common.ui.prefs.ViewPreferencePage.java
License:Open Source License
@Override protected boolean removePressed() { final ExternalToolAssociation selected = getSelection(); if (selected == null) { return false; }/*from ww w . j ava 2s . com*/ final String extensions = ExternalToolDialog.combineExtensions(selected.getExtensions()); final String messageFormat = Messages.getString("ViewPreferencePage.ConfirmRemoveFilesDialogTextFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, extensions); if (!MessageDialog.openConfirm(getShell(), Messages.getString("ViewPreferencePage.ConfirmRemoveDialogTitle"), //$NON-NLS-1$ message)) { return false; } toolset.remove(selected); save(); return true; }
From source file:com.microsoft.tfs.client.common.ui.prefs.ViewPreferencePage.java
License:Open Source License
@Override protected boolean dirRemovePressed() { final ExternalToolAssociation selected = getToolset().getDirectoryAssociation(); if (selected == null) { return false; }/*from w ww.j ava2 s. c om*/ final String confirmation = Messages.getString("ViewPreferencePage.ConfirmRemoveDirsDialogText"); //$NON-NLS-1$ if (!MessageDialog.openConfirm(getShell(), Messages.getString("ViewPreferencePage.ConfirmRemoveDialogTitle"), //$NON-NLS-1$ confirmation)) { return false; } getToolset().remove(selected); save(); return true; }
From source file:com.microsoft.tfs.client.common.ui.teamexplorer.actions.wit.DeleteQueryItemAction.java
License:Open Source License
@Override protected void doRun(final IAction action) { final Set<QueryFolder> parents = new HashSet<QueryFolder>(); final QueryHierarchy queryHierarchy = getQueryHierarchy(); String message, title;/*from ww w . j a va 2 s. co m*/ if (getStructuredSelection().size() == 1) { final QueryItem queryItem = (QueryItem) getStructuredSelection().getFirstElement(); if (queryItem instanceof QueryFolder) { final String messageFormat = Messages .getString("DeleteQueryItemAction.DeleteFolderDialogTextFormat"); //$NON-NLS-1$ message = MessageFormat.format(messageFormat, queryItem.getName()); title = Messages.getString("DeleteQueryItemAction.DeleteFolderDialogTitle"); //$NON-NLS-1$ } else { final String messageFormat = Messages .getString("DeleteQueryItemAction.DeleteQueryDialogTextFormat"); //$NON-NLS-1$ message = MessageFormat.format(messageFormat, queryItem.getName()); title = Messages.getString("DeleteQueryItemAction.DeleteQueryDialogTitle"); //$NON-NLS-1$ } } else { message = Messages.getString("DeleteQueryItemAction.DeleteItemDialogText"); //$NON-NLS-1$ title = Messages.getString("DeleteQueryItemAction.DeleteItemDialogTitle"); //$NON-NLS-1$ } if (!MessageDialog.openConfirm(getShell(), title, message)) { return; } try { @SuppressWarnings("rawtypes") Iterator i; for (i = getStructuredSelection().iterator(); i.hasNext();) { final QueryItem queryItem = (QueryItem) i.next(); if (queryItem instanceof QueryDefinition) { WorkItemHelpers.closeEditors((QueryDefinition) queryItem); } if (!selectionContainsParents(queryItem)) { parents.add(queryItem.getParent()); queryItem.delete(); } } queryHierarchy.save(); } catch (final Exception e) { queryHierarchy.reset(); final String messageFormat = Messages.getString("DeleteQueryItemAction.ErrorDialogTextFormat"); //$NON-NLS-1$ message = MessageFormat.format(messageFormat, e.getLocalizedMessage()); MessageDialog.openError(getShell(), Messages.getString("DeleteQueryItemAction.ErrorDialogTitle"), //$NON-NLS-1$ message); return; } for (final QueryFolder parent : parents) { if (parent != null) { final QueryFolderEventArg arg = new QueryFolderEventArg(parent); getContext().getEvents().notifyListener(TeamExplorerEvents.QUERY_FOLDER_CHILDREN_UPDATED, arg); } } }