Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
292,700
void () { myTextField.setText(StringUtil.unquoteString(myConstraint.getScriptCodeConstraint())); }
loadValues
292,701
void () { myConstraint.setScriptCodeConstraint('"' + myTextField.getText() + '"'); }
saveValues
292,702
JComponent () { return myTextField; }
getPreferredFocusedComponent
292,703
JComponent[] () { return new JComponent[]{myTextField}; }
getFocusableComponents
292,704
boolean () { final MatchVariableConstraint variable = myTable.getMatchVariable(); return variable != null && !StringUtil.isEmpty(variable.getContextConstraint()); }
hasFilter
292,705
void () { final MatchVariableConstraint constraint = myTable.getMatchVariable(); if (constraint == null) { return; } constraint.setContextConstraint(""); }
clearFilter
292,706
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { return myTable.getVariable() instanceof MatchVariableConstraint && completePattern && isApplicableConstraint(UIUtil.CONTEXT, nodes, true, target); }
isApplicable
292,707
void (SimpleColoredComponent component) { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } component.append(SSRBundle.message("context.0.label", StringUtil.unquoteString(variable.getContextConstraint()))); }
setLabel
292,708
FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final JLabel myLabel = new JLabel(SSRBundle.message("context.label")); private final TextFieldWithAutoCompletion<String> textField = TextFieldWithAutoCompletion.create(myTable.getProject(), Collections.emptyList(), false, ""); private final String shortcut = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION)); private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("tooltip.preconfigured.search.patterns", shortcut)); @Override protected void layoutComponents() { final ConfigurationManager configManager = ConfigurationManager.getInstance(myTable.getProject()); final StructuralSearchProfile profile = myTable.getProfile(); assert profile != null; final List<String> configurationNames = JBIterable .from(configManager.getAllConfigurationNames()) .filter(name -> { final Configuration config = configManager.findConfigurationByName(name); return config != null && profile.isApplicableContextConfiguration(config); }) .toList(); textField.setVariants(configurationNames); final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myLabel) .addComponent(textField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(textField) .addComponent(myHelpLabel) ); } @Override protected void loadValues() { textField.setText(myConstraint.getContextConstraint()); } @Override protected void saveValues() { myConstraint.setContextConstraint(textField.getText()); } @Override public JComponent getPreferredFocusedComponent() { return textField; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{textField}; } }; }
getEditor
292,709
void () { final ConfigurationManager configManager = ConfigurationManager.getInstance(myTable.getProject()); final StructuralSearchProfile profile = myTable.getProfile(); assert profile != null; final List<String> configurationNames = JBIterable .from(configManager.getAllConfigurationNames()) .filter(name -> { final Configuration config = configManager.findConfigurationByName(name); return config != null && profile.isApplicableContextConfiguration(config); }) .toList(); textField.setVariants(configurationNames); final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myLabel) .addComponent(textField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(textField) .addComponent(myHelpLabel) ); }
layoutComponents
292,710
void () { textField.setText(myConstraint.getContextConstraint()); }
loadValues
292,711
void () { myConstraint.setContextConstraint(textField.getText()); }
saveValues
292,712
JComponent () { return textField; }
getPreferredFocusedComponent
292,713
JComponent[] () { return new JComponent[]{textField}; }
getFocusableComponents
292,714
String (NamedScriptableDefinition variable) { if (!(variable instanceof MatchVariableConstraint constraint)) { return ""; } final String ref = constraint.getReferenceConstraint(); if (StringUtil.isEmpty(ref)) { return ""; } final String text = StringUtil.unquoteString(ref); return SSRBundle.message("reference.target.tooltip.message", constraint.isInvertReference() ? 1 : 0, text); }
getShortText
292,715
boolean () { final MatchVariableConstraint variable = myTable.getMatchVariable(); return variable != null && !StringUtil.isEmpty(variable.getReferenceConstraint()); }
hasFilter
292,716
void () { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } variable.setReferenceConstraintName(""); variable.setReferenceConstraint(""); variable.setInvertReference(false); }
clearFilter
292,717
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { return myTable.getVariable() instanceof MatchVariableConstraint && isApplicableConstraint(UIUtil.REFERENCE, nodes, completePattern, target); }
isApplicable
292,718
void (SimpleColoredComponent component) { final MatchVariableConstraint constraint = myTable.getMatchVariable(); if (constraint == null) { return; } final Configuration referencedConfiguration = ConfigurationManager.getInstance(myTable.getProject()).findConfigurationByName(constraint.getReferenceConstraint()); if (referencedConfiguration != null) { component .append(SSRBundle.message("reference.0.label", (constraint.isInvertReference() ? "!" : "") + referencedConfiguration.getName())); } }
setLabel
292,719
FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final JLabel myLabel = new JLabel(SSRBundle.message("reference.label")); private final @NotNull ComboBox<Configuration> myComboBox = new ComboBox<>(new CollectionComboBoxModel<>(ConfigurationManager.getInstance(myTable.getProject()).getAllConfigurations())); private final SimpleListCellRenderer<Configuration> renderer = new SimpleListCellRenderer<>() { @Override public void customize(@NotNull JList list, Configuration value, int index, boolean selected, boolean hasFocus) { setIcon(value.getIcon()); setText(value.getName()); } }; private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("reference.filter.help.text")); private final CheckBox myCheckBox = new CheckBox(SSRBundle.message("invert.filter"), this, "inverseTemplate"); private final Component myGlue = Box.createGlue(); public boolean inverseTemplate = myConstraint.isInvertReference(); @Override protected void layoutComponents() { myComboBox.setRenderer(renderer); myComboBox.setPreferredSize(new Dimension(160, 28)); myComboBox.setSwingPopup(false); final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(myLabel) .addComponent(myComboBox) ) .addGroup(layout.createSequentialGroup() .addComponent(myCheckBox) .addComponent(myGlue) .addComponent(myHelpLabel) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(myComboBox) ) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myCheckBox) .addComponent(myGlue) .addComponent(myHelpLabel) ) ); } @Override protected void loadValues() { inverseTemplate = myConstraint.isInvertReference(); myCheckBox.setSelected(inverseTemplate); var referencedTemplate = ConfigurationManager.getInstance(myTable.getProject()).findConfigurationByName(myConstraint.getReferenceConstraint()); if (referencedTemplate != null) { myComboBox.setSelectedItem(referencedTemplate); } } @Override protected void saveValues() { final Configuration item = myComboBox.getItem(); if (item != null) { myConstraint.setReferenceConstraint(item.getRefName()); myConstraint.setReferenceConstraintName(item.getName()); myConstraint.setInvertReference(inverseTemplate); } } @Override public JComponent getPreferredFocusedComponent() { return myComboBox; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{myComboBox, myCheckBox}; } }; }
getEditor
292,720
void (@NotNull JList list, Configuration value, int index, boolean selected, boolean hasFocus) { setIcon(value.getIcon()); setText(value.getName()); }
customize
292,721
void () { myComboBox.setRenderer(renderer); myComboBox.setPreferredSize(new Dimension(160, 28)); myComboBox.setSwingPopup(false); final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(myLabel) .addComponent(myComboBox) ) .addGroup(layout.createSequentialGroup() .addComponent(myCheckBox) .addComponent(myGlue) .addComponent(myHelpLabel) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(myComboBox) ) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myCheckBox) .addComponent(myGlue) .addComponent(myHelpLabel) ) ); }
layoutComponents
292,722
void () { inverseTemplate = myConstraint.isInvertReference(); myCheckBox.setSelected(inverseTemplate); var referencedTemplate = ConfigurationManager.getInstance(myTable.getProject()).findConfigurationByName(myConstraint.getReferenceConstraint()); if (referencedTemplate != null) { myComboBox.setSelectedItem(referencedTemplate); } }
loadValues
292,723
void () { final Configuration item = myComboBox.getItem(); if (item != null) { myConstraint.setReferenceConstraint(item.getRefName()); myConstraint.setReferenceConstraintName(item.getName()); myConstraint.setInvertReference(inverseTemplate); } }
saveValues
292,724
JComponent () { return myComboBox; }
getPreferredFocusedComponent
292,725
JComponent[] () { return new JComponent[]{myComboBox, myCheckBox}; }
getFocusableComponents
292,726
JBTableRow () { saveValues(); myConstraintChangedCallback.run(); return __ -> this; }
getValue
292,727
void (JTable table, int row) { loadValues(); layoutComponents(); }
prepareEditor
292,728
void (@NotNull FilterTable table) { myTable = table; }
setTable
292,729
int () { return myPosition; }
position
292,730
String (NamedScriptableDefinition variable) { return ""; }
getShortText
292,731
void (@NotNull AnActionEvent e) { initFilter(); myApplicable = false; myActive = true; myTable.addFilter(this); }
actionPerformed
292,732
SimpleColoredComponent () { myLabel.clear(); setLabel(myLabel); return myLabel; }
getRenderer
292,733
boolean () { if (hasFilter()) { myActive = true; } return myActive; }
isActive
292,734
void () {}
initFilter
292,735
void () { myApplicable = true; myActive = false; }
reset
292,736
boolean (@NonNls String constraintName, List<? extends PsiElement> nodes, boolean completePattern, boolean target) { final StructuralSearchProfile profile = myTable.getProfile(); return profile != null && profile.isApplicableConstraint(constraintName, nodes, completePattern, target); }
isApplicableConstraint
292,737
boolean () { return myApplicable && !isActive(); }
isAvailable
292,738
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { return myApplicable = isApplicable(nodes, completePattern, target); }
checkApplicable
292,739
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabledAndVisible(myApplicable && !isActive()); }
update
292,740
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
292,741
String (NamedScriptableDefinition variable) { if (!(variable instanceof MatchVariableConstraint constraint)) { return ""; } final int minCount = constraint.getMinCount(); final int maxCount = constraint.getMaxCount(); if (minCount == 1 && maxCount == 1) { return ""; } return SSRBundle.message("min.occurs.tooltip.message", minCount, (maxCount == Integer.MAX_VALUE) ? "∞" : maxCount); }
getShortText
292,742
boolean () { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return false; } return variable.getMinCount() != 1 || variable.getMaxCount() != 1; }
hasFilter
292,743
void () { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } variable.setMinCount(1); variable.setMaxCount(1); }
clearFilter
292,744
void () { final MatchVariableConstraint constraint = myTable.getMatchVariable(); if (constraint == null) { return; } constraint.setMinCount(myMinZero ? 0 : 1); constraint.setMaxCount(myMaxUnlimited ? Integer.MAX_VALUE : 1); }
initFilter
292,745
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { if (myTable.getMatchVariable() == null) { return false; } myMinZero = isApplicableConstraint(UIUtil.MINIMUM_ZERO, nodes, completePattern, target); myMaxUnlimited = isApplicableConstraint(UIUtil.MAXIMUM_UNLIMITED, nodes, completePattern, target); return myMinZero || myMaxUnlimited; }
isApplicable
292,746
void (SimpleColoredComponent component) { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } final int min = variable.getMinCount(); final int max = variable.getMaxCount(); myLabel.append(SSRBundle.message("count.label", "[" + min + "," + (max == Integer.MAX_VALUE ? "∞" : max) + ']')); if (min == 1 && max == 1) { myLabel.append(SSRBundle.message("default.label"), SimpleTextAttributes.GRAYED_ATTRIBUTES); } }
setLabel
292,747
FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final IntegerField myMinField = new IntegerField(); private final IntegerField myMaxField = new IntegerField(); private final JLabel myMinLabel = new JLabel(SSRBundle.message("min.label")); private final JLabel myMaxLabel = new JLabel(SSRBundle.message("max.label")); @Override protected void layoutComponents() { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myMinLabel) .addComponent(myMinField) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 20, 20) .addComponent(myMaxLabel) .addComponent(myMaxField) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(myMinLabel) .addComponent(myMinField) .addComponent(myMaxLabel) .addComponent(myMaxField) ); myMinField.getValueEditor().addListener(newValue -> { if (myMinField.getValueEditor().isValid(newValue) && myMaxField.getValue() < newValue) myMaxField.setValue(newValue); }); myMaxField.getValueEditor().addListener(newValue -> { if (myMaxField.getValueEditor().isValid(newValue) && myMinField.getValue() > newValue) myMinField.setValue(newValue); }); } @Override protected void loadValues() { myMinField.setMinValue(myMinZero ? 0 : 1); myMinField.setMaxValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMinField.setDefaultValue(myMinZero ? 0 : 1); myMinField.setDefaultValueText(myMinZero ? "0" : "1"); final int minCount = myConstraint.getMinCount(); if (!isDefaultValue(minCount)) { myMinField.setValue(minCount); } myMinField.setCanBeEmpty(true); myMinField.selectAll(); myMaxField.setMinValue(myMinZero ? 0 : 1); myMaxField.setMaxValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMaxField.setDefaultValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMaxField.setDefaultValueText(myMaxUnlimited ? SSRBundle.message("unlimited.placeholder") : "1"); final int maxCount = myConstraint.getMaxCount(); if (!isDefaultValue(maxCount)) { myMaxField.setValue(maxCount); } myMaxField.setCanBeEmpty(true); myMaxField.selectAll(); } private boolean isDefaultValue(int count) { if (count == 0) { return myMinZero; } else if (count == 1) { return !myMinZero || !myMaxUnlimited; } else if (count == Integer.MAX_VALUE) { return myMaxUnlimited; } return false; } @Override public void saveValues() { myConstraint.setMinCount(myMinField.getValue()); myConstraint.setMaxCount(myMaxField.getValue()); } @Override public JComponent getPreferredFocusedComponent() { return myMinField; } @Override public JComponent[] getFocusableComponents() { return new IntegerField[]{myMinField, myMaxField}; } }; }
getEditor
292,748
void () { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myMinLabel) .addComponent(myMinField) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 20, 20) .addComponent(myMaxLabel) .addComponent(myMaxField) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(myMinLabel) .addComponent(myMinField) .addComponent(myMaxLabel) .addComponent(myMaxField) ); myMinField.getValueEditor().addListener(newValue -> { if (myMinField.getValueEditor().isValid(newValue) && myMaxField.getValue() < newValue) myMaxField.setValue(newValue); }); myMaxField.getValueEditor().addListener(newValue -> { if (myMaxField.getValueEditor().isValid(newValue) && myMinField.getValue() > newValue) myMinField.setValue(newValue); }); }
layoutComponents
292,749
void () { myMinField.setMinValue(myMinZero ? 0 : 1); myMinField.setMaxValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMinField.setDefaultValue(myMinZero ? 0 : 1); myMinField.setDefaultValueText(myMinZero ? "0" : "1"); final int minCount = myConstraint.getMinCount(); if (!isDefaultValue(minCount)) { myMinField.setValue(minCount); } myMinField.setCanBeEmpty(true); myMinField.selectAll(); myMaxField.setMinValue(myMinZero ? 0 : 1); myMaxField.setMaxValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMaxField.setDefaultValue(myMaxUnlimited ? Integer.MAX_VALUE : 1); myMaxField.setDefaultValueText(myMaxUnlimited ? SSRBundle.message("unlimited.placeholder") : "1"); final int maxCount = myConstraint.getMaxCount(); if (!isDefaultValue(maxCount)) { myMaxField.setValue(maxCount); } myMaxField.setCanBeEmpty(true); myMaxField.selectAll(); }
loadValues
292,750
boolean (int count) { if (count == 0) { return myMinZero; } else if (count == 1) { return !myMinZero || !myMaxUnlimited; } else if (count == Integer.MAX_VALUE) { return myMaxUnlimited; } return false; }
isDefaultValue
292,751
void () { myConstraint.setMinCount(myMinField.getValue()); myConstraint.setMaxCount(myMaxField.getValue()); }
saveValues
292,752
JComponent () { return myMinField; }
getPreferredFocusedComponent
292,753
JComponent[] () { return new IntegerField[]{myMinField, myMaxField}; }
getFocusableComponents
292,754
String (NamedScriptableDefinition variable) { if (!(variable instanceof MatchVariableConstraint constraint)) { return ""; } final String text = constraint.getRegExp(); if (text.isEmpty()) { return constraint.isWithinHierarchy() ? SSRBundle.message("hierarchy.tooltip.message") : ""; } return SSRBundle.message("text.tooltip.message", constraint.isInvertRegExp() ? 1 : 0, text, constraint.isWholeWordsOnly() ? 1 : 0, constraint.isWithinHierarchy() ? 1 : 0); }
getShortText
292,755
boolean () { final MatchVariableConstraint variable = myTable.getMatchVariable(); return variable != null && (!StringUtil.isEmpty(variable.getRegExp()) || variable.isWithinHierarchy()); }
hasFilter
292,756
void () { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } variable.setRegExp(""); variable.setWholeWordsOnly(false); variable.setWithinHierarchy(false); }
clearFilter
292,757
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { if (!(myTable.getVariable() instanceof MatchVariableConstraint)) { return false; } myShowHierarchy = isApplicableConstraint(UIUtil.TEXT_HIERARCHY, nodes, completePattern, target); return isApplicableConstraint(UIUtil.TEXT, nodes, completePattern, target); }
isApplicable
292,758
void (SimpleColoredComponent component) { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } final String value = variable.isInvertRegExp() ? "!" + variable.getRegExp() : variable.getRegExp(); myLabel.append(SSRBundle.message("text.0.label", value)); if (variable.isWholeWordsOnly()) myLabel.append(SSRBundle.message("whole.words.label"), SimpleTextAttributes.GRAYED_ATTRIBUTES); if (variable.isWithinHierarchy()) myLabel.append(SSRBundle.message("within.hierarchy.label"), SimpleTextAttributes.GRAYED_ATTRIBUTES); }
setLabel
292,759
FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final EditorTextField myTextField = UIUtil.createRegexComponent("", myTable.getProject()); private final JCheckBox myHierarchyCheckBox = new JCheckBox(SSRBundle.message("within.type.hierarchy.check.box"), false); private final JLabel myTextLabel = new JLabel(SSRBundle.message("text.label")); private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("text.filter.help.text")); @Override protected void layoutComponents() { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTextLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTextLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) ) ); } @Override protected void loadValues() { myTextField.setText((myConstraint.isInvertRegExp() ? "!" : "") + myConstraint.getRegExp()); myHierarchyCheckBox.setSelected(myConstraint.isWithinHierarchy()); myHierarchyCheckBox.setVisible(myShowHierarchy); } @Override public void saveValues() { final String text = myTextField.getText(); if (text.startsWith("!")) { myConstraint.setRegExp(text.substring(1)); myConstraint.setInvertRegExp(true); } else { myConstraint.setRegExp(text); myConstraint.setInvertRegExp(false); } myConstraint.setWholeWordsOnly(false); myConstraint.setWithinHierarchy(myHierarchyCheckBox.isSelected()); } @Override public JComponent getPreferredFocusedComponent() { return myTextField; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{myTextField}; } }; }
getEditor
292,760
void () { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTextLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTextLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) ) ); }
layoutComponents
292,761
void () { myTextField.setText((myConstraint.isInvertRegExp() ? "!" : "") + myConstraint.getRegExp()); myHierarchyCheckBox.setSelected(myConstraint.isWithinHierarchy()); myHierarchyCheckBox.setVisible(myShowHierarchy); }
loadValues
292,762
void () { final String text = myTextField.getText(); if (text.startsWith("!")) { myConstraint.setRegExp(text.substring(1)); myConstraint.setInvertRegExp(true); } else { myConstraint.setRegExp(text); myConstraint.setInvertRegExp(false); } myConstraint.setWholeWordsOnly(false); myConstraint.setWithinHierarchy(myHierarchyCheckBox.isSelected()); }
saveValues
292,763
JComponent () { return myTextField; }
getPreferredFocusedComponent
292,764
JComponent[] () { return new JComponent[]{myTextField}; }
getFocusableComponents
292,765
String (NamedScriptableDefinition variable) { if (!(variable instanceof MatchVariableConstraint constraint)) { return ""; } if (constraint.getNameOfExprType().isEmpty()) { return ""; } return SSRBundle.message("exprtype.tooltip.message", constraint.isInvertExprType() ? 1 : 0, constraint.isRegexExprType() ? constraint.getNameOfExprType() : constraint.getExpressionTypes(), constraint.isExprTypeWithinHierarchy() ? 1 : 0); }
getShortText
292,766
boolean () { final MatchVariableConstraint variable = myTable.getMatchVariable(); return variable != null && !StringUtil.isEmpty(variable.getNameOfExprType()); }
hasFilter
292,767
void () { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } variable.setNameOfExprType(""); variable.setInvertExprType(false); variable.setExprTypeWithinHierarchy(false); }
clearFilter
292,768
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { if (myTable.getMatchVariable() == null) { return false; } myShowRegex = isApplicableConstraint(UIUtil.TYPE_REGEX, nodes, completePattern, target); return isApplicableConstraint(UIUtil.TYPE, nodes, completePattern, target); }
isApplicable
292,769
void (SimpleColoredComponent component) { final MatchVariableConstraint variable = myTable.getMatchVariable(); if (variable == null) { return; } final String s = variable.isRegexExprType() ? variable.getNameOfExprType() : variable.getExpressionTypes(); final String value = variable.isInvertExprType() ? "!" + s : s; myLabel.append(SSRBundle.message("type.0.label", value)); if (variable.isExprTypeWithinHierarchy()) { myLabel.append(SSRBundle.message("within.hierarchy.label"), SimpleTextAttributes.GRAYED_ATTRIBUTES); } }
setLabel
292,770
FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final EditorTextField myTextField = UIUtil.createTextComponent("", myTable.getProject()); private final JLabel myTypeLabel = new JLabel(SSRBundle.message("type.label")); private final JCheckBox myHierarchyCheckBox = new JCheckBox(SSRBundle.message("within.type.hierarchy.check.box"), false); private final JCheckBox myRegexCheckBox = new JCheckBox(SSRBundle.message("regex.check.box"), false); { myRegexCheckBox.addActionListener(e -> { final FileType fileType = myRegexCheckBox.isSelected() ? RegExpFileType.INSTANCE : PlainTextFileType.INSTANCE; final Document document = UIUtil.createDocument(fileType, myTextField.getText(), myTable.getProject()); myTextField.setDocument(document); }); } private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("type.filter.help.text")); @Override protected void layoutComponents() { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTypeLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(myRegexCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTypeLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) .addComponent(myRegexCheckBox) ) ); } @Override protected void loadValues() { final boolean regex = myConstraint.isRegexExprType(); myTextField.setFileType(myShowRegex && regex ? RegExpFileType.INSTANCE : PlainTextFileType.INSTANCE); myTextField.setText((myConstraint.isInvertExprType() ? "!" : "") + (regex ? myConstraint.getNameOfExprType() : myConstraint.getExpressionTypes())); myHierarchyCheckBox.setSelected(myConstraint.isExprTypeWithinHierarchy()); myRegexCheckBox.setSelected(myShowRegex && regex); myRegexCheckBox.setVisible(myShowRegex); } @Override public void saveValues() { String text = myTextField.getText(); final boolean inverted = text.startsWith("!"); if (inverted) { text = text.substring(1); } if (myShowRegex && myRegexCheckBox.isSelected()) { myConstraint.setNameOfExprType(text); } else { myConstraint.setExpressionTypes(text); } myConstraint.setInvertExprType(inverted); myConstraint.setExprTypeWithinHierarchy(myHierarchyCheckBox.isSelected()); } @Override public JComponent getPreferredFocusedComponent() { return myTextField; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{myTextField}; } }; }
getEditor
292,771
void () { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTypeLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(myRegexCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTypeLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) .addComponent(myRegexCheckBox) ) ); }
layoutComponents
292,772
void () { final boolean regex = myConstraint.isRegexExprType(); myTextField.setFileType(myShowRegex && regex ? RegExpFileType.INSTANCE : PlainTextFileType.INSTANCE); myTextField.setText((myConstraint.isInvertExprType() ? "!" : "") + (regex ? myConstraint.getNameOfExprType() : myConstraint.getExpressionTypes())); myHierarchyCheckBox.setSelected(myConstraint.isExprTypeWithinHierarchy()); myRegexCheckBox.setSelected(myShowRegex && regex); myRegexCheckBox.setVisible(myShowRegex); }
loadValues
292,773
void () { String text = myTextField.getText(); final boolean inverted = text.startsWith("!"); if (inverted) { text = text.substring(1); } if (myShowRegex && myRegexCheckBox.isSelected()) { myConstraint.setNameOfExprType(text); } else { myConstraint.setExpressionTypes(text); } myConstraint.setInvertExprType(inverted); myConstraint.setExprTypeWithinHierarchy(myHierarchyCheckBox.isSelected()); }
saveValues
292,774
JComponent () { return myTextField; }
getPreferredFocusedComponent
292,775
JComponent[] () { return new JComponent[]{myTextField}; }
getFocusableComponents
292,776
List<FilterAction> () { return List.of(new ContextFilter(), new CountFilter(), new ReferenceFilter(), new TextFilter(), new TypeFilter()); }
getFilters
292,777
List<CustomGroup> () { return List.of( new CustomGroup(InspectionProfileUtil.getGroup(), SSRBundle.message("inspection.tree.group.description")) ); }
getCustomGroups
292,778
InspectionProfileModifiableModel (@NotNull Component c) { final SingleInspectionProfilePanel panel = UIUtil.uiParents(c, true).filter(SingleInspectionProfilePanel.class).first(); if (panel == null) return null; return panel.getProfile(); }
getInspectionProfile
292,779
String[] () { return new String[] {InspectionsBundle.message("group.names.user.defined"), SSRBundle.message("structural.search.group.name")}; }
getGroup
292,780
void (@NotNull InspectionProfileModifiableModel profile, @NotNull Project project) { if (profile.getToolsOrNull(SSBasedInspection.SHORT_NAME, null) != null && !profile.isToolEnabled(HighlightDisplayKey.find(SSBasedInspection.SHORT_NAME))) { profile.setToolEnabled(SSBasedInspection.SHORT_NAME, true, project, false); for (ScopeToolState tool : profile.getAllTools()) { final InspectionToolWrapper<?, ?> wrapper = tool.getTool(); if (wrapper instanceof StructuralSearchInspectionToolWrapper) { tool.setEnabled(false); } } } }
enableSSIfDisabled
292,781
boolean (InspectionProfileEntry entry) { return entry instanceof SSBasedInspection; }
canDeleteInspection
292,782
void (InspectionProfileEntry entry, String shortName) { if (entry instanceof SSBasedInspection ssBasedInspection) { ssBasedInspection.removeConfigurationsWithUuid(shortName); } }
deleteInspection
292,783
void (@NotNull AnActionEvent e) { final SearchContext context = new SearchContext(e.getDataContext()); final StructuralSearchDialog dialog = new StructuralSearchDialog(context, myReplace, true); if (!dialog.showAndGet()) return; final InspectionProfileModifiableModel profile = myPanel.getProfile(); final Configuration configuration = dialog.getConfiguration(); if (!createNewInspection(configuration, context.getProject(), profile)) return; myPanel.selectInspectionTool(configuration.getUuid()); }
actionPerformed
292,784
void (@NotNull Configuration configuration, @NotNull Project project) { createNewInspection(configuration, project, InspectionProfileManager.getInstance(project).getCurrentProfile()); }
createNewInspection
292,785
boolean (@NotNull Configuration configuration, @NotNull Project project, @NotNull InspectionProfileImpl profile) { final SSBasedInspection inspection = SSBasedInspection.getStructuralSearchInspection(profile); if (!ApplicationManager.getApplication().isUnitTestMode()) { InspectionMetaDataDialog dialog = inspection.createMetaDataDialog(project, null); if (configuration instanceof ReplaceConfiguration) { dialog.showCleanupOption(false); } if (!dialog.showAndGet()) return false; configuration.setOrder(0); // reset configuration.setName(dialog.getName()); configuration.setDescription(dialog.getDescription()); configuration.setProblemDescriptor(dialog.getProblemDescriptor()); configuration.setSuppressId(dialog.getSuppressId()); } configuration.setUuid(null); inspection.addConfiguration(configuration); addInspectionToProfile(project, profile, configuration); if (profile instanceof InspectionProfileModifiableModel) { ((InspectionProfileModifiableModel)profile).setModified(true); } CustomInspectionActions.fireProfileChanged(profile); return true; }
createNewInspection
292,786
void (@NotNull Project project, @NotNull InspectionProfileImpl profile, @NotNull Configuration configuration) { final String shortName = configuration.getUuid(); final InspectionToolWrapper<?, ?> toolWrapper = profile.getInspectionTool(shortName, project); if (toolWrapper != null) { // already added return; } final StructuralSearchInspectionToolWrapper wrapped = new StructuralSearchInspectionToolWrapper(Collections.singletonList(configuration)); profile.addTool(project, wrapped, null); // enable inspection even when profile is locked, because either: // - user just added this inspection explicitly // - or inspection was just imported from enabled old SSR inspection profile.setToolEnabled(shortName, true); }
addInspectionToProfile
292,787
String () { return myDelegate.getMatchImage(); }
getMatchImage
292,788
PsiElement () { final PsiElement match = myDelegate.getMatch(); return PsiTreeUtil.findSameElementInCopy(match, myTarget); }
getMatch
292,789
int () { return myDelegate.getStart(); }
getStart
292,790
int () { return myDelegate.getEnd(); }
getEnd
292,791
String () { return myDelegate.getName(); }
getName
292,792
List<MatchResult> () { final List<MatchResult> children = myDelegate.getChildren(); if (children.isEmpty()) return children; final List<MatchResult> result = new ArrayList<>(children.size()); for (MatchResult child : children) { result.add(new MatchResultForPreview(child, myTarget)); } return result; }
getChildren
292,793
boolean () { return myDelegate.hasChildren(); }
hasChildren
292,794
int () { return myDelegate.size(); }
size
292,795
boolean () { return myDelegate.isScopeMatch(); }
isScopeMatch
292,796
boolean () { return myDelegate.isMultipleMatch(); }
isMultipleMatch
292,797
MatchResult () { return new MatchResultForPreview(myDelegate.getRoot(), myTarget); }
getRoot
292,798
boolean () { return myDelegate.isTarget(); }
isTarget
292,799
int () { return myTool.getShortName().hashCode(); }
hashCode