List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
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.// w ww . j a v a 2 s. co 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.EndpointDialog.java
License:Open Source License
/** * Disables the debugging if debug endpoint's type is changed to 'Internal', * and if private port is modified then assigns the new debugging port * by setting the modified endpoint as a debugging endpoint. * * @param oldType : old type of the endpoint. * @return retVal : false if any error occurs. * @throws WindowsAzureInvalidProjectOperationException *///from w ww . ja v a2 s.c o m private boolean handleChangeForDebugEndpt(WindowsAzureEndpointType oldType, String privatePort) throws WindowsAzureInvalidProjectOperationException { boolean retVal = true; if (oldType.equals(WindowsAzureEndpointType.Input) && comboType.getSelectedItem().equals(WindowsAzureEndpointType.Internal.toString())) { int choice = Messages.showYesNoDialog( String.format("%s%s%s", message("dlgEPDel"), message("dlgEPChangeType"), message("dlgEPDel2")), message("dlgTypeTitle"), Messages.getQuestionIcon()); if (choice == Messages.YES) { waEndpt.setEndPointType((WindowsAzureEndpointType) comboType.getSelectedItem()); waRole.setDebuggingEndpoint(null); } else { retVal = false; } } else if (privatePort == null) { PluginUtil.displayErrorDialog(message("dlgInvldPort"), message("dbgPort")); retVal = false; } else if (!waEndpt.getPrivatePort().equalsIgnoreCase(privatePort)) { boolean isSuspended = waRole.getStartSuspended(); waRole.setDebuggingEndpoint(null); waEndpt.setPrivatePort(privatePort); waRole.setDebuggingEndpoint(waEndpt); waRole.setStartSuspended(isSuspended); } return retVal; }
From source file:com.microsoft.intellij.ui.azureroles.EnvVarsPanel.java
License:Open Source License
/** * Listener for remove button, which removes the * environment variable from the role.//from w w w. j a v a 2 s. co m */ @SuppressWarnings("unchecked") protected void removeBtnListener() { try { Entry<String, String> mapEntry = tblEnvVariables.getSelectedObject(); // Check environment variable is associated with component if (waRole.getIsEnvPreconfigured(mapEntry.getKey())) { PluginUtil.displayErrorDialog(message("jdkDsblErrTtl"), message("envJdkDslErrMsg")); } else { int choice = Messages.showYesNoDialog(message("evRemoveMsg"), message("evRemoveTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { /* * to delete call rename with * newName(second param) as empty */ waRole.renameRuntimeEnv(mapEntry.getKey(), ""); setModified(true); } } } catch (Exception ex) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("adRolErrMsgBox1") + message("adRolErrMsgBox2"), ex); } }
From source file:com.microsoft.intellij.ui.azureroles.LoadBalancingPanel.java
License:Open Source License
/** * Enable session affinity./*from ww w. ja v a2 s.co m*/ */ protected void enableSessionAff() { try { WindowsAzureEndpoint endpt = null; isManualUpdate = false; populateEndPointList(); endpt = WARLoadBalanceUtilMethods.findInputEndpt(waRole, endpointsList); if (endpt == null) { int choice = Messages.showYesNoDialog(message("lbCreateEndptTtl"), message("lbCreateEndptMsg"), Messages.getQuestionIcon()); if (choice == Messages.YES) { WindowsAzureEndpoint newEndpt = createEndpt(); populateEndPointList(); comboEndpt.setSelectedItem(String.format(message("dbgEndPtStr"), newEndpt.getName(), newEndpt.getPort(), newEndpt.getPrivatePort())); waRole.setSessionAffinityInputEndpoint(newEndpt); btnSsnAffinity.setSelected(true); setModified(true); isEditableEndpointCombo(newEndpt); } else { btnSsnAffinity.setSelected(false); lblEndptToUse.setEnabled(false); comboEndpt.setEnabled(false); } } else { comboEndpt.setSelectedItem(String.format(message("dbgEndPtStr"), endpt.getName(), endpt.getPort(), endpt.getPrivatePort())); waRole.setSessionAffinityInputEndpoint(endpt); setModified(true); isEditableEndpointCombo(endpt); } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("adRolErrTitle"), message("adRolErrMsgBox1") + message("adRolErrMsgBox2"), e); } finally { isManualUpdate = true; } }
From source file:com.microsoft.intellij.ui.azureroles.LocalStoragePanel.java
License:Open Source License
/** * Listener method for remove button which * deletes the selected local storage resource. */// ww w .ja v a 2 s . c o m @SuppressWarnings("unchecked") protected void removeBtnListener() { try { WindowsAzureLocalStorage delRes = tblResources.getSelectedObject(); /* * Check local storage selected for removal * is associated with caching then give error * and does not allow to remove. */ if (delRes.isCachingLocalStorage()) { PluginUtil.displayErrorDialog(message("cachDsblErTtl"), message("lclStrRmvErMsg")); } else { int choice = Messages.showYesNoDialog(message("lclStgRmvMsg"), message("lclStgRmvTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { delRes.delete(); setModified(true); tblResources.getListTableModel().removeRow(tblResources.getSelectedRow()); } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(message("lclStgSetErrTtl"), message("lclStgSetErrMsg"), e); } }
From source file:com.microsoft.intellij.ui.azureroles.LocalStorageResourceDialog.java
License:Open Source License
/** * Validates the size of VM.// w w w .ja v a 2 s .co m * * @param size : user entered size * @return isValidSize : true if size is valid else false. */ private boolean isValidSize(String size) { boolean isValidSize; try { int value = Integer.parseInt(size); if (value <= 0) { PluginUtil.displayErrorDialog(message("lclStgSizeErrTtl"), message("lclStgSizeErrMsg")); isValidSize = false; } else if (value > maxSize) { int choice = Messages.showYesNoDialog( String.format("%s%s%s", message("lclStgMxSizeMsg1"), maxSize, message("lclStgMxSizeMsg2")), message("lclStgMxSizeTtl"), Messages.getQuestionIcon()); /* * If user selects No * then keep dialog open. */ isValidSize = choice == Messages.YES; } else { isValidSize = true; } } catch (NumberFormatException e) { PluginUtil.displayErrorDialogAndLog(message("lclStgSizeErrTtl"), message("lclStgSizeErrMsg"), e); isValidSize = false; } return isValidSize; }
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 ww w.j av a2 s . c o m */ 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.azureroles.SSLOffloadingPanel.java
License:Open Source License
private ItemListener createComboEndptListener() { return new ItemListener() { @Override/*from ww w . j a v a 2s . c o m*/ public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED && isManualUpdate) { try { isManualUpdate = false; setModified(true); String newText = (String) comboEndpt.getSelectedItem(); int port = Integer .valueOf(newText.substring(newText.indexOf(":") + 1, newText.indexOf(","))); if (port == HTTPS_PORT) { // user trying to set endpoint with public port 443 PluginUtil.displayWarningDialog(message("sslTtl"), message("sslWarnMsg")); } else if (port == HTTP_PORT) { WindowsAzureEndpoint httpsEndPt = WAEclipseHelperMethods .findEndpointWithPubPort(HTTPS_PORT, waRole); if (httpsEndPt != null) { /* * If HTTPS endpoint with public port 443, * is present on same role and listed in endpoint combo box * then show warning */ PluginUtil.displayWarningDialog(message("sslTtl"), String.format( message("httpsPresent"), httpsEndPt.getName(), httpsEndPt.getPort())); comboEndpt.setSelectedItem(null); } else { WindowsAzureRole role = WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager); WindowsAzureEndpoint httpEndPt = WAEclipseHelperMethods .findEndpointWithPubPort(HTTP_PORT, waRole); int pubPort = HTTPS_NXT_PORT; if (role != null) { /* * Else if endpoint with public port 443 * is already used by some other role or * on same role but with type InstanceInput * then prompt for changing port 80 * with the next available public port starting with 8443 * across all roles */ while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } } else { // Else prompt for changing port 80 with 443 across all roles pubPort = HTTPS_PORT; } int choice = Messages.showYesNoDialog( message("sslhttp").replace("${epName}", httpEndPt.getName()) .replace("${pubPort}", String.valueOf(pubPort)) .replace("${privPort}", httpEndPt.getPrivatePort()), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { httpEndPt.setPort(String.valueOf(pubPort)); populateEndPointList(); comboEndpt.setSelectedItem(String.format(message("dbgEndPtStr"), httpEndPt.getName(), httpEndPt.getPort(), httpEndPt.getPrivatePort())); isEditableEndpointCombo(httpEndPt); } else { comboEndpt.setSelectedItem(null); } } } } catch (Exception ex) { log(message("sslTtl"), ex); } finally { isManualUpdate = true; } removeErrorMsg(); } } }; }
From source file:com.microsoft.intellij.ui.azureroles.SSLOffloadingPanel.java
License:Open Source License
private WindowsAzureEndpoint findInputEndpt() throws WindowsAzureInvalidProjectOperationException { WindowsAzureEndpoint endpt = null;/*from www. ja va2s . c o m*/ WindowsAzureEndpoint sessionAffEndPt = waRole.getSessionAffinityInputEndpoint(); // check session affinity is already enabled, then consider same endpoint if (sessionAffEndPt != null) { // check port of session affinity endpoint String stSesPubPort = sessionAffEndPt.getPort(); if (stSesPubPort.equalsIgnoreCase(String.valueOf(HTTP_PORT))) { // check 443 is already available on same role (input enpoint) WindowsAzureEndpoint httpsEndPt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTPS_PORT, waRole); if (httpsEndPt != null) { /* * If HTTPS endpoint with public port 443, * is present on same role then show warning */ PluginUtil.displayWarningDialog(String.format(message("httpsPresentSt"), httpsEndPt.getName(), httpsEndPt.getPort(), httpsEndPt.getName()), message("sslTtl")); endpt = null; } else { /* * Check if 443 is used on same role (instance endpoint) * or any other role * if yes then consider 8443. */ int portToUse = HTTPS_PORT; if (WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager) != null) { // need to use 8443 int pubPort = HTTPS_NXT_PORT; while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } portToUse = pubPort; } int choice = Messages.showYesNoDialog( message("sslhttp").replace("${epName}", sessionAffEndPt.getName()) .replace("${pubPort}", String.valueOf(portToUse)) .replace("${privPort}", sessionAffEndPt.getPrivatePort()), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { sessionAffEndPt.setPort(String.valueOf(portToUse)); endpt = sessionAffEndPt; } else { // no button pressed endpt = null; } } } else { // port is other than 80, then directly consider it. endpt = sessionAffEndPt; } } else { // check this role uses public port 443 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTPS_PORT, waRole); if (endpt != null) { // endpoint on this role uses public port 443 PluginUtil.displayWarningDialog(message("sslTtl"), message("sslWarnMsg")); } else { // check if another role uses 443 as a public port WindowsAzureRole roleWithHTTPS = WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager); if (roleWithHTTPS != null) { // another role uses 443 as a public port // 1. If this role uses public port 80 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTP_PORT, waRole); if (endpt != null) { /* * endpoint on this role uses public port 80 * and 443 has been used on some other role then set to 8443 * or some suitable public port */ int pubPort = HTTPS_NXT_PORT; while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } int choice = Messages.showYesNoDialog( message("sslhttp").replace("${epName}", endpt.getName()) .replace("${pubPort}", String.valueOf(pubPort)) .replace("${privPort}", endpt.getPrivatePort()), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { endpt.setPort(String.valueOf(pubPort)); } else { // no button pressed endpt = null; } } else { // 2. Ask for creating new endpoint List<String> endPtData = WASSLOffloadingUtilMethods.prepareEndpt(HTTPS_NXT_PORT, waRole, waProjManager); int choice = Messages.showYesNoCancelDialog(String.format(message("sslNoHttp"), endPtData.get(0), endPtData.get(1), endPtData.get(2)), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { endpt = waRole.addEndpoint(endPtData.get(0), WindowsAzureEndpointType.Input, endPtData.get(2), endPtData.get(1)); setModified(true); } else { // no button pressed endpt = null; } } } else { // no public port 443 on this role, nor on other any role // 1. If this role uses public port 80 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTP_PORT, waRole); if (endpt != null) { // endpoint on this role uses public port 80 int choice = Messages.showYesNoDialog( message("sslhttp").replace("${epName}", endpt.getName()) .replace("${pubPort}", String.valueOf(HTTPS_PORT)) .replace("${privPort}", endpt.getPrivatePort()), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { endpt.setPort(String.valueOf(HTTPS_PORT)); } else { // no button pressed endpt = null; } } else { // 2. Ask for creating new endpoint List<String> endPtData = WASSLOffloadingUtilMethods.prepareEndpt(HTTPS_PORT, waRole, waProjManager); int choice = Messages.showYesNoDialog(String.format(message("sslNoHttp"), endPtData.get(0), endPtData.get(1), endPtData.get(2)), message("sslTtl"), Messages.getQuestionIcon()); if (choice == Messages.YES) { endpt = waRole.addEndpoint(endPtData.get(0), WindowsAzureEndpointType.Input, endPtData.get(2), endPtData.get(1)); setModified(true); } else { // no button pressed endpt = null; } } } } } return endpt; }
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 w w w . j a v a 2s. co m // 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; }