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.NetworkDeploy.ui.SshUserInfo.java
License:Open Source License
@Override public boolean promptYesNo(final String s) { result.remove(Fields.Answer);//from ww w .j a v a 2s . c om ApplicationManager.getApplication().invokeAndWait(new Runnable() { @Override public void run() { result.put(Fields.Answer, Messages.showYesNoDialog(project, s, "", null)); } }, ModalityState.defaultModalityState()); Integer answer = (Integer) result.get(Fields.Answer); return answer == Messages.YES; }
From source file:com.perl5.lang.perl.idea.configuration.module.PerlModuleSdkConfigurable.java
License:Apache License
private void init() { myJdkPanel = new JPanel(new GridBagLayout()); myCbModuleJdk = new JdkComboBox(myJdksModel, new Condition<SdkTypeId>() { @Override/*from ww w . j av a2 s .c om*/ public boolean value(SdkTypeId sdkTypeId) { return sdkTypeId == PerlSdkType.getInstance(); } }); myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0); myCbModuleJdk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (myFreeze) { return; } final Sdk newJdk = myCbModuleJdk.getSelectedJdk(); setSdk(newJdk); clearCaches(); } }); myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.module.radio")), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); myJdkPanel.add(myCbModuleJdk, new GridBagConstraints(1, 0, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); final Project project = getRootModel().getModule().getProject(); final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); myCbModuleJdk.setSetupButton(setUpButton, project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition<Sdk>() { @Override public boolean value(Sdk jdk) { final Sdk projectJdk = myJdksModel.getProjectSdk(); if (projectJdk == null) { final int res = Messages.showYesNoDialog(myJdkPanel, ProjectBundle.message("project.roots.no.jdk.on.project.message"), ProjectBundle.message("project.roots.no.jdk.on.project.title"), Messages.getInformationIcon()); if (res == Messages.YES) { myJdksModel.setProjectSdk(jdk); return true; } } return false; } }, true); myJdkPanel.add(setUpButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); myCbModuleJdk.setEditButton(editButton, getRootModel().getModule().getProject(), new Computable<Sdk>() { @Override @Nullable public Sdk compute() { return getRootModel().getSdk(); } }); myJdkPanel.add(editButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); }
From source file:com.perl5.lang.perl.idea.configuration.paths.PerlModuleSdkConfigurable.java
License:Apache License
private void init() { myJdkPanel = new JPanel(new GridBagLayout()); myCbModuleJdk = new JdkComboBox(myJdksModel, new Condition<SdkTypeId>() { @Override/* www. j a v a2 s . c o m*/ public boolean value(SdkTypeId sdkTypeId) { return sdkTypeId == PerlSdkType.getInstance(); } }); myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0); myCbModuleJdk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (myFreeze) return; final Sdk newJdk = myCbModuleJdk.getSelectedJdk(); setSdk(newJdk); clearCaches(); } }); myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.module.radio")), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); myJdkPanel.add(myCbModuleJdk, new GridBagConstraints(1, 0, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); final Project project = getRootModel().getModule().getProject(); final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); myCbModuleJdk.setSetupButton(setUpButton, project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition<Sdk>() { @Override public boolean value(Sdk jdk) { final Sdk projectJdk = myJdksModel.getProjectSdk(); if (projectJdk == null) { final int res = Messages.showYesNoDialog(myJdkPanel, ProjectBundle.message("project.roots.no.jdk.on.project.message"), ProjectBundle.message("project.roots.no.jdk.on.project.title"), Messages.getInformationIcon()); if (res == Messages.YES) { myJdksModel.setProjectSdk(jdk); return true; } } return false; } }, true); myJdkPanel.add(setUpButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); myCbModuleJdk.setEditButton(editButton, getRootModel().getModule().getProject(), new Computable<Sdk>() { @Override @Nullable public Sdk compute() { return getRootModel().getSdk(); } }); myJdkPanel.add(editButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); }
From source file:com.twitter.intellij.pants.components.impl.PantsProjectComponentImpl.java
License:Apache License
@Override public void projectOpened() { super.projectOpened(); if (myProject.isDefault()) { return;//from w w w .ja va 2 s. c om } StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() { @Override public void run() { /** * Set project to allow dynamic classpath for JUnit run. Still requires any junit run to specify dynamic classpath in * {@link com.twitter.intellij.pants.execution.PantsClasspathRunConfigurationExtension#updateJavaParameters} * IDEA's logic: {@link com.intellij.execution.configurations.CommandLineBuilder} */ PropertiesComponent.getInstance(myProject).setValue("dynamic.classpath", true); if (PantsUtil.isSeedPantsProject(myProject)) { convertToPantsProject(); } registerExternalBuilderListener(); subscribeToRunConfigurationAddition(); final AbstractExternalSystemSettings pantsSettings = ExternalSystemApiUtil.getSettings(myProject, PantsConstants.SYSTEM_ID); final boolean resolverVersionMismatch = pantsSettings instanceof PantsSettings && ((PantsSettings) pantsSettings).getResolverVersion() != PantsResolver.VERSION; if (resolverVersionMismatch && PantsUtil.isPantsProject(myProject)) { final int answer = Messages.showYesNoDialog(myProject, PantsBundle.message("pants.project.generated.with.old.version", myProject.getName()), PantsBundle.message("pants.name"), PantsIcons.Icon); if (answer == Messages.YES) { PantsUtil.refreshAllProjects(myProject); } } } /** * To convert a seed Pants project to a full bloom pants project: * 1. Obtain the targets and project_path generated by `pants idea-plugin` from * workspace file `project.iws` via `PropertiesComponent` API. * 2. Generate a refresh spec based on the info above. * 3. Explicitly call {@link PantsUtil#refreshAllProjects}. */ private void convertToPantsProject() { String serializedTargets = PropertiesComponent.getInstance(myProject).getValue("targets"); String projectPath = PropertiesComponent.getInstance(myProject).getValue("project_path"); if (serializedTargets == null || projectPath == null) { return; } /** * Generate the import spec for the next refresh. */ final List<String> targetSpecs = PantsUtil.gson.fromJson(serializedTargets, PantsUtil.TYPE_LIST_STRING); final PantsProjectSettings pantsProjectSettings = new PantsProjectSettings(targetSpecs, projectPath, false, true); /** * Following procedures in {@link com.intellij.openapi.externalSystem.util.ExternalSystemUtil#refreshProjects}: * Make sure the setting is injected into the project for refresh. */ ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil .getManager(PantsConstants.SYSTEM_ID); if (manager == null) { return; } AbstractExternalSystemSettings settings = manager.getSettingsProvider().fun(myProject); settings.setLinkedProjectsSettings(Collections.singleton(pantsProjectSettings)); PantsUtil.refreshAllProjects(myProject); prepareGuiComponents(); } /** * Ensure GUI is set correctly because empty IntelliJ project (seed project in this case) * does not have these set by default. * 1. Make sure the project view is opened so view switch will follow. * 2. Pants tool window is initialized; otherwise no message can be shown when invoking `PantsCompile`. */ private void prepareGuiComponents() { if (!ApplicationManager.getApplication().isUnitTestMode()) { if (ToolWindowManager.getInstance(myProject).getToolWindow("Project") != null) { ToolWindowManager.getInstance(myProject).getToolWindow("Project").show(null); } ExternalSystemUtil.ensureToolWindowInitialized(myProject, PantsConstants.SYSTEM_ID); } } private void subscribeToRunConfigurationAddition() { RunManagerEx.getInstanceEx(myProject).addRunManagerListener(new RunManagerAdapter() { @Override public void runConfigurationAdded(@NotNull RunnerAndConfigurationSettings settings) { super.runConfigurationAdded(settings); if (!PantsUtil.isPantsProject(myProject) && !PantsUtil.isSeedPantsProject(myProject)) { return; } if (!PantsSettings.getInstance(myProject).isUsePantsMakeBeforeRun()) { return; } PantsMakeBeforeRun.replaceDefaultMakeWithPantsMake(myProject, settings); } }); } }); }
From source file:com.urswolfer.intellij.plugin.gerrit.rest.SslSupport.java
License:Apache License
@CalledInAwt public boolean askIfShouldProceed(final String host) { int choice = Messages.showYesNoDialog( "The security certificate of " + host + " is not trusted. Do you want to proceed anyway?", "Not Trusted Certificate", "Proceed anyway", "No, I don't trust", Messages.getErrorIcon()); boolean trust = (choice == Messages.YES); if (trust) {//w w w . j a va 2 s . com saveToTrusted(host); } return trust; }
From source file:de.fu_berlin.inf.dpp.intellij.ui.util.SafeDialogUtils.java
License:Open Source License
public static boolean showYesNoDialog(final String message, final String title) { final AtomicBoolean choice = new AtomicBoolean(false); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override/*from w ww .j av a2s. c o m*/ public void run() { int returnValue = Messages.showYesNoDialog(saros.getProject(), message, title, Messages.getQuestionIcon()); if (returnValue == Messages.YES) { choice.set(true); } } }); return choice.get(); }
From source file:io.ballerina.plugins.idea.sdk.BallerinaSdkUtils.java
License:Open Source License
@Messages.YesNoResult public static void showRestartDialog(Project project) { ApplicationManager.getApplication().invokeLater(() -> { String action = project != null && ProjectManagerEx.getInstanceEx().canClose(project) ? "Reload Project" : "Restart IDE"; String message = "Project/IDE reloading action is required to apply changes. Do you wish to continue?"; if (Messages.showYesNoDialog(message, "Apply Changes", action, "Postpone", Messages.getQuestionIcon()) == Messages.YES) { if (action.equals("Reload Project")) { ProjectManagerEx.getInstanceEx().reloadProject(project); } else { ApplicationManagerEx.getApplicationEx().restart(true); }// w w w . j a va 2 s . co m } }); }
From source file:io.flutter.inspections.WrongModuleTypeNotificationProvider.java
License:Open Source License
@NotNull private static EditorNotificationPanel createPanel(@NotNull Project project, @NotNull Module module) { final EditorNotificationPanel panel = new EditorNotificationPanel().icon(FlutterIcons.Flutter); panel.setText(FlutterBundle.message("flutter.support.is.not.enabled.for.module.0", module.getName())); panel.createActionLabel(FlutterBundle.message("change.module.type.to.flutter.and.reload.project"), () -> { final int message = Messages.showOkCancelDialog(project, FlutterBundle.message("updating.module.type.requires.project.reload.proceed"), FlutterBundle.message("update.module.type"), FlutterBundle.message("reload.project"), CommonBundle.getCancelButtonText(), null); if (message == Messages.YES) { FlutterModuleUtils.setFlutterModuleAndReload(module, project); }/*from ww w. ja va 2 s . com*/ }); panel.createActionLabel(FlutterBundle.message("don.t.show.again.for.this.module"), () -> { final 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:jetbrains.communicator.jabber.JabberConnectionCommand.java
License:Apache License
public void execute() { if (isConnected()) { if (Messages.YES == Messages.showYesNoDialog(StringUtil.getMsg("disconnect.from.jabber.account"), StringUtil.getMsg("disconnect.confirmation"), Messages.getQuestionIcon())) { myJabberFacade.disconnect(); myJabberFacade.getMyAccount().setLoginAllowed(false); myJabberFacade.saveSettings(); }//from w ww.j a va2 s. co m } else { myJabberUi.login(myParentComponent); } }
From source file:liveplugin.toolwindow.addplugin.git.jetbrains.plugins.github.util.GithubSslSupport.java
License:Apache License
@CalledInAwt public boolean askIfShouldProceed(final String url) { String host = GithubUrlUtil.getHostFromUrl(url); int choice = Messages.showYesNoDialog( "The security certificate of " + host + " is not trusted. Do you want to proceed anyway?", "Not Trusted Certificate", "Proceed anyway", "No, I don't trust", Messages.getErrorIcon()); boolean trust = (choice == Messages.YES); if (trust) {//from w w w .ja va 2 s . c o m saveToTrusted(host); } return trust; }