private JPanel createToolPanel() {
    configurationOverrideCombo.setModel(configurationOverrideModel);
    final int preferredHeight = configurationOverrideCombo.getPreferredSize().height;
    configurationOverrideCombo.setPreferredSize(new Dimension(250, preferredHeight));
    configurationOverrideCombo.setMaximumSize(new Dimension(350, preferredHeight));

    treeModel = new ResultTreeModel();

    resultsTree = new Tree(treeModel);
    resultsTree.setRootVisible(false);

    final TreeSelectionListener treeSelectionListener = new ToolWindowSelectionListener();
    resultsTree.addTreeSelectionListener(treeSelectionListener);
    final MouseListener treeMouseListener = new ToolWindowMouseListener();
    resultsTree.addMouseListener(treeMouseListener);
    resultsTree.setCellRenderer(new ResultTreeRenderer());

    progressLabel = new JLabel(" ");
    progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    progressBar.setMinimum(0);
    final Dimension progressBarSize = new Dimension(100, progressBar.getPreferredSize().height);
    progressBar.setMinimumSize(progressBarSize);
    progressBar.setPreferredSize(progressBarSize);
    progressBar.setMaximumSize(progressBarSize);

    progressPanel = new JToolBar(JToolBar.HORIZONTAL);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(new JLabel(CheckStyleBundle.message("plugin.toolwindow.override")));
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(configurationOverrideCombo);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.addSeparator();
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(progressLabel);
    progressPanel.add(Box.createHorizontalGlue());
    progressPanel.setFloatable(false);
    progressPanel.setBackground(UIManager.getColor("Panel.background"));
    progressPanel.setBorder(null);

    final JPanel toolPanel = new JPanel(new BorderLayout());
    toolPanel.add(new JBScrollPane(resultsTree), BorderLayout.CENTER);
    toolPanel.add(progressPanel, BorderLayout.NORTH);

    ToolTipManager.sharedInstance().registerComponent(resultsTree);

    return toolPanel;
  }
Exemple #2
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);
  }