Example #1
0
 private void refreshSolutionDescriptorName() {
   ModifiableModuleModel moduleModel =
       ProjectStructureConfigurable.getInstance(myContext.getProject())
           .getContext()
           .getModulesConfigurator()
           .getModuleModel();
   String moduleName = moduleModel.getNewName(myContext.getModule());
   if (moduleName == null) {
     moduleName = myContext.getModule().getName();
   }
   mySolutionNamespace.setText(moduleName);
 }
  public ProtobufFacetEditor(
      FacetEditorContext editorContext,
      FacetValidatorsManager validatorsManager,
      ProtobufFacetConfiguration configuration) {
    this.configuration = configuration;

    final Project project = editorContext.getProject();
    final Module module = editorContext.getModule();

    commonSettingsEditor
        .getEnableCompilationCheckbox()
        .setSelected(configuration.isCompilationEnabled());
    commonSettingsEditor
        .getProtobufCompilerOutputPathField()
        .setText(configuration.getCompilerOutputPath());
    commonSettingsEditor
        .getProtobufCompilerOutputPathField()
        .addBrowseFolderListener(
            project,
            new CompilerOutputBrowseFolderActionListener(
                project, module, commonSettingsEditor.getProtobufCompilerOutputPathField()));
    commonSettingsEditor
        .getProtobufCompilerRunInFixedDirectory()
        .setSelected(configuration.isCompilationUseGivenRunDirectory());
    commonSettingsEditor
        .getProtobufCompilerRunDirectory()
        .setText(configuration.getCompilationRunDirectory());
    commonSettingsEditor
        .getProtobufCompilerRunDirectory()
        .addBrowseFolderListener(
            project,
            new CompilerOutputBrowseFolderActionListener(
                project, module, commonSettingsEditor.getProtobufCompilerRunDirectory()));
  }
  public void reset() {
    basePackageField.setText(myData.getBasePackage());
    myFSCRadioButton.setSelected(myData.getFsc());
    myRunSeparateCompilerRadioButton.setSelected(!myData.getFsc());
    updateLibrariesList();
    setCompilerLibraryById(
        new LibraryId(myData.getCompilerLibraryName(), myData.getCompilerLibraryLevel()));
    myMaximumHeapSize.setText(Integer.toString(myData.getMaximumHeapSize()));
    myVmParameters.setText(myData.getVmOptions());

    myEnableWarnings.setSelected(myData.getWarnings());
    myDeprecationWarnings.setSelected(myData.getDeprecationWarnings());
    myUncheckedWarnings.setSelected(myData.getUncheckedWarnings());
    myOptimiseBytecode.setSelected(myData.getOptimiseBytecode());
    myExplainTypeErrors.setSelected(myData.getExplainTypeErrors());
    myEnableContinuations.setSelected(myData.getContinuations());

    myDebuggingInfoLevel.setSelectedItem(myData.getDebuggingInfoLevel());
    myCompilerOptions.setText(myData.getCompilerOptions());

    myPlugins =
        new ArrayList(
            CompilerPlugin.fromPaths(myData.getPluginPaths(), myEditorContext.getModule()));
    getPluginsModel().setItems(myPlugins);
  }
  public FeaturesConfigurationTab(
      final OfbizFacetConfiguration originalConfiguration, final FacetEditorContext editorContext) {
    this.originalConfiguration = originalConfiguration;

    disablePropertiesKeys.setSelected(originalConfiguration.isPropertiesKeysDisabled());

    final Module module = editorContext.getModule();
    // final String version = OfbizVersionDetector.detectStrutsVersion(module);
    final String version = "11.04";
    if (version != null) {
      versionComboBox.setModel(new DefaultComboBoxModel(new String[] {version}));
      versionComboBox.getModel().setSelectedItem(version);
      versionComboBox.setEnabled(false);
      return;
    }
  }
  public FeaturesConfigurationTab(
      final StrutsFacetConfiguration originalConfiguration,
      final FacetEditorContext editorContext,
      final FacetLibrariesValidator validator) {
    this.originalConfiguration = originalConfiguration;
    this.validator = validator;

    disablePropertiesKeys.setSelected(originalConfiguration.isPropertiesKeysDisabled());

    final Module module = editorContext.getModule();
    final String version = StrutsVersionDetector.detectStrutsVersion(module);
    if (version != null) {
      versionComboBox.setModel(new DefaultComboBoxModel(new String[] {version}));
      versionComboBox.getModel().setSelectedItem(version);
      versionComboBox.setEnabled(false);
      return;
    }

    setupVersionComboBox();
  }
  public ComponentFileSetConfigurationTab(
      @NotNull final OfbizFacetConfiguration strutsFacetConfiguration,
      @NotNull final FacetEditorContext facetEditorContext) {
    originalConfiguration = strutsFacetConfiguration;
    module = facetEditorContext.getModule();
    myConfigsSercher = new OfbizComponentConfigsSearcher(module);

    // init tree
    final SimpleTreeStructure structure =
        new SimpleTreeStructure() {
          public Object getRootElement() {
            return myRootNode;
          }
        };
    myTree.setRootVisible(false);
    myTree.setShowsRootHandles(true); // show expand/collapse handles
    myBuilder =
        new SimpleTreeBuilder(myTree, (DefaultTreeModel) myTree.getModel(), structure, null);
    myBuilder.initRoot();

    final DumbService dumbService = DumbService.getInstance(facetEditorContext.getProject());
    myTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              public void valueChanged(final TreeSelectionEvent e) {
                final OfbizFileSet fileSet = getCurrentFileSet();
                myEditButton.setEnabled(fileSet != null && !dumbService.isDumb());
                myRemoveButton.setEnabled(fileSet != null);
              }
            });

    myAddSetButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            final OfbizFileSet fileSet =
                new OfbizFileSet(
                    OfbizFileSet.getUniqueId(myBuffer),
                    OfbizFileSet.getUniqueName("My Component Fileset", myBuffer),
                    originalConfiguration) {
                  public boolean isNew() {
                    return true;
                  }
                };

            final FileSetEditor editor =
                new FileSetEditor(myPanel, fileSet, facetEditorContext, myConfigsSercher);
            editor.show();
            if (editor.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
              final OfbizFileSet editedFileSet = editor.getEditedFileSet();
              Disposer.register(strutsFacetConfiguration, editedFileSet);
              myBuffer.add(editedFileSet);
              myModified = true;
              myBuilder.updateFromRoot();
              selectFileSet(fileSet);
            }
            myTree.requestFocus();
          }
        });

    myEditButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            final OfbizFileSet fileSet = getCurrentFileSet();
            if (fileSet != null) {
              final FileSetEditor editor =
                  new FileSetEditor(myPanel, fileSet, facetEditorContext, myConfigsSercher);
              editor.show();
              if (editor.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                myModified = true;
                myBuffer.remove(fileSet);
                final OfbizFileSet edited = editor.getEditedFileSet();
                Disposer.register(strutsFacetConfiguration, edited);
                myBuffer.add(edited);
                edited.setAutodetected(false);
                myBuilder.updateFromRoot();
                selectFileSet(edited);
              }
              myTree.requestFocus();
            }
          }
        });

    myRemoveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            remove();
            myModified = true;
            myBuilder.updateFromRoot();
            myTree.requestFocus();
          }
        });

    dumbService.makeDumbAware(myAddSetButton, this);
    dumbService.makeDumbAware(myEditButton, this);
  }