List of usage examples for com.intellij.openapi.ui Messages YES
int YES
To view the source code for com.intellij.openapi.ui Messages YES.
Click Source Link
From source file:com.android.tools.idea.structure.gradle.ModuleDependenciesPanel.java
License:Apache License
private String installRepositoryIfNeeded(String coordinateText) { GradleCoordinate gradleCoordinate = GradleCoordinate.parseCoordinateString(coordinateText); assert gradleCoordinate != null; // Only allowed to click ok when the string is valid. if (!REVISION_ANY.equals(gradleCoordinate.getFullRevision()) || !RepositoryUrlManager.EXTRAS_REPOSITORY.containsKey(gradleCoordinate.getArtifactId())) { // No installation needed, or it's not a local repository. return coordinateText; }// w w w . j a v a 2 s .c o m String message = "Library " + gradleCoordinate.getArtifactId() + " is not installed. Install repository?"; if (Messages.showYesNoDialog(myProject, message, "Install Repository", Messages.getQuestionIcon()) != Messages.YES) { // User cancelled installation. return null; } List<IPkgDesc> requested = Lists.newArrayList(); SdkMavenRepository repository; if (coordinateText.startsWith("com.android.support")) { repository = SdkMavenRepository.ANDROID; } else if (coordinateText.startsWith("com.google.android")) { repository = SdkMavenRepository.GOOGLE; } else { // Not a local repository. assert false; // EXTRAS_REPOSITORY.containsKey() should have returned false. return coordinateText + ':' + REVISION_ANY; } requested.add(repository.getPackageDescription()); SdkQuickfixWizard wizard = new SdkQuickfixWizard(myProject, null, requested); wizard.init(); wizard.setTitle("Install Missing Components"); if (wizard.showAndGet()) { return RepositoryUrlManager.get().getLibraryCoordinate(gradleCoordinate.getArtifactId()); } else { // Installation wizard didn't complete - skip adding the dependency. return null; } }
From source file:com.android.tools.idea.structure.services.view.DeveloperServicePanel.java
License:Apache License
public DeveloperServicePanel(@NotNull DeveloperService service) { super(new BorderLayout()); myService = service;//w w w . ja v a 2 s . com ServiceContext context = service.getContext(); DeveloperServiceMetadata developerServiceMetadata = service.getMetadata(); initializeHeaderPanel(developerServiceMetadata); myDetailsPanel.add(service.getPanel()); initializeFooterPanel(developerServiceMetadata); final SelectedProperty enabledCheckboxSelected = new SelectedProperty(myEnabledCheckbox); myBindings.bind(new VisibleProperty(myDetailsPanel), enabledCheckboxSelected.and(not(context.installed()))); // This definition might be modified from the user interacting with the service earlier but not // yet committing to install it. myBindings.bind(enabledCheckboxSelected, context.installed().or(context.modified())); myEnabledCheckbox.setName("enableService"); enabledCheckboxSelected.addListener(new InvalidationListener() { @Override public void onInvalidated(@NotNull ObservableValue<?> sender) { if (enabledCheckboxSelected.get()) { if (!myService.getContext().installed().get()) { // User just selected a service which was previously uninstalled. This means we are // ready to edit it. myService.getContext().beginEditing(); } } else { if (myService.getContext().installed().get()) { // User just deselected a service which was previous installed String message = String.format(DELETE_SERVICE_MESSAGE, myService.getMetadata().getName(), Joiner.on('\n').join(myService.getMetadata().getDependencies())); int answer = Messages.showYesNoDialog(myService.getModule().getProject(), message, DELETE_SERVICE_TITLE, null); if (answer == Messages.YES) { myService.uninstall(); } else { enabledCheckboxSelected.set(true); } } else { // User just deselected a service they were editing but hadn't installed yet myService.getContext().cancelEditing(); } } } }); add(myRootPanel); }
From source file:com.android.tools.idea.testartifacts.instrumented.AndroidTestRunConfiguration.java
License:Apache License
@NotNull @Override//from w w w. j a v a 2 s .c o m public List<ValidationError> checkConfiguration(@NotNull AndroidFacet facet) { List<ValidationError> errors = Lists.newArrayList(); Module module = facet.getModule(); JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject()); switch (TESTING_TYPE) { case TEST_ALL_IN_PACKAGE: final PsiPackage testPackage = facade.findPackage(PACKAGE_NAME); if (testPackage == null) { errors.add(ValidationError .warning(ExecutionBundle.message("package.does.not.exist.error.message", PACKAGE_NAME))); } break; case TEST_CLASS: PsiClass testClass = null; try { testClass = getConfigurationModule().checkModuleAndClassName(CLASS_NAME, ExecutionBundle.message("no.test.class.specified.error.text")); } catch (RuntimeConfigurationException e) { errors.add(ValidationError.fromException(e)); } if (testClass != null && !JUnitUtil.isTestClass(testClass)) { errors.add(ValidationError .warning(ExecutionBundle.message("class.isnt.test.class.error.message", CLASS_NAME))); } break; case TEST_METHOD: errors.addAll(checkTestMethod()); break; } if (INSTRUMENTATION_RUNNER_CLASS.length() > 0) { if (facade.findClass(INSTRUMENTATION_RUNNER_CLASS, module.getModuleWithDependenciesAndLibrariesScope(true)) == null) { errors.add(ValidationError .fatal(AndroidBundle.message("instrumentation.runner.class.not.specified.error"))); } } final AndroidFacetConfiguration configuration = facet.getConfiguration(); if (!facet.requiresAndroidModel() && !configuration.getState().PACK_TEST_CODE) { final int count = getTestSourceRootCount(module); if (count > 0) { final String shortMessage = "Test code not included into APK"; final String fixMessage = "Code and resources under test source " + (count > 1 ? "roots" : "root") + " aren't included into debug APK.\nWould you like to include them and recompile " + module.getName() + " module?" + "\n(You may change this option in Android facet settings later)"; Runnable quickFix = new Runnable() { @Override public void run() { final int result = Messages.showYesNoCancelDialog(getProject(), fixMessage, shortMessage, Messages.getQuestionIcon()); if (result == Messages.YES) { configuration.getState().PACK_TEST_CODE = true; } } }; errors.add(ValidationError.fatal(shortMessage, quickFix)); } } return errors; }
From source file:com.android.tools.idea.welcome.install.InstallOperation.java
License:Apache License
/** * Shows a retry prompt. Throws an exception to stop the setup process if the user preses cancel or returns normally otherwise. *//*from ww w . j a v a 2s .c o m*/ protected final void promptToRetry(@NotNull final String prompt, @NotNull String failureDescription, @Nullable Exception e) throws WizardException { final AtomicBoolean response = new AtomicBoolean(false); Application application = ApplicationManager.getApplication(); application.invokeAndWait(new Runnable() { @Override public void run() { int i = Messages.showYesNoDialog(null, prompt, "Android Studio Setup", "Retry", "Cancel", Messages.getErrorIcon()); response.set(i == Messages.YES); } }, application.getAnyModalityState()); if (!response.get()) { Throwables.propagateIfInstanceOf(e, WizardException.class); throw new WizardException(failureDescription, e); } else { myContext.print(failureDescription + "\n", ConsoleViewContentType.ERROR_OUTPUT); } }
From source file:com.chrisrm.idea.MTLafComponent.java
License:Open Source License
/** * Restart IDE if necessary (ex: material design components) * * @param mtConfig/*from w w w . ja v a 2 s .c o m*/ * @param form */ private void restartIdeIfNecessary(final MTConfig mtConfig, final MTForm form) { // Restart the IDE if changed if (mtConfig.needsRestart(form)) { final String title = MaterialThemeBundle.message("mt.restartDialog.title"); final String message = MaterialThemeBundle.message("mt.restartDialog.content"); final int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon()); if (answer == Messages.YES) { willRestartIde = true; } } }
From source file:com.chrisrm.idea.MTLafComponent.java
License:Open Source License
/** * Ask for resetting custom theme colors when the LafManager is switched from or to dark mode * * @param source//from w w w .java 2 s. c om */ private void askResetCustomTheme(final LafManager source) { // If switched look and feel and asking for reset (default true) if (source.getCurrentLookAndFeel() != currentLookAndFeel && !MTCustomThemeConfig.getInstance().isDoNotAskAgain()) { final int dialog = Messages.showOkCancelDialog( MaterialThemeBundle.message("mt.resetCustomTheme.message"), MaterialThemeBundle.message("mt.resetCustomTheme.title"), CommonBundle.getOkButtonText(), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon(), new DialogWrapper.DoNotAskOption.Adapter() { @Override public void rememberChoice(final boolean isSelected, final int exitCode) { if (exitCode != -1) { MTCustomThemeConfig.getInstance().setDoNotAskAgain(isSelected); } } }); if (dialog == Messages.YES) { MTCustomThemeConfig.getInstance().setDefaultValues(); currentLookAndFeel = source.getCurrentLookAndFeel(); MTThemeManager.getInstance().activate(); } } currentLookAndFeel = source.getCurrentLookAndFeel(); }
From source file:com.chrisrm.idea.MTThemeManager.java
License:Open Source License
private void askForRestart() { final String title = MaterialThemeBundle.message("mt.restartDialog.title"); final String message = MaterialThemeBundle.message("mt.restartDialog.content"); final int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon()); if (answer == Messages.YES) { MTUiUtils.restartIde();//from ww w . ja v a2s . c om } }
From source file:com.eugenePetrenko.idea.dependencies.actions.OnModuleAction.java
License:Apache License
@Nullable private AnalyzeStrategy decideStrategy(@NotNull final Project project, @NotNull final Module[] modules) { boolean suggestExpand = modules.length != WITH_EXPORT_DEPENDENCIES.collectAllModules(project, modules).length;//from w w w . j a v a2s. c o m if (!suggestExpand) return WITH_EXPORT_DEPENDENCIES; int result = Messages.showYesNoCancelDialog(project, "There are some modules with exported dependencies.\n" + "It's required to include more modules to the list " + "in order to analyze exported dependencies.\n\n" + "Do you like to include more modules?", "Unused Dependencies", "Include Modules", "Skip Exports", "Cancel", null); switch (result) { case Messages.YES: return WITH_EXPORT_DEPENDENCIES; case Messages.NO: return SKIP_EXPORT_DEPENDENCIES; default: return null; } }
From source file:com.goide.inspections.WrongModuleTypeNotificationProvider.java
License:Apache License
@NotNull private static EditorNotificationPanel createPanel(@NotNull final Project project, @NotNull final Module module) { EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("'" + module.getName() + "' is not Go Module, some code insight might not work here"); panel.createActionLabel("Change module type to Go and reload project", new Runnable() { @Override/*from ww w . j a v a 2s. c o m*/ public void run() { int message = Messages.showOkCancelDialog(project, "Updating module type requires project reload. Proceed?", "Update Module Type", "Reload project", "Cancel", null); if (message == Messages.YES) { module.setOption(Module.ELEMENT_TYPE, GoModuleType.getInstance().getId()); project.save(); EditorNotifications.getInstance(project).updateAllNotifications(); ProjectManager.getInstance().reloadProject(project); } } }); panel.createActionLabel("Don't show again for this module", new Runnable() { @Override public void run() { Set<String> ignoredModules = getIgnoredModules(project); ignoredModules.add(module.getName()); PropertiesComponent.getInstance(project).setValue(DONT_ASK_TO_CHANGE_MODULE_TYPE_KEY, StringUtil.join(ignoredModules, ",")); EditorNotifications.getInstance(project).updateAllNotifications(); } }); return panel; }
From source file:com.google.cloud.tools.intellij.appengine.cloud.AppEngineDeploymentRuntime.java
License:Apache License
@Override public void undeploy(@NotNull final UndeploymentTaskCallback callback) { SwingUtilities.invokeLater(new Runnable() { @Override//from w ww . j ava2 s. c om public void run() { int doStop = Messages.showOkCancelDialog( GctBundle.message("appengine.stop.modules.version.confirmation.message", STOP_CONFIRMATION_URI_OPEN_TAG, STOP_CONFIRMATION_URI_CLOSE_TAG), GctBundle.message("appengine.stop.modules.version.confirmation.title"), General.Warning); if (doStop == Messages.YES) { stop(callback); } else { callback.errorOccurred(GctBundle.message("appengine.stop.modules.version.canceled.message")); } } }); }