List of usage examples for com.intellij.openapi.ui Messages OK
int OK
To view the source code for com.intellij.openapi.ui Messages OK.
Click Source Link
From source file:com.mbeddr.pluginmanager.com.intellij.ide.plugins.InstalledPluginsTableModel.java
License:Apache License
private void warnAboutMissedDependencies(final Boolean newVal, final IdeaPluginDescriptor... ideaPluginDescriptors) { final Set<PluginId> deps = new HashSet<PluginId>(); final List<IdeaPluginDescriptor> descriptorsToCheckDependencies = new ArrayList<IdeaPluginDescriptor>(); if (newVal) { Collections.addAll(descriptorsToCheckDependencies, ideaPluginDescriptors); } else {//www. j a v a 2 s .co m descriptorsToCheckDependencies.addAll(getAllPlugins()); descriptorsToCheckDependencies.removeAll(Arrays.asList(ideaPluginDescriptors)); for (Iterator<IdeaPluginDescriptor> iterator = descriptorsToCheckDependencies.iterator(); iterator .hasNext();) { IdeaPluginDescriptor descriptor = iterator.next(); final Boolean enabled = myEnabled.get(descriptor.getPluginId()); if (enabled == null || !enabled.booleanValue()) { iterator.remove(); } } } for (final IdeaPluginDescriptor ideaPluginDescriptor : descriptorsToCheckDependencies) { PluginManagerCore.checkDependants(ideaPluginDescriptor, new Function<PluginId, IdeaPluginDescriptor>() { @Override @Nullable public IdeaPluginDescriptor fun(final PluginId pluginId) { return PluginManager.getPlugin(pluginId); } }, new Condition<PluginId>() { @Override public boolean value(final PluginId pluginId) { Boolean enabled = myEnabled.get(pluginId); if (enabled == null) { return false; } if (newVal && !enabled.booleanValue()) { deps.add(pluginId); } if (!newVal) { if (ideaPluginDescriptor instanceof IdeaPluginDescriptorImpl && ((IdeaPluginDescriptorImpl) ideaPluginDescriptor).isDeleted()) { return true; } final PluginId pluginDescriptorId = ideaPluginDescriptor.getPluginId(); for (IdeaPluginDescriptor descriptor : ideaPluginDescriptors) { if (pluginId.equals(descriptor.getPluginId())) { deps.add(pluginDescriptorId); break; } } } return true; } }); } if (!deps.isEmpty()) { final String listOfSelectedPlugins = StringUtil.join(ideaPluginDescriptors, new Function<IdeaPluginDescriptor, String>() { @Override public String fun(IdeaPluginDescriptor pluginDescriptor) { return pluginDescriptor.getName(); } }, ", "); final Set<IdeaPluginDescriptor> pluginDependencies = new HashSet<IdeaPluginDescriptor>(); final String listOfDependencies = StringUtil.join(deps, new Function<PluginId, String>() { @Override public String fun(final PluginId pluginId) { final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(pluginId); assert pluginDescriptor != null; pluginDependencies.add(pluginDescriptor); return pluginDescriptor.getName(); } }, "<br>"); final String message = !newVal ? "<html>The following plugins <br>" + listOfDependencies + "<br>are enabled and depend" + (deps.size() == 1 ? "s" : "") + " on selected plugins. " + "<br>Would you like to disable them too?</html>" : "<html>The following plugins on which " + listOfSelectedPlugins + " depend" + (ideaPluginDescriptors.length == 1 ? "s" : "") + " are disabled:<br>" + listOfDependencies + "<br>Would you like to enable them?</html>"; if (Messages.showOkCancelDialog(message, newVal ? "Enable Dependant Plugins" : "Disable Plugins with Dependency on this", Messages.getQuestionIcon()) == Messages.OK) { for (PluginId pluginId : deps) { myEnabled.put(pluginId, newVal); } updatePluginDependencies(); hideNotApplicablePlugins(newVal, pluginDependencies.toArray(new IdeaPluginDescriptor[pluginDependencies.size()])); } } }
From source file:com.mbeddr.pluginmanager.com.intellij.ide.plugins.PluginManagerMain.java
License:Apache License
/** * Start a new thread which downloads new list of plugins from the site in * the background and updates a list of plugins in the table. *///from w w w . j ava 2 s.co m protected void loadPluginsFromHostInBackground() { setDownloadStatus(true); ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @Override public void run() { final List<IdeaPluginDescriptor> list = ContainerUtil.newArrayList(); final Map<String, String> errors = ContainerUtil.newLinkedHashMap(); ProgressIndicator indicator = new EmptyProgressIndicator(); List<String> hosts = RepositoryHelper.getPluginHosts(); Set<PluginId> unique = ContainerUtil.newHashSet(); for (String host : hosts) { try { if (host == null || acceptHost(host)) { List<IdeaPluginDescriptor> plugins = RepositoryHelper.loadPlugins(host, indicator); for (IdeaPluginDescriptor plugin : plugins) { if (unique.add(plugin.getPluginId())) { list.add(plugin); } } } } catch (FileNotFoundException e) { LOG.info(host, e); } catch (IOException e) { LOG.info(host, e); if (host != ApplicationInfoEx.getInstanceEx().getBuiltinPluginsUrl()) { errors.put(host, String.format("'%s' for '%s'", e.getMessage(), host)); } } } UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { setDownloadStatus(false); if (!list.isEmpty()) { InstalledPluginsState state = InstalledPluginsState.getInstance(); for (IdeaPluginDescriptor descriptor : list) { state.onDescriptorDownload(descriptor); } modifyPluginsList(list); propagateUpdates(list); } if (!errors.isEmpty()) { String message = IdeBundle.message("error.list.of.plugins.was.not.loaded", StringUtil.join(errors.keySet(), ", "), StringUtil.join(errors.values(), ",\n")); String title = IdeBundle.message("title.plugins"); String ok = CommonBundle.message("button.retry"), cancel = CommonBundle.getCancelButtonText(); if (Messages.showOkCancelDialog(message, title, ok, cancel, Messages.getErrorIcon()) == Messages.OK) { loadPluginsFromHostInBackground(); } } } }); } }); }
From source file:com.microsoft.intellij.actions.PackageAction.java
License:Open Source License
private boolean checkSdk() { String sdkPath = null;//from w w w .ja va2 s .com if (AzurePlugin.IS_WINDOWS) { try { sdkPath = WindowsAzureProjectManager.getLatestAzureSdkDir(); } catch (IOException e) { log(message("error"), e); } try { if (sdkPath == null) { int choice = Messages.showOkCancelDialog(message("sdkInsErrMsg"), message("sdkInsErrTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { Desktop.getDesktop().browse(URI.create(message("sdkInsUrl"))); } return false; } } catch (Exception ex) { // only logging the error in log file not showing anything to // end user log(message("error"), ex); return false; } } else { log("Not Windows OS, skipping getSDK"); } return true; }
From source file:com.microsoft.intellij.forms.WebSiteDeployForm.java
License:Open Source License
void deleteWebApp() { if (selectedWebSite != null) { String name = selectedWebSite.getName(); int choice = Messages.showOkCancelDialog(String.format(message("delMsg"), name), message("delTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { try { AzureManagerImpl.getManager().deleteWebSite(selectedWebSite.getSubscriptionId(), selectedWebSite.getWebSpaceName(), name); webSiteList.remove(webSiteJList.getSelectedIndex()); webSiteConfigMap.remove(selectedWebSite); AzureSettings.getSafeInstance(AzurePlugin.project).saveWebApps(webSiteConfigMap); selectedWebSite = null;//from w ww. j av a 2 s .c om if (webSiteConfigMap.isEmpty()) { setMessages("There are no Azure web apps in the imported subscriptions."); } else { setWebApps(webSiteConfigMap); } } catch (AzureCmdException e) { String msg = message("delWebErr") + "\n" + String.format(message("webappExpMsg"), e.getMessage()); PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, e); } } } else { PluginUtil.displayErrorDialog(message("errTtl"), "Select a web app container to delete."); } }
From source file:com.microsoft.intellij.ui.AppInsightsMngmtPanel.java
License:Open Source License
private ActionListener removeButtonListener() { return new ActionListener() { public void actionPerformed(ActionEvent e) { int curSelIndex = insightsTable.getSelectedRow(); if (curSelIndex > -1) { String keyToRemove = ApplicationInsightsResourceRegistry.getKeyAsPerIndex(curSelIndex); String moduleName = MethodUtils.getModuleNameAsPerKey(myProject, keyToRemove); if (moduleName != null && !moduleName.isEmpty()) { PluginUtil.displayErrorDialog(message("aiErrTtl"), String.format(message("rsrcUseMsg"), moduleName)); } else { int choice = Messages.showOkCancelDialog(message("rsrcRmvMsg"), message("aiErrTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { ApplicationInsightsResourceRegistry.getAppInsightsResrcList().remove(curSelIndex); AzureSettings.getSafeInstance(myProject).saveAppInsights(); ((InsightsTableModel) insightsTable.getModel()).setResources(getTableContent()); ((InsightsTableModel) insightsTable.getModel()).fireTableDataChanged(); }//w w w . j a v a 2s. c o m } } } }; }
From source file:com.microsoft.intellij.ui.azureroles.AzureRolePanel.java
License:Open Source License
/** * Method checks if number of instances are equal to 1 * and caching is enabled as well as high availability * feature is on then ask input from user, * whether to turn off high availability feature * or he wants to edit instances.//from ww w . j av a 2s. co m * * @param val * @return boolean */ private boolean handleHighAvailabilityFeature(boolean val) { boolean isBackupSet = false; boolean okToProceed = val; try { /* * checks if number of instances are equal to 1 * and caching is enabled */ if (txtNoOfInstances.getText().trim().equalsIgnoreCase("1") && windowsAzureRole.getCacheMemoryPercent() > 0) { /* * Check high availability feature of any of the cache is on */ Map<String, WindowsAzureNamedCache> mapCache = windowsAzureRole.getNamedCaches(); for (Iterator<WindowsAzureNamedCache> iterator = mapCache.values().iterator(); iterator .hasNext();) { WindowsAzureNamedCache cache = (WindowsAzureNamedCache) iterator.next(); if (cache.getBackups()) { isBackupSet = true; } } /* * High availability feature of any of the cache is on. */ if (isBackupSet) { int choice = Messages.showOkCancelDialog(message("highAvailMsg"), message("highAvailTtl"), Messages.getQuestionIcon()); /* * Set High availability feature to No. */ if (choice == Messages.OK) { for (Iterator<WindowsAzureNamedCache> iterator = mapCache.values().iterator(); iterator .hasNext();) { WindowsAzureNamedCache cache = iterator.next(); if (cache.getBackups()) { cache.setBackups(false); } } okToProceed = true; waProjManager.save(); } else { /* * Stay on Role properties page. */ okToProceed = false; txtNoOfInstances.requestFocus(); } } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("cachErrTtl"), message("cachGetErMsg"), e); okToProceed = false; } return okToProceed; }
From source file:com.microsoft.intellij.ui.azureroles.CertificatesPanel.java
License:Open Source License
private void removeCertificate() { try {/*from w ww . ja v a2 s. c o m*/ WindowsAzureCertificate delCert = tblCertificates.getSelectedObject(); if (delCert.isRemoteAccess() && delCert.isSSLCert()) { String temp = String.format("%s%s%s", message("sslTtl"), " and ", message("cmhLblRmtAces")); PluginUtil.displayErrorDialog(message("certRmTtl"), String.format(message("certComMsg"), temp, temp)); } else if (delCert.isRemoteAccess()) { PluginUtil.displayErrorDialog(message("certRmTtl"), String.format(message("certComMsg"), message("cmhLblRmtAces"), message("cmhLblRmtAces"))); } else if (delCert.isSSLCert()) { PluginUtil.displayErrorDialog(message("certRmTtl"), String.format(message("certComMsg"), message("sslTtl"), message("sslTtl"))); } else { int choice = Messages.showOkCancelDialog(String.format(message("certRmMsg"), delCert.getName()), message("certRmTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { delCert.delete(); certSelected = ""; setModified(true); tblCertificates.getListTableModel().removeRow(tblCertificates.getSelectedRow()); } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("certErrTtl"), message("certErrMsg"), e); } }
From source file:com.microsoft.intellij.ui.azureroles.DebuggingPanel.java
License:Open Source License
/** * This method sets the status of debug option * based on the user input.If user checks the debug check box * first time then it will add a debugging end point otherwise it will * prompt the user for removal of associated end point for debugging if * user already has some debug end point associated and unchecked * the debug check box.// ww w .j a v a 2s .c o m */ private void debugOptionStatus() { if (debugCheck.isSelected()) { makeDebugEnable(); try { waRole.setDebuggingEndpoint(dbgSelEndpoint); waRole.setStartSuspended(jvmCheck.isSelected()); } catch (WindowsAzureInvalidProjectOperationException e1) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("dlgDbgErr"), e1); } } else { if (isDebugChecked && !"".equals(comboEndPoint.getSelectedItem())) { String msg = String.format("%s%s", message("dlgDbgEdPtAscMsg"), comboEndPoint.getSelectedItem()); int choice = Messages.showOkCancelDialog(msg, message("dlgDbgEndPtErrTtl"), Messages.getQuestionIcon()); if (choice == Messages.OK) { removeDebugAssociatedEndpoint(); } else { makeAllDisable(); try { waRole.setDebuggingEndpoint(null); } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("dlgDbgErr"), e); } } } else { removeDebugAssociatedEndpoint(); } } }
From source file:com.microsoft.intellij.ui.azureroles.RoleEndpointsPanel.java
License:Open Source License
/** * Listener method for remove button which * deletes the selected endpoint.//from w w w . j ava 2 s. c om */ private void removeEndpoint() { WindowsAzureEndpoint waEndpoint = tblEndpoints.getSelectedObject(); try { WindowsAzureEndpoint debugEndpt = windowsAzureRole.getDebuggingEndpoint(); String dbgEndptName = ""; if (debugEndpt != null) { dbgEndptName = debugEndpt.getName(); } // delete the selected endpoint /* * Check end point selected for removal * is associated with Caching then give error * and does not allow to remove. */ if (waEndpoint.isCachingEndPoint()) { PluginUtil.displayErrorDialog(message("cachDsblErTtl"), message("endPtRmvErMsg")); } /* * Check end point selected for removal * is associated with Debugging. */ else if (waEndpoint.getName().equalsIgnoreCase(dbgEndptName)) { StringBuilder msg = new StringBuilder(message("dlgEPDel")); msg.append(message("dlgEPDel1")); msg.append(message("dlgEPDel2")); int choice = Messages.showYesNoDialog(msg.toString(), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.YES) { waEndpoint.delete(); setModified(true); windowsAzureRole.setDebuggingEndpoint(null); } } /* * Endpoint associated with both SSL * and Session affinity */ else if (waEndpoint.isStickySessionEndpoint() && waEndpoint.isSSLEndpoint()) { int choice = Messages.showOkCancelDialog(message("bothDelMsg"), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.OK) { setModified(true); if (waEndpoint.getEndPointType().equals(WindowsAzureEndpointType.Input)) { windowsAzureRole.setSessionAffinityInputEndpoint(null); windowsAzureRole.setSslOffloading(null, null); waEndpoint.delete(); } else { windowsAzureRole.setSessionAffinityInputEndpoint(null); windowsAzureRole.setSslOffloading(null, null); } } } /* * Check end point selected for removal * is associated with Load balancing * i.e (HTTP session affinity). */ else if (waEndpoint.isStickySessionEndpoint()) { int choice = Messages.showOkCancelDialog(message("ssnAffDelMsg"), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.OK) { setModified(true); if (waEndpoint.getEndPointType().equals(WindowsAzureEndpointType.Input)) { windowsAzureRole.setSessionAffinityInputEndpoint(null); waEndpoint.delete(); } else { windowsAzureRole.setSessionAffinityInputEndpoint(null); } } } /* * Endpoint associated with SSL */ else if (waEndpoint.isSSLEndpoint()) { int choice = Messages.showOkCancelDialog(message("sslDelMsg"), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.OK) { setModified(true); if (waEndpoint.getEndPointType().equals(WindowsAzureEndpointType.Input)) { windowsAzureRole.setSslOffloading(null, null); waEndpoint.delete(); } else { windowsAzureRole.setSslOffloading(null, null); } } } /* * Endpoint associated with SSL redirection. */ else if (waEndpoint.isSSLRedirectEndPoint()) { int choice = Messages.showOkCancelDialog(message("sslRedirectDelMsg"), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.OK) { windowsAzureRole.deleteSslOffloadingRedirectionEndpoint(); setModified(true); } } /* * Normal end point. */ else { int choice = Messages.showOkCancelDialog(message("dlgDelEndPt2"), message("dlgDelEndPt1"), Messages.getQuestionIcon()); if (choice == Messages.OK) { setModified(true); waEndpoint.delete(); } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("adRolErrMsgBox1") + message("adRolErrMsgBox2"), message("adRolErrTitle"), e); } }
From source file:com.microsoft.intellij.ui.debug.AzureRemoteStateState.java
License:Open Source License
public ExecutionResult execute(final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException { try {//from ww w.j a va 2 s. com // get web app name to which user want to debug his application String website = webAppName; if (!website.isEmpty()) { website = website.substring(0, website.indexOf('(')).trim(); Map<WebSite, WebSiteConfiguration> webSiteConfigMap = AzureSettings.getSafeInstance(project) .loadWebApps(); // retrieve web apps configurations for (Map.Entry<WebSite, WebSiteConfiguration> entry : webSiteConfigMap.entrySet()) { final WebSite websiteTemp = entry.getKey(); if (websiteTemp.getName().equals(website)) { final WebSiteConfiguration webSiteConfiguration = entry.getValue(); // case - if user uses shortcut without going to Azure Tab Map<String, Boolean> mp = AzureSettings.getSafeInstance(project).getWebsiteDebugPrep(); if (!mp.containsKey(website)) { mp.put(website, false); } AzureSettings.getSafeInstance(project).setWebsiteDebugPrep(mp); // check if web app prepared for debugging and process has started if (AzureSettings.getSafeInstance(project).getWebsiteDebugPrep().get(website).booleanValue() && !Utils.isPortAvailable(Integer.parseInt(socketPort))) { ConsoleViewImpl consoleView = new ConsoleViewImpl(project, false); RemoteDebugProcessHandler process = new RemoteDebugProcessHandler(project); consoleView.attachToProcess(process); return new DefaultExecutionResult(consoleView, process); } else { if (AzureSettings.getSafeInstance(project).getWebsiteDebugPrep().get(website) .booleanValue()) { // process not started ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { int choice = Messages.showOkCancelDialog(message("processDebug"), "Azure Web App", Messages.getQuestionIcon()); if (choice == Messages.OK) { // check is there a need for preparation ProcessForDebug task = new ProcessForDebug(websiteTemp, webSiteConfiguration); try { task.queue(); Messages.showInfoMessage(message("debugReady"), "Azure Web App"); } catch (Exception e) { AzurePlugin.log(e.getMessage(), e); } } } }, ModalityState.defaultModalityState()); } else { // start the process of preparing the web app, in a blocking way if (Utils.isPortAvailable(Integer.parseInt(socketPort))) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { int choice = Messages.showOkCancelDialog(message("remoteDebug"), "Azure Web App", Messages.getQuestionIcon()); if (choice == Messages.OK) { // check is there a need for preparation PrepareForDebug task = new PrepareForDebug(websiteTemp, webSiteConfiguration); try { task.queue(); Messages.showInfoMessage(message("debugReady"), "Azure Web App"); } catch (Exception e) { AzurePlugin.log(e.getMessage(), e); } } } }, ModalityState.defaultModalityState()); } else { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { PluginUtil.displayErrorDialog("Azure Web App", String.format(message("portMsg"), socketPort)); } }, ModalityState.defaultModalityState()); } } } break; } } } } catch (Exception ex) { AzurePlugin.log(ex.getMessage(), ex); } return null; }