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.google.appraise.eclipse.ui.editor.AppraiseReviewTaskActivationListener.java
License:Open Source License
/** * Asks the user if they want to switch to the review branch, and performs * the switch if so./*w ww . jav a 2s.c om*/ */ private void promptSwitchToReviewBranch(TaskRepository taskRepository, String reviewBranch) { MessageDialog dialog = new MessageDialog(null, "Appraise Review", null, "Do you want to switch to the review branch (" + reviewBranch + ")", MessageDialog.QUESTION, new String[] { "Yes", "No" }, 0); int result = dialog.open(); if (result == 0) { Repository repo = AppraisePluginUtils.getGitRepoForRepository(taskRepository); try (Git git = new Git(repo)) { previousBranch = repo.getFullBranch(); git.checkout().setName(reviewBranch).call(); } catch (RefNotFoundException rnfe) { MessageDialog alert = new MessageDialog(null, "Oops", null, "Branch " + reviewBranch + " not found", MessageDialog.INFORMATION, new String[] { "OK" }, 0); alert.open(); } catch (Exception e) { AppraiseUiPlugin.logError("Unable to switch to review branch: " + reviewBranch, e); } } }
From source file:com.google.dart.tools.search.internal.ui.util.ExtendedDialogWindow.java
License:Open Source License
private MessageDialog createClosingDialog() { MessageDialog result = new MessageDialog(getShell(), SearchMessages.SearchDialogClosingDialog_title, null, SearchMessages.SearchDialogClosingDialog_message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0); return result; }
From source file:com.google.gdt.eclipse.appsmarketplace.ui.ListOnMarketplaceDialog.java
License:Open Source License
@Override protected void okPressed() { if (listingInProgress == false) { listingInProgress = true;//from w w w. ja v a 2 s . c o m if (listingType == ListingType.UPDATE) { String message = new String("This will overwrite you existing application listing \"" + DataStorage.getAppListings().get(listingCombo.getSelectionIndex()).name + "\" on Google Apps Marketplace.\n\nDo you want to continue ?"); final MessageDialog messageDialog = new MessageDialog(Display.getDefault().getActiveShell(), "Update Application Listing on Google Apps Marketplace", null, message, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 1); if (messageDialog.open() != Window.OK) { super.okPressed(); return; } } deploymentStatus = deployAppsMarketplaceListing(); String messageTitle = new String(); String messageText = new String(); if (deploymentStatus) { try { AppsMarketplaceProjectProperties.setAppListingAlreadyListed(project, true); String consumerKey = DataStorage.getListedAppListing().consumerKey; String consumerSecret = DataStorage.getListedAppListing().consumerSecret; AppsMarketplaceProjectProperties.setAppListingConsumerKey(project, consumerKey); AppsMarketplaceProjectProperties.setAppListingConsumerSecret(project, consumerSecret); } catch (BackingStoreException e) { // Consume exception AppsMarketplacePluginLog.logError(e); } messageTitle = "Successfully created private listing on Google Apps Marketplace"; messageText = "Successfully listed application \'" + appNameText.getText() + "\'" + " on Google Apps Marketplace." + " Click <a href=\"#\">here</a> to view details."; } else { messageTitle = "Failed to created listing on Google Apps Marketplace"; messageText = "Failed to list application \'" + appNameText.getText() + "\'" + " on Google Apps Marketplace." + " Click <a href=\"#\">here</a> to manually create listing."; } this.setMessage(""); this.setTitle(messageTitle); disposeDialogArea(); Composite container = (Composite) this.getDialogArea(); createDescribeLinkArea(container, 1); describeLink.setText(messageText); container.layout(true); getButton(IDialogConstants.CANCEL_ID).setVisible(false); deployButton.setText(FINISH_TEXT); describeLink.addSelectionListener(new DescribeListener()); getShell().redraw(); } else { if (deploymentStatus) { try { String consumerKey = AppsMarketplaceProjectProperties.getAppListingConsumerKey(project); String consumerSecret = AppsMarketplaceProjectProperties.getAppListingConsumerSecret(project); // Set the consumerKey and consumerSecret in web.xml. // Operation may fail. appsMarketplaceProject.setOAuthParams(consumerKey, consumerSecret, true); } catch (CoreException e) { // Consume exception AppsMarketplacePluginLog.logError(e); } } super.okPressed(); } }
From source file:com.google.gdt.eclipse.gph.egit.wizard.ImportProjectsWizardPage.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this * <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * //from ww w.j ava2 s.c om * @param pathString * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, * <code>"ALL"</code>, or <code>"CANCEL"</code> */ @Override public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = NLS.bind("''{0}'' already exists. Would you like to overwrite it?", pathString); } else { messageString = NLS.bind("Overwrite ''{0}'' in folder ''{1}''?", path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { @Override public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:com.google.gdt.eclipse.suite.preferences.ui.ErrorsWarningsPage.java
License:Open Source License
@Override public boolean performOk() { updateWorkingCopyFromCombos();/* ww w . j a v a2 s . com*/ if (!GdtProblemSeverities.getInstance().equals(problemSeveritiesWorkingCopy)) { MessageDialog dialog = new MessageDialog(getShell(), "Errors/Warnings Settings Changed", null, "The Google Error/Warning settings have changed. A full rebuild " + "of all GWT/App Engine projects is required for changes to " + "take effect. Do the full build now?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); // Cancel // is // default int result = dialog.open(); if (result == 2) { // Cancel return false; } else { updateWorkspaceSeveritySettingsFromWorkingCopy(); if (result == 0) { // Yes BuilderUtilities.scheduleRebuildAll(GWTNature.NATURE_ID); } } } return true; }
From source file:com.google.gwt.eclipse.core.preferences.ui.GwtPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { noDefaultAndApplyButton();/*from w w w . ja v a 2s .co m*/ sdkSet = GWTPreferences.getSdks(); return new SdkTable<GWTRuntime>(parent, SWT.NONE, sdkSet, null, this) { @Override protected IStatus doAddSdk() { AddSdkDialog<GWTRuntime> addGaeSdkDialog = new AddGwtSdkDialog(getShell(), sdkSet, GWTPlugin.PLUGIN_ID, "Add Google Web Toolkit SDK", GWTRuntime.getFactory()); if (addGaeSdkDialog.open() == Window.OK) { GWTRuntime 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(GWTPlugin.getActiveWorkbenchShell(), "Google Eclipse Plugin", null, "Would you like to open the Google Web Toolkit download page in your " + "web browser?\n\nFrom there, you can " + "download the latest GWT 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(GWTPlugin.SDK_DOWNLOAD_URL) == null) { return Status.CANCEL_STATUS; } } else { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; }
From source file:com.google.gwt.eclipse.core.properties.ui.GWTProjectPropertyPage.java
License:Open Source License
/** * Removes all GWT SDK jars and replaces it with a single container entry, adds GWT nature and * optionally the web app nature./* ww w. jav a 2 s . co m*/ * * @throws BackingStoreException * @throws FileNotFoundException * @throws FileNotFoundException */ private void addGWT() throws CoreException, BackingStoreException, FileNotFoundException { IProject project = getProject(); IJavaProject javaProject = JavaCore.create(project); /* * Set the appropriate web app project properties if this is a J2EE project. * * There can be a collision between different property pages manipulating the same web app * properties, but the collision actually works itself out. * * Both the GWT and GAE property pages make a call to this method. So, there are no * conflicting/differing settings of the web app project properties in this case. * * In the event that the GAE/GWT natures are enabled and the Web App property page does not have * the "This Project Has a War Directory" setting selected, and that setting is enabled, then * the settings on the Web App project page will take precedence (over those settings that are * set by this method call). * * The gory details as to why have to do with the order of application of the properties for * each page (App Engine, Web App, then GWT), and the fact that this method will not make any * changes to Web App properties if the project is already a Web App. */ WebAppProjectProperties.maybeSetWebAppPropertiesForDynamicWebProject(project); if (sdkSelectionBlock.hasSdkChanged() && !GWTProjectsRuntime.isGWTRuntimeProject(javaProject)) { SdkSelection<GWTRuntime> sdkSelection = sdkSelectionBlock.getSdkSelection(); boolean isDefault = false; GWTRuntime newSdk = null; if (sdkSelection != null) { newSdk = sdkSelection.getSelectedSdk(); isDefault = sdkSelection.isDefault(); } GWTRuntime oldSdk = sdkSelectionBlock.getInitialSdk(); UpdateType updateType = GWTUpdateProjectSdkCommand.computeUpdateType(oldSdk, newSdk, isDefault); GWTUpdateProjectSdkCommand updateProjectSdkCommand = new GWTUpdateProjectSdkCommand(javaProject, oldSdk, newSdk, updateType, null); /* * Update the project classpath which will trigger the <WAR>/WEB-INF/lib jars to be updated. */ updateProjectSdkCommand.execute(); } GWTNature.addNatureToProject(project); // Need to rebuild to get GWT errors to appear BuilderUtilities.scheduleRebuild(project); // only prompt to reopen editors if the transition from disabled -> enabled if (!initialUseGWT && useGWT) { // Get the list of Java editors opened on files in this project IEditorReference[] openEditors = getOpenJavaEditors(project); if (openEditors.length > 0) { MessageDialog dlg = new MessageDialog(GWTPlugin.getActiveWorkbenchShell(), GWTPlugin.getName(), null, "GWT editing functionality, such as syntax-colored JSNI blocks, " + "will only be enabled after you re-open your Java editors.\n\nDo " + "you want to re-open your editors now?", MessageDialog.QUESTION, new String[] { "Re-open Java editors", "No" }, 0); if (dlg.open() == IDialogConstants.OK_ID) { reopenWithGWTJavaEditor(openEditors); } } } }
From source file:com.google.gwt.eclipse.core.properties.ui.GWTProjectPropertyPage.java
License:Open Source License
public void addGWT(IProject project, GWTRuntime runtime) throws BackingStoreException, FileNotFoundException, CoreException { IJavaProject javaProject = JavaCore.create(project); // TODO this causes some issue with dialog popup and war output folder selection WebAppProjectProperties.maybeSetWebAppPropertiesForDynamicWebProject(project); // if (sdkSelectionBlock.hasSdkChanged() && // !GWTProjectsRuntime.isGWTRuntimeProject(javaProject)) { boolean isDefault = false; GWTRuntime newSdk = runtime;/*from w ww . ja va 2 s. c o m*/ GWTRuntime oldSdk = runtime; UpdateType updateType = GWTUpdateProjectSdkCommand.computeUpdateType(oldSdk, newSdk, isDefault); GWTUpdateProjectSdkCommand updateProjectSdkCommand = new GWTUpdateProjectSdkCommand(javaProject, oldSdk, newSdk, updateType, null); /* * Update the project classpath which will trigger the <WAR>/WEB-INF/lib jars to be updated. */ updateProjectSdkCommand.execute(); // } GWTNature.addNatureToProject(project); // Need to rebuild to get GWT errors to appear BuilderUtilities.scheduleRebuild(project); // only prompt to reopen editors if the transition from disabled -> enabled if (!initialUseGWT && useGWT) { // Get the list of Java editors opened on files in this project IEditorReference[] openEditors = getOpenJavaEditors(project); if (openEditors.length > 0) { MessageDialog dlg = new MessageDialog(GWTPlugin.getActiveWorkbenchShell(), GWTPlugin.getName(), null, "GWT editing functionality, such as syntax-colored JSNI blocks, " + "will only be enabled after you re-open your Java editors.\n\nDo " + "you want to re-open your editors now?", MessageDialog.QUESTION, new String[] { "Re-open Java editors", "No" }, 0); if (dlg.open() == IDialogConstants.OK_ID) { reopenWithGWTJavaEditor(openEditors); } } } }
From source file:com.hangum.tadpole.rdb.core.util.GrantCheckerUtils.java
License:Open Source License
/** * ?? ./* w w w . j a va 2 s . c o m*/ * * - DB lock ??? * - dml ? ??? * - ?, ? select ? * * @param userDB * @param reqQuery * @throws Exception */ public static boolean ifExecuteQuery(UserDBDAO userDB, RequestQuery reqQuery) throws Exception { // security check. if (!TadpoleSecurityManager.getInstance().isLock(userDB)) { throw new Exception(Messages.get().ResultMainComposite_1); } // ? ? . if (PublicTadpoleDefine.YES_NO.YES.name().equals(userDB.getQuestion_dml()) || PermissionChecker.isProductBackup(userDB)) { boolean isDDLQuestion = !reqQuery.isStatement(); if (reqQuery.getExecuteType() == EditorDefine.EXECUTE_TYPE.ALL) { for (String strSQL : reqQuery.getOriginalSql().split(PublicTadpoleDefine.SQL_DELIMITER)) { if (!SQLUtil.isStatement(strSQL)) { isDDLQuestion = true; break; } } } if (isDDLQuestion) { MessageDialog dialog = new MessageDialog(null, Messages.get().Execute, null, Messages.get().GrantCheckerUtils_0, MessageDialog.QUESTION, new String[] { Messages.get().YES, Messages.get().NO }, 1); if (dialog.open() != MessageDialog.OK) return false; } } return true; }
From source file:com.htmlhifive.tools.wizard.download.DownloadModule.java
License:Apache License
/** * 1????.// ww w . j av a 2 s .co m * * @param monitor * @param totalWork * @param iFile * @param fileContentsHandler ? * @throws IOException IO * @return ? */ private boolean updateFile(IProgressMonitor monitor, int totalWork, ResultStatus logger, IFile iFile, IFileContentsHandler fileContentsHandler) throws IOException { // PI0112=INFO,[{0}]... monitor.subTask(Messages.PI0112.format(iFile.getFullPath())); int ret = 0; InputStream is = null; try { if (iFile.exists()) { // ????. if (defaultOverwriteMode != 0) { ret = defaultOverwriteMode; } else { MessageDialog dialog = new MessageDialog(null, Messages.SE0113.format(), Dialog.getImage(Dialog.DLG_IMG_MESSAGE_INFO), Messages.SE0114.format(iFile.getRawLocation().toString()), MessageDialog.QUESTION, new String[] { UIMessages.Dialog_OVERWRITE, UIMessages.Dialog_ALL_OVERWRITE, UIMessages.Dialog_IGNORE, UIMessages.Dialog_ALL_IGNORE }, 0); ret = dialog.open(); } switch (ret) { case 1: defaultOverwriteMode = ret; case 0: // ???. logger.log(Messages.SE0097, iFile.getFullPath()); is = fileContentsHandler.getInputStream(); iFile.setContents(is, true, true, null); logger.log(Messages.SE0098, iFile.getFullPath()); break; case 3: defaultOverwriteMode = ret; case 2: // ?. break; } } else { if (!iFile.getParent().exists()) { // ??. H5IOUtils.createParentFolder(iFile.getParent(), null); } is = fileContentsHandler.getInputStream(); logger.log(Messages.SE0091, iFile.getFullPath()); iFile.create(is, true, null); logger.log(Messages.SE0092, iFile.getFullPath()); } return true; } catch (CoreException e) { // SE0024=ERROR,({0})??????? logger.log(e, Messages.SE0024, iFile.getFullPath().toString()); } finally { IOUtils.closeQuietly(is); } return false; }