@Override @NotNull public List<KeyValue<String, String>> getExtraJvmArgs() { if (isInProcessMode(GRADLE_SYSTEM_ID)) { List<KeyValue<String, String>> args = Lists.newArrayList(); if (!isAndroidStudio()) { LocalProperties localProperties = getLocalProperties(); if (localProperties.getAndroidSdkPath() == null) { File androidHomePath = IdeSdks.getAndroidSdkPath(); // In Android Studio, the Android SDK home path will never be null. It may be null when running in IDEA. if (androidHomePath != null) { args.add(KeyValue.create(ANDROID_HOME_JVM_ARG, androidHomePath.getPath())); } } } return args; } return Collections.emptyList(); }
public AddGradleDslPluginAction() { getTemplatePresentation().setDescription(GradleBundle.message("gradle.codeInsight.action.apply_plugin.description")); getTemplatePresentation().setText(GradleBundle.message("gradle.codeInsight.action.apply_plugin.text")); getTemplatePresentation().setIcon(GradleIcons.GradlePlugin); Collection<KeyValue> pluginDescriptions = new ArrayList<KeyValue>(); for (GradlePluginDescriptionsExtension extension : GradlePluginDescriptionsExtension.EP_NAME.getExtensions()) { for (Map.Entry<String, String> pluginDescription : extension.getPluginDescriptions().entrySet()) { pluginDescriptions.add(KeyValue.create(pluginDescription.getKey(), pluginDescription.getValue())); } } myPlugins = pluginDescriptions.toArray(new KeyValue[pluginDescriptions.size()]); Arrays.sort(myPlugins, new Comparator<KeyValue>() { @Override public int compare(KeyValue o1, KeyValue o2) { return String.valueOf(o1.getKey()).compareTo(String.valueOf(o2.getKey())); } }); }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { KeyValue descriptor = (KeyValue)value; Color backgroundColor = isSelected ? list.getSelectionBackground() : list.getBackground(); myNameLabel.setText(String.valueOf(descriptor.getKey())); myNameLabel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); myPanel.setBackground(backgroundColor); String description = String.format("<html><div WIDTH=%d>%s</div><html>", 400, String.valueOf(descriptor.getValue())); myDescLabel.setText(description); myDescLabel.setForeground(LookupCellRenderer.getGrayedForeground(isSelected)); myDescLabel.setBackground(backgroundColor); return myPanel; }
@NotNull private MantisConnectPortType createSoap() throws Exception { if (isUseProxy()) { for (KeyValue<String, String> pair : HttpConfigurable.getJvmPropertiesList(false, null)) { String key = pair.getKey(), value = pair.getValue(); // Axis uses another names for username and password properties // see http://axis.apache.org/axis/java/client-side-axis.html for complete list if (key.equals(JavaProxyProperty.HTTP_USERNAME)) { AxisProperties.setProperty("http.proxyUser", value); } else if (key.equals(JavaProxyProperty.HTTP_PASSWORD)) { AxisProperties.setProperty("http.proxyPassword", value); } else { AxisProperties.setProperty(key, value); } } } return new MantisConnectLocator().getMantisConnectPort(new URL(getUrl() + SOAP_API_LOCATION)); }
public EnumComboEditor(Vector<KeyValue<String, String>> values) { DefaultComboBoxModel model = new DefaultComboBoxModel<>(values); model.insertElementAt(UNSET, 0); myCombo.setModel(model); myCombo.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (myCombo.getSelectedItem() == UNSET) { myCombo.setSelectedItem(null); } } }); myCombo.setSelectedIndex(0); }
@VisibleForTesting static void populateHttpProxyProperties(List<String> jvmArgs, List<KeyValue<String, String>> properties) { int propertyCount = properties.size(); for (int i = 0; i < propertyCount; i++) { KeyValue<String, String> property = properties.get(i); String name = HTTP_PROXY_PROPERTY_PREFIX + i; String value = property.getKey() + HTTP_PROXY_PROPERTY_SEPARATOR + property.getValue(); jvmArgs.add(createJvmArg(name, value)); } }
public void testPopulateHttpProxyProperties() { List<KeyValue<String, String>> properties = Lists.newArrayList(); properties.add(KeyValue.create("http.proxyHost", "proxy.android.com")); properties.add(KeyValue.create("http.proxyPort", "8080")); List<String> jvmArgList = Lists.newArrayList(); AndroidGradleBuildProcessParametersProvider.populateHttpProxyProperties(jvmArgList, properties); Map<String, String> jvmArgs = convertJvmArgsToMap(jvmArgList); assertEquals(2, jvmArgs.size()); assertEquals("http.proxyHost:proxy.android.com", jvmArgs.get("-Dcom.android.studio.gradle.proxy.property.0")); assertEquals("http.proxyPort:8080", jvmArgs.get("-Dcom.android.studio.gradle.proxy.property.1")); }
@NotNull @Override public List<KeyValue<String, String>> getExtraJvmArgs() { if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) { final List<KeyValue<String, String>> extraJvmArgs = ContainerUtil.newArrayList(); final HttpConfigurable httpConfigurable = HttpConfigurable.getInstance(); if (!StringUtil.isEmpty(httpConfigurable.PROXY_EXCEPTIONS)) { List<String> hosts = StringUtil.split(httpConfigurable.PROXY_EXCEPTIONS, ","); if (!hosts.isEmpty()) { final String nonProxyHosts = StringUtil.join(hosts, StringUtil.TRIMMER, "|"); extraJvmArgs.add(KeyValue.create("http.nonProxyHosts", nonProxyHosts)); extraJvmArgs.add(KeyValue.create("https.nonProxyHosts", nonProxyHosts)); } } if (httpConfigurable.USE_HTTP_PROXY && StringUtil.isNotEmpty(httpConfigurable.PROXY_LOGIN)) { extraJvmArgs.add(KeyValue.create("http.proxyUser", httpConfigurable.PROXY_LOGIN)); extraJvmArgs.add(KeyValue.create("https.proxyUser", httpConfigurable.PROXY_LOGIN)); final String plainProxyPassword = httpConfigurable.getPlainProxyPassword(); extraJvmArgs.add(KeyValue.create("http.proxyPassword", plainProxyPassword)); extraJvmArgs.add(KeyValue.create("https.proxyPassword", plainProxyPassword)); } extraJvmArgs.addAll(HttpConfigurable.getJvmPropertiesList(false, null)); return extraJvmArgs; } return Collections.emptyList(); }
private CvsProxySelector() { myKnownHosts = Collections.synchronizedMap(new HashMap<Pair<String, Integer>, Pair<String, Integer>>()); myAuthMap = Collections.synchronizedMap(new HashMap<Pair<String, Integer>, KeyValue<String, String>>()); myAuthenticator = new NonStaticAuthenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { final KeyValue<String, String> value = myAuthMap.get(Pair.create(getRequestingHost(), getRequestingPort())); if (value != null) { return new PasswordAuthentication(value.getKey(), value.getValue().toCharArray()); } return null; } }; }
public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition) { super(null, name); myDefinition = definition; for (KeyValue<String, String> option : definition.getValues()) { myOptions.add(new OptionProperty(this, option.getKey(), option.getKey())); } }
@Override public Object getValue() throws Exception { Object itemObj = myCombo.getSelectedItem(); if(itemObj instanceof KeyValue) { KeyValue<String, String> item = (KeyValue<String, String>)itemObj; return item.getValue(); } //return item == UNSET ? null : item; return null; }
private static void addHttpProxySettings(@NotNull List<String> jvmArgs) { List<KeyValue<String, String>> proxyProperties = HttpConfigurable.getJvmPropertiesList(false, null); populateHttpProxyProperties(jvmArgs, proxyProperties); }
public AddGradleDslPluginActionHandler(KeyValue[] plugins) { myPlugins = plugins; }
@NotNull List<KeyValue<String, String>> getExtraJvmArgs();
@NotNull @Override public List<KeyValue<String, String>> getExtraJvmArgs() { return Collections.emptyList(); }
private void startUploadingProcess() { final Process process; final GeneralCommandLine commandLine; try { JavaParameters parameters = new JavaParameters(); parameters.configureByModule(myAppEngineFacet.getModule(), JavaParameters.JDK_ONLY); parameters.setMainClass("com.google.appengine.tools.admin.AppCfg"); parameters.getClassPath().add(mySdk.getToolsApiJarFile().getAbsolutePath()); final List<KeyValue<String,String>> list = HttpConfigurable.getJvmPropertiesList(false, null); if (! list.isEmpty()) { final ParametersList parametersList = parameters.getVMParametersList(); for (KeyValue<String, String> value : list) { parametersList.defineProperty(value.getKey(), value.getValue()); } } final ParametersList programParameters = parameters.getProgramParametersList(); if (myAuthData.isOAuth2()) { programParameters.add("--oauth2"); } else { programParameters.add("--email=" + myAuthData.getEmail()); programParameters.add("--passin"); programParameters.add("--no_cookies"); } programParameters.add("update"); programParameters.add(FileUtil.toSystemDependentName(myArtifact.getOutputPath())); commandLine = CommandLineBuilder.createFromJavaParameters(parameters); process = commandLine.createProcess(); } catch (ExecutionException e) { myCallback.errorOccurred("Cannot start uploading: " + e.getMessage()); return; } final ProcessHandler processHandler = new OSProcessHandler(process, commandLine.getCommandLineString()); processHandler.addProcessListener(new MyProcessListener(processHandler, null, myLoggingHandler)); myLoggingHandler.attachToProcess(processHandler); processHandler.startNotify(); }
public void register(final String host, final int port, final String proxyHost, final int proxyPort, final String login, final String password) { final Pair<String, Integer> value = Pair.create(proxyHost, proxyPort); myKnownHosts.put(Pair.create(host, port), value); myAuthMap.put(value, KeyValue.create(login, password)); }
private void startUploadingProcess() { final Process process; final GeneralCommandLine commandLine; try { JavaParameters parameters = new JavaParameters(); parameters.configureByModule(myAppEngineFacet.getModule(), JavaParameters.JDK_ONLY); parameters.setMainClass("com.google.appengine.tools.admin.AppCfg"); parameters.getClassPath().add(mySdk.getToolsApiJarFile().getAbsolutePath()); final List<KeyValue<String,String>> list = HttpConfigurable.getJvmPropertiesList(false, null); if (! list.isEmpty()) { final ParametersList parametersList = parameters.getVMParametersList(); for (KeyValue<String, String> value : list) { parametersList.defineProperty(value.getKey(), value.getValue()); } } final ParametersList programParameters = parameters.getProgramParametersList(); programParameters.add("--email=" + myEmail); programParameters.add("update"); programParameters.add(FileUtil.toSystemDependentName(myArtifact.getOutputPath())); commandLine = CommandLineBuilder.createFromJavaParameters(parameters); process = commandLine.createProcess(); } catch (ExecutionException e) { Messages.showErrorDialog(myProject, "Cannot start uploading: " + e.getMessage(), CommonBundle.getErrorTitle()); return; } final Executor executor = DefaultRunExecutor.getRunExecutorInstance(); final ConsoleView console = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole(); final RunnerLayoutUi ui = RunnerLayoutUi.Factory.getInstance(myProject).create("Upload", "Upload Application", "Upload Application", myProject); final DefaultActionGroup group = new DefaultActionGroup(); ui.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN); ui.addContent(ui.createContent("upload", console.getComponent(), "Upload Application", null, console.getPreferredFocusableComponent())); final ProcessHandler processHandler = new OSProcessHandler(process, commandLine.getCommandLineString()); processHandler.addProcessListener(new MyProcessListener(processHandler, console)); console.attachToProcess(processHandler); final RunContentDescriptor contentDescriptor = new RunContentDescriptor(console, processHandler, ui.getComponent(), "Upload Application"); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM)); group.add(new CloseAction(executor, contentDescriptor, myProject)); ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, contentDescriptor); processHandler.startNotify(); }
public void addValue(@NotNull String name, @NotNull String displayName) { myValues.add(new KeyValue<>(name, displayName)); }
@NotNull public Vector<KeyValue<String, String>> getValues() { return myValues; }