private void update(ConfigurationData data) {
    data.setBasePackage(basePackageField.getText());
    data.setFsc(myFSCRadioButton.isSelected());
    data.setCompilerLibraryName(getCompilerLibraryName());
    data.setCompilerLibraryLevel(getCompilerLibraryLevel());

    try {
      data.setMaximumHeapSize(Integer.parseInt(myMaximumHeapSize.getText().trim()));
    } catch (NumberFormatException e) {
      data.setMaximumHeapSize(myData.getMaximumHeapSize());
    }

    data.setVmOptions(myVmParameters.getText().trim());

    data.setWarnings(myEnableWarnings.isSelected());
    data.setDeprecationWarnings(myDeprecationWarnings.isSelected());
    data.setUncheckedWarnings(myUncheckedWarnings.isSelected());
    data.setOptimiseBytecode(myOptimiseBytecode.isSelected());
    data.setExplainTypeErrors(myExplainTypeErrors.isSelected());
    data.setContinuations(myEnableContinuations.isSelected());

    data.setDebuggingInfoLevel((DebuggingInfoLevel) myDebuggingInfoLevel.getSelectedItem());
    data.setCompilerOptions(myCompilerOptions.getText().trim());

    data.setPluginPaths(CompilerPlugin.toPaths(myPlugins));

    updateCheckboxesState();
  }
 /** If we're using ghc-mod >= 5.4, ghc-modi will be configured as `ghc-mod legacy-interactive` */
 private void ghcModLegacyInteractivePreSaveHook() {
   // If ghc-mod is not configured or is not >= 5.4, we can't infer legacy-interactive.
   if (ghcModPath.getText().isEmpty() || !isGhcMod5_4(ghcModPath.getText())) return;
   // If ghc-modi is configured and it is not >= 5.4, leave it alone.
   if (!ghcModiPath.getText().isEmpty() && !isGhcMod5_4(ghcModiPath.getText())) return;
   // If all is good, configure ghc-modi as legacy-interactive.
   ghcModiPath.setText(ghcModPath.getText());
   // If the current ghc-modi flags contains the `legacy-interactive` command, do not add it back.
   if (!ghcModiFlags.getText().contains("legacy-interactive")) {
     ghcModiFlags.setText(ghcModiFlags.getText() + " legacy-interactive");
   }
 }
  @Override
  public void apply(@NotNull HttpConfigurable settings) {
    if (!isValid()) {
      return;
    }

    if (isModified(settings)) {
      settings.AUTHENTICATION_CANCELLED = false;
    }

    settings.USE_PROXY_PAC = myAutoDetectProxyRb.isSelected();
    settings.USE_PAC_URL = myPacUrlCheckBox.isSelected();
    settings.PAC_URL = getText(myPacUrlTextField);
    settings.USE_HTTP_PROXY = myUseHTTPProxyRb.isSelected();
    settings.PROXY_TYPE_IS_SOCKS = mySocks.isSelected();
    settings.PROXY_AUTHENTICATION = myProxyAuthCheckBox.isSelected();
    settings.KEEP_PROXY_PASSWORD = myRememberProxyPasswordCheckBox.isSelected();

    settings.setProxyLogin(getText(myProxyLoginTextField));
    settings.setPlainProxyPassword(new String(myProxyPasswordTextField.getPassword()));
    settings.PROXY_EXCEPTIONS = StringUtil.nullize(myProxyExceptions.getText(), true);

    settings.PROXY_PORT = myProxyPortTextField.getNumber();
    settings.PROXY_HOST = getText(myProxyHostTextField);
  }
 @Override
 protected void applyEditorTo(@NotNull ErlangConsoleRunConfiguration config)
     throws ConfigurationException {
   config.setModule((Module) myModuleComboBox.getSelectedItem());
   config.setWorkingDirPath(myWorkingDirPathField.getText());
   config.setConsoleArgs(myConsoleArgsEditor.getText());
 }
  @Override
  protected void applyEditorTo(GoApplicationConfiguration configuration)
      throws ConfigurationException {
    if (applicationName.getText().length() == 0)
      throw new ConfigurationException("Please select the file to run.");
    if (buildBeforeRunCheckBox.isSelected() && buildDirectoryPathBrowser.getText().equals("")) {
      throw new ConfigurationException("Please select the directory for the executable.");
    }

    configuration.scriptName = applicationName.getText();
    configuration.scriptArguments = appArguments.getText();
    configuration.builderArguments = builderArguments.getText();
    configuration.goBuildBeforeRun = buildBeforeRunCheckBox.isSelected();
    configuration.goOutputDir = buildDirectoryPathBrowser.getText();
    configuration.workingDir = workingDirectoryBrowser.getText();
  }
  @Override
  public void apply() throws ConfigurationException {
    commonCompilerArguments.suppressWarnings = generateNoWarningsCheckBox.isSelected();
    compilerSettings.setAdditionalArguments(additionalArgsOptionsField.getText());
    compilerSettings.setScriptTemplates(scriptTemplatesField.getText());
    compilerSettings.setScriptTemplatesClasspath(scriptTemplatesClasspathField.getText());
    compilerSettings.setCopyJsLibraryFiles(copyRuntimeFilesCheckBox.isSelected());
    compilerSettings.setOutputDirectoryForJsLibraryFiles(outputDirectory.getText());

    if (compilerWorkspaceSettings != null) {
      compilerWorkspaceSettings.setPreciseIncrementalEnabled(
          enablePreciseIncrementalCheckBox.isSelected());

      boolean oldEnableDaemon = compilerWorkspaceSettings.getEnableDaemon();
      compilerWorkspaceSettings.setEnableDaemon(keepAliveCheckBox.isSelected());
      if (keepAliveCheckBox.isSelected() != oldEnableDaemon) {
        PluginStartupComponent.getInstance().resetAliveFlag();
      }
    }

    k2jsCompilerArguments.sourceMap = generateSourceMapsCheckBox.isSelected();
    k2jsCompilerArguments.outputPrefix = StringUtil.nullize(outputPrefixFile.getText(), true);
    k2jsCompilerArguments.outputPostfix = StringUtil.nullize(outputPostfixFile.getText(), true);
    k2jsCompilerArguments.moduleKind = getSelectedModuleKind();

    BuildManager.getInstance().clearState(project);
  }
 public void saveState() {
   if (isModified() && publisher != null) {
     publisher.onSettingsChanged(new ToolSettings(pathField.getText(), flagsField.getText()));
   }
   for (PropertyField propertyField : propertyFields) {
     propertyField.saveState();
   }
 }
 private void onTextChange() {
   if (!myIsInUpdate) {
     myUpdateAlarm.cancelAllRequests();
     myTextChanged = true;
     final String text = myPatternField.getText();
     myCurrentScope = new InvalidPackageSet(text);
     try {
       if (!StringUtil.isEmpty(text)) {
         myCurrentScope = PackageSetFactory.getInstance().compile(text);
       }
       myErrorMessage = null;
     } catch (Exception e) {
       myErrorMessage = e.getMessage();
       showErrorMessage();
     }
     rebuild(false);
   } else if (!invalidScopeInside(myCurrentScope)) {
     myErrorMessage = null;
   }
 }
  @Override
  public boolean isModified(@NotNull HttpConfigurable settings) {
    if (!isValid()) {
      return false;
    }

    return !Comparing.strEqual(myProxyExceptions.getText().trim(), settings.PROXY_EXCEPTIONS)
        || settings.USE_PROXY_PAC != myAutoDetectProxyRb.isSelected()
        || settings.USE_PAC_URL != myPacUrlCheckBox.isSelected()
        || !Comparing.strEqual(settings.PAC_URL, myPacUrlTextField.getText())
        || settings.USE_HTTP_PROXY != myUseHTTPProxyRb.isSelected()
        || settings.PROXY_AUTHENTICATION != myProxyAuthCheckBox.isSelected()
        || settings.KEEP_PROXY_PASSWORD != myRememberProxyPasswordCheckBox.isSelected()
        || settings.PROXY_TYPE_IS_SOCKS != mySocks.isSelected()
        || !Comparing.strEqual(settings.getProxyLogin(), myProxyLoginTextField.getText())
        || !Comparing.strEqual(
            settings.getPlainProxyPassword(), new String(myProxyPasswordTextField.getPassword()))
        || settings.PROXY_PORT != myProxyPortTextField.getNumber()
        || !Comparing.strEqual(settings.PROXY_HOST, myProxyHostTextField.getText());
  }
  public boolean isModified() {
    Sdk sdk = myCompilationServerSdk.getSelectedJdk();
    String sdkName = sdk == null ? null : sdk.getName();

    if (showTypeInfoOnCheckBox.isSelected() != mySettings.SHOW_TYPE_TOOLTIP_ON_MOUSE_HOVER)
      return true;
    if (!delaySpinner.getValue().equals(mySettings.SHOW_TYPE_TOOLTIP_DELAY)) return true;

    return !(myEnableCompileServer.isSelected() == mySettings.COMPILE_SERVER_ENABLED
        && myCompilationServerPort.getText().equals(mySettings.COMPILE_SERVER_PORT)
        && ComparatorUtil.equalsNullable(sdkName, mySettings.COMPILE_SERVER_SDK)
        && myCompilationServerMaximumHeapSize
            .getText()
            .equals(mySettings.COMPILE_SERVER_MAXIMUM_HEAP_SIZE)
        && myCompilationServerJvmParameters
            .getText()
            .equals(mySettings.COMPILE_SERVER_JVM_PARAMETERS)
        && myIncrementalTypeCmb.getModel().getSelectedItem().equals(mySettings.INCREMENTAL_TYPE)
        && myCompileOrderCmb.getModel().getSelectedItem().equals(mySettings.COMPILE_ORDER));
  }
  public void apply() throws ConfigurationException {
    mySettings.INCREMENTAL_TYPE = (String) myIncrementalTypeCmb.getModel().getSelectedItem();
    mySettings.COMPILE_ORDER = (String) myCompileOrderCmb.getModel().getSelectedItem();
    mySettings.COMPILE_SERVER_ENABLED = myEnableCompileServer.isSelected();
    mySettings.COMPILE_SERVER_PORT = myCompilationServerPort.getText();

    Sdk sdk = myCompilationServerSdk.getSelectedJdk();
    mySettings.COMPILE_SERVER_SDK = sdk == null ? null : sdk.getName();

    mySettings.COMPILE_SERVER_MAXIMUM_HEAP_SIZE = myCompilationServerMaximumHeapSize.getText();
    mySettings.COMPILE_SERVER_JVM_PARAMETERS = myCompilationServerJvmParameters.getText();
    mySettings.SHOW_TYPE_TOOLTIP_ON_MOUSE_HOVER = showTypeInfoOnCheckBox.isSelected();
    mySettings.SHOW_TYPE_TOOLTIP_DELAY = (Integer) delaySpinner.getValue();

    // TODO
    //    boolean externalCompiler =
    // CompilerWorkspaceConfiguration.getInstance(myProject).USE_COMPILE_SERVER;
    //
    //    if (!externalCompiler || !myEnableCompileServer.isSelected()) {
    //      myProject.getComponent(CompileServerLauncher.class).stop();
    //    }
    //    myProject.getComponent(CompileServerManager.class).configureWidget();
  }
 public String getPatternText() {
   return myPatternField.getText();
 }