@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);
  }
 @Override
 public boolean isModified() {
   return ComparingUtils.isModified(
           generateNoWarningsCheckBox, commonCompilerArguments.suppressWarnings)
       || ComparingUtils.isModified(
           additionalArgsOptionsField, compilerSettings.getAdditionalArguments())
       || ComparingUtils.isModified(scriptTemplatesField, compilerSettings.getScriptTemplates())
       || ComparingUtils.isModified(
           scriptTemplatesClasspathField, compilerSettings.getScriptTemplatesClasspath())
       || ComparingUtils.isModified(
           copyRuntimeFilesCheckBox, compilerSettings.getCopyJsLibraryFiles())
       || ComparingUtils.isModified(
           outputDirectory, compilerSettings.getOutputDirectoryForJsLibraryFiles())
       || (compilerWorkspaceSettings != null
           && (ComparingUtils.isModified(
                   enablePreciseIncrementalCheckBox,
                   compilerWorkspaceSettings.getPreciseIncrementalEnabled())
               || ComparingUtils.isModified(
                   keepAliveCheckBox, compilerWorkspaceSettings.getEnableDaemon())))
       || ComparingUtils.isModified(generateSourceMapsCheckBox, k2jsCompilerArguments.sourceMap)
       || isModified(outputPrefixFile, k2jsCompilerArguments.outputPrefix)
       || isModified(outputPostfixFile, k2jsCompilerArguments.outputPostfix)
       || !getSelectedModuleKind()
           .equals(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind));
 }
  @Override
  public void reset() {
    generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings);
    additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments());
    scriptTemplatesField.setText(compilerSettings.getScriptTemplates());
    scriptTemplatesClasspathField.setText(compilerSettings.getScriptTemplatesClasspath());
    copyRuntimeFilesCheckBox.setSelected(compilerSettings.getCopyJsLibraryFiles());
    outputDirectory.setText(compilerSettings.getOutputDirectoryForJsLibraryFiles());

    if (compilerWorkspaceSettings != null) {
      enablePreciseIncrementalCheckBox.setSelected(
          compilerWorkspaceSettings.getPreciseIncrementalEnabled());
      keepAliveCheckBox.setSelected(compilerWorkspaceSettings.getEnableDaemon());
    }

    generateSourceMapsCheckBox.setSelected(k2jsCompilerArguments.sourceMap);
    outputPrefixFile.setText(k2jsCompilerArguments.outputPrefix);
    outputPostfixFile.setText(k2jsCompilerArguments.outputPostfix);

    moduleKindComboBox.setSelectedItem(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind));
  }