PluginPathPane(final Project project, final String plugin) {
   super(new BorderLayout());
   _importCheckbox = new JCheckBox("Import");
   _importCheckbox.addActionListener(
       new ActionListener() {
         public void actionPerformed(final ActionEvent e) {
           _pathTextField.setEnabled(isImport());
         }
       });
   _pathTextField = new TextFieldWithBrowseButton();
   _pathTextField.setEnabled(false);
   try {
     _pathTextField.setText(FindBugsCustomPluginUtil.getAsFile(plugin).getPath());
   } catch (final MalformedURLException e) {
     LOGGER.debug("invalid plugin=" + plugin, e);
     _pathTextField.setText(plugin);
   }
   _pathTextField.addBrowseFolderListener(
       "Choose plugin",
       "Please select the plugin archive.",
       project,
       createJarChooserDescriptor());
   add(_importCheckbox, BorderLayout.NORTH);
   add(_pathTextField);
   add(
       new Box.Filler(new Dimension(16, 0), new Dimension(16, 0), new Dimension(16, 0)),
       BorderLayout.WEST);
 }
  @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);
  }
  private void initControls(final LauncherParameters launcherParameters) {
    final LauncherParameters.LauncherType launcherType = launcherParameters.getLauncherType();
    myDefaultOSApplicationRadioButton.setSelected(
        launcherType == LauncherParameters.LauncherType.OSDefault);
    myBrowserRadioButton.setSelected(launcherType == LauncherParameters.LauncherType.Browser);
    myPlayerRadioButton.setSelected(launcherType == LauncherParameters.LauncherType.Player);

    myBrowserSelector.setSelected(launcherParameters.getBrowser());

    myPlayerTextWithBrowse.setText(
        FileUtil.toSystemDependentName(launcherParameters.getPlayerPath()));
    myPlayerTextWithBrowse.addBrowseFolderListener(
        null,
        null,
        myProject,
        new FileChooserDescriptor(true, true, false, false, false, false) {
          @Override
          public boolean isFileSelectable(final VirtualFile file) {
            return SystemInfo.isMac
                    && file.isDirectory()
                    && "app".equalsIgnoreCase(file.getExtension())
                || !file.isDirectory();
          }
        });
    myNewPlayerInstanceCheckBox.setVisible(SystemInfo.isMac);
  }
  public boolean validate() throws ConfigurationException {
    final String moduleName = getModuleName();
    if (myCreateModuleCb.isSelected() || !myWizardContext.isCreatingNewProject()) {
      final String moduleFileDirectory = myModuleFileLocation.getText();
      if (moduleFileDirectory.length() == 0) {
        throw new ConfigurationException("Enter module file location");
      }
      if (moduleName.length() == 0) {
        throw new ConfigurationException("Enter a module name");
      }

      if (!ProjectWizardUtil.createDirectoryIfNotExists(
          IdeBundle.message("directory.module.file"),
          moduleFileDirectory,
          myImlLocationChangedByUser)) {
        return false;
      }
      if (!ProjectWizardUtil.createDirectoryIfNotExists(
          IdeBundle.message("directory.module.content.root"),
          myModuleContentRoot.getText(),
          myContentRootChangedByUser)) {
        return false;
      }

      File moduleFile =
          new File(moduleFileDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
      if (moduleFile.exists()) {
        int answer =
            Messages.showYesNoDialog(
                IdeBundle.message(
                    "prompt.overwrite.project.file",
                    moduleFile.getAbsolutePath(),
                    IdeBundle.message("project.new.wizard.module.identification")),
                IdeBundle.message("title.file.already.exists"),
                Messages.getQuestionIcon());
        if (answer != 0) {
          return false;
        }
      }
    }
    if (!myWizardContext.isCreatingNewProject()) {
      final Module module;
      final ProjectStructureConfigurable fromConfigurable =
          ProjectStructureConfigurable.getInstance(myWizardContext.getProject());
      if (fromConfigurable != null) {
        module = fromConfigurable.getModulesConfig().getModule(moduleName);
      } else {
        module =
            ModuleManager.getInstance(myWizardContext.getProject()).findModuleByName(moduleName);
      }
      if (module != null) {
        throw new ConfigurationException(
            "Module \'"
                + moduleName
                + "\' already exist in project. Please, specify another name.");
      }
    }
    return !myWizardContext.isCreatingNewProject() || super.validate();
  }
  public GoRunConfigurationEditorForm(final Project project) {

    applicationName
        .getButton()
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {

                TreeFileChooser fileChooser =
                    TreeFileChooserFactory.getInstance(project)
                        .createFileChooser(
                            "Go Application Chooser",
                            null,
                            GoFileType.INSTANCE,
                            new TreeFileChooser.PsiFileFilter() {
                              public boolean accept(PsiFile file) {

                                if (!(file instanceof GoFile)) {
                                  return false;
                                }

                                GoFile goFile = (GoFile) file;

                                return goFile.getPackage().isMainPackage();
                              }
                            },
                            true,
                            false);

                fileChooser.showDialog();

                PsiFile selectedFile = fileChooser.getSelectedFile();
                if (selectedFile != null) {
                  setChosenFile(selectedFile.getVirtualFile());
                }
              }
            });

    buildDirectoryPathBrowser.addBrowseFolderListener(
        "Go executable build path",
        "Go executable build path",
        project,
        new FileChooserDescriptor(false, true, false, false, false, false));

    workingDirectoryBrowser.addBrowseFolderListener(
        "Application working directory",
        "Application working directory",
        project,
        new FileChooserDescriptor(false, true, false, false, false, false));

    buildBeforeRunCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            buildDirectoryPathBrowser.setEnabled(buildBeforeRunCheckBox.isSelected());
          }
        });
  }
示例#6
0
  public ApkStep(ExportSignedPackageWizard wizard) {
    myWizard = wizard;
    myApkPathLabel.setLabelFor(myApkPathField);
    myProguardConfigFilePathLabel.setLabelFor(myProguardConfigFilePathField);

    myApkPathField
        .getButton()
        .addActionListener(
            new SaveFileListener(
                myContentPanel,
                myApkPathField,
                AndroidBundle.message("android.extract.package.choose.dest.apk")) {
              @Override
              protected String getDefaultLocation() {
                Module module = myWizard.getFacet().getModule();
                return getContentRootPath(module);
              }
            });

    myProguardConfigFilePathField
        .getButton()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                final String path = myProguardConfigFilePathField.getText().trim();
                VirtualFile defaultFile =
                    path != null && path.length() > 0
                        ? LocalFileSystem.getInstance().findFileByPath(path)
                        : null;
                final AndroidFacet facet = myWizard.getFacet();

                if (defaultFile == null && facet != null) {
                  defaultFile = AndroidRootUtil.getMainContentRoot(facet);
                }
                final VirtualFile file =
                    FileChooser.chooseFile(
                        myContentPanel,
                        FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
                        defaultFile);
                if (file != null) {
                  myProguardConfigFilePathField.setText(
                      FileUtil.toSystemDependentName(file.getPath()));
                }
              }
            });

    myProguardCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            final boolean enabled = myProguardCheckBox.isSelected();
            myProguardConfigFilePathLabel.setEnabled(enabled);
            myProguardConfigFilePathField.setEnabled(enabled);
          }
        });
  }
 @Override
 protected void resetEditorFrom(GoApplicationConfiguration configuration) {
   applicationName.setText(configuration.scriptName);
   appArguments.setText(configuration.scriptArguments);
   builderArguments.setText(configuration.builderArguments);
   buildBeforeRunCheckBox.setSelected(configuration.goBuildBeforeRun);
   buildDirectoryPathBrowser.setText(configuration.goOutputDir);
   workingDirectoryBrowser.setText(configuration.workingDir);
 }
  @Nullable
  @Override
  protected ValidationInfo doValidate() {
    if (StringUtils.isBlank(myOutputFolderChooser.getText())) {
      return new ValidationInfo("Target path can't be blank", myOutputFolderChooser.getTextField());
    }

    return null;
  }
 @Override
 protected void resetEditorFrom(@NotNull K2JSRunConfiguration configuration) {
   htmlChooseFile.setText(
       toSystemIndependentName(configuration.settings().getPageToOpenFilePath()));
   browserComboBox.setSelectedItem(configuration.settings().getBrowserFamily());
   generatedChooseFile.setText(
       toSystemIndependentName(configuration.settings().getGeneratedFilePath()));
   openInBrowserCheckBox.setSelected(
       configuration.settings().isShouldOpenInBrowserAfterTranslation());
 }
 public void validate() throws ConfigurationException {
   validateExecutableIfNonEmpty("stylish", stylishPath);
   validateExecutableIfNonEmpty("hlint", hlintPath);
   // Validate ghcModPath if either it or ghcModiPath have been set.
   if (ghcModPath.getText().isEmpty() && !ghcModiPath.getText().isEmpty()) {
     throw new ConfigurationException("ghc-mod must be configured if ghc-modi is configured.");
   }
   validateExecutableIfNonEmpty("ghc-mod", ghcModPath);
   validateExecutableIfNonEmpty("ghc-modi", ghcModiPath);
   validateExecutableIfNonEmpty("hindent", hindentPath);
 }
  /** Init components */
  private void initListeners() {
    FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    fcd.setShowFileSystemRoots(true);
    fcd.setTitle(GitBundle.getString("clone.destination.directory.title"));
    fcd.setDescription(GitBundle.getString("clone.destination.directory.description"));
    fcd.setHideIgnored(false);
    myParentDirectory.addActionListener(
        new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            fcd.getTitle(),
            fcd.getDescription(),
            myParentDirectory,
            myProject,
            fcd,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
          @Override
          protected VirtualFile getInitialFile() {
            // suggest project base directory only if nothing is typed in the component.
            String text = getComponentText();
            if (text.length() == 0) {
              VirtualFile file = myProject.getBaseDir();
              if (file != null) {
                return file;
              }
            }
            return super.getInitialFile();
          }
        });

    final DocumentListener updateOkButtonListener =
        new DocumentAdapter() {
          @Override
          protected void textChanged(DocumentEvent e) {
            updateButtons();
          }
        };
    myParentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
    String parentDir = GitRememberedInputs.getInstance().getCloneParentDir();
    if (StringUtil.isEmptyOrSpaces(parentDir)) {
      parentDir = ProjectUtil.getBaseDir();
    }
    myParentDirectory.setText(parentDir);

    myDirectoryName.getDocument().addDocumentListener(updateOkButtonListener);

    myTestButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            test();
          }
        });

    setOKActionEnabled(false);
    myTestButton.setEnabled(false);
  }
  @Nullable
  @Override
  protected JComponent createCenterPanel() {
    final JPanel content = new JPanel(new BorderLayout());

    final JPanel topLine = new JPanel(new BorderLayout());
    content.setBorder(
        IdeBorderFactory.createTitledBorder(
            "Thrift compiler " + myGenerator.getType().name(), false));
    myOutputFolderChooser.addBrowseFolderListener(
        new TextBrowseFolderListener(
            FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject) {
          @Nullable
          @Override
          protected VirtualFile getInitialFile() {
            if (myGenerator.getOutputDir() != null) {
              return LocalFileFinder.findFile(myGenerator.getOutputDir());
            } else {
              return null;
            }
          }

          @Override
          protected void onFileChosen(@NotNull VirtualFile chosenFile) {
            final String absolutePath = VfsUtil.virtualToIoFile(chosenFile).getAbsolutePath();
            myOutputFolderChooser.setText(absolutePath);
          }
        });

    topLine.add(new JBLabel("Output folder:"), BorderLayout.WEST);
    topLine.add(myOutputFolderChooser, BorderLayout.CENTER);

    content.add(topLine, BorderLayout.NORTH);

    final JPanel options = new JPanel(new BorderLayout());
    content.add(options, BorderLayout.CENTER);

    myPane = AOptionPane.get(myGenerator.getType());
    if (myPane != null) {
      options.setBorder(IdeBorderFactory.createTitledBorder("Additional options"));
      options.add(myPane.getPanel());
      myPane.setValues(myGenerator);
    } else {
      options.setBorder(null);
    }

    final String url = myGenerator.getOutputDir();
    final VirtualFile file =
        url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url);
    myOutputFolderChooser.setText(file == null ? VfsUtil.urlToPath(url) : file.getPath());

    return content;
  }
 @Override
 protected void applyEditorTo(@NotNull K2JSRunConfiguration configuration)
     throws ConfigurationException {
   K2JSConfigurationSettings settings = configuration.settings();
   settings.setPageToOpenFilePath(toSystemIndependentName(htmlChooseFile.getText()));
   Object item = browserComboBox.getSelectedItem();
   if (item instanceof BrowsersConfiguration.BrowserFamily) {
     settings.setBrowserFamily((BrowsersConfiguration.BrowserFamily) item);
   }
   settings.setGeneratedFilePath(toSystemIndependentName(generatedChooseFile.getText()));
   settings.setShouldOpenInBrowserAfterTranslation(openInBrowserCheckBox.isSelected());
 }
 private void updateManifest() {
   myManifestFileConfiguration = myContext.getManifestFile(myElement, myContext.getArtifactType());
   final String card;
   if (myManifestFileConfiguration != null) {
     card = "properties";
     myManifestPathField.setText(
         FileUtil.toSystemDependentName(myManifestFileConfiguration.getManifestFilePath()));
     myMainClassField.setText(StringUtil.notNullize(myManifestFileConfiguration.getMainClass()));
     myClasspathField.setText(StringUtil.join(myManifestFileConfiguration.getClasspath(), " "));
   } else {
     card = "buttons";
     myManifestPathField.setText("");
   }
   ((CardLayout) myPropertiesPanel.getLayout()).show(myPropertiesPanel, card);
 }
 @Override
 protected void applyEditorTo(@NotNull ErlangConsoleRunConfiguration config)
     throws ConfigurationException {
   config.setModule((Module) myModuleComboBox.getSelectedItem());
   config.setWorkingDirPath(myWorkingDirPathField.getText());
   config.setConsoleArgs(myConsoleArgsEditor.getText());
 }
  @Override
  public void updateDataModel() {

    myWizardContext.setProjectBuilder(myModuleBuilder);
    myWizardContext.setProjectName(myNamePathComponent.getNameValue());
    myWizardContext.setProjectFileDirectory(myNamePathComponent.getPath());
    myFormatPanel.updateData(myWizardContext);

    if (myModuleBuilder != null) {
      final String moduleName = getModuleName();
      myModuleBuilder.setName(moduleName);
      myModuleBuilder.setModuleFilePath(
          FileUtil.toSystemIndependentName(myModuleFileLocation.getText())
              + "/"
              + moduleName
              + ModuleFileType.DOT_DEFAULT_EXTENSION);
      myModuleBuilder.setContentEntryPath(FileUtil.toSystemIndependentName(getModuleContentRoot()));
      if (myModuleBuilder instanceof TemplateModuleBuilder) {
        myWizardContext.setProjectStorageFormat(StorageScheme.DIRECTORY_BASED);
      }
    }

    if (mySettingsStep != null) {
      mySettingsStep.updateDataModel();
    }
  }
  @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();
  }
 public void reset() {
   ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);
   if (myCanBeOpenInBrowser) {
     myCbOpenInBrowser.setSelected(exportToHTMLSettings.OPEN_IN_BROWSER);
   }
   myTargetDirectoryField.setText(exportToHTMLSettings.OUTPUT_DIRECTORY);
 }
 private void setUpChooseHtmlToShow() {
   FileChooserDescriptor fileChooserDescriptor =
       FileChooserDescriptorFactory.createSingleFileDescriptor(StdFileTypes.HTML);
   fileChooserDescriptor.setRoots(ProjectRootManager.getInstance(project).getContentRoots());
   htmlChooseFile.addBrowseFolderListener(
       "Choose file to show after translation is finished", null, project, fileChooserDescriptor);
 }
示例#20
0
 /**
  * The constructor
  *
  * @param project the context project
  */
 public GitVcsPanel(@NotNull Project project) {
   myVcs = GitVcs.getInstance(project);
   myAppSettings = GitVcsApplicationSettings.getInstance();
   myProjectSettings = GitVcsSettings.getInstance(project);
   myProject = project;
   mySSHExecutableComboBox.addItem(IDEA_SSH);
   mySSHExecutableComboBox.addItem(NATIVE_SSH);
   mySSHExecutableComboBox.setSelectedItem(
       GitVcsSettings.isDefaultIdeaSsh() ? IDEA_SSH : NATIVE_SSH);
   mySSHExecutableComboBox.setToolTipText(
       GitBundle.message(
           "git.vcs.config.ssh.mode.tooltip",
           ApplicationNamesInfo.getInstance().getFullProductName()));
   myTestButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           testConnection();
         }
       });
   myConvertTextFilesComboBox.addItem(CRLF_DO_NOT_CONVERT);
   myConvertTextFilesComboBox.addItem(CRLF_CONVERT_TO_PROJECT);
   myConvertTextFilesComboBox.addItem(CRLF_ASK);
   myConvertTextFilesComboBox.setSelectedItem(CRLF_ASK);
   myGitField.addBrowseFolderListener(
       GitBundle.getString("find.git.title"),
       GitBundle.getString("find.git.description"),
       project,
       new FileChooserDescriptor(true, false, false, false, false, false));
 }
示例#21
0
  @Override
  public void _init() {
    if (myInited) return;
    Module module = myWizard.getFacet().getModule();

    PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
    String lastModule = properties.getValue(ChooseModuleStep.MODULE_PROPERTY);
    String lastApkPath = properties.getValue(APK_PATH_PROPERTY);
    if (lastApkPath != null && module.getName().equals(lastModule)) {
      myApkPathField.setText(FileUtil.toSystemDependentName(lastApkPath));
    } else {
      String contentRootPath = getContentRootPath(module);
      if (contentRootPath != null) {
        String defaultPath =
            FileUtil.toSystemDependentName(contentRootPath + "/" + module.getName() + ".apk");
        myApkPathField.setText(defaultPath);
      }
    }

    final String runProguardPropValue = properties.getValue(RUN_PROGUARD_PROPERTY);
    boolean selected;

    if (runProguardPropValue != null) {
      selected = Boolean.parseBoolean(runProguardPropValue);
    } else {
      selected = false;
    }
    myProguardCheckBox.setSelected(selected);
    myProguardConfigFilePathLabel.setEnabled(selected);
    myProguardConfigFilePathField.setEnabled(selected);

    final String proguardCfgPath = properties.getValue(PROGUARD_CFG_PATH_PROPERTY);
    if (proguardCfgPath != null
        && LocalFileSystem.getInstance().refreshAndFindFileByPath(proguardCfgPath) != null) {
      myProguardConfigFilePathField.setText(FileUtil.toSystemDependentName(proguardCfgPath));
    } else {
      final VirtualFile proguardConfigFile =
          AndroidCompileUtil.getProguardConfigFile(myWizard.getFacet());
      if (proguardConfigFile != null) {
        myProguardConfigFilePathField.setText(
            FileUtil.toSystemDependentName(proguardConfigFile.getPath()));
      }
    }

    myInited = true;
  }
 public void updateVersion() {
   String pathText = pathField.getText();
   if (pathText.isEmpty()) {
     versionField.setText("");
   } else {
     versionField.setText(getVersion(pathText, versionParam));
   }
 }
 public void saveState() {
   if (isModified() && publisher != null) {
     publisher.onSettingsChanged(new ToolSettings(pathField.getText(), flagsField.getText()));
   }
   for (PropertyField propertyField : propertyFields) {
     propertyField.saveState();
   }
 }
    private AskForWorkDir(Project project) {
      super(project);

      setTitle("Set Sphinx Working Directory: ");
      init();
      VirtualFile baseDir = project.getBaseDir();
      String path = baseDir != null ? baseDir.getPath() : "";
      myInputFile.setText(path);
      myInputFile.setEditable(false);
      myInputFile.addBrowseFolderListener(
          "Choose sphinx working directory (containing makefile): ",
          null,
          project,
          FileChooserDescriptorFactory.createSingleFolderDescriptor());

      myPanel.setPreferredSize(new Dimension(600, 20));
    }
 private void updateControls() {
   final boolean isNameOK = myValidator.checkName(myNameField.getText());
   getOKAction().setEnabled(isNameOK);
   if (isNameOK) {
     final String text = myValueField.getText().trim();
     getOKAction().setEnabled(text.length() > 0 && !"/".equals(text.trim()));
   }
 }
  public void apply() {
    ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);

    if (myCanBeOpenInBrowser) {
      exportToHTMLSettings.OPEN_IN_BROWSER = myCbOpenInBrowser.isSelected();
    }
    exportToHTMLSettings.OUTPUT_DIRECTORY = myTargetDirectoryField.getText();
  }
  @SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI
  public RasterAssetSetStep(
      TemplateWizardState state,
      @Nullable Project project,
      @Nullable Module module,
      @Nullable Icon sidePanelIcon,
      UpdateListener updateListener,
      @Nullable VirtualFile invocationTarget) {
    super(state, project, module, sidePanelIcon, updateListener, invocationTarget);

    // Speed the scrolling of myScrollPane
    myScrollPane.getVerticalScrollBar().setUnitIncrement(16);

    register(ATTR_TEXT, myText);
    register(ATTR_SCALING, myCropRadioButton, Scaling.CROP);
    register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER);
    register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE);
    register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE);
    register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE);
    register(ATTR_SHAPE, myVerticalRadioButton, GraphicGenerator.Shape.VRECT);
    register(ATTR_SHAPE, myHorizontalRadioButton, GraphicGenerator.Shape.HRECT);
    register(ATTR_DOGEAR, myDogEarEffectCheckBox);
    register(ATTR_PADDING, myPaddingSlider);
    register(ATTR_TRIM, myTrimBlankSpace);
    register(ATTR_FONT, myFontFamily);
    register(ATTR_SOURCE_TYPE, myImageRadioButton, AssetStudioAssetGenerator.SourceType.IMAGE);
    register(ATTR_SOURCE_TYPE, myClipartRadioButton, AssetStudioAssetGenerator.SourceType.CLIPART);
    register(ATTR_SOURCE_TYPE, myTextRadioButton, AssetStudioAssetGenerator.SourceType.TEXT);
    register(ATTR_FOREGROUND_COLOR, myForegroundColor);
    register(ATTR_BACKGROUND_COLOR, myBackgroundColor);
    register(ATTR_ASSET_TYPE, myAssetTypeComboBox);
    register(ATTR_ASSET_THEME, myChooseThemeComboBox);
    register(ATTR_ASSET_NAME, myResourceNameField);

    myImageFile.addBrowseFolderListener(
        null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
    myForegroundColor.setSelectedColor(Color.BLUE);
    myBackgroundColor.setSelectedColor(Color.WHITE);

    for (String font :
        GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) {
      myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1));
      if (font.equals(myTemplateState.get(ATTR_FONT))) {
        myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1);
      }
    }

    myChooseClipart.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            displayClipartDialog();
          }
        });

    populateComboBox(myAssetTypeComboBox, AssetType.class);
    populateComboBox(myChooseThemeComboBox, ActionBarIconGenerator.Theme.class);
  }
 /**
  * Check destination directory and set appropriate error text if there are problems
  *
  * @return true if destination components are OK.
  */
 private boolean checkDestination() {
   if (myParentDirectory.getText().length() == 0 || myDirectoryName.getText().length() == 0) {
     setErrorText(null);
     setOKActionEnabled(false);
     return false;
   }
   File file = new File(myParentDirectory.getText(), myDirectoryName.getText());
   if (file.exists()) {
     setErrorText(GitBundle.message("clone.destination.exists.error", file));
     setOKActionEnabled(false);
     return false;
   } else if (!file.getParentFile().exists()) {
     setErrorText(GitBundle.message("clone.parent.missing.error", file.getParent()));
     setOKActionEnabled(false);
     return false;
   }
   return true;
 }
 @NotNull
 private JPanel createSelectDirectoryPanel(
     @NotNull Project project, @NotNull JTextField directoryTextField) {
   FileChooserDescriptor fileChooserDescriptor =
       FileChooserDescriptorFactory.createSingleFolderDescriptor();
   String adapterName = getAssertFrameworkAdapterName();
   String title = "Select a directory for " + adapterName + " files";
   String description = adapterName + " source files will be copied to the selected directory";
   TextFieldWithBrowseButton directoryTextFieldWithBrowseButton =
       new TextFieldWithBrowseButton(directoryTextField);
   directoryTextFieldWithBrowseButton.addBrowseFolderListener(
       title, description, project, fileChooserDescriptor);
   Dimension oldDimension = directoryTextFieldWithBrowseButton.getPreferredSize();
   directoryTextFieldWithBrowseButton.setMaximumSize(oldDimension);
   JPanel panel = new JPanel(new BorderLayout(0, 2));
   panel.add(new JLabel("Copy these files to directory:"), BorderLayout.NORTH);
   panel.add(directoryTextFieldWithBrowseButton, BorderLayout.CENTER);
   return SwingHelper.wrapWithHorizontalStretch(panel);
 }
  public Dart2JSSettingsDialog(@Nullable Project project, String jsFilePath) {
    super(project, true);
    myOutputFilePath.setText(FileUtil.toSystemDependentName(jsFilePath));

    myCheckedMode.setSelected(
        PropertiesComponent.getInstance().getBoolean("dart2js.checked.mode", false));
    myMinify.setSelected(PropertiesComponent.getInstance().getBoolean("dart2js.minify", false));

    myCheckedMode.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            PropertiesComponent.getInstance()
                .setValue("dart2js.checked.mode", Boolean.toString(myCheckedMode.isSelected()));
          }
        });
    myMinify.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            PropertiesComponent.getInstance()
                .setValue("dart2js.minify", Boolean.toString(myMinify.isSelected()));
          }
        });
    myOutputFilePath
        .getButton()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                final FileChooserDescriptor descriptor =
                    new FileChooserDescriptor(false, true, false, false, false, false);
                final VirtualFile file =
                    FileChooser.chooseFile(descriptor, myMainPanel, null, null);
                if (file != null) {
                  myOutputFilePath.setText(FileUtil.toSystemDependentName(file.getPath()));
                }
              }
            });

    setTitle("Dart2JS");
    init();
  }