Java 类com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager 实例源码

项目:intellij-ce-playground    文件:ArrangementRuleAliasDialog.java   
public ArrangementRuleAliasDialog(@Nullable Project project,
                                  @NotNull ArrangementStandardSettingsManager settingsManager,
                                  @NotNull ArrangementColorsProvider colorsProvider,
                                  @NotNull Collection<StdArrangementRuleAliasToken> tokens,
                                  @NotNull Set<String> tokensInUse) {
  super(project, false);

  final List<StdArrangementRuleAliasToken> tokenList = ContainerUtil.newArrayList(tokens);
  myEditor = new ArrangementRuleAliasesListEditor(settingsManager, colorsProvider, tokenList, tokensInUse);
  if (!tokenList.isEmpty()) {
    myEditor.selectItem(tokenList.get(0));
  }

  setTitle(ApplicationBundle.message("arrangement.settings.section.rule.custom.token.title"));
  init();
}
项目:intellij-ce-playground    文件:ArrangementGroupingRulesPanel.java   
public ArrangementGroupingRulesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull 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));
}
项目:intellij-ce-playground    文件:ArrangementGroupingRulesControl.java   
public ArrangementGroupingRulesControl(@NotNull ArrangementStandardSettingsManager settingsManager,
                                       @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new DefaultTableModel(0, 1));
  mySettingsManager = settingsManager;
  setDefaultRenderer(Object.class, new MyRenderer());
  getColumnModel().getColumn(0).setCellEditor(new MyEditor());
  setShowColumns(false);
  setShowGrid(false);
  setBorder(IdeBorderFactory.createBorder());
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  List<CompositeArrangementSettingsToken> groupingTokens = settingsManager.getSupportedGroupingTokens();
  if (groupingTokens != null) {
    for (CompositeArrangementSettingsToken token : groupingTokens) {
      ArrangementGroupingComponent component = new ArrangementGroupingComponent(token, colorsProvider, settingsManager);
      myComponents.put(token.getToken(), component);
      getModel().addRow(new Object[]{component});
    }
  }
}
项目:tools-idea    文件:ArrangementGroupingRulesPanel.java   
public ArrangementGroupingRulesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull 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));
}
项目:tools-idea    文件:ArrangementGroupingRulesControl.java   
public ArrangementGroupingRulesControl(@NotNull ArrangementStandardSettingsManager settingsManager,
                                       @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new DefaultTableModel(0, 1));
  mySettingsManager = settingsManager;
  setDefaultRenderer(Object.class, new MyRenderer());
  getColumnModel().getColumn(0).setCellEditor(new MyEditor());
  setShowColumns(false);
  setShowGrid(false);
  setBorder(IdeBorderFactory.createBorder());
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  List<CompositeArrangementSettingsToken> groupingTokens = settingsManager.getSupportedGroupingTokens();
  if (groupingTokens != null) {
    for (CompositeArrangementSettingsToken token : groupingTokens) {
      ArrangementGroupingComponent component = new ArrangementGroupingComponent(token, colorsProvider, settingsManager);
      myComponents.put(token.getToken(), component);
      getModel().addRow(new Object[]{component});
    }
  }
}
项目:consulo    文件:ArrangementRuleAliasDialog.java   
public ArrangementRuleAliasDialog(@Nullable Project project,
                                  @Nonnull ArrangementStandardSettingsManager settingsManager,
                                  @Nonnull ArrangementColorsProvider colorsProvider,
                                  @Nonnull Collection<StdArrangementRuleAliasToken> tokens,
                                  @Nonnull Set<String> tokensInUse) {
  super(project, false);

  final List<StdArrangementRuleAliasToken> tokenList = ContainerUtil.newArrayList(tokens);
  myEditor = new ArrangementRuleAliasesListEditor(settingsManager, colorsProvider, tokenList, tokensInUse);
  if (!tokenList.isEmpty()) {
    myEditor.selectItem(tokenList.get(0));
  }

  setTitle(ApplicationBundle.message("arrangement.settings.section.rule.custom.token.title"));
  init();
}
项目:consulo    文件:ArrangementGroupingRulesPanel.java   
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));
}
项目:consulo    文件:ArrangementGroupingRulesControl.java   
public ArrangementGroupingRulesControl(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                       @Nonnull ArrangementColorsProvider colorsProvider)
{
  super(new DefaultTableModel(0, 1));
  mySettingsManager = settingsManager;
  setDefaultRenderer(Object.class, new MyRenderer());
  getColumnModel().getColumn(0).setCellEditor(new MyEditor());
  setShowColumns(false);
  setShowGrid(false);
  setBorder(IdeBorderFactory.createBorder());
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  List<CompositeArrangementSettingsToken> groupingTokens = settingsManager.getSupportedGroupingTokens();
  if (groupingTokens != null) {
    for (CompositeArrangementSettingsToken token : groupingTokens) {
      ArrangementGroupingComponent component = new ArrangementGroupingComponent(token, colorsProvider, settingsManager);
      myComponents.put(token.getToken(), component);
      getModel().addRow(new Object[]{component});
    }
  }
}
项目:intellij-ce-playground    文件:ArrangementMatchNodeComponentFactory.java   
public ArrangementMatchNodeComponentFactory(@NotNull ArrangementStandardSettingsManager manager,
                                            @NotNull ArrangementColorsProvider provider,
                                            @NotNull ArrangementMatchingRulesControl list)
{
  mySettingsManager = manager;
  myColorsProvider = provider;
  myList = list;
}
项目:intellij-ce-playground    文件:ArrangementSectionRuleManager.java   
@Nullable
public static ArrangementSectionRuleManager getInstance(@NotNull Language language,
                                                        @NotNull ArrangementStandardSettingsManager settingsManager,
                                                        @NotNull ArrangementColorsProvider colorsProvider,
                                                        @NotNull ArrangementSectionRulesControl control) {
  if (settingsManager.isSectionRulesSupported()) {
    return new ArrangementSectionRuleManager(language, settingsManager, colorsProvider, control);
  }
  return null;
}
项目:intellij-ce-playground    文件:ArrangementSectionRuleManager.java   
private ArrangementSectionRuleManager(@NotNull Language language,
                                      @NotNull ArrangementStandardSettingsManager settingsManager,
                                      @NotNull ArrangementColorsProvider colorsProvider,
                                      @NotNull ArrangementSectionRulesControl control) {
  myCommenter = LanguageCommenters.INSTANCE.forLanguage(language);
  myControl = control;
  final List<CompositeArrangementSettingsToken> tokens = ContainerUtil.newArrayList();
  tokens.add(new CompositeArrangementSettingsToken(TYPE, ContainerUtil.newArrayList(START_SECTION, END_SECTION)));
  tokens.add(new CompositeArrangementSettingsToken(TEXT));
  myEditor = new ArrangementMatchingRuleEditor(settingsManager, tokens, colorsProvider, control);
}
项目:intellij-ce-playground    文件:ArrangementRuleAliasesListEditor.java   
protected ArrangementRuleAliasesListEditor(@NotNull ArrangementStandardSettingsManager settingsManager,
                                           @NotNull ArrangementColorsProvider colorsProvider,
                                           @NotNull List<StdArrangementRuleAliasToken> items,
                                           @NotNull Set<String> usedTokenIds) {
  super(NAMER, FACTORY, CLONER, COMPARER, items, false);
  mySettingsManager = settingsManager;
  myColorsProvider = colorsProvider;
  myUsedTokenIds = usedTokenIds;
  reset();
  initTree();
}
项目:intellij-ce-playground    文件:ArrangementRuleAliasesPanel.java   
public ArrangementRuleAliasesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                   @NotNull 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(@NotNull 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));
}
项目:intellij-ce-playground    文件:ArrangementRuleAliasConfigurable.java   
public ArrangementRuleAliasConfigurable(@NotNull ArrangementStandardSettingsManager settingsManager,
                                        @NotNull ArrangementColorsProvider colorsProvider,
                                        @NotNull StdArrangementRuleAliasToken token) {
  myToken = token;
  myTokenRulesPanel = new ArrangementRuleAliasesPanel(settingsManager, colorsProvider);
  myTokenRulesPanel.setRuleSequences(token.getDefinitionRules());

  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_ADD, CommonShortcuts.getNew(), myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_REMOVE, CommonShortcuts.getDelete(), myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_MOVE_UP, CommonShortcuts.MOVE_UP, myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_MOVE_DOWN, CommonShortcuts.MOVE_DOWN, myTokenRulesPanel);
  final CustomShortcutSet edit = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_EDIT, edit, myTokenRulesPanel);
}
项目:intellij-ce-playground    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@NotNull StdArrangementTokenUiRole role,
                                    @NotNull List<ArrangementSettingsToken> tokens,
                                    @NotNull ArrangementColorsProvider colorsProvider,
                                    @NotNull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}
项目:tools-idea    文件:ArrangementMatchNodeComponentFactory.java   
public ArrangementMatchNodeComponentFactory(@NotNull ArrangementStandardSettingsManager manager,
                                            @NotNull ArrangementColorsProvider provider,
                                            @NotNull ArrangementMatchingRulesControl list)
{
  mySettingsManager = manager;
  myColorsProvider = provider;
  myList = list;
}
项目:tools-idea    文件:ArrangementMatchingRuleEditor.java   
public ArrangementMatchingRuleEditor(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull ArrangementColorsProvider colorsProvider,
                                     @NotNull ArrangementMatchingRulesControl control)
{
  mySettingsManager = settingsManager;
  myColorsProvider = colorsProvider;
  myControl = control;
  init(settingsManager);
  addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      onMouseClicked(e);
    }
  });
}
项目:tools-idea    文件:ArrangementMatchingRuleEditor.java   
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());
}
项目:tools-idea    文件:ArrangementAndMatchConditionComponent.java   
public ArrangementAndMatchConditionComponent(@NotNull StdArrangementMatchRule rule,
                                             @NotNull ArrangementCompositeMatchCondition setting,
                                             @NotNull ArrangementMatchNodeComponentFactory factory,
                                             @NotNull ArrangementStandardSettingsManager manager)
{
  mySetting = setting;
  setOpaque(false);
  setLayout(new GridBagLayout());
  final Map<ArrangementSettingsToken, ArrangementMatchCondition> operands = ContainerUtilRt.newHashMap();
  ArrangementMatchConditionVisitor visitor = new ArrangementMatchConditionVisitor() {
    @Override
    public void visit(@NotNull ArrangementAtomMatchCondition condition) {
      operands.put(condition.getType(), condition);
    }

    @Override
    public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
      assert false;
    }
  };
  for (ArrangementMatchCondition operand : setting.getOperands()) {
    operand.invite(visitor);
  }

  List<ArrangementSettingsToken> ordered = manager.sort(operands.keySet());
  GridBagConstraints constraints = new GridBag().anchor(GridBagConstraints.EAST).insets(0, 0, 0, ArrangementConstants.HORIZONTAL_GAP);
  for (ArrangementSettingsToken key : ordered) {
    ArrangementMatchCondition operand = operands.get(key);
    assert operand != null;
    ArrangementUiComponent component = factory.getComponent(operand, rule, true);
    myComponents.add(component);
    myAvailableTokens.addAll(component.getAvailableTokens());
    JComponent uiComponent = component.getUiComponent();
    add(uiComponent, constraints);
  }
}
项目:tools-idea    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@NotNull StdArrangementTokenUiRole role,
                                    @NotNull List<ArrangementSettingsToken> tokens,
                                    @NotNull ArrangementColorsProvider colorsProvider,
                                    @NotNull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}
项目:consulo    文件:ArrangementSectionRulesControl.java   
public ArrangementSectionRulesControl(@Nonnull Language language,
                                      @Nonnull ArrangementStandardSettingsManager settingsManager,
                                      @Nonnull ArrangementColorsProvider colorsProvider,
                                      @Nonnull RepresentationCallback callback) {
  super(settingsManager, colorsProvider, callback);
  mySectionRuleManager = ArrangementSectionRuleManager.getInstance(language, settingsManager, colorsProvider, this);
  mySettingsManager = settingsManager;
  myColorsProvider = colorsProvider;
}
项目:consulo    文件:ArrangementMatchNodeComponentFactory.java   
public ArrangementMatchNodeComponentFactory(@Nonnull ArrangementStandardSettingsManager manager,
                                            @Nonnull ArrangementColorsProvider provider,
                                            @Nonnull ArrangementMatchingRulesControl list)
{
  mySettingsManager = manager;
  myColorsProvider = provider;
  myList = list;
}
项目:consulo    文件:ArrangementSectionRuleManager.java   
@Nullable
public static ArrangementSectionRuleManager getInstance(@Nonnull Language language,
                                                        @Nonnull ArrangementStandardSettingsManager settingsManager,
                                                        @Nonnull ArrangementColorsProvider colorsProvider,
                                                        @Nonnull ArrangementMatchingRulesControl control) {
  if (settingsManager.isSectionRulesSupported()) {
    return new ArrangementSectionRuleManager(language, settingsManager, colorsProvider, control);
  }
  return null;
}
项目:consulo    文件:ArrangementSectionRuleManager.java   
private ArrangementSectionRuleManager(@Nonnull Language language,
                                      @Nonnull ArrangementStandardSettingsManager settingsManager,
                                      @Nonnull ArrangementColorsProvider colorsProvider,
                                      @Nonnull ArrangementMatchingRulesControl control) {
  myCommenter = LanguageCommenters.INSTANCE.forLanguage(language);
  myControl = control;
  final List<CompositeArrangementSettingsToken> tokens = ContainerUtil.newArrayList();
  tokens.add(new CompositeArrangementSettingsToken(TYPE, ContainerUtil.newArrayList(START_SECTION, END_SECTION)));
  tokens.add(new CompositeArrangementSettingsToken(TEXT));
  myEditor = new ArrangementMatchingRuleEditor(settingsManager, tokens, colorsProvider, control);
}
项目:consulo    文件:ArrangementRuleAliasesListEditor.java   
protected ArrangementRuleAliasesListEditor(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                           @Nonnull ArrangementColorsProvider colorsProvider,
                                           @Nonnull List<StdArrangementRuleAliasToken> items,
                                           @Nonnull Set<String> usedTokenIds) {
  super(NAMER, FACTORY, CLONER, COMPARER, items, false);
  mySettingsManager = settingsManager;
  myColorsProvider = colorsProvider;
  myUsedTokenIds = usedTokenIds;
  reset();
  initTree();
}
项目:consulo    文件:ArrangementRuleAliasesPanel.java   
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));
}
项目:consulo    文件:ArrangementRuleAliasConfigurable.java   
public ArrangementRuleAliasConfigurable(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                        @Nonnull ArrangementColorsProvider colorsProvider,
                                        @Nonnull StdArrangementRuleAliasToken token) {
  myToken = token;
  myTokenRulesPanel = new ArrangementRuleAliasesPanel(settingsManager, colorsProvider);
  myTokenRulesPanel.setRuleSequences(token.getDefinitionRules());

  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_ADD, CommonShortcuts.getNew(), myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_REMOVE, CommonShortcuts.getDelete(), myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_MOVE_UP, CommonShortcuts.MOVE_UP, myTokenRulesPanel);
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_MOVE_DOWN, CommonShortcuts.MOVE_DOWN, myTokenRulesPanel);
  final CustomShortcutSet edit = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
  registerShortcut(ArrangementConstants.MATCHING_ALIAS_RULE_EDIT, edit, myTokenRulesPanel);
}
项目:consulo    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@Nonnull StdArrangementTokenUiRole role,
                                    @Nonnull List<ArrangementSettingsToken> tokens,
                                    @Nonnull ArrangementColorsProvider colorsProvider,
                                    @Nonnull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}
项目:intellij-ce-playground    文件:ArrangementMatchingRulesPanel.java   
public ArrangementMatchingRulesPanel(@NotNull Language language,
                                     @NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  JBScrollPane scrollPane = new JBScrollPane();
  final JViewport viewport = scrollPane.getViewport();
  ArrangementSectionRulesControl.RepresentationCallback callback = new ArrangementSectionRulesControl.RepresentationCallback() {
    @Override
    public void ensureVisible(@NotNull 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));
}
项目:intellij-ce-playground    文件:ArrangementMatchingRulesPanel.java   
protected ArrangementSectionRulesControl createRulesControl(@NotNull Language language,
                                                             @NotNull ArrangementStandardSettingsManager settingsManager,
                                                             @NotNull ArrangementColorsProvider colorsProvider,
                                                             @NotNull ArrangementSectionRulesControl.RepresentationCallback callback) {
  return new ArrangementSectionRulesControl(language, settingsManager, colorsProvider, callback);
}
项目:intellij-ce-playground    文件:ArrangementRuleAliasControl.java   
public ArrangementRuleAliasControl(@NotNull ArrangementStandardSettingsManager settingsManager,
                                   @NotNull ArrangementColorsProvider colorsProvider,
                                   @NotNull RepresentationCallback callback) {
  super(settingsManager, colorsProvider, callback);
}
项目:tools-idea    文件:ArrangementMatchingRulesPanel.java   
public ArrangementMatchingRulesPanel(@NotNull ArrangementStandardSettingsManager settingsManager,
                                     @NotNull ArrangementColorsProvider colorsProvider)
{
  super(new GridBagLayout());

  JBScrollPane scrollPane = new JBScrollPane();
  final JViewport viewport = scrollPane.getViewport();
  ArrangementMatchingRulesControl.RepresentationCallback callback = new ArrangementMatchingRulesControl.RepresentationCallback() {
    @Override
    public void ensureVisible(@NotNull 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 ArrangementMatchingRulesControl(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));
}
项目:consulo    文件:ArrangementSectionRulesControl.java   
public void setRulesAliases(@Nullable Collection<StdArrangementRuleAliasToken> aliases) {
  if (aliases != null) {
    myExtendedSettingsManager = new ArrangementStandardSettingsManager(mySettingsManager.getDelegate(), myColorsProvider, aliases);
    myEditor = new ArrangementMatchingRuleEditor(myExtendedSettingsManager, myColorsProvider, this);
  }
}
项目:consulo    文件:ArrangementMatchingRulesPanel.java   
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));
}
项目:consulo    文件:ArrangementMatchingRulesPanel.java   
protected ArrangementSectionRulesControl createRulesControl(@Nonnull Language language,
                                                            @Nonnull ArrangementStandardSettingsManager settingsManager,
                                                            @Nonnull ArrangementColorsProvider colorsProvider,
                                                            @Nonnull ArrangementSectionRulesControl.RepresentationCallback callback) {
  return new ArrangementSectionRulesControl(language, settingsManager, colorsProvider, callback);
}
项目:consulo    文件:ArrangementRuleAliasControl.java   
public ArrangementRuleAliasControl(@Nonnull ArrangementStandardSettingsManager settingsManager,
                                   @Nonnull ArrangementColorsProvider colorsProvider,
                                   @Nonnull RepresentationCallback callback) {
  super(settingsManager, colorsProvider, callback);
}