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(); }
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)); }
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}); } } }
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(); }
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)); }
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}); } } }
public ArrangementMatchNodeComponentFactory(@NotNull ArrangementStandardSettingsManager manager, @NotNull ArrangementColorsProvider provider, @NotNull ArrangementMatchingRulesControl list) { mySettingsManager = manager; myColorsProvider = provider; myList = list; }
@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; }
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); }
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(); }
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)); }
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); }
@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; }
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); } }); }
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()); }
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); } }
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; }
public ArrangementMatchNodeComponentFactory(@Nonnull ArrangementStandardSettingsManager manager, @Nonnull ArrangementColorsProvider provider, @Nonnull ArrangementMatchingRulesControl list) { mySettingsManager = manager; myColorsProvider = provider; myList = list; }
@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; }
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); }
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(); }
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)); }
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); }
@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; }
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)); }
protected ArrangementSectionRulesControl createRulesControl(@NotNull Language language, @NotNull ArrangementStandardSettingsManager settingsManager, @NotNull ArrangementColorsProvider colorsProvider, @NotNull ArrangementSectionRulesControl.RepresentationCallback callback) { return new ArrangementSectionRulesControl(language, settingsManager, colorsProvider, callback); }
public ArrangementRuleAliasControl(@NotNull ArrangementStandardSettingsManager settingsManager, @NotNull ArrangementColorsProvider colorsProvider, @NotNull RepresentationCallback callback) { super(settingsManager, colorsProvider, callback); }
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)); }
public void setRulesAliases(@Nullable Collection<StdArrangementRuleAliasToken> aliases) { if (aliases != null) { myExtendedSettingsManager = new ArrangementStandardSettingsManager(mySettingsManager.getDelegate(), myColorsProvider, aliases); myEditor = new ArrangementMatchingRuleEditor(myExtendedSettingsManager, myColorsProvider, this); } }
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)); }
protected ArrangementSectionRulesControl createRulesControl(@Nonnull Language language, @Nonnull ArrangementStandardSettingsManager settingsManager, @Nonnull ArrangementColorsProvider colorsProvider, @Nonnull ArrangementSectionRulesControl.RepresentationCallback callback) { return new ArrangementSectionRulesControl(language, settingsManager, colorsProvider, callback); }
public ArrangementRuleAliasControl(@Nonnull ArrangementStandardSettingsManager settingsManager, @Nonnull ArrangementColorsProvider colorsProvider, @Nonnull RepresentationCallback callback) { super(settingsManager, colorsProvider, callback); }