@Nullable
 @Override
 public JComponent createComponent() {
   myEnabled = new JBCheckBox("Enable EditorConfig support");
   final JPanel result = new JPanel();
   result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS));
   final JPanel panel = new JPanel(new VerticalFlowLayout());
   result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false));
   panel.add(myEnabled);
   final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings");
   warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
   warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0));
   panel.add(warning);
   panel.setAlignmentY(Component.TOP_ALIGNMENT);
   result.add(panel);
   final JButton export = new JButton("Export");
   export.addActionListener(
       (event) -> {
         final Component parent = UIUtil.findUltimateParent(result);
         if (parent instanceof IdeFrame) {
           Utils.export(((IdeFrame) parent).getProject());
         }
       });
   export.setAlignmentY(Component.TOP_ALIGNMENT);
   result.add(export);
   return result;
 }
  protected JComponent createCenterPanel() {
    JPanel contentPanel = new JPanel(new BorderLayout());

    Box mainPanel = Box.createHorizontalBox();

    myClassFilterEditor =
        new ClassFilterEditor(
            myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
    myClassFilterEditor.setPreferredSize(new Dimension(400, 200));
    myClassFilterEditor.setBorder(
        IdeBorderFactory.createTitledBorder(
            DebuggerBundle.message("class.filters.dialog.inclusion.filters.group"),
            false,
            false,
            true));
    mainPanel.add(myClassFilterEditor);

    myClassExclusionFilterEditor =
        new ClassFilterEditor(
            myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
    myClassExclusionFilterEditor.setPreferredSize(new Dimension(400, 200));
    myClassExclusionFilterEditor.setBorder(
        IdeBorderFactory.createTitledBorder(
            DebuggerBundle.message("class.filters.dialog.exclusion.filters.group"),
            false,
            false,
            true));
    mainPanel.add(myClassExclusionFilterEditor);

    contentPanel.add(mainPanel, BorderLayout.CENTER);

    return contentPanel;
  }
  private void layoutPanel() {
    if (myUsagePreviewPanel != null) {
      Disposer.dispose(myUsagePreviewPanel);
    }
    removeAll();
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);

    if (isPreview()) {
      pane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.RIGHT));

      boolean vertical =
          myToolWindow.getAnchor() == ToolWindowAnchor.LEFT
              || myToolWindow.getAnchor() == ToolWindowAnchor.RIGHT;
      Splitter splitter =
          new Splitter(
              vertical, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
      splitter.setFirstComponent(pane);
      myUsagePreviewPanel = new UsagePreviewPanel(myProject, new UsageViewPresentation());
      myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));

      Disposer.register(this, myUsagePreviewPanel);
      splitter.setSecondComponent(myUsagePreviewPanel);
      add(splitter, BorderLayout.CENTER);
    } else {
      pane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
      add(pane, BorderLayout.CENTER);
    }

    add(createToolbar().getComponent(), BorderLayout.WEST);

    myTree.getParent().setBackground(UIManager.getColor("Tree.background"));

    revalidate();
  }
  @Nullable
  @Override
  protected JComponent createCenterPanel() {
    final JPanel content = new JPanel(new BorderLayout());

    final JPanel topLine = new JPanel(new BorderLayout());
    content.setBorder(
        IdeBorderFactory.createTitledBorder(
            "Thrift compiler " + myGenerator.getType().name(), false));
    myOutputFolderChooser.addBrowseFolderListener(
        new TextBrowseFolderListener(
            FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject) {
          @Nullable
          @Override
          protected VirtualFile getInitialFile() {
            if (myGenerator.getOutputDir() != null) {
              return LocalFileFinder.findFile(myGenerator.getOutputDir());
            } else {
              return null;
            }
          }

          @Override
          protected void onFileChosen(@NotNull VirtualFile chosenFile) {
            final String absolutePath = VfsUtil.virtualToIoFile(chosenFile).getAbsolutePath();
            myOutputFolderChooser.setText(absolutePath);
          }
        });

    topLine.add(new JBLabel("Output folder:"), BorderLayout.WEST);
    topLine.add(myOutputFolderChooser, BorderLayout.CENTER);

    content.add(topLine, BorderLayout.NORTH);

    final JPanel options = new JPanel(new BorderLayout());
    content.add(options, BorderLayout.CENTER);

    myPane = AOptionPane.get(myGenerator.getType());
    if (myPane != null) {
      options.setBorder(IdeBorderFactory.createTitledBorder("Additional options"));
      options.add(myPane.getPanel());
      myPane.setValues(myGenerator);
    } else {
      options.setBorder(null);
    }

    final String url = myGenerator.getOutputDir();
    final VirtualFile file =
        url == null ? null : VirtualFileManager.getInstance().findFileByUrl(url);
    myOutputFolderChooser.setText(file == null ? VfsUtil.urlToPath(url) : file.getPath());

    return content;
  }
  protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());

    final JPanel exprPanel = new JPanel(new BorderLayout());
    exprPanel.add(
        new JLabel(DebuggerBundle.message("label.evaluate.dialog.expression")), BorderLayout.WEST);
    exprPanel.add(getExpressionCombo(), BorderLayout.CENTER);
    final JLabel help =
        new JLabel(
            "Press Enter to Evaluate or Control+Enter to evaluate and add to the Watches",
            SwingConstants.RIGHT);
    help.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 6, 0));
    UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, help);
    help.setForeground(UIUtil.getInactiveTextColor());
    exprPanel.add(help, BorderLayout.SOUTH);

    final JPanel resultPanel = new JPanel(new BorderLayout());
    // resultPanel.add(new JLabel(DebuggerBundle.message("label.evaluate.dialog.result")),
    // BorderLayout.NORTH);
    resultPanel.add(getEvaluationPanel(), BorderLayout.CENTER);

    panel.add(exprPanel, BorderLayout.NORTH);
    panel.add(resultPanel, BorderLayout.CENTER);

    return panel;
  }
 public void setupCorners() {
   setBorder(IdeBorderFactory.createBorder());
   setCorner(UPPER_RIGHT_CORNER, new Corner(UPPER_RIGHT_CORNER));
   setCorner(UPPER_LEFT_CORNER, new Corner(UPPER_LEFT_CORNER));
   setCorner(LOWER_RIGHT_CORNER, new Corner(LOWER_RIGHT_CORNER));
   setCorner(LOWER_LEFT_CORNER, new Corner(LOWER_LEFT_CORNER));
 }
  private JPanel createReportingPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.gridx = 0;
    c.ipady = 2;
    c.fill = GridBagConstraints.BOTH;
    panel.add(myShowInfo, c);
    panel.add(myShowWarnings, c);
    c.insets.left = 16;
    panel.add(myKeepModelsWithWarnings, c);
    panel.add(myShowBadChildWarnings, c);
    myButtonState.track(
        myShowInfo, myShowWarnings, myKeepModelsWithWarnings, myShowBadChildWarnings);

    final ChangeListener listener =
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            myKeepModelsWithWarnings.setEnabled(myShowWarnings.isSelected());
            myShowBadChildWarnings.setEnabled(myShowWarnings.isSelected());
          }
        };
    myShowWarnings.addChangeListener(listener);

    c.insets.left = 0;
    c.ipady = 0;
    panel.add(createLinkErrorsGroup(), c);
    panel.setBorder(IdeBorderFactory.createTitledBorder("Error reporting"));
    return panel;
  }
  private JPanel createFieldPanel() {
    myDoNotReplaceRadioButton =
        new JBRadioButton(UIUtil.replaceMnemonicAmpersand("Do n&ot replace"));
    myReplaceFieldsInaccessibleInRadioButton =
        new JBRadioButton(
            UIUtil.replaceMnemonicAmpersand("Replace fields &inaccessible in usage context"));
    myReplaceAllFieldsRadioButton =
        new JBRadioButton(UIUtil.replaceMnemonicAmpersand("&Replace all fields"));

    myDoNotReplaceRadioButton.setFocusable(false);
    myReplaceFieldsInaccessibleInRadioButton.setFocusable(false);
    myReplaceAllFieldsRadioButton.setFocusable(false);

    final ButtonGroup group = new ButtonGroup();
    group.add(myDoNotReplaceRadioButton);
    group.add(myReplaceFieldsInaccessibleInRadioButton);
    group.add(myReplaceAllFieldsRadioButton);

    final JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(myDoNotReplaceRadioButton);
    panel.add(myReplaceFieldsInaccessibleInRadioButton);
    panel.add(myReplaceAllFieldsRadioButton);

    panel.setBorder(
        IdeBorderFactory.createTitledBorder(
            "Replace fields used in expression with their getters", true));
    return panel;
  }
 private static JComponent wrap(@NotNull JComponent content, @NotNull String title) {
   JPanel result = new JPanel(new BorderLayout());
   result.setOpaque(false);
   result.setBorder(IdeBorderFactory.createTitledBorder(title, false));
   result.add(content, BorderLayout.CENTER);
   return result;
 }
  private void setupCentralPanel() {
    myCentralPanel.removeAll();
    if (myUsagePreviewPanel != null) {
      Disposer.dispose(myUsagePreviewPanel);
      myUsagePreviewPanel = null;
    }
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);

    if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) {
      Splitter splitter =
          new Splitter(false, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
      pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT);

      splitter.setFirstComponent(pane);
      myUsagePreviewPanel = new UsagePreviewPanel(myProject);
      myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
      Disposer.register(this, myUsagePreviewPanel);
      splitter.setSecondComponent(myUsagePreviewPanel);
      myCentralPanel.add(splitter, BorderLayout.CENTER);
    } else {
      myCentralPanel.add(pane, BorderLayout.CENTER);
    }
    myCentralPanel.add(myButtonPanel, BorderLayout.SOUTH);

    myRootPanel.revalidate();
  }
  private RepositoryChangesBrowser createRepositoryChangesBrowser(final Project project) {
    TableView<ChangeInfo> table = changeListPanel.getTable();

    RepositoryChangesBrowser repositoryChangesBrowser =
        new RepositoryChangesBrowser(
            project,
            Collections.<CommittedChangeList>emptyList(),
            Collections.<Change>emptyList(),
            null);
    repositoryChangesBrowser
        .getDiffAction()
        .registerCustomShortcutSet(CommonShortcuts.getDiff(), table);
    repositoryChangesBrowser
        .getViewer()
        .setScrollPaneBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP));

    changeListPanel.addListSelectionListener(
        new Consumer<ChangeInfo>() {
          @Override
          public void consume(ChangeInfo changeInfo) {
            changeSelected(changeInfo, project);
          }
        });
    return repositoryChangesBrowser;
  }
  private void createProgressPanel() {
    myProgressIcon = new AsyncProcessIcon("Designer progress");
    myProgressMessage = new JLabel();

    JPanel progressBlock = new JPanel();
    progressBlock.add(myProgressIcon);
    progressBlock.add(myProgressMessage);
    progressBlock.setBorder(IdeBorderFactory.createRoundedBorder());

    myProgressPanel = new JPanel(new GridBagLayout());
    myProgressPanel.add(
        progressBlock,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    myProgressPanel.setOpaque(false);
  }
示例#13
0
  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;
  }
示例#14
0
  @Override
  public VcsDependentHistoryComponents getUICustomization(
      final VcsHistorySession session, JComponent forShortcutRegistration) {
    final ColumnInfo[] columns;
    final Consumer<VcsFileRevision> listener;
    final JComponent addComp;
    if (((SvnHistorySession) session).isHaveMergeSources()) {
      final MergeSourceColumnInfo mergeSourceColumn =
          new MergeSourceColumnInfo((SvnHistorySession) session);
      columns = new ColumnInfo[] {new CopyFromColumnInfo(), mergeSourceColumn};

      final JPanel panel = new JPanel(new BorderLayout());

      final JTextArea field = new JTextArea();
      field.setEditable(false);
      field.setBackground(UIUtil.getComboBoxDisabledBackground());
      field.setWrapStyleWord(true);
      listener =
          new Consumer<VcsFileRevision>() {
            @Override
            public void consume(VcsFileRevision vcsFileRevision) {
              field.setText(mergeSourceColumn.getText(vcsFileRevision));
            }
          };

      final MergeSourceDetailsAction sourceAction = new MergeSourceDetailsAction();
      sourceAction.registerSelf(forShortcutRegistration);

      JPanel fieldPanel =
          new ToolbarDecorator() {
            @Override
            protected JComponent getComponent() {
              return field;
            }

            @Override
            protected void updateButtons() {}

            @Override
            protected void installDnDSupport() {}

            @Override
            protected boolean isModelEditable() {
              return false;
            }
          }.initPosition().addExtraAction(AnActionButton.fromAction(sourceAction)).createPanel();
      fieldPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP));

      panel.add(fieldPanel, BorderLayout.CENTER);
      panel.add(new JLabel("Merge Sources:"), BorderLayout.NORTH);
      addComp = panel;
    } else {
      columns = new ColumnInfo[] {new CopyFromColumnInfo()};
      addComp = null;
      listener = null;
    }
    return new VcsDependentHistoryComponents(columns, listener, addComp);
  }
示例#15
0
 @Override
 public JComponent getComponent() {
   if (myComponent == null) {
     myComponent = createComponent();
     final IdeaTitledBorder border = IdeBorderFactory.createTitledBorder(myDescription, false);
     myComponent.setBorder(border);
   }
   return myComponent;
 }
 private JPanel createTextGenPanel() {
   JPanel textgenPanel = new JPanel();
   textgenPanel.setLayout(new BoxLayout(textgenPanel, BoxLayout.Y_AXIS));
   textgenPanel.add(myFailOnMissingTextgen);
   textgenPanel.add(myGenerateDebugInfo);
   textgenPanel.setBorder(IdeBorderFactory.createTitledBorder("TextGen options"));
   myButtonState.track(myFailOnMissingTextgen, myGenerateDebugInfo);
   return textgenPanel;
 }
 private static JScrollPane wrapInScrollPane(JPanel panel) {
   JPanel wrapper = new JPanel(new BorderLayout());
   wrapper.add(panel);
   wrapper.setBorder(IdeBorderFactory.createEmptyBorder(5));
   return ScrollPaneFactory.createScrollPane(
       wrapper,
       ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
       ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 }
 @Override
 public JComponent createCustomComponent(final Presentation presentation) {
   ComboBoxButton button = createComboBoxButton(presentation);
   button.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
   NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
   panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2));
   panel.add(button);
   return panel;
 }
 public static TitledBorder createTitledBorder(
     Border border,
     String title,
     int titleJustification,
     int titlePosition,
     Font titleFont,
     Color titleColor) {
   return IdeBorderFactory.createTitledBorder(title, false, true, true);
 }
  @Override
  public void setPopupVisible(boolean visible) {
    if (!isSwingPopup()) {
      if (visible && (myJBPopup == null || myJBPopup.isDisposed())) {
        final JBList list = createJBList(getModel());
        myJBPopup =
            JBPopupFactory.getInstance()
                .createListPopupBuilder(list)
                .setItemChoosenCallback(
                    new Runnable() {
                      @Override
                      public void run() {
                        final Object value = list.getSelectedValue();
                        if (value != null) {
                          configureEditor(getEditor(), value);
                          IdeFocusManager.getGlobalInstance().requestFocus(ComboBox.this, true);
                          assert myJBPopup != null;
                          ComboBox.this.getUI().setPopupVisible(ComboBox.this, false);
                          myJBPopup.cancel();
                        }
                      }
                    })
                .setFocusOwners(new Component[] {this})
                .setMinSize(new Dimension(getWidth(), -1))
                .createPopup();
        list.setBorder(IdeBorderFactory.createEmptyBorder());
        myJBPopup.showUnderneathOf(this);
        list.addFocusListener(
            new FocusAdapter() {
              @Override
              public void focusLost(FocusEvent e) {
                ComboBox.this.getUI().setPopupVisible(ComboBox.this, false);
                myJBPopup.cancel();
              }
            });
      }
      return;
    }

    if (getModel().getSize() == 0 && visible) return;
    if (visible && JBPopupFactory.getInstance().getChildFocusedPopup(this) != null) return;

    final boolean wasShown = isPopupVisible();
    super.setPopupVisible(visible);
    if (!wasShown
        && visible
        && isEditable()
        && !UIManager.getBoolean("ComboBox.isEnterSelectablePopup")) {

      final ComboBoxEditor editor = getEditor();
      final Object item = editor.getItem();
      final Object selectedItem = getSelectedItem();
      if (isSwingPopup() && (item == null || item != selectedItem)) {
        configureEditor(editor, selectedItem);
      }
    }
  }
 public static TitledBorder createTitledBorder(
     Border border,
     String title,
     int titleJustification,
     int titlePosition,
     Font titleFont,
     Color titleColor) {
   return IdeBorderFactory.createTitledBorder(
       title, true, new Insets(TITLED_BORDER_TOP_INSET, 0, 0, 0));
 }
 protected JComponent createCenterPanel() {
   JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
   scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
   myCenterPanel.add(CARD_STATUS, scrollPane);
   myTreeBrowser =
       new CommittedChangesTreeBrowser(myProject, Collections.<CommittedChangeList>emptyList());
   Disposer.register(this, myTreeBrowser);
   myTreeBrowser.setHelpId(getHelpId());
   myCenterPanel.add(CARD_CHANGES, myTreeBrowser);
   return myCenterPanel;
 }
  private void addErrorMessage(final FixableMessageInfo message, Icon icon) {
    if (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0) {
      HyperlinkLabel warnLabel = new HyperlinkLabel();
      warnLabel.setOpaque(false);
      warnLabel.setHyperlinkText(
          message.myBeforeLinkText, message.myLinkText, message.myAfterLinkText);
      warnLabel.setIcon(icon);

      if (message.myQuickFix != null) {
        warnLabel.addHyperlinkListener(
            new HyperlinkListener() {
              public void hyperlinkUpdate(final HyperlinkEvent e) {
                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                  message.myQuickFix.run();
                }
              }
            });
      }
      myErrorMessages.add(warnLabel);
    } else {
      JBLabel warnLabel = new JBLabel();
      warnLabel.setOpaque(false);
      warnLabel.setText(
          "<html><body>" + message.myBeforeLinkText.replace("\n", "<br>") + "</body></html>");
      warnLabel.setIcon(icon);
      myErrorMessages.add(warnLabel);
    }
    if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) {
      JPanel fixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
      fixesPanel.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 10, 0));
      fixesPanel.setOpaque(false);
      fixesPanel.add(Box.createHorizontalStrut(icon.getIconWidth()));

      for (Pair<String, Runnable> pair : message.myAdditionalFixes) {
        HyperlinkLabel fixLabel = new HyperlinkLabel();
        fixLabel.setOpaque(false);
        fixLabel.setHyperlinkText(pair.getFirst());
        final Runnable fix = pair.getSecond();

        fixLabel.addHyperlinkListener(
            new HyperlinkListener() {
              @Override
              public void hyperlinkUpdate(HyperlinkEvent e) {
                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                  fix.run();
                }
              }
            });
        fixesPanel.add(fixLabel);
      }
      myErrorMessages.add(fixesPanel);
    }
  }
  @Override
  protected JComponent createCenterPanel() {
    myTitle.setText(myText);
    myOptionsPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.options")));
    myFiltersPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.filters")));

    myMaskWarningLabel.setIcon(AllIcons.General.Warning);
    myMaskWarningLabel.setVisible(false);

    myIncludeSubdirsCb.setVisible(shouldShowIncludeSubdirsCb());

    initFileTypeFilter();
    initScopeFilter();

    restoreCbsStates();
    return myWholePanel;
  }
  @Override
  public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
    Component component = toolWindow.getComponent();

    changeListPanel = new GerritChangeListPanel(Lists.<ChangeInfo>newArrayList(), null);

    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);

    ActionToolbar toolbar = createToolbar();
    toolbar.setTargetComponent(changeListPanel);
    panel.setToolbar(toolbar.getComponent());

    myRepositoryChangesBrowser = createRepositoryChangesBrowser(project);

    myDetailsSplitter = new Splitter(true, 0.6f);
    myDetailsSplitter.setShowDividerControls(true);

    changeListPanel.setBorder(
        IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT | SideBorder.BOTTOM));
    myDetailsSplitter.setFirstComponent(changeListPanel);

    myDetailsPanel = new GerritChangeDetailsPanel(project);
    JPanel details = myDetailsPanel.getComponent();
    details.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT));
    myDetailsSplitter.setSecondComponent(details);

    Splitter myHorizontalSplitter = new Splitter(false, 0.7f);
    myHorizontalSplitter.setShowDividerControls(true);
    myHorizontalSplitter.setFirstComponent(myDetailsSplitter);
    myHorizontalSplitter.setSecondComponent(myRepositoryChangesBrowser);

    panel.setContent(myHorizontalSplitter);

    component.getParent().add(panel);

    reloadChanges(project, false);

    setupRefreshTask(project);
  }
  private void init(@NotNull ArrangementStandardSettingsManager settingsManager) {
    setLayout(new GridBagLayout());
    setBorder(IdeBorderFactory.createEmptyBorder(5));

    List<CompositeArrangementSettingsToken> tokens = settingsManager.getSupportedMatchingTokens();
    if (tokens != null) {
      for (CompositeArrangementSettingsToken token : tokens) {
        addToken(token);
      }
    }

    applyBackground(UIUtil.getListBackground());
  }
示例#27
0
  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;
  }
  private JPanel createOptionsPanel() {
    JPanel optionsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.gridx = 0;
    c.ipady = 2;
    c.fill = GridBagConstraints.BOTH;
    optionsPanel.add(mySaveTransientModelsCheckBox, c);
    optionsPanel.add(myCheckModelsBeforeGenerationCheckBox, c);
    optionsPanel.add(myStrictMode, c);
    c.ipady = 0;
    optionsPanel.add(createParallelGenerationGroup(), c);
    c.ipady = 2;
    optionsPanel.add(myIncremental, c);
    c.insets.left = 16;
    optionsPanel.add(myIncrementalCache, c);
    if (InternalFlag.isInternalMode()) {
      optionsPanel.add(myDebugIncrementalDependencies, c);
    }
    c.insets.left = 0;
    optionsPanel.add(myInplaceTransform, c);

    myButtonState.track(
        mySaveTransientModelsCheckBox,
        myCheckModelsBeforeGenerationCheckBox,
        myStrictMode,
        myInplaceTransform);
    myButtonState.track(myDebugIncrementalDependencies, myIncremental, myIncrementalCache);

    final ChangeListener listener =
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            myIncremental.setEnabled(myStrictMode.isSelected());
            myIncrementalCache.setEnabled(myStrictMode.isSelected() && myIncremental.isSelected());
            if (InternalFlag.isInternalMode()) {
              myDebugIncrementalDependencies.setEnabled(
                  myStrictMode.isSelected() && myIncremental.isSelected());
            }
          }
        };
    myStrictMode.addChangeListener(listener);
    myIncremental.addChangeListener(listener);
    optionsPanel.setBorder(IdeBorderFactory.createTitledBorder("General"));

    mySaveTransientModelsCheckBox.addItemListener(myStatusUpdater);
    myInplaceTransform.addItemListener(myStatusUpdater);
    return optionsPanel;
  }
 public ThreeStateCheckBoxRenderer() {
   setThirdStateEnabled(false);
   setHorizontalAlignment(CENTER);
   setVerticalAlignment(CENTER);
   setBorder(
       IdeBorderFactory.createEmptyBorder(
           0, 0, 0, InspectionsConfigTreeTable.getAdditionalPadding()));
   addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           stopCellEditing();
         }
       });
 }
  public SelectTemplateStep(
      WizardContext context,
      StepSequence sequence,
      final MultiMap<TemplatesGroup, ProjectTemplate> map) {

    myWizardContext = context;
    mySequence = sequence;
    Messages.installHyperlinkSupport(myDescriptionPane);

    myFormatPanel = new ProjectFormatPanel();
    myNamePathComponent = initNamePathComponent(context);
    if (context.isCreatingNewProject()) {
      mySettingsPanel.add(myNamePathComponent, BorderLayout.NORTH);
      addExpertPanel(myModulePanel);
    } else {
      mySettingsPanel.add(myModulePanel, BorderLayout.NORTH);
    }
    bindModuleSettings();

    myExpertDecorator = new HideableDecorator(myExpertPlaceholder, "Mor&e Settings", false);
    myExpertPanel.setBorder(
        IdeBorderFactory.createEmptyBorder(0, IdeBorderFactory.TITLED_BORDER_INDENT, 5, 0));
    myExpertDecorator.setContentComponent(myExpertPanel);

    myList = new ProjectTypesList(myTemplatesList, map, context);
    myList.installKeyAction(getNameComponent());

    myTemplatesList
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                ProjectTemplate template = getSelectedTemplate();
                boolean loading = template instanceof LoadingProjectTemplate;
                myModuleBuilder =
                    template == null || loading ? null : template.createModuleBuilder();
                setupPanels(template);
                mySequence.setType(myModuleBuilder == null ? null : myModuleBuilder.getBuilderId());
                myWizardContext.requestWizardButtonsUpdate();
              }
            });

    if (myWizardContext.isCreatingNewProject()) {
      addProjectFormat(myModulePanel);
    }
  }