Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
292,600
LanguageFileType () { return getMatchOptions().getFileType(); }
getFileType
292,601
String () { return refName == null || !predefined ? name : refName; }
getRefName
292,602
void (String refName) { if (predefined) this.refName = refName; }
setRefName
292,603
String () { return getChildComponent().getText(); }
getText
292,604
void (Collection<String> items) { getChildComponent().setVariants(items); }
setAutoCompletionItems
292,605
void (String text) { getChildComponent().setText(text); }
setText
292,606
String (ComboBox comboBox) { return comboBox.getEditor().getItem().toString(); }
getText
292,607
void (ComboBox component, @NotNull String text) { comboBox.getEditor().setItem(text); }
setText
292,608
ComboBox<String> () { return myDirectoryComboBox.getChildComponent(); }
getComboBox
292,609
void (Runnable callback) { myCallback = callback; }
setCallback
292,610
void (@NotNull List<@NlsSafe String> recentDirectories) { final ComboBox<String> comboBox = myDirectoryComboBox.getChildComponent(); myUpdating = true; try { comboBox.removeAllItems(); for (int i = recentDirectories.size() - 1; i >= 0; i--) { comboBox.addItem(recentDirectories.get(i)); } } finally { myUpdating = false; } }
setRecentDirectories
292,611
void (@Nullable VirtualFile directory) { if (directory == null) { return; } final String url = directory.getPresentableUrl(); final ComboBox<String> comboBox = myDirectoryComboBox.getChildComponent(); comboBox.getEditor().setItem(url); myDirectoryComboBox.getChildComponent().setSelectedItem(url); }
setDirectory
292,612
VirtualFile () { final ComboBox<String> comboBox = myDirectoryComboBox.getChildComponent(); final String directoryName = (String)comboBox.getSelectedItem(); if (StringUtil.isEmptyOrSpaces(directoryName)) { return null; } final String path = FileUtil.toSystemIndependentName(directoryName); final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path); return virtualFile == null || !virtualFile.isDirectory() ? null : virtualFile; }
getDirectory
292,613
boolean () { return myRecursive; }
isRecursive
292,614
void (boolean recursive) { myRecursive = recursive; }
setRecursive
292,615
boolean (@NotNull AnActionEvent e) { return myRecursive; }
isSelected
292,616
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
292,617
void (@NotNull AnActionEvent e, boolean state) { myRecursive = state; myCallback.run(); }
setSelected
292,618
void (String selectedScope) { myCurrentNamedScope = selectedScope; myScopesComboBox.selectItem(selectedScope); }
selectNamedScope
292,619
JComponent (JComponent component) { final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(component, BorderLayout.WEST); wrapper.add(Box.createHorizontalGlue(), BorderLayout.CENTER); return wrapper; }
shrinkWrap
292,620
void (@NotNull List<String> recentDirectories) { myDirectoryComboBox.setRecentDirectories(recentDirectories); }
setRecentDirectories
292,621
void (@Nullable SearchScope selectedScope) { final Scopes.Type scopeType = Scopes.getType(selectedScope); myUpdating = true; try { if (selectedScope instanceof ModuleWithDependenciesScope scope) { myModulesComboBox.setItem(scope.getModule()); } else if (selectedScope instanceof GlobalSearchScopesCore.DirectoryScope directoryScope) { myDirectoryComboBox.setDirectory(directoryScope.getDirectory()); myDirectoryComboBox.setRecursive(directoryScope.isWithSubdirectories()); } else if (selectedScope != null && scopeType == Scopes.Type.NAMED) { selectNamedScope(selectedScope.getDisplayName()); } } finally { myUpdating = false; } showScope(scopeType); }
setScope
292,622
void (@Nullable SearchScope scope) { if (scope != null) myScope = scope; DataManager.getInstance().getDataContextFromFocusAsync().onSuccess(context -> { Scopes.Type foundScope = null; myUpdating = true; try { boolean moduleFound = false; boolean directoryFound = false; boolean namedScopeFound = false; final Module[] modules = ModuleManager.getInstance(myProject).getModules(); if (modules.length > 0) { // set some defaults final Module module = modules[0]; myModulesComboBox.setSelectedModule(module); final VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots(); if (roots.length > 0) { final VirtualFile root = roots[0]; myDirectoryComboBox.setDirectory(root.isDirectory() ? root : root.getParent()); } } final Module module = PlatformCoreDataKeys.MODULE.getData(context); if (module != null) { moduleFound = true; myModulesComboBox.setSelectedModule(module); } final Editor editor = CommonDataKeys.HOST_EDITOR.getData(context); if (editor != null) { final VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument()); if (file != null) { myDirectoryComboBox.setDirectory(file.getParent()); } selectNamedScope(PredefinedSearchScopeProviderImpl.getCurrentFileScopeName()); setScope(scope); return; } final FindModel findModel = new FindModel(); for (FindInProjectExtension extension : FindInProjectExtension.EP_NAME.getExtensionList()) { namedScopeFound = extension.initModelFromContext(findModel, context); if (namedScopeFound) { selectNamedScope(findModel.getCustomScopeName()); foundScope = Scopes.Type.NAMED; break; } } final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(context); if (files != null && files.length > 0) { if (!moduleFound) { final Module fileModule = ModuleUtilCore.findModuleForFile(files[0], myProject); if (fileModule != null) { myModulesComboBox.setSelectedModule(fileModule); } } if (!namedScopeFound) { final SearchScope selectedFilesScope = PredefinedSearchScopeProviderImpl.getSelectedFilesScope(myProject, context, null); if (selectedFilesScope != null) { selectNamedScope(selectedFilesScope.getDisplayName()); } } if (files.length == 1) { directoryFound = true; final VirtualFile file = files[0]; myDirectoryComboBox.setDirectory(file.isDirectory() ? file : file.getParent()); if (foundScope == null) { foundScope = Scopes.Type.DIRECTORY; } } else { for (VirtualFile file : files) { if (file.isDirectory()) { myDirectoryComboBox.setDirectory(file); directoryFound = true; break; } } if (foundScope == null) { foundScope = Scopes.Type.NAMED; } } if (!directoryFound) { final VirtualFile ancestor = VfsUtil.getCommonAncestor(List.of(files)); if (ancestor != null) { myDirectoryComboBox.setDirectory(ancestor); directoryFound = true; } } if (!directoryFound) { final VirtualFile directory = files[0].getParent(); if (directory != null) { myDirectoryComboBox.setDirectory(directory); } } } } finally { myUpdating = false; } showScope(foundScope == null ? Scopes.Type.PROJECT : foundScope); }); }
setScopesFromContext
292,623
void (@Nullable Consumer<? super SearchScope> consumer) { myConsumer = consumer; }
setScopeConsumer
292,624
SearchScope () { return myScope; }
getScope
292,625
void () { if (myUpdating) return; switch (myScopeType) { case PROJECT -> myScope = GlobalSearchScope.projectScope(myProject); case MODULE -> { final Module module = myModulesComboBox.getSelectedModule(); if (module == null) return; myScope = GlobalSearchScope.moduleScope(module); } case DIRECTORY -> { final VirtualFile directory = myDirectoryComboBox.getDirectory(); if (directory == null) return; myScope = GlobalSearchScopesCore.directoryScope(myProject, directory, myDirectoryComboBox.isRecursive()); } case NAMED -> { final SearchScope namedScope = myScopesComboBox.getSelectedScope(); if (namedScope == null) return; myScope = namedScope; } } if (myConsumer != null) myConsumer.accept(myScope); }
setScopeFromUI
292,626
void (@NotNull Scopes.Type scopeType) { myScopeType = scopeType; ((CardLayout)myScopeDetailsPanel.getLayout()).show(myScopeDetailsPanel, scopeType.toString()); if (myScopeType == Scopes.Type.MODULE) myModulesComboBox.requestFocus(); else if (myScopeType == Scopes.Type.DIRECTORY) myDirectoryComboBox.getComboBox().requestFocus(); else if (myScopeType == Scopes.Type.NAMED) myScopesComboBox.requestFocus(); setScopeFromUI(); myToolbar.updateActionsImmediately(); }
showScope
292,627
boolean (@NotNull AnActionEvent e) { return myScopeType == ScopePanel.this.myScopeType; }
isSelected
292,628
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
292,629
void (@NotNull AnActionEvent e, boolean state) { showScope(myScopeType); }
setSelected
292,630
boolean () { return true; }
displayTextInToolbar
292,631
ConfigurationManager (@NotNull Project project) { return project.getService(ConfigurationManager.class); }
getInstance
292,632
Element () { final Element state = new Element("state"); writeConfigurations(state, configurations, historyConfigurations); return state; }
getState
292,633
void (@NotNull Element element) { configurations.clear(); historyConfigurations.clear(); final SmartList<Configuration> tmp = new SmartList<>(); readConfigurations(element, configurations, tmp); migrate(configurations); for (Configuration configuration : tmp) { addHistoryConfiguration(configuration); } Collections.reverse(historyConfigurations); }
loadState
292,634
void (@NotNull List<? extends Configuration> configurations) { if (configurations.isEmpty()) { return; } outer: for (Configuration configuration : configurations) { Configuration existing = myIdeState.get(configuration.getRefName()); while (existing != null) { if (configuration.equals(existing)) { continue outer; } configuration.setName(configuration.getName() + '~'); existing = myIdeState.get(configuration.getRefName()); } myIdeState.add(configuration); } configurations.clear(); }
migrate
292,635
void (@NotNull Configuration configuration) { configuration = configuration.copy(); if (configuration.getCreated() <= 0) { configuration.setCreated(System.currentTimeMillis()); } final var searchTemplate = configuration.getMatchOptions().getSearchPattern(); configuration.setName(searchTemplate.length() < RECENT_CONFIGURATION_NAME_LENGTH ? searchTemplate : searchTemplate.substring(0, RECENT_CONFIGURATION_NAME_LENGTH).trim() + "…"); final Configuration old = findConfiguration(historyConfigurations, configuration); if (old != null) historyConfigurations.remove(old); // move to most recent historyConfigurations.add(0, configuration); while (historyConfigurations.size() > MAX_RECENT_SIZE) { historyConfigurations.remove(historyConfigurations.size() - 1); } }
addHistoryConfiguration
292,636
Configuration () { return historyConfigurations.isEmpty() ? null : historyConfigurations.get(0); }
getMostRecentConfiguration
292,637
void (Configuration configuration) { myIdeState.add(configuration); }
addConfiguration
292,638
void (Configuration configuration, boolean ide) { (ide ? myIdeState : myProjectState).remove(configuration.getRefName()); }
removeConfiguration
292,639
void (@NotNull Element element, @NotNull Collection<? extends Configuration> configurations) { writeConfigurations(element, configurations, Collections.emptyList()); }
writeConfigurations
292,640
void (@NotNull Element element, @NotNull Collection<? extends Configuration> configurations, @NotNull Collection<? extends Configuration> historyConfigurations) { for (Configuration configuration : configurations) { configuration.getMatchOptions().setScope(null); saveConfiguration(element, configuration); } for (Configuration historyConfiguration : historyConfigurations) { final Element infoElement = saveConfiguration(element, historyConfiguration); infoElement.setAttribute(SAVE_HISTORY_ATTR_NAME, "1"); } }
writeConfigurations
292,641
Element (@NotNull Element element, @NotNull Configuration config) { final Element infoElement = new Element(config instanceof SearchConfiguration ? SEARCH_TAG_NAME : REPLACE_TAG_NAME); element.addContent(infoElement); config.writeExternal(infoElement); return infoElement; }
saveConfiguration
292,642
void (@NotNull Element element, @NotNull Collection<? super Configuration> configurations) { readConfigurations(element, configurations, new SmartList<>()); }
readConfigurations
292,643
void (@NotNull Element element, @NotNull Collection<? super Configuration> configurations, @NotNull Collection<? super Configuration> historyConfigurations) { for (Element pattern : element.getChildren()) { final Configuration config = readConfiguration(pattern); if (config == null) continue; if (pattern.getAttribute(SAVE_HISTORY_ATTR_NAME) != null) { historyConfigurations.add(config); } else { configurations.add(config); } } }
readConfigurations
292,644
Configuration (@NotNull Element element) { final String name = element.getName(); final Configuration config; if (name.equals(SEARCH_TAG_NAME)) { config = new SearchConfiguration(); } else if (name.equals(REPLACE_TAG_NAME)) { config = new ReplaceConfiguration(); } else { return null; } config.readExternal(element); return config; }
readConfiguration
292,645
List<String> () { return ContainerUtil.map(getAllConfigurations(), c -> c.getRefName()); }
getAllConfigurationNames
292,646
List<Configuration> () { return ContainerUtil.concat(StructuralSearchUtil.getPredefinedTemplates(), getIdeConfigurations(), getProjectConfigurations()); }
getAllConfigurations
292,647
List<Configuration> () { return myIdeState.getAll(); }
getIdeConfigurations
292,648
List<Configuration> () { return myProjectState.getAll(); }
getProjectConfigurations
292,649
Configuration (String name) { Configuration projectConfiguration = myProjectState.get(name); // project overrides local if (projectConfiguration != null) return projectConfiguration; final Configuration ideConfiguration = myIdeState.get(name); if (ideConfiguration != null) return ideConfiguration; return ContainerUtil.find(StructuralSearchUtil.getPredefinedTemplates(), config -> config.getRefName().equals(name)); }
findConfigurationByName
292,650
Configuration (@NotNull Collection<? extends Configuration> configurations, Configuration configuration) { return ContainerUtil.find(configurations, c -> { if (configuration instanceof ReplaceConfiguration) { return c instanceof ReplaceConfiguration && c.getMatchOptions().getSearchPattern().equals(configuration.getMatchOptions().getSearchPattern()) && c.getReplaceOptions().getReplacement().equals(configuration.getReplaceOptions().getReplacement()); } else { return c instanceof SearchConfiguration && c.getMatchOptions().getSearchPattern().equals( configuration.getMatchOptions().getSearchPattern()); } }); }
findConfiguration
292,651
List<Configuration> () { for (Configuration configuration : historyConfigurations) { configuration.getMatchOptions().initScope(myProject); } return Collections.unmodifiableList(historyConfigurations); }
getHistoryConfigurations
292,652
boolean (@NotNull Configuration newConfiguration) { Pair<@NlsSafe String, Boolean> nameAndProject = showInputDialog(newConfiguration.getName()); while (nameAndProject.first != null && (nameAndProject.second ? myProjectState : myIdeState).get(nameAndProject.first) != null) { final int answer = Messages.showYesNoDialog( myProject, SSRBundle.message("overwrite.message"), SSRBundle.message("overwrite.title", nameAndProject.first), SSRBundle.message("button.replace"), Messages.getCancelButton(), Messages.getQuestionIcon() ); if (answer == Messages.YES) { break; } nameAndProject = showInputDialog(nameAndProject.first); } if (nameAndProject.first != null) { newConfiguration.setName(nameAndProject.first); newConfiguration.setUuid(null); myLastSaveWasInProject = nameAndProject.second; (nameAndProject.second ? myProjectState : myIdeState).add(newConfiguration.copy()); return true; } return false; }
showSaveTemplateAsDialog
292,653
ProjectConfigurationManagerState (Project project) { return project.getService(ProjectConfigurationManagerState.class); }
getInstance
292,654
ConfigurationManagerState () { return ApplicationManager.getApplication().getService(ConfigurationManagerState.class); }
getInstance
292,655
void (Configuration configuration) { configuration.getMatchOptions().setScope(null); configurations.put(configuration.getRefName(), configuration); }
add
292,656
Configuration (String name) { return configurations.get(name); }
get
292,657
void (String name) { configurations.remove(name); }
remove
292,658
List<Configuration> () { return new ArrayList<>(configurations.values()); }
getAll
292,659
Element () { final Element element = new Element("state"); for (Configuration configuration : configurations.values()) { saveConfiguration(element, configuration); } return element; }
getState
292,660
void (@NotNull Element state) { for (Element child : state.getChildren()) { final Configuration configuration = readConfiguration(child); if (configuration != null) { configurations.put(configuration.getRefName(), configuration); } } }
loadState
292,661
String () { return myConfiguration.getMatchOptions().getSearchPattern(); }
getPresentableText
292,662
Icon (boolean unused) { return null; }
getIcon
292,663
void () { mySearchStarter.run(); }
findUsages
292,664
boolean () { return true; }
isValid
292,665
String () { return "my name"; }
getName
292,666
ItemPresentation () { return this; }
getPresentation
292,667
void () { UIUtil.invokeAction(myConfiguration, mySearchContext); }
showSettings
292,668
KeyboardShortcut () { return ActionManager.getInstance().getKeyboardShortcut(myConfiguration instanceof ReplaceConfiguration ? "StructuralSearchPlugin.StructuralReplaceAction" : "StructuralSearchPlugin.StructuralSearchAction"); }
getShortcut
292,669
Filter (Filter s) { return s; }
valueOf
292,670
JBTableRowRenderer (int row) { return (table, row1, selected, focused) -> myTableModel.getRowValue(row1).getRenderer(); }
getRowRenderer
292,671
JBTableRowEditor (int row) { if (!isValid()) return null; return myTableModel.getRowValue(row).getEditor(); }
getRowEditor
292,672
void (FilterAction filter) { final JBTable table = myFilterTable.getTable(); TableUtil.stopEditing(table); table.setRowHeight(table.getRowHeight()); // reset int index = 0; final int max = myTableModel.getRowCount(); for (; index < max; index++) { if (filter.position() < myTableModel.getItem(index).position()) { break; } } if (index == 0) { myTableModel.addRow(myHeader); index = 1; } myTableModel.insertRow(index, filter); table.editCellAt(index, 0); table.setRowSelectionInterval(index, index); table.setColumnSelectionInterval(0, 0); TableUtil.updateScroller(table); final Component editorComponent = table.getEditorComponent(); if (editorComponent != null) { table.scrollRectToVisible(editorComponent.getBounds()); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(editorComponent, true)); } }
addFilter
292,673
void (FilterAction filter, List<? extends PsiElement> nodes, boolean completePattern, boolean target) { if (filter.checkApplicable(nodes, completePattern, target)) { if (filter.isActive() && !myTableModel.getItems().contains(filter)) { if (myTableModel.getRowCount() == 0) { myTableModel.addRow(myHeader); } myTableModel.addRow(filter); } } else if (filter.hasFilter()) { filter.clearFilter(); myConstraintChangedCallback.run(); } }
initFilter
292,674
void (FilterAction filter) { final int index = myTableModel.indexOf(filter); if (index >= 0) myTableModel.removeRow(index); if (myTableModel.getRowCount() == 1) myTableModel.removeRow(0); // remove header filter.clearFilter(); filter.reset(); myConstraintChangedCallback.run(); }
removeFilter
292,675
NamedScriptableDefinition () { return myConstraint; }
getVariable
292,676
String (NamedScriptableDefinition variable) { if (variable == null) { return ""; } final StringBuilder builder = new StringBuilder(); for (FilterAction filter : myFilters) { final String text = filter.getShortText(variable); if (text.length() > 0) { if (builder.length() > 0) builder.append(", "); builder.append(text); } } return builder.toString(); }
getShortFilterText
292,677
StructuralSearchProfile () { return StructuralSearchUtil.getProfileByFileType(myFileType); }
getProfile
292,678
Project () { return myProject; }
getProject
292,679
JComponent () { return myFilterPanel; }
getComponent
292,680
void (@Nullable LanguageFileType fileType) { myFileType = fileType; }
setFileType
292,681
void (@Nullable CompiledPattern compiledPattern) { myCompiledPattern = compiledPattern; showFilters(); }
setCompiledPattern
292,682
boolean () { return myCompiledPattern != null; }
isValid
292,683
void (@NotNull NamedScriptableDefinition constraint) { if (constraint == myConstraint) { return; } myConstraint = constraint; resetFilters(); showFilters(); }
initFilters
292,684
boolean () { return myTableModel.getRowCount() > 0; }
hasVisibleFilter
292,685
void () { for (FilterAction filter : myFilters) { filter.reset(); } }
resetFilters
292,686
void () { if (myConstraint == null) { return; } if (!isValid()) { myConstraint = null; return; } final String varName = myConstraint.getName(); final List<PsiElement> nodes = myCompiledPattern.getVariableNodes(varName); // replacement variable has no nodes final boolean completePattern = Configuration.CONTEXT_VAR_NAME.equals(varName); final boolean target = myConstraint instanceof MatchVariableConstraint && ((MatchVariableConstraint)myConstraint).isPartOfSearchResults(); myTableModel.setItems(new SmartList<>()); ReadAction.run(() -> { for (FilterAction filter : myFilters) { initFilter(filter, nodes, completePattern, target); } }); final String message; if (myConstraint instanceof MatchVariableConstraint) { message = Configuration.CONTEXT_VAR_NAME.equals(varName) ? SSRBundle.message("no.filters.whole.template.label") : SSRBundle.message("no.filters.for.0.label", varName); } else { message = SSRBundle.message("no.script.for.0.label", varName); } final StatusText statusText = myFilterTable.getTable().getEmptyText(); statusText.clear(); Arrays.stream(message.split("\n")).forEach((@NlsSafe var line) -> statusText.appendLine(line)); if (isValid()) { statusText.appendLine(myConstraint instanceof MatchVariableConstraint ? SSRBundle.message("add.filter.label") : SSRBundle.message("add.script.label"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, e -> showAddFilterPopup(myFilterTable.getTable(), new RelativePoint(MouseInfo.getPointerInfo().getLocation()))); } }
showFilters
292,687
void (Runnable callback) { myConstraintChangedCallback = callback; }
setConstraintChangedCallback
292,688
Runnable () { return myConstraintChangedCallback; }
getConstraintChangedCallback
292,689
JBTable () { return myFilterTable.getTable(); }
getTable
292,690
int () { return 0; }
position
292,691
SimpleColoredComponent () { myLabel.clear(); final String varName = myConstraint.getName(); myLabel.append(Configuration.CONTEXT_VAR_NAME.equals(varName) ? SSRBundle.message("filters.for.whole.template.title") : SSRBundle.message("filters.for.0.title", varName), SimpleTextAttributes.GRAYED_ATTRIBUTES); return myLabel; }
getRenderer
292,692
String (NamedScriptableDefinition variable) { return variable.getScriptCodeConstraint().length() > 2 ? SSRBundle.message("script.tooltip.message") : ""; }
getShortText
292,693
boolean () { final NamedScriptableDefinition variable = myTable.getVariable(); return variable != null && !StringUtil.isEmpty(variable.getScriptCodeConstraint()); }
hasFilter
292,694
void () { myTable.getVariable().setScriptCodeConstraint(""); }
clearFilter
292,695
boolean (List<? extends PsiElement> nodes, boolean completePattern, boolean target) { return true; }
isApplicable
292,696
void (SimpleColoredComponent component) { component.append(SSRBundle.message("script.0.label", StringUtil.unquoteString(myTable.getVariable().getScriptCodeConstraint()))); }
setLabel
292,697
FilterEditor<NamedScriptableDefinition> () { return new FilterEditor<>(myTable.getVariable(), myTable.getConstraintChangedCallback()) { private final JLabel myLabel = new JLabel(SSRBundle.message("script.label")); private final EditorTextField myTextField = UIUtil.createScriptComponent("", myTable.getProject()); private ContextHelpLabel myHelpLabel; @Override protected void layoutComponents() { new ExpandableEditorSupport(myTextField) { @NotNull @Override protected Content prepare(@NotNull EditorTextField field, @NotNull Function<? super String, String> onShow) { final Content popup = super.prepare(field, onShow); popup.getContentComponent().setPreferredSize(new Dimension(600, 150)); return popup; } }; final String[] variableNames = {Configuration.CONTEXT_VAR_NAME, ScriptLog.SCRIPT_LOG_VAR_NAME}; final String variableText = String.join(", ", variableNames); if (myConstraint instanceof MatchVariableConstraint) { myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.match.variable.help.text", variableText)); } else { myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.replacement.variable.help.text", variableText)); } final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ); } @Override protected void loadValues() { myTextField.setText(StringUtil.unquoteString(myConstraint.getScriptCodeConstraint())); } @Override protected void saveValues() { myConstraint.setScriptCodeConstraint('"' + myTextField.getText() + '"'); } @Override public JComponent getPreferredFocusedComponent() { return myTextField; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{myTextField}; } }; }
getEditor
292,698
void () { new ExpandableEditorSupport(myTextField) { @NotNull @Override protected Content prepare(@NotNull EditorTextField field, @NotNull Function<? super String, String> onShow) { final Content popup = super.prepare(field, onShow); popup.getContentComponent().setPreferredSize(new Dimension(600, 150)); return popup; } }; final String[] variableNames = {Configuration.CONTEXT_VAR_NAME, ScriptLog.SCRIPT_LOG_VAR_NAME}; final String variableText = String.join(", ", variableNames); if (myConstraint instanceof MatchVariableConstraint) { myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.match.variable.help.text", variableText)); } else { myHelpLabel = ContextHelpLabel.create(SSRBundle.message("script.filter.replacement.variable.help.text", variableText)); } final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(myLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ); }
layoutComponents
292,699
Content (@NotNull EditorTextField field, @NotNull Function<? super String, String> onShow) { final Content popup = super.prepare(field, onShow); popup.getContentComponent().setPreferredSize(new Dimension(600, 150)); return popup; }
prepare