private void updateProjects() {
   try {
     myProjectCombobox.setModel(new DefaultComboBoxModel(myRepository.getProjects().toArray()));
     if (myRepository.getProject() != null)
       myProjectCombobox.setSelectedItem(myRepository.getProject());
     updateFilters();
   } catch (Exception e) {
     resetComboBoxes();
   }
 }
 @Override
 public void reset() {
   myOSCombo.setSelectedItem(expandDefault(myBuildTargetSettings.getOS(), myDefaultOSValue));
   myArchCombo.setSelectedItem(expandDefault(myBuildTargetSettings.getArch(), myDefaultArchValue));
   myGoVersionCombo.setSelectedItem(
       expandDefault(myBuildTargetSettings.getGoVersion(), myDefaultGoVersion));
   myCgoCombo.setSelectedItem(expandDefault(cgo(myBuildTargetSettings.getCgo()), myDefaultCgo));
   myCompilerCombo.setSelectedItem(myBuildTargetSettings.getCompiler());
   myCustomFlagsField.setText(StringUtil.join(myBuildTargetSettings.getCustomFlags(), " "));
 }
 public void setOptions(Map<String, ?> inputOptions) {
   myDisableAbstractElements.setSelected(
       inputOptions.get(DISABLE_ABSTRACT_ELEMENTS) == Boolean.TRUE);
   final Object o = inputOptions.get(ANY_PROCESS_CONTENTS);
   if (o != null) {
     myAnyProcessContents.setSelectedItem(o);
   }
   final Object o2 = inputOptions.get(ANY_ATTRIBUTE_PROCESS_CONTENTS);
   if (o2 != null) {
     myAnyAttributeProcessContents.setSelectedItem(o2);
   }
 }
 private void updateFilters() {
   try {
     final Object selectedItem = myProjectCombobox.getModel().getSelectedItem();
     if (selectedItem != null && selectedItem instanceof MantisProject) {
       myFilterCombobox.setModel(
           new DefaultComboBoxModel(
               myRepository.getFilters((MantisProject) selectedItem).toArray()));
       if (myRepository.getFilter() != null)
         myFilterCombobox.setSelectedItem(myRepository.getFilter());
       doApply();
     }
   } catch (Exception e) {
     resetComboBoxes();
   }
 }
    GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) {
      super(project, panel);
      myVcs = GitVcs.getInstance(project);
      final Insets insets = new Insets(2, 2, 2, 2);
      // add authors drop down
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.anchor = GridBagConstraints.WEST;
      c.insets = insets;
      final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
      myPanel.add(authorLabel, c);

      c = new GridBagConstraints();
      c.anchor = GridBagConstraints.CENTER;
      c.insets = insets;
      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.fill = GridBagConstraints.HORIZONTAL;
      final List<String> usersList = getUsersList(project);
      final Set<String> authors =
          usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
      ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
      List<String> list = new ArrayList<String>(authors);
      Collections.sort(list);
      list =
          ObjectsConvertor.convert(
              list,
              new Convertor<String, String>() {
                @Override
                public String convert(String o) {
                  return StringUtil.shortenTextWithEllipsis(o, 30, 0);
                }
              });
      myAuthor = new ComboBox(ArrayUtil.toObjectArray(list));
      myAuthor.insertItemAt("", 0);
      myAuthor.setSelectedItem("");
      myAuthor.setEditable(true);
      authorLabel.setLabelFor(myAuthor);
      myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
      myPanel.add(myAuthor, c);
    }
  @Nullable
  private DependencyOnPlugin editPluginDependency(
      @NotNull JComponent parent, @NotNull final DependencyOnPlugin original) {
    List<String> pluginIds = new ArrayList<String>(getPluginNameByIdMap().keySet());
    if (!original.getPluginId().isEmpty() && !pluginIds.contains(original.getPluginId())) {
      pluginIds.add(original.getPluginId());
    }
    Collections.sort(
        pluginIds,
        new Comparator<String>() {
          @Override
          public int compare(String o1, String o2) {
            return getPluginNameById(o1).compareToIgnoreCase(getPluginNameById(o2));
          }
        });

    final ComboBox pluginChooser = new ComboBox(ArrayUtilRt.toStringArray(pluginIds), 250);
    pluginChooser.setRenderer(
        new ListCellRendererWrapper<String>() {
          @Override
          public void customize(
              JList list, String value, int index, boolean selected, boolean hasFocus) {
            setText(getPluginNameById(value));
          }
        });
    new ComboboxSpeedSearch(pluginChooser) {
      @Override
      protected String getElementText(Object element) {
        return getPluginNameById((String) element);
      }
    };
    pluginChooser.setSelectedItem(original.getPluginId());

    final JBTextField minVersionField =
        new JBTextField(StringUtil.notNullize(original.getMinVersion()));
    final JBTextField maxVersionField =
        new JBTextField(StringUtil.notNullize(original.getMaxVersion()));
    final JBTextField channelField = new JBTextField(StringUtil.notNullize(original.getChannel()));
    minVersionField.getEmptyText().setText("<any>");
    minVersionField.setColumns(10);
    maxVersionField.getEmptyText().setText("<any>");
    maxVersionField.setColumns(10);
    channelField.setColumns(10);
    JPanel panel =
        FormBuilder.createFormBuilder()
            .addLabeledComponent("Plugin:", pluginChooser)
            .addLabeledComponent("Minimum version:", minVersionField)
            .addLabeledComponent("Maximum version:", maxVersionField)
            .addLabeledComponent("Channel:", channelField)
            .getPanel();
    final DialogBuilder dialogBuilder =
        new DialogBuilder(parent).title("Required Plugin").centerPanel(panel);
    dialogBuilder.setPreferredFocusComponent(pluginChooser);
    pluginChooser.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dialogBuilder.setOkActionEnabled(
                !StringUtil.isEmpty((String) pluginChooser.getSelectedItem()));
          }
        });
    if (dialogBuilder.show() == DialogWrapper.OK_EXIT_CODE) {
      return new DependencyOnPlugin(
          ((String) pluginChooser.getSelectedItem()),
          StringUtil.nullize(minVersionField.getText().trim()),
          StringUtil.nullize(maxVersionField.getText().trim()),
          StringUtil.nullize(channelField.getText().trim()));
    }
    return null;
  }
 @Override
 public void refresh() {
   super.refresh();
   myAuthor.setSelectedItem("");
   reset();
 }
示例#8
0
  @Override
  public void init() {
    JPanel advancedTab = new JPanel();
    advancedTab.setLayout(
        new GridLayoutManager(
            (myJavaModuleFacet.getModule() instanceof Solution ? 5 : 3),
            2,
            MPSPropertiesConfigurable.INSETS,
            -1,
            -1));

    int row = 0;

    if (myJavaModuleFacet.getModule() instanceof Solution) {
      SolutionDescriptor descriptor =
          ((Solution) myJavaModuleFacet.getModule()).getModuleDescriptor();

      JBLabel solutionKindLabel =
          new JBLabel(
              PropertiesBundle.message("mps.properties.configurable.module.javatab.solutionkind"));
      myComboBox = new ComboBox(new DefaultComboBoxModel(SolutionKind.values()));
      myComboBox.setSelectedItem(descriptor.getKind());
      myComboBox.setPreferredSize(new Dimension(300, 20));

      advancedTab.add(
          solutionKindLabel,
          new GridConstraints(
              row,
              0,
              1,
              1,
              GridConstraints.ANCHOR_WEST,
              GridConstraints.FILL_NONE,
              GridConstraints.SIZEPOLICY_FIXED,
              GridConstraints.SIZEPOLICY_FIXED,
              null,
              null,
              null,
              0,
              false));
      advancedTab.add(
          myComboBox,
          new GridConstraints(
              row++,
              1,
              1,
              1,
              GridConstraints.ANCHOR_WEST,
              GridConstraints.FILL_HORIZONTAL,
              GridConstraints.SIZEPOLICY_CAN_GROW,
              GridConstraints.SIZEPOLICY_FIXED,
              null,
              null,
              null,
              0,
              false));

      myCheckBox =
          new JBCheckBox(
              PropertiesBundle.message("mps.properties.configurable.module.javatab.compileinmps"),
              descriptor.getCompileInMPS());
      advancedTab.add(
          myCheckBox,
          new GridConstraints(
              row++,
              0,
              1,
              2,
              GridConstraints.ANCHOR_WEST,
              GridConstraints.FILL_HORIZONTAL,
              GridConstraints.SIZEPOLICY_CAN_GROW,
              GridConstraints.SIZEPOLICY_FIXED,
              null,
              null,
              null,
              0,
              false));
    }

    advancedTab.add(
        getSourcePathsTable(),
        new GridConstraints(
            row++,
            0,
            1,
            2,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_BOTH,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            null,
            null,
            null,
            0,
            false));
    advancedTab.add(
        getLibrariesTable(),
        new GridConstraints(
            row,
            0,
            1,
            2,
            GridConstraints.ANCHOR_CENTER,
            GridConstraints.FILL_BOTH,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
            null,
            null,
            null,
            0,
            false));

    setTabComponent(advancedTab);
  }
示例#9
0
    @Override
    public JComponent createComponent() {
      JPanel panel = new JPanel(new GridLayoutManager(2, 1));

      List<ModelRootManager> managers = ManagerTableCellEditor.getManagers();
      managers.remove(null);
      final ModelRootManager empty = new ModelRootManager("", "Default");
      managers.add(empty);
      myComboBox = new ComboBox(managers.toArray(), 10);
      myComboBox.setRenderer(
          new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(
                JList list, Object value, int index, boolean selected, boolean focus) {
              ModelRootManager manager = ((ModelRootManager) value);
              String managerName = NameUtil.shortNameFromLongName(manager.getClassName());
              return super.getListCellRendererComponent(list, managerName, index, selected, focus);
            }
          });
      panel.add(
          myComboBox,
          new GridConstraints(
              0,
              0,
              1,
              1,
              GridConstraints.ANCHOR_NORTHWEST,
              GridConstraints.FILL_HORIZONTAL,
              GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK,
              GridConstraints.SIZEPOLICY_FIXED,
              null,
              null,
              null));
      myComboBox.setSelectedItem(
          myModelRoot.getModelRoot().getManager() == null
              ? empty
              : myModelRoot.getModelRoot().getManager());
      myComboBox.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              if (e.getStateChange() == ItemEvent.SELECTED) {
                ModelRootManager manager = (ModelRootManager) e.getItem();
                myModelRoot.getModelRoot().setManager(manager.equals(empty) ? null : manager);
                myEventDispatcher.getMulticaster().fireDataChanged();
              }
            }
          });

      myTreePanel = new JPanel(new BorderLayout());
      updateTree();
      final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTreePanel);
      panel.add(
          scrollPane,
          new GridConstraints(
              1,
              0,
              1,
              1,
              GridConstraints.ANCHOR_CENTER,
              GridConstraints.FILL_BOTH,
              GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK,
              GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK,
              null,
              null,
              null));

      return panel;
    }