List of usage examples for com.intellij.openapi.ui Messages showYesNoDialog
@YesNoResult public static int showYesNoDialog(@NotNull Component parent, String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon)
From source file:bazaar4idea.action.BzrInit.java
License:Apache License
private static void doInit(final Project project, FileChooserDescriptor fcd, VirtualFile baseDir, final VirtualFile finalBaseDir) { FileChooser.chooseFile(fcd, project, baseDir, new Consumer<VirtualFile>() { @Override/*ww w.j a v a 2s .co m*/ public void consume(final VirtualFile root) { if (BzrUtil.isUnderBzr(root) && Messages.showYesNoDialog(project, BzrBundle.message("init.warning.already.under.bzr", StringUtil.escapeXml(root.getPresentableUrl())), BzrBundle.getString("init.warning.title"), Messages.getWarningIcon()) != Messages.YES) { return; } BzrCommandResult result = ServiceManager.getService(Bzr.class).init(project, root); if (!result.success()) { BzrVcs vcs = BzrVcs.getInstance(project); if (vcs != null && vcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) { BzrUIUtil.notify(BzrVcs.IMPORTANT_ERROR_NOTIFICATION, project, "Bazaar init failed", result.getErrorOutputAsHtmlString(), NotificationType.ERROR, null); } return; } if (project.isDefault()) { return; } final String path = root.equals(finalBaseDir) ? "" : root.getPath(); BzrVcs.runInBackground(new Task.Backgroundable(project, BzrBundle.getString("common.refreshing")) { @Override public void run(@NotNull ProgressIndicator indicator) { refreshAndConfigureVcsMappings(project, root, path); } }); } }); }
From source file:bazaar4idea.util.BzrErrorReportSubmitter.java
License:Apache License
/** * @noinspection ThrowablePrintStackTrace,ThrowableResultOfMethodCallIgnored *///from w w w. ja v a 2s . c o m private static SubmittedReportInfo sendError(IdeaLoggingEvent event, Component parentComponent) { NotifierBean notifierBean = new NotifierBean(); ErrorBean errorBean = new ErrorBean(); errorBean.autoInit(); // errorBean.setLastAction(IdeaLogger.ourLastActionId); int threadId = 0; SubmittedReportInfo.SubmissionStatus submissionStatus = SubmittedReportInfo.SubmissionStatus.FAILED; final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); Project project = PlatformDataKeys.PROJECT.getData(dataContext); String description = ""; do { // prepare try { ErrorReportSender sender = ErrorReportSender.getInstance(); // sender.prepareError(project, event.getThrowable()); // BzrSendErrorForm dlg = new BzrSendErrorForm(); dlg.setErrorDescription(description); dlg.show(); BzrErrorReportConfigurable reportConf = BzrErrorReportConfigurable.getInstance(); @NonNls String senderEmail = reportConf.EMAIL_ADDRESS; @NonNls String smtpServer = reportConf.SMTP_SERVER; @NonNls String itnLogin = reportConf.AUTH_USERNAME; @NonNls String itnPassword = reportConf.getPlainItnPassword(); notifierBean.setEmailAddress(senderEmail); notifierBean.setSmtpServer(smtpServer); notifierBean.setItnLogin(itnLogin); notifierBean.setItnPassword(itnPassword); // description = dlg.getErrorDescription(); String message = event.getMessage(); // @NonNls StringBuilder descBuilder = new StringBuilder(); if (description.length() > 0) { descBuilder.append("User description: ").append(description).append("\n"); } if (message != null) { descBuilder.append("Error message: ").append(message).append("\n"); } Throwable t = event.getThrowable(); if (t != null) { // final PluginId pluginId = IdeErrorsDialog.findPluginId(t); // if (pluginId != null) { // final IdeaPluginDescriptor ideaPluginDescriptor = ApplicationManager.getApplication().getPlugin(pluginId); // if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { // descBuilder.append("Plugin version: ").append(ideaPluginDescriptor.getVersion()).append("\n"); // } // } } if (previousExceptionThreadId != 0) { descBuilder.append("Previous exception is: ").append(URL_HEADER) .append(previousExceptionThreadId).append("\n"); } if (wasException) { descBuilder.append("There was at least one exception before this one.\n"); } errorBean.setDescription(descBuilder.toString()); if (dlg.isShouldSend()) { threadId = sender.sendError(notifierBean, errorBean); previousExceptionThreadId = threadId; wasException = true; submissionStatus = SubmittedReportInfo.SubmissionStatus.NEW_ISSUE; Messages.showInfoMessage(parentComponent, BzrBundle.message("error.report.confirmation"), ERROR_REPORT); break; } else { break; } // } catch (NoSuchEAPUserException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.authentication.failed"), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (InternalEAPException e) { // if (Messages.showYesNoDialog(parentComponent, DiagnosticBundle.message("error.report.posting.failed", e.getMessage()), // ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { // break; // } // } catch (IOException e) { // if (!IOExceptionDialog.showErrorDialog(BzrVcsMessages.message("error.report.exception.title"), // BzrVcsMessages.message("error.report.failure.message"))) { // break; // } // } catch (NewBuildException e) { // Messages.showMessageDialog(parentComponent, // DiagnosticBundle.message("error.report.new.eap.build.message", e.getMessage()), CommonBundle.getWarningTitle(), // Messages.getWarningIcon()); // break; } catch (Exception e) { LOG.info(e); if (Messages.showYesNoDialog(JOptionPane.getRootFrame(), BzrBundle.message("error.report.sending.failure"), ERROR_REPORT, Messages.getErrorIcon()) != 0) { break; } } } while (true); return new SubmittedReportInfo( submissionStatus != SubmittedReportInfo.SubmissionStatus.FAILED ? URL_HEADER + threadId : null, String.valueOf(threadId), submissionStatus); }
From source file:com.android.tools.idea.avdmanager.AvdEditWizard.java
License:Apache License
@Override public void performFinishingActions() { Device device = myState.get(DEVICE_DEFINITION_KEY); assert device != null; // Validation should be done by individual steps SystemImageDescription systemImageDescription = myState.get(SYSTEM_IMAGE_KEY); assert systemImageDescription != null; ScreenOrientation orientation = myState.get(DEFAULT_ORIENTATION_KEY); if (orientation == null) { orientation = device.getDefaultState().getOrientation(); }// ww w . ja v a2s. c o m Map<String, String> hardwareProperties = DeviceManager.getHardwareProperties(device); Map<String, Object> userEditedProperties = myState.flatten(); // Remove the SD card setting that we're not using String sdCard = null; Boolean useExternalSdCard = myState.get(DISPLAY_USE_EXTERNAL_SD_KEY); boolean useExisting = useExternalSdCard != null && useExternalSdCard; if (!useExisting) { if (Objects.equal(myState.get(SD_CARD_STORAGE_KEY), myState.get(DISPLAY_SD_SIZE_KEY))) { // unchanged, use existing card useExisting = true; } } boolean hasSdCard; if (!useExisting) { userEditedProperties.remove(EXISTING_SD_LOCATION.name); Storage storage = myState.get(DISPLAY_SD_SIZE_KEY); myState.put(SD_CARD_STORAGE_KEY, storage); if (storage != null) { sdCard = toIniString(storage, false); } hasSdCard = storage != null && storage.getSize() > 0; } else { sdCard = myState.get(DISPLAY_SD_LOCATION_KEY); myState.put(EXISTING_SD_LOCATION, sdCard); userEditedProperties.remove(SD_CARD_STORAGE_KEY.name); assert sdCard != null; hasSdCard = true; hardwareProperties.put(HardwareProperties.HW_SDCARD, toIniString(true)); } hardwareProperties.put(HardwareProperties.HW_SDCARD, toIniString(hasSdCard)); // Remove any internal keys from the map userEditedProperties = Maps.filterEntries(userEditedProperties, new Predicate<Map.Entry<String, Object>>() { @Override public boolean apply(Map.Entry<String, Object> input) { return !input.getKey().startsWith(WIZARD_ONLY) && input.getValue() != null; } }); // Call toString() on all remaining values hardwareProperties.putAll( Maps.transformEntries(userEditedProperties, new Maps.EntryTransformer<String, Object, String>() { @Override public String transformEntry(String key, Object value) { if (value instanceof Storage) { if (key.equals(AvdWizardConstants.RAM_STORAGE_KEY.name) || key.equals(AvdWizardConstants.VM_HEAP_STORAGE_KEY.name)) { return toIniString((Storage) value, true); } else { return toIniString((Storage) value, false); } } else if (value instanceof Boolean) { return toIniString((Boolean) value); } else if (value instanceof AvdScaleFactor) { return toIniString((AvdScaleFactor) value); } else if (value instanceof File) { return toIniString((File) value); } else if (value instanceof Double) { return toIniString((Double) value); } else { return value.toString(); } } })); File skinFile = myState.get(CUSTOM_SKIN_FILE_KEY); if (skinFile == null) { skinFile = resolveSkinPath(device.getDefaultHardware().getSkinFile(), systemImageDescription); } File backupSkinFile = myState.get(BACKUP_SKIN_FILE_KEY); if (backupSkinFile != null) { hardwareProperties.put(AvdManager.AVD_INI_BACKUP_SKIN_PATH, backupSkinFile.getPath()); } // Add defaults if they aren't already set differently if (!hardwareProperties.containsKey(AvdManager.AVD_INI_SKIN_DYNAMIC)) { hardwareProperties.put(AvdManager.AVD_INI_SKIN_DYNAMIC, toIniString(true)); } if (!hardwareProperties.containsKey(HardwareProperties.HW_KEYBOARD)) { hardwareProperties.put(HardwareProperties.HW_KEYBOARD, toIniString(false)); } boolean isCircular = device.isScreenRound(); String tempAvdName = myState.get(AvdWizardConstants.AVD_ID_KEY); if (tempAvdName == null || tempAvdName.isEmpty()) { tempAvdName = calculateAvdName(myAvdInfo, hardwareProperties, device, myForceCreate); } final String avdName = tempAvdName; // If we're editing an AVD and we downgrade a system image, wipe the user data with confirmation if (myAvdInfo != null && !myForceCreate) { IAndroidTarget target = myAvdInfo.getTarget(); if (target != null) { int oldApiLevel = target.getVersion().getFeatureLevel(); int newApiLevel = systemImageDescription.getVersion().getFeatureLevel(); final String oldApiName = target.getVersion().getApiString(); final String newApiName = systemImageDescription.getVersion().getApiString(); if (oldApiLevel > newApiLevel || (oldApiLevel == newApiLevel && target.getVersion().isPreview() && !systemImageDescription.getVersion().isPreview())) { final AtomicReference<Boolean> shouldContinue = new AtomicReference<Boolean>(); ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { String message = String.format(Locale.getDefault(), "You are about to downgrade %1$s from API level %2$s to API level %3$s.\n" + "This requires a wipe of the userdata partition of the AVD.\nDo you wish to " + "continue with the data wipe?", avdName, oldApiName, newApiName); int result = Messages.showYesNoDialog((Project) null, message, "Confirm Data Wipe", AllIcons.General.QuestionDialog); shouldContinue.set(result == Messages.YES); } }, ModalityState.any()); if (shouldContinue.get()) { AvdManagerConnection.getDefaultAvdManagerConnection().wipeUserData(myAvdInfo); } else { return; } } } } AvdManagerConnection connection = AvdManagerConnection.getDefaultAvdManagerConnection(); connection.createOrUpdateAvd(myForceCreate ? null : myAvdInfo, avdName, device, systemImageDescription, orientation, isCircular, sdCard, skinFile, hardwareProperties, false); }
From source file:com.android.tools.idea.avdmanager.AvdOptionsModel.java
License:Apache License
@Override protected void handleFinished() { // By this point we should have both a Device and a SystemImage Device device = myDevice.getValue(); SystemImageDescription systemImage = mySystemImage.getValue(); Map<String, String> hardwareProperties = DeviceManager.getHardwareProperties(device); Map<String, Object> userEditedProperties = generateUserEditedPropertiesMap(); // Remove the SD card setting that we're not using String sdCard = null;//from ww w . j a v a 2s . c o m boolean useExisting = myUseExternalSdCard.get(); if (!useExisting) { if (sdCardStorage().get().isPresent() && myOriginalSdCard != null && sdCardStorage().getValue().equals(myOriginalSdCard.get())) { // unchanged, use existing card useExisting = true; } } boolean hasSdCard = false; if (!useExisting) { userEditedProperties.remove(AvdWizardUtils.EXISTING_SD_LOCATION); Storage storage = null; myOriginalSdCard = new ObjectValueProperty<>(mySdCardStorage.getValue()); if (mySdCardStorage.get().isPresent()) { storage = mySdCardStorage.getValue(); sdCard = toIniString(storage, false); } hasSdCard = storage != null && storage.getSize() > 0; } else if (!Strings.isNullOrEmpty(existingSdLocation.get())) { sdCard = existingSdLocation.get(); userEditedProperties.remove(AvdWizardUtils.SD_CARD_STORAGE_KEY); hasSdCard = true; } hardwareProperties.put(HardwareProperties.HW_SDCARD, toIniString(hasSdCard)); // Remove any internal keys from the map userEditedProperties = Maps.filterEntries(userEditedProperties, input -> !input.getKey().startsWith(AvdWizardUtils.WIZARD_ONLY) && input.getValue() != null); // Call toIniString() on all remaining values hardwareProperties.putAll(Maps.transformEntries(userEditedProperties, (key, value) -> { if (value instanceof Storage) { if (key.equals(AvdWizardUtils.RAM_STORAGE_KEY) || key.equals(AvdWizardUtils.VM_HEAP_STORAGE_KEY)) { return toIniString((Storage) value, true); } else { return toIniString((Storage) value, false); } } else if (value instanceof Boolean) { return toIniString((Boolean) value); } else if (value instanceof File) { return toIniString((File) value); } else if (value instanceof Double) { return toIniString((Double) value); } else if (value instanceof GpuMode) { return ((GpuMode) value).getGpuSetting(); } else { return value.toString(); } })); File skinFile = (myAvdDeviceData.customSkinFile().get().isPresent()) ? myAvdDeviceData.customSkinFile().getValue() : AvdWizardUtils.resolveSkinPath(device.getDefaultHardware().getSkinFile(), systemImage, FileOpUtils.create()); if (myBackupSkinFile.get().isPresent()) { hardwareProperties.put(AvdManager.AVD_INI_BACKUP_SKIN_PATH, myBackupSkinFile.getValue().getPath()); } // Add defaults if they aren't already set differently if (!hardwareProperties.containsKey(AvdManager.AVD_INI_SKIN_DYNAMIC)) { hardwareProperties.put(AvdManager.AVD_INI_SKIN_DYNAMIC, toIniString(true)); } if (!hardwareProperties.containsKey(HardwareProperties.HW_KEYBOARD)) { hardwareProperties.put(HardwareProperties.HW_KEYBOARD, toIniString(false)); } boolean isCircular = myAvdDeviceData.isScreenRound().get(); String tempAvdName = myAvdId.get(); final String avdName = tempAvdName.isEmpty() ? calculateAvdName(myAvdInfo, hardwareProperties, device) : tempAvdName; // If we're editing an AVD and we downgrade a system image, wipe the user data with confirmation if (myAvdInfo != null) { ISystemImage image = myAvdInfo.getSystemImage(); if (image != null) { int oldApiLevel = image.getAndroidVersion().getFeatureLevel(); int newApiLevel = systemImage.getVersion().getFeatureLevel(); final String oldApiName = image.getAndroidVersion().getApiString(); final String newApiName = systemImage.getVersion().getApiString(); if (oldApiLevel > newApiLevel || (oldApiLevel == newApiLevel && image.getAndroidVersion().isPreview() && !systemImage.getVersion().isPreview())) { final AtomicReference<Boolean> shouldContinue = new AtomicReference<>(); ApplicationManager.getApplication().invokeAndWait(() -> { String message = String.format(Locale.getDefault(), "You are about to downgrade %1$s from API level %2$s to API level %3$s.\n" + "This requires a wipe of the userdata partition of the AVD.\nDo you wish to " + "continue with the data wipe?", avdName, oldApiName, newApiName); int result = Messages.showYesNoDialog((Project) null, message, "Confirm Data Wipe", AllIcons.General.QuestionDialog); shouldContinue.set(result == Messages.YES); }, ModalityState.any()); if (shouldContinue.get()) { AvdManagerConnection.getDefaultAvdManagerConnection().wipeUserData(myAvdInfo); } else { return; } } } } AvdManagerConnection connection = AvdManagerConnection.getDefaultAvdManagerConnection(); myCreatedAvd = connection.createOrUpdateAvd(myAvdInfo, avdName, device, systemImage, mySelectedAvdOrientation.get(), isCircular, sdCard, skinFile, hardwareProperties, false); if (myCreatedAvd == null) { ApplicationManager.getApplication().invokeAndWait(() -> Messages.showErrorDialog((Project) null, "An error occurred while creating the AVD. See idea.log for details.", "Error Creating AVD"), ModalityState.any()); } }
From source file:com.android.tools.idea.avdmanager.ConfigureAvdOptionsStep.java
License:Apache License
private void addListeners() { myAvdId.addMouseListener(new MouseAdapter() { @Override// w w w . j a va 2 s .com public void mouseClicked(MouseEvent mouseEvent) { myAvdId.requestFocusInWindow(); } }); myShowAdvancedSettingsButton.addActionListener(myToggleAdvancedSettingsListener); myChangeDeviceButton.addActionListener(myChangeDeviceButtonListener); myChangeSystemImageButton.addActionListener(myChangeSystemImageButtonListener); myExternalRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myExternalSdCard.setEnabled(true); myBuiltInSdCardStorage.setEnabled(false); } }); myBuiltInRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myExternalSdCard.setEnabled(false); myBuiltInSdCardStorage.setEnabled(true); } }); myOrientationToggle.setOpaque(false); KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(FOCUS_OWNER, myPropertyChangeListener); myListeners.receive(getModel().device(), device -> { toggleOptionals(device, true); if (device.isPresent()) { myDeviceName.setIcon(DeviceDefinitionPreview.getIcon(getModel().getAvdDeviceData())); myDeviceName.setText(getModel().device().getValue().getDisplayName()); updateDeviceDetails(); } }); List<AbstractProperty<?>> deviceProperties = AbstractProperty.getAll(getModel().getAvdDeviceData()); deviceProperties.add(getModel().systemImage()); myListeners.listenAll(deviceProperties).with(new Runnable() { @Override public void run() { if (getModel().systemImage().get().isPresent() && getModel().getAvdDeviceData().customSkinFile().get().isPresent()) { File skin = AvdWizardUtils.resolveSkinPath( getModel().getAvdDeviceData().customSkinFile().getValue(), getModel().systemImage().getValue(), FileOpUtils.create()); if (skin != null) { getModel().getAvdDeviceData().customSkinFile().setValue(skin); if (FileUtil.filesEqual(skin, AvdWizardUtils.NO_SKIN)) { myDeviceFrameCheckbox.setSelected(false); } } else { getModel().getAvdDeviceData().customSkinFile().setValue(AvdWizardUtils.NO_SKIN); } } } }); myListeners.listen(getModel().systemImage(), new InvalidationListener() { @Override public void onInvalidated(@NotNull ObservableValue<?> sender) { updateSystemImageData(); } }); myListeners.receive(getModel().sdCardStorage(), storage -> { if (myCheckSdForChanges && storage.isPresent() && !storage.get().equals(myOriginalSdCard)) { int result = Messages.showYesNoDialog((Project) null, "Changing the size of the built-in SD card will erase " + "the current contents of the card. Continue?", "Confirm Data Wipe", AllIcons.General.QuestionDialog); if (result == Messages.YES) { myCheckSdForChanges = false; } else { getModel().sdCardStorage().setValue(myOriginalSdCard); } } }); myListeners.listen(getModel().useQemu2(), new InvalidationListener() { @Override public void onInvalidated(@NotNull ObservableValue<?> sender) { toggleSystemOptionals(true); } }); myListeners.receive(getModel().selectedAvdOrientation(), screenOrientation -> myOrientationToggle.setSelectedElement(screenOrientation)); }
From source file:com.android.tools.idea.avdmanager.DeleteAvdAction.java
License:Apache License
@Override public void actionPerformed(ActionEvent e) { AvdManagerConnection connection = AvdManagerConnection.getDefaultAvdManagerConnection(); AvdInfo info = getAvdInfo();//from w w w . j a va 2 s . c om if (info == null) { return; } if (connection.isAvdRunning(info)) { Messages.showErrorDialog(myAvdInfoProvider.getComponent(), "The selected AVD is currently running in the Emulator. Please exit the emulator instance and try deleting again.", "Cannot Delete A Running AVD"); return; } int result = Messages.showYesNoDialog(myAvdInfoProvider.getComponent(), "Do you really want to delete AVD " + info.getName() + "?", "Confirm Deletion", AllIcons.General.QuestionDialog); if (result == Messages.YES) { if (!connection.deleteAvd(info)) { Messages.showErrorDialog(myAvdInfoProvider.getComponent(), "An error occurred while deleting the AVD. See idea.log for details.", "Error Deleting AVD"); } refreshAvds(); } }
From source file:com.android.tools.idea.avdmanager.DeleteDeviceAction.java
License:Apache License
@Override public void actionPerformed(ActionEvent e) { Device device = myProvider.getDevice(); int result = Messages.showYesNoDialog((Project) null, "Do you really want to delete Device " + device.getDisplayName() + "?", "Confirm Deletion", AllIcons.General.QuestionDialog); if (result == Messages.YES) { DeviceManagerConnection.getDefaultDeviceManagerConnection().deleteDevice(device); myProvider.refreshDevices();/* w w w. ja v a 2s . c o m*/ myProvider.selectDefaultDevice(); } }
From source file:com.android.tools.idea.avdmanager.WipeAvdDataAction.java
License:Apache License
@Override public void actionPerformed(ActionEvent e) { AvdManagerConnection connection = AvdManagerConnection.getDefaultAvdManagerConnection(); AvdInfo avdInfo = getAvdInfo();/*from w w w. j a v a 2 s. c o m*/ if (avdInfo == null) { return; } if (connection.isAvdRunning(avdInfo)) { Messages.showErrorDialog(myAvdInfoProvider.getComponent(), "The selected AVD is currently running in the Emulator. " + "Please exit the emulator instance and try wiping again.", "Cannot Wipe A Running AVD"); return; } int result = Messages.showYesNoDialog(myAvdInfoProvider.getComponent(), "Do you really want to wipe user files from AVD " + avdInfo.getName() + "?", "Confirm Data Wipe", AllIcons.General.QuestionDialog); if (result == Messages.YES) { connection.wipeUserData(avdInfo); refreshAvds(); } }
From source file:com.android.tools.idea.gradle.actions.CleanImportProjectAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject();// w w w.ja v a2 s . co m if (project != null && isGradleProjectIfNotNull(project)) { String projectName = project.getName(); int answer = Messages.showYesNoDialog(project, String.format(MESSAGE_FORMAT, projectName), TITLE, null); if (answer == Messages.YES) { LOG.info(String.format("Closing, cleaning and re-importing project '%1$s'...", projectName)); List<File> filesToDelete = collectFilesToDelete(project); File projectDirPath = getBaseDirPath(project); close(project); deleteFiles(filesToDelete, projectName); try { LOG.info(String.format("About to import project '%1$s'.", projectName)); GradleProjectImporter.getInstance().importProject(projectName, projectDirPath, null); LOG.info(String.format("Done importing project '%1$s'.", projectName)); } catch (Exception error) { String title = getErrorMessageTitle(error); Messages.showErrorDialog(error.getMessage(), title); LOG.info(String.format("Failed to import project '%1$s'.", projectName)); } } } }
From source file:com.android.tools.idea.gradle.project.sync.hyperlink.StopGradleDaemonsHyperlink.java
License:Apache License
@Override protected void execute(@NotNull Project project) { String title = "Stop Gradle Daemons"; String message = "Stopping all Gradle daemons will terminate any running Gradle builds (e.g. from the command line).\n" + "This action will also restart the IDE.\n\n" + "Do you want to continue?"; int answer = Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon()); if (answer == Messages.YES) { stopAllGradleDaemonsAndRestart(); }// www .j a v a 2 s . c o m }