コード例 #1
0
ファイル: JavaModuleFacetTab.java プロジェクト: sprig/MPS
 public JavaModuleFacetTab(JavaModuleFacet javaModuleFacet) {
   super(
       PropertiesBundle.message("mps.properties.configurable.module.javatab.title"),
       IdeIcons.DEFAULT_ICON,
       PropertiesBundle.message("mps.properties.configurable.module.javatab.tip"));
   myJavaModuleFacet = (JavaModuleFacetImpl) javaModuleFacet;
   init();
 }
コード例 #2
0
ファイル: JavaModuleFacetTab.java プロジェクト: sprig/MPS
  private JComponent getLibrariesTable() {
    myLibraryTableModel = new LibraryTableModel();
    final JBTable librariesTable = new JBTable(myLibraryTableModel);
    librariesTable.setTableHeader(null);
    librariesTable.setDefaultRenderer(String.class, new MyPathRenderer());
    librariesTable.setShowHorizontalLines(false);
    librariesTable.setShowVerticalLines(false);
    librariesTable.setAutoCreateRowSorter(false);
    librariesTable.setAutoscrolls(true);

    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(librariesTable);
    decorator
        .setAddAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton anActionButton) {
                List<ModelRootDescriptor> modelRoots =
                    new ArrayList<ModelRootDescriptor>(
                        myJavaModuleFacet
                            .getModule()
                            .getModuleDescriptor()
                            .getModelRootDescriptors());
                StubRootChooser stubRootChooser =
                    new StubRootChooser(
                        modelRoots,
                        (myJavaModuleFacet.getModule() instanceof Language ? true : false));
                myLibraryTableModel.addAll(stubRootChooser.compute());
              }
            })
        .setRemoveAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton anActionButton) {
                TableUtil.removeSelectedItems(librariesTable);
                myLibraryTableModel.fireTableDataChanged();
              }
            });
    decorator.setToolbarBorder(IdeBorderFactory.createBorder());
    decorator.setPreferredSize(new Dimension(500, 100));

    JPanel table = decorator.createPanel();
    table.setBorder(
        IdeBorderFactory.createTitledBorder(
            PropertiesBundle.message("mps.properties.configurable.module.javatab.librariesborder"),
            false));
    return table;
  }
コード例 #3
0
ファイル: JavaModuleFacetTab.java プロジェクト: sprig/MPS
  private JComponent getSourcePathsTable() {
    myPathsTableModel = new PathsTableModel();
    final JBTable sourcePathTable = new JBTable(myPathsTableModel);
    sourcePathTable.setTableHeader(null);
    sourcePathTable.setDefaultRenderer(String.class, new MyPathRenderer());
    sourcePathTable.setShowHorizontalLines(false);
    sourcePathTable.setShowVerticalLines(false);
    sourcePathTable.setAutoCreateRowSorter(false);
    sourcePathTable.setAutoscrolls(true);

    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(sourcePathTable);
    decorator
        .setAddAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton anActionButton) {
                myPathsTableModel.add((new PathChooser()).compute());
              }
            })
        .setRemoveAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton anActionButton) {
                TableUtil.removeSelectedItems(sourcePathTable);
                myPathsTableModel.fireTableDataChanged();
              }
            });
    decorator.setToolbarBorder(IdeBorderFactory.createBorder());
    decorator.setPreferredSize(new Dimension(500, 100));

    JPanel table = decorator.createPanel();
    table.setBorder(
        IdeBorderFactory.createTitledBorder(
            PropertiesBundle.message("mps.properties.configurable.module.javatab.sourcepathborder"),
            false));
    return table;
  }
コード例 #4
0
ファイル: JavaModuleFacetTab.java プロジェクト: sprig/MPS
  @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);
  }