com.intellij.util.ui.GridBag Java Examples

The following examples show how to use com.intellij.util.ui.GridBag. 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: CommentNodeRenderer.java    From Crucible4IDEA with MIT License 6 votes vote down vote up
CommentRendererPanel() {
  super(new BorderLayout());
  setOpaque(false);

  myIconLabel = new JBLabel();
  myMessageLabel = new JBLabel();
  myMessageLabel.setOpaque(false);

  JPanel actionsPanel = new JPanel();
  myPostLink = new LinkLabel("Publish", null);
  actionsPanel.add(myPostLink);

  myMainPanel = new JPanel(new GridBagLayout());
  GridBag bag = new GridBag()
    .setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP)
    .setDefaultPaddingY(UIUtil.DEFAULT_VGAP);
  myMainPanel.add(myIconLabel, bag.next().coverColumn().anchor(GridBagConstraints.NORTHWEST).weightx(0.1));
  myMainPanel.add(myMessageLabel, bag.next().fillCell().anchor(GridBagConstraints.NORTH).weightx(1.0));
  myMainPanel.add(myPostLink, bag.nextLine().anchor(GridBagConstraints.SOUTHEAST));

  add(myMainPanel);
}
 
Example #2
Source File: LiveTemplateSettingsEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());

  GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH);

  JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation"));
  keyPrompt.setLabelFor(myKeyField);
  panel.add(keyPrompt, gb.nextLine().next());

  panel.add(myKeyField, gb.next().weightx(1));

  JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description"));
  descriptionPrompt.setLabelFor(myDescription);
  panel.add(descriptionPrompt, gb.next());

  panel.add(myDescription, gb.next().weightx(3));
  return panel;
}
 
Example #3
Source File: DesktopEditorAnalyzeStatusPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateContents(@Nonnull java.util.List<StatusItem> status) {
  removeAll();

  setEnabled(!status.isEmpty());
  setVisible(!status.isEmpty());

  GridBag gc = new GridBag().nextLine();
  if (status.size() == 1 && StringUtil.isEmpty(status.get(0).getText())) {
    add(createStyledLabel(null, status.get(0).getIcon(), SwingConstants.CENTER), gc.next().weightx(1).fillCellHorizontally());
  }
  else if (status.size() > 0) {
    int leftRightOffset = JBUIScale.scale(LEFT_RIGHT_INDENT);
    add(Box.createHorizontalStrut(leftRightOffset), gc.next());

    int counter = 0;
    for (StatusItem item : status) {
      add(createStyledLabel(item.getText(), item.getIcon(), SwingConstants.LEFT), gc.next().insetLeft(counter++ > 0 ? INTER_GROUP_OFFSET : 0));
    }

    add(Box.createHorizontalStrut(leftRightOffset), gc.next());
  }
}
 
Example #4
Source File: ArrangementGroupingRulesPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public ArrangementGroupingRulesPanel(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                     @Nonnull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  myControl = new ArrangementGroupingRulesControl(settingsManager, colorsProvider);

  TitleWithToolbar top = new TitleWithToolbar(
          ApplicationBundle.message("arrangement.settings.section.groups"),
          ArrangementConstants.ACTION_GROUP_GROUPING_RULES_CONTROL_TOOLBAR,
          ArrangementConstants.GROUPING_RULES_CONTROL_TOOLBAR_PLACE,
          myControl
  );

  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(myControl, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
 
Example #5
Source File: SelectFileTemplateDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
@NotNull
private JPanel getOptionsPanel(final JPanel root) {
    JPanel options = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag()
            .setDefaultInsets(new JBInsets(0, 4, 0, 4))
            .setDefaultFill(GridBagConstraints.HORIZONTAL);

    cbAddInternal = new JBCheckBox("Internal");
    cbAddJ2EE = new JBCheckBox("J2EE");

    ItemListener itemListener = e -> {
        root.remove(comboBox);
        comboBox = getSelector();
        root.add(comboBox);
        root.revalidate();
    };

    cbAddInternal.addItemListener(itemListener);
    cbAddJ2EE.addItemListener(itemListener);

    options.add(cbAddInternal, bag.nextLine().next());
    options.add(cbAddJ2EE, bag.next());
    return options;
}
 
Example #6
Source File: TitleWithToolbar.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TitleWithToolbar(@Nonnull String title,
                        @Nonnull String actionGroupId,
                        @Nonnull String place,
                        @Nonnull JComponent targetComponent)
{
  super(new GridBagLayout());
  ActionManager actionManager = ActionManager.getInstance();
  ActionGroup group = (ActionGroup)actionManager.getAction(actionGroupId);
  ActionToolbar actionToolbar = actionManager.createActionToolbar(place, group, true);
  actionToolbar.setTargetComponent(targetComponent);
  actionToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);

  add(new MyTitleComponent(title), new GridBag().weightx(1).anchor(GridBagConstraints.WEST).fillCellHorizontally());
  add(actionToolbar.getComponent(), new GridBag().anchor(GridBagConstraints.CENTER));
}
 
Example #7
Source File: GridBagFactory.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
public static GridBag getBagForDirectory() {
    return new GridBag()
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 1)
            .setDefaultInsets(defaultInsets)
            .setDefaultFill(GridBagConstraints.HORIZONTAL);
}
 
Example #8
Source File: InlineProgressIndicator.java    From consulo with Apache License 2.0 5 votes vote down vote up
static JPanel createButtonPanel(Iterable<? extends JComponent> components) {
  JPanel iconsPanel = new NonOpaquePanel(new GridBagLayout());
  GridBag gb = new GridBag().setDefaultFill(GridBagConstraints.BOTH);
  for (JComponent component : components) {
    iconsPanel.add(component, gb.next());
  }
  return iconsPanel;
}
 
Example #9
Source File: GridBagFactory.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
public static GridBag getBagForPackageTemplate() {
    return new GridBag()
            .setDefaultInsets(defaultInsets)
            .setDefaultFill(GridBagConstraints.HORIZONTAL)
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 1);
}
 
Example #10
Source File: ArrangementRuleAliasesPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ArrangementRuleAliasesPanel(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                   @Nonnull ArrangementColorsProvider colorsProvider) {
  super(new GridBagLayout());
  setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
  JBScrollPane scrollPane = new JBScrollPane();
  final JViewport viewport = scrollPane.getViewport();
  ArrangementMatchingRulesControl.RepresentationCallback callback = new ArrangementMatchingRulesControl.RepresentationCallback() {
    @Override
    public void ensureVisible(@Nonnull Rectangle r) {
      Rectangle visibleRect = viewport.getViewRect();
      if (r.y <= visibleRect.y) {
        return;
      }

      int excessiveHeight = r.y + r.height - (visibleRect.y + visibleRect.height);
      if (excessiveHeight <= 0) {
        return;
      }

      int verticalShift = Math.min(r.y - visibleRect.y, excessiveHeight);
      if (verticalShift > 0) {
        viewport.setViewPosition(new Point(visibleRect.x, visibleRect.y + verticalShift));
      }
    }
  };
  myControl = new ArrangementRuleAliasControl(settingsManager, colorsProvider, callback);
  scrollPane.setViewportView(myControl);
  CustomizationUtil.installPopupHandler(
          myControl, ArrangementConstants.ALIAS_RULE_CONTEXT_MENU, ArrangementConstants.ALIAS_RULE_CONTROL_PLACE
  );

  TitleWithToolbar top = new TitleWithToolbar(
          ApplicationBundle.message("arrangement.settings.section.rule.sequence"),
          ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR,
          ArrangementConstants.ALIAS_RULE_CONTROL_TOOLBAR_PLACE,
          myControl
  );
  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(scrollPane, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
 
Example #11
Source File: ArrangementMatchingRuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private MultiRowFlowPanel addRowIfNecessary(@Nonnull MultiRowFlowPanel panel) {
  if (panel.getComponentCount() <= 0) {
    return panel;
  }
  add(panel, new GridBag().anchor(GridBagConstraints.WEST).weightx(1).fillCellHorizontally().coverLine());
  myRows.add(panel);
  return new MultiRowFlowPanel(
          FlowLayout.LEFT, ArrangementConstants.HORIZONTAL_GAP, ArrangementConstants.VERTICAL_GAP
  );
}
 
Example #12
Source File: ArrangementAnimationPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ArrangementAnimationPanel(@Nonnull JComponent content, boolean expand, boolean horizontal) {
  super(new GridBagLayout());
  myContent = content;
  myExpand = expand;
  myHorizontal = horizontal;
  add(content, new GridBag().fillCell().weightx(1).weighty(1));
  setOpaque(false);
  setBackground(UIUtil.getListBackground());
  doLayout();
}
 
Example #13
Source File: ExternalProjectPathField.java    From consulo with Apache License 2.0 5 votes vote down vote up
public MyPathAndProjectButtonPanel(@Nonnull EditorTextField textField,
                                   @Nonnull FixedSizeButton registeredProjectsButton)
{
  super(new GridBagLayout());
  myTextField = textField;
  myRegisteredProjectsButton = registeredProjectsButton;
  add(myTextField, new GridBag().weightx(1).fillCellHorizontally());
  add(myRegisteredProjectsButton, new GridBag().insets(0, 3, 0, 0));
}
 
Example #14
Source File: ScriptDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
@Override
public void preShow() {
    panel.setLayout(new GridBagLayout());
    GridBag gridBag = GridBagFactory.getBagForScriptDialog();

    createEditorField();
    createViews();

    panel.add(etfCode, gridBag.nextLine().next().weighty(1).fillCell());
    panel.add(etfName, gridBag.nextLine().next());
    panel.add(btnTry, gridBag.nextLine().next().insets(4, 0, 4, 0));
    panel.add(jlResult, gridBag.nextLine().next());
}
 
Example #15
Source File: DiffSplitter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected Divider createDivider() {
  return new DividerImpl() {
    @Override
    public void setOrientation(boolean isVerticalSplit) {
      removeAll();
      setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));

      List<JComponent> actionComponents = ContainerUtil.list(createActionComponent(myTopAction),
                                                             createActionComponent(myBottomAction));
      List<JComponent> syncComponents = DiffUtil.createSyncHeightComponents(actionComponents);


      GridBag bag = new GridBag();

      if (syncComponents.get(0) != null) {
        add(syncComponents.get(0), bag.nextLine());
        add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine());
      }

      add(new JLabel(AllIcons.General.SplitGlueH), bag.nextLine());

      if (syncComponents.get(1) != null) {
        add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine());
        add(syncComponents.get(1), bag.nextLine());
      }


      revalidate();
      repaint();
    }

    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      if (myPainter != null) myPainter.paint(g, this);
    }
  };
}
 
Example #16
Source File: PantsProjectSettingsControl.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel) {
  PantsProjectSettings initialSettings = getInitialSettings();
  myLibsWithSourcesCheckBox.setSelected(initialSettings.libsWithSources);
  myEnableIncrementalImportCheckBox.setSelected(initialSettings.incrementalImportEnabled);
  myImportDepthSpinner.setValue(initialSettings.incrementalImportDepth);
  myUseIdeaProjectJdkCheckBox.setSelected(initialSettings.useIdeaProjectJdk);
  myImportSourceDepsAsJarsCheckBox.setSelected(initialSettings.importSourceDepsAsJars);
  myUseIntellijCompilerCheckBox.setSelected(initialSettings.useIntellijCompiler);
  LinkLabel<?> intellijCompilerHelpMessage = LinkLabel.create(
    PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge"),
    () -> BrowserUtil.browse(PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge.link"))
  );

  myTargetSpecsBox.setItems(initialSettings.getAllAvailableTargetSpecs(), x -> x);
  initialSettings.getSelectedTargetSpecs().forEach(spec -> myTargetSpecsBox.setItemSelected(spec, true));

  insertNameFieldBeforeProjectPath(content);

  List<JComponent> boxes = ContainerUtil.newArrayList(
    myLibsWithSourcesCheckBox,
    myEnableIncrementalImportCheckBox,
    myImportDepthPanel,
    myUseIdeaProjectJdkCheckBox,
    myImportSourceDepsAsJarsCheckBox,
    myUseIntellijCompilerCheckBox,
    intellijCompilerHelpMessage,
    new JBLabel(PantsBundle.message("pants.settings.text.targets")),
    new JBScrollPane(myTargetSpecsBox)
  );

  GridBag lineConstraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);

  for (JComponent component : boxes) {
    content.add(component, lineConstraints);
  }
}
 
Example #17
Source File: ArrangementGroupingComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void init() {
  setLayout(new GridBagLayout());
  add(myRowIndexControl,
      new GridBag().anchor(GridBagConstraints.CENTER)
        .insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, ArrangementConstants.HORIZONTAL_GAP * 2)
  );
  add(myGroupingTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST).insets(0, 0, 0, 2));
  if (myOrderTypeToken != null) {
    add(myOrderTypeToken.getUiComponent(), new GridBag().anchor(GridBagConstraints.WEST));
  }
  add(new JLabel(" "), new GridBag().weightx(1).fillCellHorizontally());
  
  setBackground(UIUtil.getListBackground());
  setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
}
 
Example #18
Source File: UiUtil.java    From intellij with Apache License 2.0 5 votes vote down vote up
public static GridBag getFillLineConstraints(int indentLevel) {
  Insets insets = new Insets(INSETS, INSETS + INSETS * indentLevel, 0, INSETS);
  return new GridBag()
      .weightx(1)
      .coverLine()
      .fillCellHorizontally()
      .anchor(GridBagConstraints.WEST)
      .insets(insets);
}
 
Example #19
Source File: ArrangementListRowDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void init() {
  setLayout(new GridBagLayout());
  GridBag constraints = new GridBag().anchor(GridBagConstraints.CENTER)
          .insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, ArrangementConstants.HORIZONTAL_GAP * 2);
  add(myRowIndexControl, constraints);
  add(new InsetsPanel(mySortLabel), new GridBag().anchor(GridBagConstraints.CENTER).insets(0, 0, 0, ArrangementConstants.HORIZONTAL_GAP));
  add(myDelegate.getUiComponent(), new GridBag().weightx(1).anchor(GridBagConstraints.WEST));
  add(myEditButton, new GridBag().anchor(GridBagConstraints.EAST));
  setBorder(IdeBorderFactory.createEmptyBorder(ArrangementConstants.VERTICAL_GAP));
}
 
Example #20
Source File: GridBagFactory.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
public static GridBag getOptionsPanelGridBag() {
    return new GridBag()
            .setDefaultWeightX(0, 0)
            .setDefaultWeightX(1, 0)
            .setDefaultWeightX(2, 1)
            .setDefaultFill(GridBagConstraints.HORIZONTAL);
}
 
Example #21
Source File: AbstractArrangementUiComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected JComponent compute() {
  JPanel result = new JPanel(new GridBagLayout()) {
    @Override
    protected void paintComponent(Graphics g) {
      Point point = UIUtil.getLocationOnScreen(this);
      if (point != null) {
        Rectangle bounds = getBounds();
        myScreenBounds = new Rectangle(point.x, point.y, bounds.width, bounds.height);
      }
      if (!myEnabled && g instanceof Graphics2D) {
        ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f));
      }
      super.paintComponent(g);
    }

    @Override
    public boolean isFocusOwner() {
      Component[] components = getComponents();
      if (components != null) {
        for (Component component : components) {
          if (component.isFocusOwner()) {
            return true;
          }
        }
      }
      return false;
    }

    @Override
    public boolean requestFocusInWindow() {
      if (getComponentCount() > 0) {
        return getComponent(0).requestFocusInWindow();
      }
      else {
        return super.requestFocusInWindow();
      }
    }
  };
  result.setOpaque(false);
  result.add(doGetUiComponent(), new GridBag().fillCell());
  return result;
}
 
Example #22
Source File: InsetsPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InsetsPanel(@Nonnull JComponent content) {
  super(new GridBagLayout());
  setOpaque(false);
  myContent = content;
  add(myContent, new GridBag().fillCell().weightx(1).weighty(1));
}
 
Example #23
Source File: ArrangementMatchingRulesPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ArrangementMatchingRulesPanel(@Nonnull Language language,
                                     @Nonnull ArrangementStandardSettingsManager settingsManager,
                                     @Nonnull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  JBScrollPane scrollPane = new JBScrollPane();
  final JViewport viewport = scrollPane.getViewport();
  ArrangementSectionRulesControl.RepresentationCallback callback = new ArrangementSectionRulesControl.RepresentationCallback() {
    @Override
    public void ensureVisible(@Nonnull Rectangle r) {
      Rectangle visibleRect = viewport.getViewRect();
      if (r.y <= visibleRect.y) {
        return;
      }

      int excessiveHeight = r.y + r.height - (visibleRect.y + visibleRect.height);
      if (excessiveHeight <= 0) {
        return;
      }

      int verticalShift = Math.min(r.y - visibleRect.y, excessiveHeight);
      if (verticalShift > 0) {
        viewport.setViewPosition(new Point(visibleRect.x, visibleRect.y + verticalShift));
      }
    }
  };
  myControl = createRulesControl(language, settingsManager, colorsProvider, callback);
  scrollPane.setViewportView(myControl);
  CustomizationUtil.installPopupHandler(
          myControl, ArrangementConstants.ACTION_GROUP_MATCHING_RULES_CONTEXT_MENU, ArrangementConstants.MATCHING_RULES_CONTROL_PLACE
  );

  TitleWithToolbar top = new TitleWithToolbar(
          ApplicationBundle.message("arrangement.settings.section.match"),
          ArrangementConstants.ACTION_GROUP_MATCHING_RULES_CONTROL_TOOLBAR,
          ArrangementConstants.MATCHING_RULES_CONTROL_TOOLBAR_PLACE,
          myControl
  );
  add(top, new GridBag().coverLine().fillCellHorizontally().weightx(1));
  add(scrollPane, new GridBag().fillCell().weightx(1).weighty(1).insets(0, ArrangementConstants.HORIZONTAL_PADDING, 0, 0));
}
 
Example #24
Source File: EmptyArrangementRuleComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
public EmptyArrangementRuleComponent(int height) {
  super(new GridBagLayout());
  myHeight = height;
  add(new JLabel(ApplicationBundle.message("arrangement.text.empty.rule")), new GridBag().anchor(GridBagConstraints.WEST));
  setBackground(UIUtil.getDecoratedRowColor());
}
 
Example #25
Source File: CustomFileTypeEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected JComponent createCenterPanel() {
  JPanel panel = new JPanel(new BorderLayout());

  JPanel fileTypePanel = new JPanel(new BorderLayout());
  JPanel info = FormBuilder.createFormBuilder()
    .addLabeledComponent(IdeBundle.message("editbox.customfiletype.name"), myFileTypeName)
    .addLabeledComponent(IdeBundle.message("editbox.customfiletype.description"), myFileTypeDescr).getPanel();
  info.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
  fileTypePanel.add(info, BorderLayout.NORTH);

  JPanel highlighterPanel = new JPanel();
  highlighterPanel.setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("group.customfiletype.syntax.highlighting"), false));
  highlighterPanel.setLayout(new BorderLayout());
  JPanel commentsAndNumbersPanel = new JPanel();
  commentsAndNumbersPanel.setLayout(new GridBagLayout());

  JPanel _panel1 = new JPanel(new BorderLayout());
  GridBag gb = new GridBag()
    .setDefaultFill(GridBagConstraints.HORIZONTAL)
    .setDefaultAnchor(GridBagConstraints.WEST)
    .setDefaultInsets(1, 5, 1, 5);

  commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.line.comment")), gb.nextLine().next());
  commentsAndNumbersPanel.add(myLineComment, gb.next());
  commentsAndNumbersPanel.add(myCommentAtLineStart, gb.next().coverLine(2));

  commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.start")), gb.nextLine().next());
  commentsAndNumbersPanel.add(myBlockCommentStart, gb.next());
  commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.block.comment.end")), gb.next());
  commentsAndNumbersPanel.add(myBlockCommentEnd, gb.next());

  commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.hex.prefix")), gb.nextLine().next());
  commentsAndNumbersPanel.add(myHexPrefix, gb.next());
  commentsAndNumbersPanel.add(new JLabel(IdeBundle.message("editbox.customfiletype.number.postfixes")), gb.next());
  commentsAndNumbersPanel.add(myNumPostfixes, gb.next());

  commentsAndNumbersPanel.add(mySupportBraces, gb.nextLine().next().coverLine(2));
  commentsAndNumbersPanel.add(mySupportBrackets, gb.next().next().coverLine(2));
  commentsAndNumbersPanel.add(mySupportParens, gb.nextLine().next().coverLine(2));
  commentsAndNumbersPanel.add(mySupportEscapes, gb.next().next().coverLine(2));

  _panel1.add(commentsAndNumbersPanel, BorderLayout.WEST);


  highlighterPanel.add(_panel1, BorderLayout.NORTH);

  TabbedPaneWrapper tabbedPaneWrapper = new TabbedPaneWrapper(this);
  tabbedPaneWrapper.getComponent().setBorder(IdeBorderFactory.createTitledBorder(IdeBundle.message("listbox.customfiletype.keywords"),
                                                                                 false));
  tabbedPaneWrapper.addTab(" 1 ", createKeywordsPanel(0));
  tabbedPaneWrapper.addTab(" 2 ", createKeywordsPanel(1));
  tabbedPaneWrapper.addTab(" 3 ", createKeywordsPanel(2));
  tabbedPaneWrapper.addTab(" 4 ", createKeywordsPanel(3));

  highlighterPanel.add(tabbedPaneWrapper.getComponent(), BorderLayout.CENTER);
  highlighterPanel.add(myIgnoreCase, BorderLayout.SOUTH);

  fileTypePanel.add(highlighterPanel, BorderLayout.CENTER);

  panel.add(fileTypePanel);

  for (int i = 0; i < myKeywordsLists.length; i++) {
    final int idx = i;
    new DoubleClickListener() {
      @Override
      protected boolean onDoubleClick(MouseEvent e) {
        edit(idx);
        return true;
      }
    }.installOn(myKeywordsLists[i]);
  }


  return panel;
}
 
Example #26
Source File: ExternalSystemUiUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void fillBottom(@Nonnull JComponent component) {
  component.add(Box.createVerticalGlue(), new GridBag().weightx(1).weighty(1).fillCell().coverLine());
}
 
Example #27
Source File: ExternalSystemUiUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static GridBag getFillLineConstraints(int indentLevel) {
  Insets insets = new Insets(INSETS, INSETS + INSETS * indentLevel, 0, INSETS);
  return new GridBag().weightx(1).coverLine().fillCellHorizontally().anchor(GridBagConstraints.WEST).insets(insets);
}
 
Example #28
Source File: ExternalSystemUiUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static GridBag getLabelConstraints(int indentLevel) {
  Insets insets = new Insets(INSETS, INSETS + INSETS * indentLevel, 0, INSETS);
  return new GridBag().anchor(GridBagConstraints.WEST).weightx(0).insets(insets);
}
 
Example #29
Source File: ExternalSystemTaskSettingsControl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void fillUi(@Nonnull final PaintAwarePanel canvas, int indentLevel) {
  myProjectPathLabel = new JBLabel(ExternalSystemBundle.message(
    "run.configuration.settings.label.project", myExternalSystemId.getReadableName()
  ));
  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
  FileChooserDescriptor projectPathChooserDescriptor = null;
  if (manager instanceof ExternalSystemUiAware) {
    projectPathChooserDescriptor = ((ExternalSystemUiAware)manager).getExternalProjectConfigDescriptor();
  }
  if (projectPathChooserDescriptor == null) {
    projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
  }
  String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName());
  myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) {
    @Override
    public Dimension getPreferredSize() {
      return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize();
    }
  };
  canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0));

  myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks"));
  myTasksTextField = new JBTextField(ExternalSystemConstants.TEXT_FIELD_WIDTH_IN_COLUMNS);
  canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0);
  c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8 /* street magic, sorry */;
  canvas.add(myTasksTextField, c);

  myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
  myVmOptionsEditor = new RawCommandLineEditor();
  myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
  canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
  myScriptParametersLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters"));
  myScriptParametersEditor = new RawCommandLineEditor();
  myScriptParametersEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters"));
  canvas.add(myScriptParametersLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myScriptParametersEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
}
 
Example #30
Source File: UiUtil.java    From intellij with Apache License 2.0 4 votes vote down vote up
public static void fillBottom(JComponent component) {
  component.add(
      Box.createVerticalGlue(), new GridBag().weightx(1).weighty(1).fillCell().coverLine());
}