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);
 }
Esempio n. 2
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;
  }
  private void updateControls() {
    myBrowserSelector.getMainComponent().setEnabled(myBrowserRadioButton.isSelected());

    myPlayerTextWithBrowse.setEnabled(myPlayerRadioButton.isSelected());
    myNewPlayerInstanceCheckBox.setEnabled(myPlayerRadioButton.isSelected());
  }