Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
291,500
void (@NotNull TerminalAction action) { result.add(new TerminalActionWrapper(action)); }
addAction
291,501
void () { result.addSeparator(); }
addSeparator
291,502
void (Graphics2D gfx, BufferedImage image, int x, int y, ImageObserver observer) { UIUtil.drawImage(gfx, image, x, y, observer); }
drawImage
291,503
void (Graphics2D g, BufferedImage image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) { drawImage(g, image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); }
drawImage
291,504
void (Graphics g, Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { if (image instanceof JBHiDPIScaledImage) { final Graphics2D newG = (Graphics2D)g.create(0, 0, image.getWidth(observer), image.getHeight(observer)); newG.scale(0.5, 0.5); Image img = ((JBHiDPIScaledImage)image).getDelegate(); if (img == null) { img = image; } newG.drawImage(img, 2 * dx1, 2 * dy1, 2 * dx2, 2 * dy2, sx1 * 2, sy1 * 2, sx2 * 2, sy2 * 2, observer); newG.scale(1, 1); newG.dispose(); } else { g.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer); } }
drawImage
291,505
BufferedImage (int width, int height) { return ImageUtil.createImage(width, height, BufferedImage.TYPE_INT_ARGB); }
createBufferedImage
291,506
void (FocusEvent event) { if (mySettingsProvider.overrideIdeShortcuts()) { myActionsToSkip = setupActionsToSkip(); myEventDispatcher.register(); } else { myActionsToSkip = null; myEventDispatcher.unregister(); } if (GeneralSettings.getInstance().isSaveOnFrameDeactivation()) { ApplicationManager.getApplication().invokeLater(() -> FileDocumentManager.getInstance().saveAllDocuments(), ModalityState.nonModal()); } }
focusGained
291,507
List<AnAction> () { List<AnAction> res = new ArrayList<>(); ActionManager actionManager = ActionManager.getInstance(); for (String actionId : ACTIONS_TO_SKIP) { AnAction action = actionManager.getAction(actionId); if (action != null) { res.add(action); } } return res; }
setupActionsToSkip
291,508
void (FocusEvent event) { myActionsToSkip = null; myEventDispatcher.unregister(); SaveAndSyncHandler.getInstance().scheduleRefresh(); }
focusLost
291,509
Font (char[] text, int start, int end, @NotNull TextStyle style) { int fontStyle = Font.PLAIN; if (style.hasOption(TextStyle.Option.BOLD)) { fontStyle |= Font.BOLD; } if (style.hasOption(TextStyle.Option.ITALIC)) { fontStyle |= Font.ITALIC; } FontInfo fontInfo = ComplementaryFontsRegistry.getFontAbleToDisplay( text, start, end, fontStyle, mySettingsProvider.getColorsScheme().getConsoleFontPreferences(), null); return fontInfo.getFont().deriveFont((float)mySettingsProvider.getUiSettingsManager().getFontSize()); }
getFontToDisplay
291,510
void () { reinitFontAndResize(); }
fontChanged
291,511
void (MouseWheelEvent e) { if (EditorSettingsExternalizable.getInstance().isWheelFontChangeEnabled() && EditorUtil.isChangeFontSize(e)) { int newFontSize = (int)mySettingsProvider.getTerminalFontSize() - e.getWheelRotation(); if (newFontSize >= EditorFontsConstants.getMinEditorFontSize() && newFontSize <= EditorFontsConstants.getMaxEditorFontSize()) { mySettingsProvider.getUiSettingsManager().setFontSize(newFontSize); } return; } super.processMouseWheelEvent(e); }
processMouseWheelEvent
291,512
JBTerminalSystemSettingsProviderBase () { return mySettingsProvider; }
getSettingsProvider
291,513
boolean (@NotNull AWTEvent e) { if (e instanceof KeyEvent) { dispatchKeyEvent((KeyEvent)e); } return false; }
dispatch
291,514
void (@NotNull KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && !skipKeyEvent(e)) { if (!JBTerminalPanel.this.isFocusOwner()) { if (LOG.isDebugEnabled()) { LOG.debug("Prevented attempt to process " + KeyStroke.getKeyStrokeForEvent(e) + " by not focused " + getDebugTerminalPanelName() + ", unregistering"); } unregister(); return; } if (LOG.isDebugEnabled()) { LOG.debug("Consuming " + KeyStroke.getKeyStrokeForEvent(e) + ", registered:" + myRegistered); } JBTerminalPanel.this.dispatchEvent(e); } }
dispatchKeyEvent
291,515
String () { return JBTerminalPanel.class.getSimpleName() + "@" + System.identityHashCode(JBTerminalPanel.this); }
getDebugTerminalPanelName
291,516
boolean (@Nullable KeyEvent e) { split(myVertically); return true; }
actionPerformed
291,517
TerminalSplitAction (boolean vertically, @Nullable JBTerminalWidgetListener listener) { String text = vertically ? UIUtil.removeMnemonic(ActionsBundle.message("action.SplitVertically.text")) : UIUtil.removeMnemonic(ActionsBundle.message("action.SplitHorizontally.text")); return new TerminalSplitAction(new TerminalActionPresentation(text, Collections.emptyList()), vertically) { @Override public boolean isEnabled(@Nullable KeyEvent e) { return listener != null && listener.canSplit(vertically); } @Override public void split(boolean vertically) { Objects.requireNonNull(listener).split(vertically); } }; }
create
291,518
boolean (@Nullable KeyEvent e) { return listener != null && listener.canSplit(vertically); }
isEnabled
291,519
void (boolean vertically) { Objects.requireNonNull(listener).split(vertically); }
split
291,520
void (@NotNull AnActionEvent e) { JBTerminalWidget terminal = getTerminalWidget(e); e.getPresentation().setEnabledAndVisible(terminal != null); }
update
291,521
TerminalAction (@NotNull JBTerminalWidget widget, @NonNls @NotNull AnAction action) { Collection<KeyStroke> strokes = KeymapUtil.getKeyStrokes(action.getShortcutSet()); String name = StringUtil.notNullize(action.getTemplateText(), "unknown"); return new TerminalAction(new TerminalActionPresentation(name, List.copyOf(strokes)), (keyEvent) -> { DataContext dataContext = DataManager.getInstance().getDataContext(widget.getTerminalPanel()); ActionUtil.performActionDumbAwareWithCallbacks(action, AnActionEvent.createFromInputEvent(keyEvent, "Terminal", null, dataContext)); return true; }); }
createTerminalAction
291,522
TerminalAction (@NotNull JBTerminalWidget widget, @NotNull TerminalActionPresentation actionPresentation, @NotNull Predicate<? super JBTerminalWidgetListener> action) { return new TerminalAction(actionPresentation, input -> { JBTerminalWidgetListener listener = widget.getListener(); if (listener != null) { return action.test(listener); } return false; }).withEnabledSupplier(() -> widget.getListener() != null); }
createTerminalAction
291,523
boolean () { T dependency = myToProcess.peekFirst(); if (dependency == null) return false; if (mySeenObjects.contains(dependency)) { myToProcess.removeFirst(); return hasNext(); } return true; }
hasNext
291,524
T () { T dependency = myToProcess.removeFirst(); if (mySeenObjects.add(dependency)) { Collection<? extends T> children = getChildren(dependency); myToProcess.addAll(children); myProcessedStructure.add(children.size()); return dependency; } else { return next(); } }
next
291,525
void () { throw new UnsupportedOperationException("remove"); }
remove
291,526
int (String debuggerId, String processName, String processParameters, String moduleDir) { return setupDebugger(debuggerId, processName, processParameters, getPortFromProperty(), moduleDir); }
setupDebugger
291,527
int (String debuggerId, String processName, String processParameters, int dispatchPort, String moduleDir) { int port = 0; try { port = findAvailableSocketPort(); processParameters = (processParameters == null || processParameters.isEmpty()) ? "" : processParameters + PARAMETERS_SEPARATOR; processParameters = processParameters + DEBUG_SERVER_PORT_KEY + "=" + port + PARAMETERS_SEPARATOR; processParameters = processParameters + RUNTIME_MODULE_DIR_KEY + "=" + moduleDir; send(debuggerId, processName, processParameters, dispatchPort); } catch (IOException e) { //noinspection CallToPrintStackTrace e.printStackTrace(); } return port; }
setupDebugger
291,528
void (String debuggerId, String processName) { signalizeFinish(debuggerId, processName, getPortFromProperty()); }
signalizeFinish
291,529
void (String debuggerId, String processName, int dispatchPort) { try { send(debuggerId, processName, FINISH_PARAMS, dispatchPort); } catch (IOException e) { //noinspection CallToPrintStackTrace e.printStackTrace(); } }
signalizeFinish
291,530
String () { return System.getProperty(DISPATCH_ADDR_SYS_PROP, "127.0.0.1"); }
getAddrFromProperty
291,531
int () { String property = System.getProperty(DISPATCH_PORT_SYS_PROP); try { if (property == null || property.trim().isEmpty()) { throw new IllegalStateException("System property '" + DISPATCH_PORT_SYS_PROP + "' is not set"); } return Integer.parseInt(property); } catch (NumberFormatException e) { throw new IllegalStateException("System property '" + DISPATCH_PORT_SYS_PROP + "' has invalid value: " + property, e); } }
getPortFromProperty
291,532
String () { return myOriginalReason; }
getOriginalReason
291,533
String[] () { return myQuickFixes; }
getQuickFixes
291,534
void (PrintWriter s) { super.printStackTrace(s); s.println(myOriginalReason); }
printStackTrace
291,535
void (PrintStream s) { super.printStackTrace(s); s.println(myOriginalReason); }
printStackTrace
291,536
String (@Nullable String message, @Nullable Throwable cause) { StringBuilder buffer = new StringBuilder(); if (message != null) { buffer.append(message); } boolean first = true; for (Throwable t = cause; t != null; t = t.getCause()) { final String m = t.getLocalizedMessage(); if (m == null) { continue; } if (first) { first = false; // do not append same exception.message twice if (m.equals(message)) { continue; } } else if (buffer.length() > 0) { buffer.append("\n"); } buffer.append(m); } return buffer.toString(); }
extractMessage
291,537
String[] (@NotNull String[] a1, @NotNull String[] a2) { if (a1.length == 0) return a2; if (a2.length == 0) return a1; String[] result = new String[a1.length + a2.length]; System.arraycopy(a1, 0, result, 0, a1.length); System.arraycopy(a2, 0, result, a1.length, a2.length); return result; }
mergeArrays
291,538
boolean () { return isTest; }
isTest
291,539
boolean () { return isGenerated; }
isGenerated
291,540
boolean () { return isResource; }
isResource
291,541
boolean () { return isExcluded; }
isExcluded
291,542
ExternalSystemSourceType (IExternalSystemSourceType sourceType) { for (ExternalSystemSourceType systemSourceType : ExternalSystemSourceType.values()) { if (systemSourceType.isGenerated == sourceType.isGenerated() && systemSourceType.isResource == sourceType.isResource() && systemSourceType.isTest == sourceType.isTest() && systemSourceType.isExcluded == sourceType.isExcluded()) { return systemSourceType; } } throw new IllegalArgumentException("Invalid source type: " + sourceType); }
from
291,543
ExternalSystemSourceType (boolean isTest, boolean isGenerated, boolean isResource, boolean isExcluded) { for (ExternalSystemSourceType systemSourceType : ExternalSystemSourceType.values()) { if (systemSourceType.isGenerated == isGenerated && systemSourceType.isResource == isResource && systemSourceType.isTest == isTest && systemSourceType.isExcluded == isExcluded) { return systemSourceType; } } return null; }
from
291,544
String () { return path; }
getPath
291,545
String () { return displayName; }
getDisplayName
291,546
String () { return componentName; }
getComponentName
291,547
DependencyScopeNode () { return compileDependencies; }
getCompileDependenciesGraph
291,548
DependencyScopeNode () { return runtimeDependencies; }
getRuntimeDependenciesGraph
291,549
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ComponentDependenciesImpl that = (ComponentDependenciesImpl)o; if (!componentName.equals(that.componentName)) return false; if (!compileDependencies.equals(that.compileDependencies)) return false; if (!runtimeDependencies.equals(that.runtimeDependencies)) return false; return true; }
equals
291,550
int () { int result = componentName.hashCode(); result = 31 * result + compileDependencies.hashCode(); result = 31 * result + runtimeDependencies.hashCode(); return result; }
hashCode
291,551
String () { return projectName; }
getProjectName
291,552
String () { return projectPath; }
getProjectPath
291,553
String () { return "project " + projectName; }
getDisplayName
291,554
long () { return id; }
getId
291,555
List<DependencyNode> () { return dependencies; }
getDependencies
291,556
ResolutionState () { return resolutionState; }
getResolutionState
291,557
void (@Nullable ResolutionState resolutionState) { this.resolutionState = resolutionState; }
setResolutionState
291,558
String () { return selectionReason; }
getSelectionReason
291,559
void (@Nullable String selectionReason) { this.selectionReason = selectionReason; }
setSelectionReason
291,560
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AbstractDependencyNode node = (AbstractDependencyNode)o; return id == node.id; }
equals
291,561
int () { int result = (int)(id ^ (id >>> 32)); return result; }
hashCode
291,562
List<ComponentDependencies> () { return dependencies; }
getComponentsDependencies
291,563
void (ComponentDependencies componentDependencies) { dependencies.add(componentDependencies); }
add
291,564
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProjectDependenciesImpl that = (ProjectDependenciesImpl)o; if (!dependencies.equals(that.dependencies)) return false; return true; }
equals
291,565
int () { return dependencies.hashCode(); }
hashCode
291,566
String () { return scope; }
getScope
291,567
String () { return group; }
getGroup
291,568
String () { return module; }
getModule
291,569
String () { return version; }
getVersion
291,570
String () { return group + ':' + module + ':' + version; //NON-NLS }
getDisplayName
291,571
String () { return name == null ? "unknown" : name; //NON-NLS }
getDisplayName
291,572
long () { return id; }
getId
291,573
String () { return "*"; }
getDisplayName
291,574
ResolutionState () { return null; }
getResolutionState
291,575
String () { return null; }
getSelectionReason
291,576
List<DependencyNode> () { return Collections.emptyList(); }
getDependencies
291,577
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ReferenceNode node = (ReferenceNode)o; if (id != node.id) return false; return true; }
equals
291,578
int () { return (int)(id ^ (id >>> 32)); }
hashCode
291,579
void () { assertEquals("convert array types correctly", "char[]|int[]", MatchVariableConstraint.convertRegExpTypeToTypeString("char\\[]|int\\[\\]")); assertEquals("consider dots without following meta chars a regular dot (common mistake)", "java.lang.String", MatchVariableConstraint.convertRegExpTypeToTypeString("java.lang.String")); assertEquals("", MatchVariableConstraint.convertRegExpTypeToTypeString("start.*")); assertEquals("parentheses", "int|long", MatchVariableConstraint.convertRegExpTypeToTypeString("(int|long)")); }
testConvertRegExpToTypeString
291,580
void () { assertEquals("char\\[\\]|int\\[\\]", MatchVariableConstraint.convertTypeStringToRegExp("char[]|int[]")); }
testConvertTypeStringToRegExp
291,581
void () { final MatchVariableConstraint constraint = new MatchVariableConstraint(); constraint.setName("elephant"); constraint.setNameOfExprType("String"); constraint.setNameOfFormalArgType("String"); final Element test = new Element("constraint"); constraint.writeExternal(test); assertEquals("<constraint name=\"elephant\" nameOfExprType=\"String\" nameOfFormalType=\"String\" within=\"\" contains=\"\" />", JDOMUtil.writeElement(test)); }
testWriteExternal
291,582
void () { final MatchVariableConstraint constraint = new MatchVariableConstraint(); assertNull(constraint.getAdditionalConstraint("hypergolic")); try { constraint.putAdditionalConstraint("reférence", "test"); fail(); } catch (IllegalArgumentException ignored) {} try { constraint.putAdditionalConstraint("Capital", "test"); fail(); } catch (IllegalArgumentException ignored) {} try { constraint.putAdditionalConstraint("words with spaces", "test"); fail(); } catch (IllegalArgumentException ignored) {} constraint.putAdditionalConstraint("test", "test"); assertFalse(constraint.equals(new MatchVariableConstraint())); final Element element = new Element("constraint"); constraint.writeExternal(element); assertEquals("<constraint name=\"\" within=\"\" contains=\"\" _test=\"test\" />", JDOMUtil.writeElement(element)); final MatchVariableConstraint constraint2 = new MatchVariableConstraint(); constraint2.readExternal(element); assertEquals("test", constraint2.getAdditionalConstraint("test")); final MatchVariableConstraint constraint3 = constraint2.copy(); assertEquals("test", constraint3.getAdditionalConstraint("test")); assertEquals(String.valueOf(constraint2.getAllAdditionalConstraints()), 1, constraint2.getAllAdditionalConstraints().size()); constraint.putAdditionalConstraint("test", null); assertTrue(constraint.equals(new MatchVariableConstraint())); }
testAdditionalConstraints
291,583
void (Configuration template, String source, LanguageFileType fileType, String... results) { doTest(template, source, fileType, e -> StructuralSearchUtil.getPresentableElement(e).getText(), results); }
doTest
291,584
void (Configuration template, String source, LanguageFileType fileType, Function<? super PsiElement, String> resultConverter, String... expectedResults) { if (!(template instanceof SearchConfiguration)) fail(); final SearchConfiguration searchConfiguration = (SearchConfiguration)template; options = searchConfiguration.getMatchOptions(); final Matcher matcher = new Matcher(getProject(), options); final List<MatchResult> matches = matcher.testFindMatches(source, true, fileType, false); final List<String> actualResults = ContainerUtil.map(matches, result -> resultConverter.apply(result.getMatch())); assertEquals(template.getName() , List.of(expectedResults), actualResults); }
doTest
291,585
String (String in, String what, String by) { return replace(in, what, by, false); }
replace
291,586
String (String in, String what, String by, boolean sourceIsFile) { return replace(in, what, by, sourceIsFile, false); }
replace
291,587
String (String in, String what, String by, boolean sourceIsFile, boolean createPhysicalFile) { if (in == null && (sourceIsFile || createPhysicalFile)) { throw new IllegalArgumentException("can't create file when 'in' argument is null"); } final MatchOptions matchOptions = options.getMatchOptions(); if (createPhysicalFile) { configureFromFileText("Source." + matchOptions.getFileType().getDefaultExtension(), in); matchOptions.setScope(new LocalSearchScope(getFile())); } matchOptions.fillSearchCriteria(what); final CompiledPattern compiledPattern = PatternCompiler.compilePattern(getProject(), matchOptions, true, false); final String message = StructuralSearchTestCase.checkApplicableConstraints(matchOptions, compiledPattern); assertNull(message, message); return Replacer.testReplace(in, what, by, options, getProject(), sourceIsFile); }
replace
291,588
void () { doTest("hello world!", "[in text:hello][in text:world]"); doTest("<html>", "[in code:html]"); }
testSimple
291,589
void () { doTest("<'_A{0,0}><b>freak <em>mulching</em> accident</b></'_A><br>", "[in code:br]"); }
testVars
291,590
void () { doTest("<'_a title=\"fiber\">", "[in code:title][in code:fiber]"); doTest("<a '_t{0,1}:[regex( href )]=\"https://www.jetbrains.com\">", "[in code:a]"); doTest("<a href=\"'_value{0,1}:[regex( xxx )]\">", "[in code:a][in code:href]"); }
testAttributes
291,591
void () { doTest(""" <TextView \t\tandroid:id="@+id/text" \t\tandroid:layout_width="wrap_content" \t\tandroid:fontFamily="sans-serif-medium" \t\tandroid:layout_height="wrap_content" />""", "[in code:TextView][in code:android][in code:id][in code:text][in code:layout_width][in code:wrap_content]" + "[in code:fontFamily][in code:medium][in code:serif][in code:sans][in code:layout_height]"); doTest("<idea-plugin url=\"https://www.jetbrains.com\">", "[in code:plugin][in code:idea][in code:url][in code:jetbrains][in code:https][in code:www][in code:com]"); }
testElementsThatAreNotWords
291,592
void (String query, String plan) { assertEquals(plan, getSearchPlan(query, HtmlFileType.INSTANCE)); }
doTest
291,593
String (String query, LanguageFileType fileType) { final MatchOptions matchOptions = new MatchOptions(); matchOptions.fillSearchCriteria(query); matchOptions.setFileType(fileType); PatternCompiler.compilePattern(getProject(), matchOptions, true, true); return PatternCompiler.getLastSearchPlan(); }
getSearchPlan
291,594
int (String in, String pattern, LanguageFileType fileType) { return findMatches(in, pattern, fileType).size(); }
findMatchesCount
291,595
List<MatchResult> (String in, String pattern, LanguageFileType patternFileType, Language patternLanguage, LanguageFileType sourceFileType, boolean physicalSourceFile) { options.fillSearchCriteria(pattern); options.setFileType(patternFileType); options.setDialect(patternLanguage); final CompiledPattern compiledPattern = PatternCompiler.compilePattern(getProject(), options, true, false); final String message = checkApplicableConstraints(options, compiledPattern); assertNull(message, message); final Matcher matcher = new Matcher(getProject(), options, compiledPattern); return matcher.testFindMatches(in, true, sourceFileType, physicalSourceFile); }
findMatches
291,596
String (MatchOptions options, CompiledPattern compiledPattern) { final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(options.getFileType()); assert profile != null : "no profile found for file type: " + options.getFileType(); for (String varName : options.getVariableConstraintNames()) { final List<PsiElement> nodes = compiledPattern.getVariableNodes(varName); final MatchVariableConstraint constraint = options.getVariableConstraint(varName); final List<String> usedConstraints = new SmartList<>(); if (!StringUtil.isEmpty(constraint.getRegExp())) { usedConstraints.add(UIUtil.TEXT); } if (constraint.isWithinHierarchy()) { usedConstraints.add(UIUtil.TEXT_HIERARCHY); } if (constraint.getMinCount() == 0) { usedConstraints.add(UIUtil.MINIMUM_ZERO); } if (constraint.getMaxCount() > 1) { usedConstraints.add(UIUtil.MAXIMUM_UNLIMITED); } if (!StringUtil.isEmpty(constraint.getNameOfExprType())) { usedConstraints.add(UIUtil.TYPE); } if (!StringUtil.isEmpty(constraint.getNameOfFormalArgType())) { usedConstraints.add(UIUtil.EXPECTED_TYPE); } if (!StringUtil.isEmpty(constraint.getReferenceConstraint())) { usedConstraints.add(UIUtil.REFERENCE); } for (String usedConstraint : usedConstraints) { if (!profile.isApplicableConstraint(usedConstraint, nodes, false, constraint.isPartOfSearchResults())) { return usedConstraint + " not applicable for " + varName; } } } return null; }
checkApplicableConstraints
291,597
List<MatchResult> (String in, String pattern, LanguageFileType fileType) { return findMatches(in, pattern, fileType, null, fileType, false); }
findMatches
291,598
void (String in, String pattern, LanguageFileType fileType, String... expectedResults) { final List<MatchResult> matches = findMatches(in, pattern, fileType); final List<String> actualResults = ContainerUtil.map(matches, r -> StructuralSearchUtil.getPresentableElement(r.getMatch()).getText()); assertEquals(String.join("\n", actualResults), expectedResults.length, actualResults.size()); for (int i = 0, length = expectedResults.length; i < length; i++) { assertEquals(expectedResults[i], actualResults.get(i)); } }
findMatchesText
291,599
String () { final Element node = new Element("profile"); myProfile.writeExternal(node); return JDOMUtil.writeElement(node); }
buildXmlFromProfile