com.intellij.ui.border.CustomLineBorder Java Examples

The following examples show how to use com.intellij.ui.border.CustomLineBorder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseWelcomeScreenPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
public BaseWelcomeScreenPanel(@Nonnull Disposable parentDisposable) {
  super(new BorderLayout());
  myLeftComponent = createLeftComponent(parentDisposable);

  JPanel leftPanel = new JPanel(new BorderLayout());
  leftPanel.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), JBUI.insetsRight(1)));
  leftPanel.setPreferredSize(JBUI.size(300, 460));
  leftPanel.add(myLeftComponent, BorderLayout.CENTER);

  add(leftPanel, BorderLayout.WEST);

  JComponent rightComponent = createRightComponent();

  add(rightComponent, BorderLayout.CENTER);
}
 
Example #2
Source File: IdeMenuBar.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Border getBorder() {
  //avoid moving lines
  if (myState == State.EXPANDING || myState == State.COLLAPSING) {
    return new EmptyBorder(0, 0, 0, 0);
  }

  //fix for Darcula double border
  if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) {
    return new CustomLineBorder(Gray._75, 0, 0, 1, 0);
  }

  //save 1px for mouse handler
  if (myState == State.COLLAPSED) {
    return new EmptyBorder(0, 0, 1, 0);
  }

  return UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ? super.getBorder() : null;
}
 
Example #3
Source File: DesktopProjectStructureDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected JComponent createSouthPanel() {
  JComponent southPanel = super.createSouthPanel();
  if (southPanel != null) {
    southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets));
    BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel);
    borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0));
    return borderLayoutPanel;
  }
  return null;
}
 
Example #4
Source File: ToolbarPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ToolbarPanel(JComponent contentComponent, ActionGroup actions) {
  super(new GridBagLayout());
  setBorder(new CustomLineBorder(1, 0, 0, 0));
  if (contentComponent.getBorder() != null) {
    contentComponent.setBorder(BorderFactory.createEmptyBorder());
  }
  final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true);
  add(actionToolbar.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  add(contentComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
 
Example #5
Source File: ToolbarDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ToolbarDecorator setToolbarPosition(ActionToolbarPosition position) {
  myToolbarPosition = position;
  myActionsPanelBorder =
          new CustomLineBorder(myToolbarPosition == ActionToolbarPosition.BOTTOM ? 1 : 0, myToolbarPosition == ActionToolbarPosition.RIGHT ? 1 : 0,
                               myToolbarPosition == ActionToolbarPosition.TOP ? 1 : 0, myToolbarPosition == ActionToolbarPosition.LEFT ? 1 : 0);
  return this;
}
 
Example #6
Source File: UiInspectorAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Color getBorderColor(@Nonnull Border value) {
  if (value instanceof LineBorder) {
    return ((LineBorder)value).getLineColor();
  }
  else if (value instanceof CustomLineBorder) {
    try {
      return (Color)ReflectionUtil.findField(CustomLineBorder.class, Color.class, "myColor").get(value);
    }
    catch (Exception ignore) {
    }
  }

  return null;
}
 
Example #7
Source File: PlatformOrPluginDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected JComponent createSouthPanel() {
  JComponent southPanel = super.createSouthPanel();
  if (southPanel != null) {
    southPanel.add(new JBLabel("Following nodes will be downloaded & installed"), BorderLayout.WEST);
    southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets));

    BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel);
    borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0));
    return borderLayoutPanel;
  }
  return null;
}
 
Example #8
Source File: DesktopSettingsDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected JComponent createSouthPanel() {
  JComponent southPanel = super.createSouthPanel();
  if (southPanel != null) {
    southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets));
    BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel);
    borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0));
    return borderLayoutPanel;
  }
  return null;
}
 
Example #9
Source File: LayoutTreeComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void createPropertiesPanel() {
  myPropertiesPanel = new JPanel(new BorderLayout());
  final JPanel emptyPanel = new JPanel();
  emptyPanel.setMinimumSize(new Dimension(0, 0));
  emptyPanel.setPreferredSize(new Dimension(0, 0));

  myPropertiesPanelWrapper = new JPanel(new CardLayout());
  myPropertiesPanel.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, 0, 0));
  myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel);
  myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel);
}
 
Example #10
Source File: AddModuleDependencyDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected JComponent createSouthPanel() {
  JComponent southPanel = super.createSouthPanel();
  if(southPanel != null) {
    southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets));
    BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel);
    borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0));
    return borderLayoutPanel;
  }
  return null;
}
 
Example #11
Source File: StripeTabPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public StripeTabPanel() {
  super(new BorderLayout());
  myTabPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
  myTabPanel.setBorder(new CustomLineBorder(0, 0, 0, JBUI.scale(1)));

  add(myTabPanel, BorderLayout.WEST);

  myContentPanel = new JPanel(new CardLayout());
  add(myContentPanel, BorderLayout.CENTER);
}
 
Example #12
Source File: EditorHeaderComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
public EditorHeaderComponent() {
  super(new BorderLayout(0, 0));
  boolean topBorderRequired = !SystemInfo.isMac && UISettings.getInstance().EDITOR_TAB_PLACEMENT != UISettings.PLACEMENT_EDITOR_TAB_TOP &&
                              !(UISettings.getInstance().SHOW_MAIN_TOOLBAR && UISettings.getInstance().SHOW_NAVIGATION_BAR);
  setBorder(new CustomLineBorder(JBColor.border(), topBorderRequired ? 1 : 0, 0, 1, 0));
}
 
Example #13
Source File: JBUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static Border customLine(Color color, int top, int left, int bottom, int right) {
  return new CustomLineBorder(color, insets(top, left, bottom, right));
}
 
Example #14
Source File: ContentEntriesEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JPanel createComponentImpl() {
  final Module module = getModule();
  final Project project = module.getProject();

  myContentEntryEditorListener = new MyContentEntryEditorListener();

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

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

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddContentEntryAction action = new AddContentEntryAction();
  action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
  group.add(action);

  myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
  myEditorsPanel.setBackground(BACKGROUND_COLOR);
  JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);
  entriesPanel.add(new ToolbarPanel(myScrollPane, group), BorderLayout.CENTER);

  final JBSplitter splitter = new OnePixelSplitter(false);
  splitter.setProportion(0.6f);
  splitter.setHonorComponentsMinimumSize(true);

  myRootTreeEditor = new ContentEntryTreeEditor(project, myState);
  JComponent component = myRootTreeEditor.createComponent();
  component.setBorder(new CustomLineBorder(JBUI.scale(1),0,0,0));

  splitter.setFirstComponent(component);
  splitter.setSecondComponent(entriesPanel);
  JPanel contentPanel = new JPanel(new GridBagLayout());

  final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
  contentPanel.add(new JLabel("Mark as:"),
                   new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, new JBInsets(0, 5, 0, 5), 0,
                                          0));
  contentPanel.add(actionToolbar.getComponent(),
                   new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                                          new JBInsets(0, 0, 0, 0), 0, 0));
  contentPanel.add(splitter,
                   new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
                                          new JBInsets(0, 0, 0, 0), 0, 0));

  mainPanel.add(contentPanel, BorderLayout.CENTER);

  final ModifiableRootModel model = getModel();
  if (model != null) {
    final ContentEntry[] contentEntries = model.getContentEntries();
    if (contentEntries.length > 0) {
      for (final ContentEntry contentEntry : contentEntries) {
        addContentEntryPanel(contentEntry);
      }
      selectContentEntry(contentEntries[0]);
    }
  }

  return mainPanel;
}
 
Example #15
Source File: CodeStyleAbstractPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void installPreviewPanel(final JPanel previewPanel) {
  previewPanel.setLayout(new BorderLayout());
  previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
  previewPanel.setBorder(new CustomLineBorder(0, 1, 0, 0));
}
 
Example #16
Source File: XWatchesViewImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public XWatchesViewImpl(@Nonnull XDebugSessionImpl session, boolean watchesInVariables) {
  super(session);
  myWatchesInVariables = watchesInVariables;

  XDebuggerTree tree = getTree();
  createNewRootNode(null);

  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XNEW_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XREMOVE_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XCOPY_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XEDIT_WATCH, tree, myDisposables);

  EmptyAction.registerWithShortcutSet(XDebuggerActions.XNEW_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD), tree);
  EmptyAction.registerWithShortcutSet(XDebuggerActions.XREMOVE_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE), tree);

  DnDManager.getInstance().registerTarget(this, tree);

  new AnAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      Object contents = CopyPasteManager.getInstance().getContents(XWatchTransferable.EXPRESSIONS_FLAVOR);
      if (contents instanceof List) {
        for (Object item : ((List)contents)){
          if (item instanceof XExpression) {
            addWatchExpression(((XExpression)item), -1, true);
          }
        }
      }
    }
  }.registerCustomShortcutSet(CommonShortcuts.getPaste(), tree, myDisposables);

  ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(
          ActionPlaces.DEBUGGER_TOOLBAR,
          DebuggerSessionTabBase.getCustomizedActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP),
          !myWatchesInVariables);
  toolbar.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 0, 0,
                                         myWatchesInVariables ? 0 : 1,
                                         myWatchesInVariables ? 1 : 0));
  toolbar.setTargetComponent(tree);

  if (!myWatchesInVariables) {
    getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches"));
  }
  getPanel().add(toolbar.getComponent(), myWatchesInVariables ? BorderLayout.WEST : BorderLayout.NORTH);

  installEditListeners();
}
 
Example #17
Source File: PluginManagerMain.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void init() {
  GuiUtils.replaceJSplitPaneWithIDEASplitter(main);
  myDescriptionTextArea.setEditorKit(UIUtil.getHTMLEditorKit());
  myDescriptionTextArea.setEditable(false);
  myDescriptionTextArea.addHyperlinkListener(new MyHyperlinkListener());

  JScrollPane installedScrollPane = createTable();
  myPluginHeaderPanel = new PluginHeaderPanel(this, getPluginTable());
  myHeader.setBackground(UIUtil.getTextFieldBackground());
  myPluginHeaderPanel.getPanel().setBackground(UIUtil.getTextFieldBackground());
  myPluginHeaderPanel.getPanel().setOpaque(true);

  myHeader.add(myPluginHeaderPanel.getPanel(), BorderLayout.CENTER);
  installTableActions();

  myTablePanel.add(installedScrollPane, BorderLayout.CENTER);
  UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, myPanelDescription);
  myPanelDescription.setBorder(JBUI.Borders.empty(0, 7, 0, 0));

  final JPanel header = new JPanel(new BorderLayout()) {
    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      final Color bg = UIUtil.getTableBackground(false);
      ((Graphics2D)g).setPaint(new GradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, getHeight(), ColorUtil.shift(bg, 0.9)));
      g.fillRect(0, 0, getWidth(), getHeight());
    }
  };
  header.setBorder(new CustomLineBorder(JBUI.scale(1), JBUI.scale(1), 0, JBUI.scale(1)));
  final JLabel mySortLabel = new JLabel();
  mySortLabel.setForeground(UIUtil.getLabelDisabledForeground());
  mySortLabel.setBorder(JBUI.Borders.empty(1, 1, 1, 5));
  mySortLabel.setIcon(AllIcons.General.SplitDown);
  mySortLabel.setHorizontalTextPosition(SwingConstants.LEADING);
  header.add(mySortLabel, BorderLayout.EAST);
  myTablePanel.add(header, BorderLayout.NORTH);
  myToolbarPanel.setLayout(new BorderLayout());
  myActionToolbar = ActionManager.getInstance().createActionToolbar("PluginManager", getActionGroup(true), true);
  final JComponent component = myActionToolbar.getComponent();
  myToolbarPanel.add(component, BorderLayout.CENTER);
  myToolbarPanel.add(myFilter, BorderLayout.WEST);
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent event, int clickCount) {
      JBPopupFactory.getInstance().createActionGroupPopup("Sort by:", createSortersGroup(), DataManager.getInstance().getDataContext(myPluginTable),
                                                          JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).showUnderneathOf(mySortLabel);
      return true;
    }
  }.installOn(mySortLabel);
  final TableModelListener modelListener = new TableModelListener() {
    @Override
    public void tableChanged(TableModelEvent e) {
      String text = "Sort by:";
      if (myPluginsModel.isSortByStatus()) {
        text += " status,";
      }
      if (myPluginsModel.isSortByRating()) {
        text += " rating,";
      }
      if (myPluginsModel.isSortByDownloads()) {
        text += " downloads,";
      }
      if (myPluginsModel.isSortByUpdated()) {
        text += " updated,";
      }
      text += " name";
      mySortLabel.setText(text);
    }
  };
  myPluginTable.getModel().addTableModelListener(modelListener);
  modelListener.tableChanged(null);

  Border border = new BorderUIResource.LineBorderUIResource(new JBColor(Gray._220, Gray._55), JBUI.scale(1));
  myInfoPanel.setBorder(border);
}
 
Example #18
Source File: BaseItemSelectPanel.java    From EasyCode with MIT License 4 votes vote down vote up
/**
 * 获取面板
 */
public JComponent getComponent() {
    // 创建主面板
    JPanel mainPanel = new JPanel(new BorderLayout());
    // 左边的选择列表
    this.leftPanel = new JPanel(new BorderLayout());

    // 头部操作按钮
    JPanel headToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT));

    // 添加事件按钮
    DefaultActionGroup actionGroup = createActionGroup();

    ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("Item Toolbar", actionGroup, true);

    headToolbar.add(actionToolbar.getComponent());
    // 添加边框
    actionToolbar.getComponent().setBorder(new CustomLineBorder(1, 1, 1, 1));

    // 工具栏添加至左边面板的北边(上面)
    leftPanel.add(actionToolbar.getComponent(), BorderLayout.NORTH);

    // 元素列表
    listPanel = new JBList<>(dataConvert());
    // 只能单选
    listPanel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // 添加元素选中事件
    listPanel.addListSelectionListener(e -> {
        T item = getSelectedItem();
        if (item == null) {
            return;
        }
        selectedItem(item);
    });
    // 添加边框
    listPanel.setBorder(new CustomLineBorder(0, 1, 1, 1));

    // 将列表添加至左边面板的中间
    leftPanel.add(listPanel, BorderLayout.CENTER);

    // 右边面板
    this.rightPanel = new JPanel(new BorderLayout());

    // 左右分割面板并添加至主面板
    Splitter splitter = new Splitter(false, 0.2F);

    splitter.setFirstComponent(leftPanel);
    splitter.setSecondComponent(rightPanel);

    mainPanel.add(splitter, BorderLayout.CENTER);

    mainPanel.setPreferredSize(JBUI.size(400, 300));

    // 存在元素时,默认选中第一个元素
    if (!itemList.isEmpty()) {
        listPanel.setSelectedIndex(0);
    }

    return mainPanel;
}
 
Example #19
Source File: DiffPanelImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DiffPanelImpl(final Window owner, @Nonnull Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) {
  myProject = project;
  myIsHorizontal = horizontal;
  myParentTool = parentTool;
  myOptions = new DiffPanelOptions(this);
  myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null);
  myPanel.disableToolbar(!enableToolbar);
  if (enableToolbar) myPanel.resetToolbar();
  myOwnerWindow = owner;
  myIsSyncScroll = true;
  final boolean v = !horizontal;
  myLeftSide = new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1));
  myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0));
  myLeftSide.becomeMaster();
  myDiffUpdater = new Rediffers(this);

  myDiffDividerPolygonsOffset = diffDividerPolygonsOffset;

  myData = createDiffPanelState(this);

  if (horizontal) {
    mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData);
  }
  else {
    mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
  }

  myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel());
  myDataProvider = new MyGenericDataProvider(this);
  myPanel.setDataProvider(myDataProvider);

  final ComparisonPolicy comparisonPolicy = getComparisonPolicy();
  final ComparisonPolicy defaultComparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy();
  final HighlightMode highlightMode = getHighlightMode();
  final HighlightMode defaultHighlightMode = DiffManagerImpl.getInstanceEx().getHighlightMode();

  if (defaultComparisonPolicy != null && comparisonPolicy != defaultComparisonPolicy) {
    setComparisonPolicy(defaultComparisonPolicy);
  }
  if (defaultHighlightMode != null && highlightMode != defaultHighlightMode) {
    setHighlightMode(defaultHighlightMode);
  }
  myVisibleAreaListener = new VisibleAreaListener() {
    @Override
    public void visibleAreaChanged(VisibleAreaEvent e) {
      Editor editor1 = getEditor1();
      if (editor1 != null) {
        editor1.getComponent().repaint();
      }
      Editor editor2 = getEditor2();
      if (editor2 != null) {
        editor2.getComponent().repaint();
      }
    }
  };
  registerActions();
}
 
Example #20
Source File: EarlyAccessProgramConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  CheckBoxList checkBoxList = (CheckBoxList)list;
  EarlyAccessProgramDescriptor earlyAccessProgramDescriptor = (EarlyAccessProgramDescriptor)checkBoxList.getItemAt(index);

  JCheckBox checkbox = (JCheckBox)value;

  checkbox.setEnabled(list.isEnabled());
  checkbox.setFocusPainted(false);
  checkbox.setBorderPainted(true);

  if (earlyAccessProgramDescriptor == null) {
    return checkbox;
  }
  else {
    checkbox.setEnabled(earlyAccessProgramDescriptor.isAvailable());

    JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, true, true)) {
      @Override
      public Dimension getPreferredSize() {
        Dimension size = super.getPreferredSize();
        return new Dimension(Math.min(size.width, 200), size.height);
      }
    };
    panel.setEnabled(earlyAccessProgramDescriptor.isAvailable());

    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(checkbox, BorderLayout.WEST);

    if (earlyAccessProgramDescriptor.isRestartRequired()) {
      JBLabel comp = new JBLabel("Restart required");
      comp.setForeground(JBColor.GRAY);
      topPanel.add(comp, BorderLayout.EAST);
    }

    panel.add(topPanel);
    panel.setBorder(new CustomLineBorder(0, 0, 1, 0));

    String description = StringUtil.notNullizeIfEmpty(earlyAccessProgramDescriptor.getDescription(), "Description is not available");
    JTextPane textPane = new JTextPane();
    textPane.setText(description);
    textPane.setEditable(false);
    if (!earlyAccessProgramDescriptor.isAvailable()) {
      textPane.setForeground(JBColor.GRAY);
    }
    panel.add(textPane);
    return panel;
  }
}
 
Example #21
Source File: ToolbarDecorator.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ToolbarDecorator setLineBorder(int top, int left, int bottom, int right) {
  return setToolbarBorder(new CustomLineBorder(top, left, bottom, right));
}
 
Example #22
Source File: GraphConsoleView.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
public void initToolWindow(Project project, ToolWindow toolWindow) {
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = contentFactory.createContent(consoleToolWindowContent, "", false);
    toolWindow.getContentManager().addContent(content);

    if (!initialized) {
        updateLookAndFeel();
        initializeWidgets(project);
        initializeUiComponents(project);

        // Hide standard tabs
        defaultTabContainer.setVisible(false);

        // Tabs
        consoleTabs.setFirstTabOffset(0);
        consoleTabs.addTab(new TabInfo(logTab)
            .setText(Tabs.LOG));
        consoleTabs.addTab(new TabInfo(graphTab)
            .setText(Tabs.GRAPH));
        consoleTabs.addTab(new TabInfo(tableScrollPane)
            .setText(Tabs.TABLE));
        consoleTabs.addTab(new TabInfo(parametersTab)
            .setText(Tabs.PARAMETERS));
        consoleTabs.setSelectionChangeHandler((info, requestFocus, doChangeSelection) -> {
            Analytics.event("console", "openTab[" + info.getText() + "]");
            ActionCallback callback = doChangeSelection.run();
            graphPanel.resetPan();
            return callback;
        });

        project.getMessageBus().connect().subscribe(OpenTabEvent.OPEN_TAB_TOPIC, this::selectTab);

        AtomicInteger tabId = new AtomicInteger(0);
        project.getMessageBus().connect().subscribe(QueryPlanEvent.QUERY_PLAN_EVENT,
                (query, result) -> createNewQueryPlanTab(query, result, tabId.incrementAndGet()));

        // Actions
        final ActionGroup consoleActionGroup = (ActionGroup)
                ActionManager.getInstance().getAction(GraphConstants.Actions.CONSOLE_ACTIONS);
        ActionToolbar consoleToolbar = ActionManager.getInstance()
                .createActionToolbar(GraphConstants.ToolWindow.CONSOLE_TOOL_WINDOW, consoleActionGroup, false);
        consoleToolbarPanel.add(consoleToolbar.getComponent(), BorderLayout.CENTER);
        consoleToolbarPanel.setBorder(new CustomLineBorder(0, 0, 0, 1));
        consoleToolbarPanel.validate();
        initialized = true;
    }
}