コード例 #1
0
 private JComponent toUsageViewToolbar(final DefaultActionGroup group) {
   ActionToolbar actionToolbar =
       ActionManager.getInstance()
           .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, group, false);
   actionToolbar.setTargetComponent(myRootPanel);
   return actionToolbar.getComponent();
 }
コード例 #2
0
  @NotNull
  protected JComponent createToolbar() {
    DefaultActionGroup toolbarGroups = new DefaultActionGroup();
    myToolBarGroup = new DefaultActionGroup();
    toolbarGroups.add(myToolBarGroup);
    buildToolBar(myToolBarGroup);

    toolbarGroups.addSeparator();
    DefaultActionGroup treeActionsGroup = new DefaultActionGroup();
    toolbarGroups.add(treeActionsGroup);
    for (AnAction action : myViewer.getTreeActions()) {
      treeActionsGroup.add(action);
    }

    ActionToolbar toolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, toolbarGroups, true);
    toolbar.setTargetComponent(this);
    return toolbar.getComponent();
  }
コード例 #3
0
  @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);
  }
コード例 #4
0
  public RegistryUi() {
    myContent.setLayout(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));

    myModel = new MyTableModel();
    myTable = new JBTable(myModel);
    myTable.setCellSelectionEnabled(true);
    myTable.setEnableAntialiasing(true);
    final MyRenderer r = new MyRenderer();

    final TableColumn c0 = myTable.getColumnModel().getColumn(0);
    c0.setCellRenderer(r);
    c0.setMaxWidth(RESTART_ICON.getIconWidth() + 12);
    c0.setMinWidth(RESTART_ICON.getIconWidth() + 12);
    c0.setHeaderValue(null);

    final TableColumn c1 = myTable.getColumnModel().getColumn(1);
    c1.setCellRenderer(r);
    c1.setHeaderValue("Key");

    final TableColumn c2 = myTable.getColumnModel().getColumn(2);
    c2.setCellRenderer(r);
    c2.setHeaderValue("Value");
    c2.setCellEditor(new MyEditor());
    myTable.setStriped(true);

    myDescriptionLabel = new JTextArea(3, 50);
    myDescriptionLabel.setEditable(false);
    final JScrollPane label = ScrollPaneFactory.createScrollPane(myDescriptionLabel);
    final JPanel descriptionPanel = new JPanel(new BorderLayout());
    descriptionPanel.add(label, BorderLayout.CENTER);
    descriptionPanel.setBorder(
        IdeBorderFactory.createTitledBorder("Description", false, false, true));

    myContent.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
    myContent.add(descriptionPanel, BorderLayout.SOUTH);

    myTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                if (e.getValueIsAdjusting()) return;

                final int selected = myTable.getSelectedRow();
                if (selected != -1) {
                  final RegistryValue value = myModel.getRegistryValue(selected);
                  String desc = value.getDescription();
                  if (value.isRestartRequired()) {
                    String required = "Requires IDE restart.";
                    if (desc.endsWith(".")) {
                      desc += required;
                    } else {
                      desc += (". " + required);
                    }
                  }
                  myDescriptionLabel.setText(desc);
                } else {
                  myDescriptionLabel.setText(null);
                }
              }
            });

    myRestoreDefaultsAction = new RestoreDefaultsAction();

    final DefaultActionGroup tbGroup = new DefaultActionGroup();
    tbGroup.add(new EditAction());
    tbGroup.add(new RevertAction());

    final ActionToolbar tb =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, tbGroup, true);
    tb.setTargetComponent(myTable);

    myContent.add(tb.getComponent(), BorderLayout.NORTH);
    new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false));
  }