file_path
stringlengths 57
191
| method_name
stringlengths 2
80
| method_block
stringlengths 8
32.6k
| method_name_pointers
sequencelengths 2
2
| method_signature
stringlengths 7
4.42k
| length
int64 8
32.6k
| __index_level_0__
int64 0
516k
|
---|---|---|---|---|---|---|
../intellij-community/platform/ide-core/src/com/intellij/openapi/vfs/newvfs/impl/StubVirtualFile.java | setDetectedLineSeparator | @Override
public void setDetectedLineSeparator(@Nullable String separator) {
throw unsupported();
} | [
24,
48
] | @Override
public void setDetectedLineSeparator(@Nullable String separator) | 107 | 248,599 |
../intellij-community/java/idea-ui/src/com/intellij/ide/util/importProject/ModuleInsight.java | maximizeModuleFolders | private void maximizeModuleFolders(@NotNull Collection<ModuleCandidate> modules) {
Object2IntMap<File> dirToChildRootCount = new Object2IntOpenHashMap<>();
for (ModuleCandidate module : modules) {
walkParents(module.myFolder, this::isEntryPointRoot, file -> {
dirToChildRootCount.mergeInt(file, 1, Math::addExact);
});
}
for (ModuleCandidate module : modules) {
File moduleRoot = module.myFolder;
Ref<File> adjustedRootRef = new Ref<>(module.myFolder);
File current = moduleRoot;
while (dirToChildRootCount.getInt(current) == 1) {
adjustedRootRef.set(current);
if (isEntryPointRoot(current)) break;
current = current.getParentFile();
}
module.myFolder = adjustedRootRef.get();
}
} | [
13,
34
] | private void maximizeModuleFolders(@NotNull Collection<ModuleCandidate> modules) | 782 | 361,098 |
../intellij-community/platform/execution.serviceView/src/ServiceViewManagerImpl.java | registerToolWindow | private void registerToolWindow(@NotNull ServiceViewToolWindowDescriptor descriptor, boolean active) {
if (myProject.isDefault()) {
return;
}
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
toolWindowManager.invokeLater(() -> {
String toolWindowId = descriptor.getToolWindowId();
if (toolWindowManager.getToolWindow(toolWindowId) != null) return;
if (!myActivationActionsRegistered && ToolWindowId.SERVICES.equals(toolWindowId)) {
myActivationActionsRegistered = true;
Collection<ServiceViewContributor<?>> contributors = myGroups.get(ToolWindowId.SERVICES);
if (contributors != null) {
registerActivateByContributorActions(myProject, contributors);
}
}
myRegisteringToolWindowAvailable = active;
try {
ToolWindow toolWindow = toolWindowManager.registerToolWindow(toolWindowId, builder -> {
builder.contentFactory = new ServiceViewToolWindowFactory();
builder.icon = descriptor.getToolWindowIcon();
builder.hideOnEmptyContent = false;
builder.stripeTitle = () -> {
return descriptor.getStripeTitle();
};
return Unit.INSTANCE;
});
if (active) {
myActiveToolWindowIds.add(toolWindowId);
}
restoreBrokenToolWindowIfNeeded(toolWindow);
}
finally {
myRegisteringToolWindowAvailable = false;
}
});
} | [
13,
31
] | private void registerToolWindow(@NotNull ServiceViewToolWindowDescriptor descriptor, boolean active) | 1,482 | 276,724 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/psi/impl/stubs/PyTypeAliasStatementElementType.java | createElement | @Override
@NotNull
public PsiElement createElement(@NotNull ASTNode node) {
return new PyTypeAliasStatementImpl(node);
} | [
41,
54
] | @Override
@NotNull
public PsiElement createElement(@NotNull ASTNode node) | 130 | 10,763 |
../intellij-community/python/gen/com/jetbrains/python/requirements/psi/VersionOne.java | getVersionCmpStmt | @NotNull
VersionCmpStmt getVersionCmpStmt(); | [
26,
43
] | @NotNull
VersionCmpStmt getVersionCmpStmt() | 46 | 3,307 |
../intellij-community/platform/webSymbols/gen/com/intellij/webSymbols/webTypes/json/CssPseudoElement.java | setArguments | @JsonProperty("arguments")
public void setArguments(Boolean arguments) {
this.arguments = arguments;
} | [
43,
55
] | @JsonProperty("arguments")
public void setArguments(Boolean arguments) | 118 | 330,927 |
../intellij-community/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxFieldIdReferenceProvider.java | getGuessedTagClass | private PsiClass getGuessedTagClass() {
final PsiElement xmlAttribute = myXmlAttributeValue.getParent();
final XmlTag xmlTag = ((XmlAttribute)xmlAttribute).getParent();
if (xmlTag == null) return null;
final PsiElement parentTag = xmlTag.getParent();
if (parentTag == null) return null;
String className = null;
if (parentTag instanceof XmlDocument) {
className = JavaFxCommonNames.JAVAFX_SCENE_LAYOUT_PANE;
}
else if (parentTag.getParent() instanceof XmlDocument) {
final String name = xmlTag.getName();
if (!FxmlConstants.FX_BUILT_IN_TAGS.contains(name)) {
className = JavaFxCommonNames.JAVAFX_SCENE_NODE;
}
}
if (className == null) return null;
return JavaPsiFacade.getInstance(myAClass.getProject()).findClass(className, GlobalSearchScope.allScope(myAClass.getProject()));
} | [
17,
35
] | private PsiClass getGuessedTagClass() | 898 | 49,657 |
../intellij-community/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/RunAnythingMavenItem.java | createComponent | @NotNull
@Override
public Component createComponent(@Nullable String pattern, boolean isSelected, boolean hasFocus) {
String command = getCommand();
JPanel component = (JPanel)super.createComponent(pattern, isSelected, hasFocus);
String toComplete = notNullize(substringAfterLast(command, " "));
if (toComplete.startsWith("-")) {
Option option = MavenCommandLineOptions.findOption(toComplete);
if (option != null) {
String description = option.getDescription();
if (description != null) {
SimpleColoredComponent descriptionComponent = new SimpleColoredComponent();
//noinspection HardCodedStringLiteral
descriptionComponent.append(" " + shortenTextWithEllipsis(description, 200, 0), SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES);
component.add(descriptionComponent, BorderLayout.EAST);
}
}
}
return component;
} | [
40,
55
] | @NotNull
@Override
public Component createComponent(@Nullable String pattern, boolean isSelected, boolean hasFocus) | 926 | 58,707 |
../intellij-community/platform/analysis-impl/src/com/intellij/codeInsight/dataflow/map/DFAMap.java | put | public void put(String key, V value) {
if ((myK == null || myK.equals(key)) && myAll == null) {
myK = key;
myV = value;
}
else {
if (myAll == null) {
myAll = new HashMap<>();
myAll.put(myK, myV);
}
myAll.put(key, value);
}
} | [
12,
15
] | public void put(String key, V value) | 288 | 245,952 |
../intellij-community/platform/diff-impl/src/com/intellij/diff/tools/external/ExternalDiffToolUtil.java | getPath | @NotNull
String getPath(); | [
20,
27
] | @NotNull
String getPath() | 30 | 273,891 |
../intellij-community/platform/util/src/com/intellij/util/CodeWriter.java | println | @Override
public void println() {
((PrintWriter)out).println();
myNewLineStarted = true;
} | [
24,
31
] | @Override
public void println() | 102 | 234,326 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingManagerImpl.java | setNative2AsciiForPropertiesFiles | @Override
public void setNative2AsciiForPropertiesFiles(final VirtualFile virtualFile, final boolean native2Ascii) {
Project project = guessProject(virtualFile);
if (project == null) return;
EncodingProjectManager.getInstance(project).setNative2AsciiForPropertiesFiles(virtualFile, native2Ascii);
} | [
24,
57
] | @Override
public void setNative2AsciiForPropertiesFiles(final VirtualFile virtualFile, final boolean native2Ascii) | 314 | 319,270 |
../intellij-community/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java | invokeCompletion | private void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int time, boolean hasModifiers, @NotNull Caret caret) {
markCaretAsProcessed(caret);
if (invokedExplicitly) {
StatisticsUpdate.applyLastCompletionStatisticsUpdate();
}
checkNoWriteAccess();
CompletionAssertions.checkEditorValid(editor);
int offset = editor.getCaretModel().getOffset();
if (editor.isViewer() || editor.getDocument().getRangeGuard(offset, offset) != null) {
editor.getDocument().fireReadOnlyModificationAttempt();
EditorModificationUtil.checkModificationAllowed(editor);
return;
}
if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
return;
}
CompletionPhase phase = CompletionServiceImpl.getCompletionPhase();
boolean repeated = phase.indicator != null && phase.indicator.isRepeatedInvocation(completionType, editor);
final int newTime = phase.newCompletionStarted(time, repeated);
if (invokedExplicitly) {
time = newTime;
}
final int invocationCount = time;
if (CompletionServiceImpl.isPhase(CompletionPhase.InsertedSingleItem.class)) {
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
}
CompletionServiceImpl.assertPhase(CompletionPhase.NoCompletion.getClass(), CompletionPhase.CommittingDocuments.class);
if (invocationCount > 1 && completionType == CompletionType.BASIC) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.SECOND_BASIC_COMPLETION);
}
long startingTime = System.currentTimeMillis();
Runnable initCmd = () -> {
WriteAction.run(() -> EditorUtil.fillVirtualSpaceUntilCaret(editor));
CompletionInitializationContextImpl context = withTimeout(calcSyncTimeOut(startingTime), () -> {
return CompletionInitializationUtil.createCompletionInitializationContext(project, editor, caret, invocationCount, completionType);
});
boolean hasValidContext = context != null;
if (!hasValidContext) {
PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(caret, project);
context = new CompletionInitializationContextImpl(editor, caret, psiFile, completionType, invocationCount);
}
doComplete(context, hasModifiers, hasValidContext, startingTime);
};
try {
if (autopopup) {
CommandProcessor.getInstance().runUndoTransparentAction(initCmd);
}
else {
CommandProcessor.getInstance().executeCommand(project, initCmd, null, null, editor.getDocument());
}
}
catch (IndexNotReadyException e) {
if (invokedExplicitly) {
DumbService.getInstance(project).showDumbModeNotificationForFunctionality(CodeInsightBundle.message("completion.not.available.during.indexing"),
DumbModeBlockedFunctionality.CodeCompletion);
}
throw e;
}
} | [
13,
29
] | private void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int time, boolean hasModifiers, @NotNull Caret caret) | 3,062 | 212,764 |
../intellij-community/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionTree.java | createMessageNode | @Override
public DebuggerTreeNodeImpl createMessageNode(String message) {
return new DebuggerTreeNodeImpl(null, new MessageDescriptor(message));
} | [
42,
59
] | @Override
public DebuggerTreeNodeImpl createMessageNode(String message) | 160 | 34,733 |
../intellij-community/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousConstructorProcessor.java | generateLocalsForArguments | private void generateLocalsForArguments() {
for (int i = 0; i < myConstructorArguments.length; i++) {
PsiExpression expr = myConstructorArguments[i];
PsiParameter parameter = myConstructorParameters.getParameters()[i];
if (parameter.isVarArgs()) {
PsiEllipsisType ellipsisType = (PsiEllipsisType)parameter.getType();
PsiType baseType = ellipsisType.getComponentType();
@NonNls StringBuilder exprBuilder = new StringBuilder("new ");
exprBuilder.append(baseType.getCanonicalText());
exprBuilder.append("[] { }");
try {
PsiNewExpression newExpr = (PsiNewExpression) myElementFactory.createExpressionFromText(exprBuilder.toString(), myClass);
PsiArrayInitializerExpression arrayInitializer = newExpr.getArrayInitializer();
assert arrayInitializer != null;
for(int j = i; j < myConstructorArguments.length; j++) {
arrayInitializer.add(myConstructorArguments[j]);
}
PsiLocalVariable variable = generateLocal(parameter.getName(), ellipsisType.toArrayType(), newExpr);
myLocalsForParameters.put(parameter, variable);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
break;
}
else if (!isConstant(expr)) {
PsiLocalVariable variable = generateLocal(parameter.getName(), parameter.getType(), expr);
myLocalsForParameters.put(parameter, variable);
}
}
} | [
13,
39
] | private void generateLocalsForArguments() | 1,486 | 483,667 |
../intellij-community/platform/platform-impl/src/com/intellij/formatting/LineWrappingUtil.java | emulateEnter | private static void emulateEnter(final @NotNull Editor editor, @NotNull Project project, int[] shifts) {
DataContext dataContext = prepareContext(project, editor);
int caretOffset = editor.getCaretModel().getOffset();
Document document = editor.getDocument();
SelectionModel selectionModel = editor.getSelectionModel();
int startSelectionOffset = 0;
int endSelectionOffset = 0;
boolean restoreSelection = selectionModel.hasSelection();
if (restoreSelection) {
startSelectionOffset = selectionModel.getSelectionStart();
endSelectionOffset = selectionModel.getSelectionEnd();
selectionModel.removeSelection();
}
int textLengthBeforeWrap = document.getTextLength();
int lineCountBeforeWrap = document.getLineCount();
DataManager.getInstance().saveInDataContext(dataContext, WRAP_LONG_LINE_DURING_FORMATTING_IN_PROGRESS_KEY, true);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
try {
Runnable command = () -> EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER)
.execute(editor, editor.getCaretModel().getCurrentCaret(), dataContext);
if (commandProcessor.getCurrentCommand() == null) {
commandProcessor.executeCommand(project, command, WRAP_LINE_COMMAND_NAME, null);
}
else {
command.run();
}
}
finally {
DataManager.getInstance().saveInDataContext(dataContext, WRAP_LONG_LINE_DURING_FORMATTING_IN_PROGRESS_KEY, null);
}
int symbolsDiff = document.getTextLength() - textLengthBeforeWrap;
if (restoreSelection) {
int newSelectionStart = startSelectionOffset;
int newSelectionEnd = endSelectionOffset;
if (startSelectionOffset >= caretOffset) {
newSelectionStart += symbolsDiff;
}
if (endSelectionOffset >= caretOffset) {
newSelectionEnd += symbolsDiff;
}
selectionModel.setSelection(newSelectionStart, newSelectionEnd);
}
shifts[0] = document.getLineCount() - lineCountBeforeWrap;
shifts[1] = symbolsDiff;
} | [
20,
32
] | private static void emulateEnter(final @NotNull Editor editor, @NotNull Project project, int[] shifts) | 2,082 | 329,127 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageUpAction.java | isEnabledForCaret | @Override
public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
return !editor.isOneLineMode();
} | [
29,
46
] | @Override
public boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) | 163 | 328,257 |
../intellij-community/java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java | onAlternativeJreChanged | public static void onAlternativeJreChanged(boolean changed, Project project) {
if (changed) {
AlternativeSdkRootsProvider.reindexIfNeeded(project);
}
} | [
19,
42
] | public static void onAlternativeJreChanged(boolean changed, Project project) | 167 | 382,051 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java | getContentManager | public @NotNull ContentManager getContentManager() {
return contentManager;
} | [
31,
48
] | public @NotNull ContentManager getContentManager() | 83 | 322,511 |
../intellij-community/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/MemberModel.java | create | @Override
public @NotNull PsiMember create(@NotNull PsiElementFactory factory,
@NotNull String text,
@Nullable PsiElement context) {
return factory.createFieldFromText(text, context);
} | [
42,
48
] | @Override
public @NotNull PsiMember create(@NotNull PsiElementFactory factory,
@NotNull String text,
@Nullable PsiElement context) | 283 | 354,011 |
../intellij-community/platform/core-api/src/com/intellij/patterns/ObjectPattern.java | isNull | public @NotNull Self isNull() {
//noinspection Convert2Diamond (would break compilation: IDEA-168317)
return adapt(new ElementPatternCondition<T>(new InitialPatternCondition(Object.class) {
@Override
public boolean accepts(final @Nullable Object o, final ProcessingContext context) {
return o == null;
}
}));
} | [
21,
27
] | public @NotNull Self isNull() | 350 | 290,778 |
../intellij-community/platform/core-api/src/com/intellij/psi/tree/ILazyParseableElementType.java | createNode | public ASTNode createNode(CharSequence text) {
return null;
} | [
15,
25
] | public ASTNode createNode(CharSequence text) | 67 | 294,286 |
../intellij-community/java/java-impl/src/com/intellij/codeInsight/intention/impl/CollapseIntoLoopAction.java | tryCollapseIntoCountingLoop | private String tryCollapseIntoCountingLoop(String varName) {
if (!PsiTypes.intType().equals(myType) && !PsiTypes.longType().equals(myType)) return null;
Long start = null;
Long step = null;
Long last = null;
for (PsiExpression element : myLoopElements) {
if (!(element instanceof PsiLiteralExpression)) return null;
Object value = ((PsiLiteralExpression)element).getValue();
if (!(value instanceof Integer) && !(value instanceof Long)) return null;
long cur = ((Number)value).longValue();
if (start == null) {
start = cur;
}
else if (step == null) {
step = cur - start;
if (step == 0) return null;
}
else if (cur - last != step || (step > 0 && cur < last) || (step < 0 && cur > last)) {
return null;
}
last = cur;
}
if (start == null || step == null) return null;
// Prefer for(int x : new int[] {12, 17}) over for(int x = 12; x <= 17; x+= 5)
if (myLoopElements.size() == 2 && step != 1L && step != -1L) return null;
PsiElement parent = myStatements.get(0).getParent();
boolean mustBeEffectivelyFinal = myExpressionsToReplace.stream()
.map(ref -> PsiTreeUtil.getParentOfType(ref, PsiClass.class, PsiLambdaExpression.class))
.anyMatch(ctx -> ctx != null && PsiTreeUtil.isAncestor(parent, ctx, false));
if (mustBeEffectivelyFinal) return null;
String suffix = PsiTypes.longType().equals(myType) ? "L" : "";
String initial = myType.getCanonicalText() + " " + varName + "=" + start + suffix;
String condition =
varName + (step == 1 && last != (PsiTypes.longType().equals(myType) ? Long.MAX_VALUE : Integer.MAX_VALUE) ? "<" + (last + 1) :
step == -1 && last != (PsiTypes.longType().equals(myType) ? Long.MIN_VALUE : Integer.MIN_VALUE) ? ">" + (last - 1) :
(step < 0 ? ">=" : "<=") + last) + suffix;
String increment = varName + (step == 1 ? "++" : step == -1 ? "--" : step > 0 ? "+=" + step + suffix : "-=" + (-step) + suffix);
return "for(" + initial + ";" + condition + ";" + increment + ")";
} | [
15,
42
] | private String tryCollapseIntoCountingLoop(String varName) | 2,187 | 373,851 |
../intellij-community/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java | isTextNotStartingWithLineBreaks | private boolean isTextNotStartingWithLineBreaks(@Nullable ASTNode astNode) {
if (astNode != null && isTextNode(astNode.getElementType())) {
ASTNode firstChild = astNode.getFirstChildNode();
if (firstChild != null) {
return !(firstChild.getPsi() instanceof PsiWhiteSpace) || !CharArrayUtil.containLineBreaks(firstChild.getChars());
}
}
return false;
} | [
16,
47
] | private boolean isTextNotStartingWithLineBreaks(@Nullable ASTNode astNode) | 390 | 501,085 |
../intellij-community/platform/util-rt/src/com/intellij/util/ReflectionUtilRt.java | collectGetters | @NotNull
public static List<Method> collectGetters(@NotNull Class<?> clazz) {
List<Method> methods = collectMethods(clazz);
List<Method> result = new ArrayList<>();
for (Method method: methods) {
String methodName = method.getName();
if (methodName.startsWith("get") && method.getParameterTypes().length == 0 && !methodName.equals("getClass")) {
result.add(method);
}
}
return result;
} | [
38,
52
] | @NotNull
public static List<Method> collectGetters(@NotNull Class<?> clazz) | 436 | 264,003 |
../intellij-community/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongRootElementInspection.java | getDefaultLevel | @Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.ERROR;
} | [
52,
67
] | @Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() | 115 | 507,939 |
../intellij-community/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/AttachRootButtonDescriptor.java | getRootType | public OrderRootType getRootType() {
return myOrderRootType;
} | [
21,
32
] | public OrderRootType getRootType() | 68 | 200,363 |
../intellij-community/platform/execution-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java | isStateBeingRestored | @Override
public boolean isStateBeingRestored() {
return !myRestoreStateRequestors.isEmpty();
} | [
27,
47
] | @Override
public boolean isStateBeingRestored() | 103 | 267,371 |
../intellij-community/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenRunConfigurationType.java | createTemplateConfiguration | @NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project, @NotNull RunManager runManager) {
return new MavenRunConfiguration(project, this, "");
} | [
51,
78
] | @NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project, @NotNull RunManager runManager) | 203 | 58,439 |
../intellij-community/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/highlighters/VcsLogHighlighterFactory.java | showMenuItem | boolean showMenuItem(); | [
8,
20
] | boolean showMenuItem() | 23 | 279,044 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java | getFilePath | @NotNull
@Override
public FilePath getFilePath() {
return ChangesUtil.getFilePath(myChange);
} | [
43,
54
] | @NotNull
@Override
public FilePath getFilePath() | 112 | 222,596 |
../intellij-community/java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java | getInstance | public static JavaCodeFragmentFactory getInstance(Project project) {
return project.getService(JavaCodeFragmentFactory.class);
} | [
38,
49
] | public static JavaCodeFragmentFactory getInstance(Project project) | 134 | 488,075 |
../intellij-community/plugins/ui-designer-core/src/com/intellij/designer/inspection/AbstractQuickFixManager.java | mouseExited | @Override
public void mouseExited(MouseEvent e) {
setIcon(myInactiveIcon);
setBorder(INACTIVE_BORDER);
} | [
30,
41
] | @Override
public void mouseExited(MouseEvent e) | 140 | 62,421 |
../intellij-community/python/src/com/jetbrains/python/console/PydevConsoleCommunication.java | setExecuting | private void setExecuting(boolean executing) {
myExecuting = executing;
} | [
13,
25
] | private void setExecuting(boolean executing) | 79 | 27,170 |
../intellij-community/platform/util/storages/src/com/intellij/platform/util/io/storages/intmultimaps/extendiblehashmap/ExtendibleHashMap.java | suffixMask | private static int suffixMask(int suffixSize) {
if (suffixSize == Integer.SIZE) {
return -1;
}
return (1 << suffixSize) - 1;
} | [
19,
29
] | private static int suffixMask(int suffixSize) | 146 | 229,172 |
../intellij-community/plugins/groovy/groovy-psi/gen/org/jetbrains/plugins/groovy/lang/parser/GroovyGeneratedParser.java | code_reference_identifiers_2 | private static boolean code_reference_identifiers_2(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "code_reference_identifiers_2")) return false;
boolean r;
Marker m = enter_section_(b);
r = code_reference_identifiers_soft(b, l + 1);
r = r && code_reference_identifiers_2_1(b, l + 1);
exit_section_(b, m, null, r);
return r;
} | [
23,
51
] | private static boolean code_reference_identifiers_2(PsiBuilder b, int l) | 360 | 161,443 |
../intellij-community/java/compiler/impl/src/com/intellij/packaging/impl/ui/FileCopyPresentation.java | getWeight | @Override
public int getWeight() {
return PackagingElementWeights.FILE_COPY;
} | [
23,
32
] | @Override
public int getWeight() | 86 | 489,999 |
../intellij-community/plugins/ui-designer-core/src/com/intellij/designer/inspection/AbstractQuickFixManager.java | mouseEntered | @Override
public void mouseEntered(MouseEvent e) {
setIcon(myActiveIcon);
setBorder(ACTIVE_BORDER);
} | [
30,
42
] | @Override
public void mouseEntered(MouseEvent e) | 137 | 62,420 |
../intellij-community/java/java-analysis-impl/src/com/siyeh/ig/portability/HardcodedLineSeparatorsInspection.java | buildVisitor | @Override
public BaseInspectionVisitor buildVisitor() {
return new HardcodedLineSeparatorsVisitor();
} | [
41,
53
] | @Override
public BaseInspectionVisitor buildVisitor() | 110 | 348,199 |
../intellij-community/platform/platform-impl/src/com/intellij/internal/JBTabsDemoAction.java | actionPerformed | @Override
public void actionPerformed(final ActionEvent e) {
toAnimate1.setHidden(!toAnimate1.isHidden());
} | [
28,
43
] | @Override
public void actionPerformed(final ActionEvent e) | 128 | 316,160 |
../intellij-community/plugins/ant/src/com/intellij/lang/ant/dom/PropertyProviderFinder.java | visitTarget | @Override
public void visitTarget(AntDomTarget target) {
if (myStage == Stage.TARGETS_WALKUP_STAGE) {
final String targetEffectiveName = myCurrentTargetEffectiveName.peek();
if (myProcessedTargets.add(targetEffectiveName)) {
final List<String> depsList = myDependenciesMap.get(targetEffectiveName);
if (depsList != null) {
for (String dependencyName : depsList) {
final AntDomTarget dependency = getTargetByName(dependencyName);
if (dependency != null) {
processTarget(dependencyName, dependency);
}
}
}
super.visitTarget(target);
}
}
else if (myStage == Stage.RESOLVE_MAP_BUILDING_STAGE){
final String declaredTargetName = target.getName().getRawText();
String effectiveTargetName;
final InclusionKind inclusionKind = myNameContext.getCurrentInclusionKind();
switch (inclusionKind) {
case IMPORT -> {
final String alias = myNameContext.getShortPrefix() + declaredTargetName;
if (!myTargetsResolveMap.containsKey(declaredTargetName)) {
effectiveTargetName = declaredTargetName;
myTargetsResolveMap.put(alias, target);
}
else {
effectiveTargetName = alias;
}
}
case INCLUDE -> effectiveTargetName = myNameContext.getFQPrefix() + declaredTargetName;
default -> effectiveTargetName = declaredTargetName;
}
if (effectiveTargetName != null) {
final AntDomTarget existingTarget = myTargetsResolveMap.get(effectiveTargetName);
if (existingTarget != null && Comparing.equal(existingTarget.getAntProject(), target.getAntProject())) {
duplicateTargetFound(existingTarget, target, effectiveTargetName);
}
else {
myTargetsResolveMap.put(effectiveTargetName, target);
final String dependsStr = target.getDependsList().getRawText();
Map<String, Pair<AntDomTarget, String>> depsMap = Collections.emptyMap();
if (dependsStr != null) {
depsMap = new HashMap<>();
final StringTokenizer tokenizer = new StringTokenizer(dependsStr, ",", false);
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken().trim();
final String dependentTargetEffectiveName = myNameContext.calcTargetReferenceText(token);
final AntDomTarget dependent = getTargetByName(dependentTargetEffectiveName);
if (dependent != null) {
depsMap.put(token, Pair.create(dependent, dependentTargetEffectiveName));
}
addDependency(effectiveTargetName, dependentTargetEffectiveName);
}
}
targetDefined(target, effectiveTargetName, depsMap);
}
}
}
} | [
24,
35
] | @Override
public void visitTarget(AntDomTarget target) | 2,869 | 30,334 |
../intellij-community/platform/lang-core/src/com/intellij/facet/ui/FacetEditorContext.java | getFacetsProvider | @NotNull
FacetsProvider getFacetsProvider(); | [
26,
43
] | @NotNull
FacetsProvider getFacetsProvider() | 46 | 181,439 |
../intellij-community/java/idea-ui/src/com/intellij/framework/library/impl/DownloadableLibraryServiceImpl.java | createLibraryDescription | @NotNull
@Override
public DownloadableLibraryDescription createLibraryDescription(@NotNull String groupId, final URL @NotNull ... localUrls) {
return new LibraryVersionsFetcher(groupId, localUrls) {
@Override
@NotNull
protected FrameworkAvailabilityCondition createAvailabilityCondition(Artifact version) {
RequiredFrameworkVersion groupVersion = version.getRequiredFrameworkVersion();
if (groupVersion != null) {
return new FrameworkLibraryAvailabilityCondition(groupVersion.myGroupId, groupVersion.myVersion);
}
return FrameworkAvailabilityCondition.ALWAYS_TRUE;
}
};
} | [
61,
85
] | @NotNull
@Override
public DownloadableLibraryDescription createLibraryDescription(@NotNull String groupId, final URL @NotNull ... localUrls) | 651 | 362,049 |
../intellij-community/platform/indexing-impl/src/com/intellij/util/indexing/FileBasedIndexEx.java | createLazyFileIterator | @ApiStatus.Internal
public static @NotNull Iterator<VirtualFile> createLazyFileIterator(@Nullable IntSet result, @NotNull GlobalSearchScope scope) {
Set<VirtualFile> fileSet = new CompactVirtualFileSet(result == null ? IntSets.emptySet() : result).freezed();
return fileSet.stream().filter(scope::contains).iterator();
} | [
67,
89
] | @ApiStatus.Internal
public static @NotNull Iterator<VirtualFile> createLazyFileIterator(@Nullable IntSet result, @NotNull GlobalSearchScope scope) | 332 | 301,435 |
../intellij-community/java/java-psi-impl/src/com/intellij/codeInsight/BaseExternalAnnotationsManager.java | escapeAttributes | private static @NotNull CharSequence escapeAttributes(@NotNull CharSequence invalidXml) {
if (!hasInvalidAttribute(invalidXml)) {
return invalidXml;
}
// We assume that XML has single- and double-quote characters only for attribute values, therefore we don't any complex parsing,
// just have binary inAttribute state
StringBuilder buf = new StringBuilder(invalidXml.length());
boolean inAttribute = false;
for (int i = 0; i < invalidXml.length(); i++) {
char c = invalidXml.charAt(i);
if (inAttribute && c == '<') {
buf.append("<");
}
else if (inAttribute && c == '>') {
buf.append(">");
}
else if (c == '\"' || c == '\'') {
buf.append('\"');
inAttribute = !inAttribute;
}
else {
buf.append(c);
}
}
return buf;
} | [
37,
53
] | private static @NotNull CharSequence escapeAttributes(@NotNull CharSequence invalidXml) | 857 | 499,900 |
../intellij-community/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactErrorPanel.java | performFix | private static void performFix(ConfigurationErrorQuickFix quickFix, ArtifactEditorImpl artifactEditor) {
quickFix.performFix();
artifactEditor.queueValidation();
} | [
20,
30
] | private static void performFix(ConfigurationErrorQuickFix quickFix, ArtifactEditorImpl artifactEditor) | 173 | 362,897 |
../intellij-community/platform/util/src/com/intellij/util/io/pagecache/impl/PageToStorageHandle.java | flushBytes | void flushBytes(final @NotNull ByteBuffer dataToFlush,
final long offsetInFile) throws IOException; | [
5,
15
] | void flushBytes(final @NotNull ByteBuffer dataToFlush,
final long offsetInFile) | 117 | 236,404 |
../intellij-community/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/UsagesInUnloadedModules.java | replaceElement | @Override
public void replaceElement(ProjectStructureElement newElement) {
} | [
24,
38
] | @Override
public void replaceElement(ProjectStructureElement newElement) | 81 | 364,030 |
../intellij-community/platform/lang-impl/src/com/intellij/execution/console/ConsoleExecutionEditor.java | setEditable | public void setEditable(boolean editable) {
myConsoleEditor.setRendererMode(!editable);
myConsolePromptDecorator.update();
} | [
12,
23
] | public void setEditable(boolean editable) | 134 | 202,931 |
../intellij-community/platform/lang-impl/src/com/intellij/util/ui/tree/AbstractFileTreeTable.java | getProject | public Project getProject() {
return myProject;
} | [
15,
25
] | public Project getProject() | 55 | 197,089 |
../intellij-community/platform/execution-impl/src/com/intellij/terminal/JBTerminalSystemSettingsProviderBase.java | getClearBufferActionPresentation | @Override
public @NotNull TerminalActionPresentation getClearBufferActionPresentation() {
List<KeyStroke> strokes = getKeyStrokesByActionId("Terminal.ClearBuffer");
return new TerminalActionPresentation(IdeBundle.message("terminal.action.ClearBuffer.text"), strokes);
} | [
55,
87
] | @Override
public @NotNull TerminalActionPresentation getClearBufferActionPresentation() | 281 | 266,096 |
../intellij-community/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagAction.java | isEnabled | @Override
protected boolean isEnabled(@NotNull SvnVcs vcs, @NotNull VirtualFile file) {
return SvnStatusUtil.isUnderControl(vcs, file);
} | [
30,
39
] | @Override
protected boolean isEnabled(@NotNull SvnVcs vcs, @NotNull VirtualFile file) | 145 | 152,595 |
../intellij-community/python/src/com/jetbrains/python/refactoring/introduce/PyIntroduceDialog.java | itemStateChanged | @Override
public void itemStateChanged(ItemEvent e) {
updateControls();
} | [
28,
44
] | @Override
public void itemStateChanged(ItemEvent e) | 93 | 26,130 |
../intellij-community/platform/analysis-api/src/com/intellij/modcommand/ModNothing.java | unpack | @Override
public @NotNull List<@NotNull ModCommand> unpack() {
return List.of();
} | [
54,
60
] | @Override
public @NotNull List<@NotNull ModCommand> unpack() | 90 | 303,193 |
../intellij-community/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java | getElementVisibility | private static Visibility getElementVisibility(PyElement element) {
if (!(element instanceof PyTargetExpression) && PsiTreeUtil.getParentOfType(element, PyFunction.class) != null) {
return Visibility.INVISIBLE;
}
else {
return getVisibilityByName(element.getName());
}
} | [
26,
46
] | private static Visibility getElementVisibility(PyElement element) | 300 | 24,213 |
../intellij-community/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeImpl.java | getReferences | @Override
public PsiReference @NotNull [] getReferences(@NotNull PsiReferenceService.Hints hints) {
return getImpl().getDefaultReferences(hints);
} | [
44,
57
] | @Override
public PsiReference @NotNull [] getReferences(@NotNull PsiReferenceService.Hints hints) | 155 | 507,680 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/Mappings.java | processRemovedClases | private void processRemovedClases(final DiffState state, @NotNull File fileName) {
final Collection<ClassRepr> removed = state.myClassDiff.removed();
if (removed.isEmpty()) {
return;
}
assert myPresent != null;
assert myDelta.myChangedFiles != null;
myDelta.myChangedFiles.add(fileName);
debug("Processing removed classes:");
for (final ClassRepr c : removed) {
myDelta.addDeletedClass(c, fileName);
if (!myEasyMode) {
myPresent.appendDependents(c, state.myDependants);
debug("Adding usages of class ", c.name);
state.myAffectedUsages.add(c.createUsage());
debug("Affecting usages of removed class ", c.name);
affectAll(c.name, fileName, myAffectedFiles, myCompiledFiles, myFilter);
}
}
debug("End of removed classes processing.");
} | [
13,
33
] | private void processRemovedClases(final DiffState state, @NotNull File fileName) | 882 | 340,862 |
../intellij-community/platform/editor-ui-api/src/com/intellij/ide/DataManager.java | removeDataProvider | public static void removeDataProvider(@NotNull JComponent component) {
component.putClientProperty(CLIENT_PROPERTY_DATA_PROVIDER, null);
} | [
19,
37
] | public static void removeDataProvider(@NotNull JComponent component) | 144 | 299,528 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/clauses/GrForInClauseImpl.java | getDelimiter | @NotNull
@Override
public PsiElement getDelimiter() {
PsiElement in = findChildByType(GroovyTokenTypes.kIN);
if (in != null) return in;
PsiElement colon = findChildByType(GroovyTokenTypes.mCOLON);
return Objects.requireNonNull(colon);
} | [
41,
53
] | @NotNull
@Override
public PsiElement getDelimiter() | 259 | 166,006 |
../intellij-community/platform/vcs-impl/src/com/intellij/unscramble/AnnotateStackTraceAction.java | getHyperlinkVirtualFile | @Nullable
@RequiresReadLock
private static VirtualFile getHyperlinkVirtualFile(@NotNull List<? extends RangeHighlighter> links) {
RangeHighlighter key = ContainerUtil.getLastItem(links);
if (key == null) return null;
HyperlinkInfo info = EditorHyperlinkSupport.getHyperlinkInfo(key);
if (!(info instanceof FileHyperlinkInfo)) return null;
OpenFileDescriptor descriptor = ((FileHyperlinkInfo)info).getDescriptor();
return descriptor != null ? descriptor.getFile() : null;
} | [
59,
82
] | @Nullable
@RequiresReadLock
private static VirtualFile getHyperlinkVirtualFile(@NotNull List<? extends RangeHighlighter> links) | 502 | 218,533 |
../intellij-community/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/collapsing/EdgeStorageWrapper.java | decompressEdge | @Nullable
private GraphEdge decompressEdge(int nodeIndex, @Nullable Integer targetId, @NotNull GraphEdgeType edgeType) {
if (edgeType.isNormalEdge()) {
assert targetId != null;
Integer anotherNodeIndex = myGetNodeIndexById.apply(targetId);
if (anotherNodeIndex == null) return null; // todo edge to hide node
return GraphEdge.createNormalEdge(nodeIndex, anotherNodeIndex, edgeType);
}
else {
return GraphEdge.createEdgeWithTargetId(nodeIndex, targetId, edgeType);
}
} | [
30,
44
] | @Nullable
private GraphEdge decompressEdge(int nodeIndex, @Nullable Integer targetId, @NotNull GraphEdgeType edgeType) | 518 | 280,266 |
../intellij-community/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java | isEnumType | @Contract(value = "null -> false", pure = true)
public static boolean isEnumType(PsiType type) {
type = uncapture(type);
if (type instanceof PsiClassType) {
final PsiClass psiClass = ((PsiClassType)type).resolve();
if (psiClass instanceof PsiTypeParameter) {
return InheritanceUtil.isInheritor(psiClass, true, JAVA_LANG_ENUM);
}
return psiClass != null && psiClass.isEnum();
}
return false;
} | [
72,
82
] | @Contract(value = "null -> false", pure = true)
public static boolean isEnumType(PsiType type) | 444 | 489,540 |
../intellij-community/platform/usageView-impl/src/com/intellij/find/findUsages/similarity/ExportClusteringResultActionLink.java | getStructuralFeatures | private static Stream<Object2IntMap.Entry<String>> getStructuralFeatures(@NotNull Bag bag) {
return bag.getBag().object2IntEntrySet().stream().filter(entry -> isStructural(String.valueOf(entry.getKey())));
} | [
51,
72
] | private static Stream<Object2IntMap.Entry<String>> getStructuralFeatures(@NotNull Bag bag) | 213 | 263,735 |
../intellij-community/xml/xmlbeans/src/com/intellij/xml/tools/GenerateInstanceDocumentFromSchemaDialog.java | enableUniquenessCheck | boolean enableUniquenessCheck() {
return enableUniqueCheck.isSelected();
} | [
8,
29
] | boolean enableUniquenessCheck() | 80 | 504,359 |
../intellij-community/python/src/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpPresenter.java | parentChanged | void parentChanged(); | [
5,
18
] | void parentChanged() | 21 | 26,113 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ExpressionGenerator.java | visitIndexProperty | @Override
public void visitIndexProperty(@NotNull GrIndexProperty expression) {
final GrExpression selectedExpression = expression.getInvokedExpression();
final PsiType thisType = selectedExpression.getType();
final GrArgumentList argList = expression.getArgumentList();
if (argList.getAllArguments().length == 0) { // int[] or String[]
if (selectedExpression instanceof GrBuiltinTypeClassExpression) {
selectedExpression.accept(this);
return;
}
else if (selectedExpression instanceof GrReferenceExpression) {
PsiElement resolved = ((GrReferenceExpression)selectedExpression).resolve();
if (resolved instanceof PsiClass) {
builder.append(((PsiClass)resolved).getQualifiedName());
builder.append("[].class");
return;
}
}
}
final PsiType[] argTypes = PsiUtil.getArgumentTypes(argList);
final GrExpression[] exprArgs = argList.getExpressionArguments();
final GrNamedArgument[] namedArgs = argList.getNamedArguments();
if (!PsiImplUtil.isSimpleArrayAccess(thisType, argTypes, expression, PsiUtil.isLValue(expression))) {
final GroovyResolveResult candidate = advancedResolve(expression);
PsiElement element = candidate.getElement();
if (element != null || !PsiUtil.isLValue(expression)) { //see the case of l-value in assignment expression
if (element instanceof GrGdkMethod && ((GrGdkMethod)element).getReceiverType().equalsToText("java.util.Map<K,V>")) {
PsiClass map = JavaPsiFacade.getInstance(context.project).findClass(CommonClassNames.JAVA_UTIL_MAP, expression.getResolveScope());
if (map != null) {
PsiMethod[] gets = map.findMethodsByName("get", false);
invokeMethodOn(gets[0], selectedExpression, exprArgs, namedArgs, GrClosableBlock.EMPTY_ARRAY, PsiSubstitutor.EMPTY, expression);
return;
}
}
else if (element instanceof GrGdkMethod && ((GrGdkMethod)element).getReceiverType().equalsToText("java.util.List<T>")) {
PsiClass list =
JavaPsiFacade.getInstance(context.project).findClass(CommonClassNames.JAVA_UTIL_LIST, expression.getResolveScope());
if (list != null) {
PsiMethod[] gets = list.findMethodsByName("get", false);
invokeMethodOn(gets[0], selectedExpression, exprArgs, namedArgs, GrClosableBlock.EMPTY_ARRAY, PsiSubstitutor.EMPTY, expression);
return;
}
}
GenerationUtil
.invokeMethodByResolveResult(selectedExpression, candidate, "getAt", exprArgs, namedArgs, GrClosableBlock.EMPTY_ARRAY, this, expression);
return;
}
}
selectedExpression.accept(this);
builder.append('[');
final GrExpression arg = exprArgs[0];
arg.accept(this);
builder.append(']');
} | [
24,
42
] | @Override
public void visitIndexProperty(@NotNull GrIndexProperty expression) | 2,900 | 172,730 |
../intellij-community/platform/platform-impl/src/com/intellij/ui/EditorComboBox.java | setHistory | public void setHistory(final String[] history) {
setModel(new DefaultComboBoxModel(history));
} | [
12,
22
] | public void setHistory(final String[] history) | 101 | 310,391 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java | getAffectedContentRoots | @Override
public Collection<VirtualFile> getAffectedContentRoots() {
return myAffectedVcsRoots;
} | [
43,
66
] | @Override
public Collection<VirtualFile> getAffectedContentRoots() | 105 | 220,252 |
../intellij-community/java/debugger/impl/src/com/intellij/debugger/settings/RendererConfiguration.java | readExternal | @Override
public void readExternal(final Element root) {
int configurationVersion = StringUtil.parseInt(root.getAttributeValue("VERSION"), -1);
if (configurationVersion != VERSION) {
return;
}
final List<Element> children = root.getChildren(NodeRendererSettings.RENDERER_TAG);
final List<NodeRenderer> renderers = new ArrayList<>(children.size());
for (Element nodeElement : children) {
try {
renderers.add((NodeRenderer)myRendererSettings.readRenderer(nodeElement));
}
catch (Exception e) {
LOG.debug(e);
}
}
setRenderers(renderers);
} | [
24,
36
] | @Override
public void readExternal(final Element root) | 619 | 385,643 |
../intellij-community/plugins/ant/src/com/intellij/lang/ant/dom/AntDomMacrodefAttributeReference.java | getVariants | @Override
public Object @NotNull [] getVariants() {
final AntDomMacroDef parentMacrodef = getParentMacrodef();
if (parentMacrodef != null) {
final List<Object> variants = new ArrayList<>();
for (AntDomMacrodefAttribute attribute : parentMacrodef.getMacroAttributes()) {
final String attribName = attribute.getName().getStringValue();
if (attribName != null && !attribName.isEmpty()) {
final LookupElementBuilder builder = LookupElementBuilder.create(attribName);
final LookupElement element = AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE.applyPolicy(builder);
variants.add(element);
}
}
return ArrayUtil.toObjectArray(variants);
}
return EMPTY_ARRAY;
} | [
38,
49
] | @Override
public Object @NotNull [] getVariants() | 751 | 30,195 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/builders/impl/BuildTargetIndexImpl.java | getDependencies | @Override
public @NotNull Collection<BuildTarget<?>> getDependencies(@NotNull BuildTarget<?> target, @NotNull CompileContext context) {
initializeChunks(context);
Collection<BuildTarget<?>> deps = myDependencies.get(target);
return deps != null ? deps : Collections.emptyList();
} | [
55,
70
] | @Override
public @NotNull Collection<BuildTarget<?>> getDependencies(@NotNull BuildTarget<?> target, @NotNull CompileContext context) | 296 | 340,328 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertConcatenationToGstringIntention.java | processSlashyContent | private static void processSlashyContent(StringBuilder builder, boolean multiline, String text) {
String unescaped = GrStringUtil.unescapeSlashyString(text);
GrStringUtil.escapeSymbolsForGString(unescaped, !multiline, false, builder);
} | [
20,
40
] | private static void processSlashyContent(StringBuilder builder, boolean multiline, String text) | 246 | 170,384 |
../intellij-community/plugins/tasks/tasks-core/jira/src/com/intellij/tasks/jira/JiraRepository.java | discoverApiVersion | @NotNull
public JiraRemoteApi discoverApiVersion() throws Exception {
if (LEGACY_API_ONLY) {
LOG.info("Intentionally using only legacy JIRA API");
return createLegacyApi();
}
String responseBody;
GetMethod method = new GetMethod(getRestUrl("serverInfo"));
try {
responseBody = executeMethod(method);
}
catch (Exception e) {
// probably JIRA version prior 4.2
// It's not safe to call HttpMethod.getStatusCode() directly, because it will throw NPE
// if response was not received (connection lost etc.) and hasBeenUsed()/isRequestSent() are
// not the way to check it safely.
StatusLine status = method.getStatusLine();
if (status != null && status.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
return createLegacyApi();
}
else {
throw e;
}
}
JsonObject serverInfo = GSON.fromJson(responseBody, JsonObject.class);
// when JIRA 4.x support will be dropped 'versionNumber' array in response
// may be used instead version string parsing
myJiraVersion = serverInfo.get("version").getAsString();
myInCloud = isHostedInCloud(serverInfo);
LOG.info("JIRA version (from serverInfo): " + getPresentableVersion());
if (isInCloud()) {
LOG.info("Connecting to JIRA Cloud. Cookie authentication is enabled unless 'tasks.jira.basic.auth.only' VM flag is used.");
}
JiraRestApi restApi = JiraRestApi.fromJiraVersion(myJiraVersion, this);
if (restApi == null) {
throw new Exception(TaskBundle.message("jira.failure.no.REST"));
}
return restApi;
} | [
32,
50
] | @NotNull
public JiraRemoteApi discoverApiVersion() | 1,614 | 38,861 |
../intellij-community/platform/platform-api/src/com/intellij/ui/table/JBTable.java | getPreferredHeaderWidth | private int getPreferredHeaderWidth(int columnIdx) {
TableColumn column = getColumnModel().getColumn(columnIdx);
TableCellRenderer renderer = column.getHeaderRenderer();
if (renderer == null) {
JTableHeader header = getTableHeader();
if (header == null) {
return DEFAULT_MIN_COLUMN_WIDTH;
}
renderer = header.getDefaultRenderer();
}
Object headerValue = column.getHeaderValue();
Component headerCellRenderer = renderer.getTableCellRendererComponent(this, headerValue, false, false, -1, columnIdx);
return headerCellRenderer.getPreferredSize().width;
} | [
12,
35
] | private int getPreferredHeaderWidth(int columnIdx) | 613 | 253,769 |
../intellij-community/platform/lang-impl/src/com/intellij/find/SearchReplaceComponent.java | actionPerformed | @Override
public void actionPerformed(ActionEvent e) {} | [
28,
43
] | @Override
public void actionPerformed(ActionEvent e) | 61 | 204,724 |
../intellij-community/java/java-impl-inspections/src/com/intellij/codeInspection/UseHashCodeMethodInspection.java | tryReplaceDouble | @NotNull HashCodeModel tryReplaceDouble() {
@Nullable PsiExpression expression = PsiUtil.skipParenthesizedExprDown(argument);
if (!(expression instanceof PsiReferenceExpression referenceExpression)) return this;
if (!(referenceExpression.resolve() instanceof PsiLocalVariable local)) return this;
PsiExpression definition = PsiUtil.skipParenthesizedExprDown(DeclarationSearchUtils.findDefinition(referenceExpression, local));
if (!(definition instanceof PsiMethodCallExpression call)) return this;
if (!DOUBLE_TO_LONG_BITS.matches(call)) return this;
PsiStatement statement = PsiTreeUtil.getParentOfType(definition, PsiStatement.class);
PsiElement nextStatement = PsiTreeUtil.skipWhitespacesAndCommentsForward(statement);
if (!PsiTreeUtil.isAncestor(nextStatement, completeExpression, true)) return this;
final PsiCodeBlock block = PsiTreeUtil.getParentOfType(local, PsiCodeBlock.class);
if (block == null || DefUseUtil.getRefs(block, local, definition).length != 2) return this;
return new HashCodeModel(completeExpression, call.getArgumentList().getExpressions()[0], local, definition, "Double");
} | [
23,
39
] | @NotNull HashCodeModel tryReplaceDouble() | 1,176 | 378,894 |
../intellij-community/plugins/maven-model/src/main/java/org/jetbrains/idea/maven/model/MavenId.java | hashCode | @Override
public int hashCode() {
int result;
result = (myGroupId != null ? myGroupId.hashCode() : 0);
result = 31 * result + (myArtifactId != null ? myArtifactId.hashCode() : 0);
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
return result;
} | [
23,
31
] | @Override
public int hashCode() | 291 | 146,473 |
../intellij-community/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/ui/XBreakpointGroupingRule.java | getId | @NotNull
public String getId() {
return myId;
} | [
26,
31
] | @NotNull
public String getId() | 56 | 259,361 |
../intellij-community/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/jcef/JCEFHtmlPanelProvider.java | createHtmlPanel | @NotNull
@Override
public MarkdownHtmlPanel createHtmlPanel() {
return new MarkdownJCEFHtmlPanel();
} | [
48,
63
] | @NotNull
@Override
public MarkdownHtmlPanel createHtmlPanel() | 111 | 54,159 |
../intellij-community/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/details/commit/ReferencesPanel.java | createRestLabel | protected @NotNull JBLabel createRestLabel(int restSize) {
return createLabel(VcsLogBundle.message("vcs.log.details.references.more.label", restSize), null);
} | [
27,
42
] | protected @NotNull JBLabel createRestLabel(int restSize) | 165 | 278,464 |
../intellij-community/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/AdvancedSettingsUI.java | createComponent | @Override
public JComponent createComponent() {
myPanel = new AdvancedSettingsPanel();
return myPanel.myRoot;
} | [
30,
45
] | @Override
public JComponent createComponent() | 123 | 33,338 |
../intellij-community/java/java-impl-refactorings/src/com/intellij/refactoring/extractclass/ExtractedClassBuilder.java | isCompletelyMoved | private boolean isCompletelyMoved(PsiMethod method) {
return methods.contains(method) && !
MethodInheritanceUtils.hasSiblingMethods(method);
} | [
16,
33
] | private boolean isCompletelyMoved(PsiMethod method) | 160 | 484,321 |
../intellij-community/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java | saveDetected | public void saveDetected() {
try {
myExistentFrameworkFiles.close();
}
catch (IOException e) {
LOG.info(e);
}
} | [
12,
24
] | public void saveDetected() | 141 | 198,896 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/dependencies/GrDependencyVisitorFactory.java | visitImportStatement | @Override
public void visitImportStatement(@NotNull GrImportStatement statement) {
if (!myOptions.skipImports()) {
visitElement(statement);
}
} | [
26,
46
] | @Override
public void visitImportStatement(@NotNull GrImportStatement statement) | 171 | 169,171 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java | filterKeywordArguments | @NotNull
private static List<PyKeywordArgument> filterKeywordArguments(@NotNull List<PyExpression> arguments) {
final List<PyKeywordArgument> results = new ArrayList<>();
for (PyExpression argument : arguments) {
if (argument instanceof PyKeywordArgument) {
results.add((PyKeywordArgument)argument);
}
}
return results;
} | [
50,
72
] | @NotNull
private static List<PyKeywordArgument> filterKeywordArguments(@NotNull List<PyExpression> arguments) | 361 | 9,883 |
../intellij-community/platform/core-api/src/com/intellij/util/DisposeAwareRunnable.java | run | @Override
public void run() {
Object res = get();
if (res == null) return;
if (res instanceof PsiElement) {
if (!((PsiElement)res).isValid()) return;
}
else if (res instanceof ComponentManager) {
if (((ComponentManager)res).isDisposed()) return;
}
myDelegate.run();
} | [
24,
27
] | @Override
public void run() | 313 | 290,973 |
../intellij-community/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java | removeElement | private void removeElement(DirDiffElementImpl element, boolean removeFromTree) {
int row = myElements.indexOf(element);
if (row != -1) {
final DTree node = element.getNode();
if (removeFromTree) {
final DTree parentNode = element.getParentNode();
parentNode.remove(node);
}
myElements.remove(row);
int start = row;
if (row > 0 && row == myElements.size() && myElements.get(row - 1).isSeparator() ||
row != myElements.size() && myElements.get(row).isSeparator() && row > 0 && myElements.get(row - 1).isSeparator()) {
DirDiffElementImpl el = myElements.get(row - 1);
if (removeFromTree) {
el.getParentNode().remove(el.getNode());
}
myElements.remove(row - 1);
start = row - 1;
}
fireTableRowsDeleted(start, row);
}
} | [
13,
26
] | private void removeElement(DirDiffElementImpl element, boolean removeFromTree) | 853 | 275,230 |
../intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/LibraryDataNodeSubstitutor.java | applyClasspathShift | private static void applyClasspathShift(@NotNull Collection<AbstractDependencyData<?>> dependenciesToMove, int shift) {
if (shift > 0) {
dependenciesToMove.forEach(data -> {
int order = data.getOrder();
data.setOrder(order + shift);
});
}
} | [
20,
39
] | private static void applyClasspathShift(@NotNull Collection<AbstractDependencyData<?>> dependenciesToMove, int shift) | 278 | 142,840 |
../intellij-community/platform/execution.dashboard/src/RunDashboardComponentWrapper.java | setContentId | public void setContentId(@Nullable Integer contentId) {
myContentId = contentId;
} | [
12,
24
] | public void setContentId(@Nullable Integer contentId) | 88 | 280,643 |
../intellij-community/platform/lang-impl/src/com/intellij/psi/search/MappedFileTypeIndex.java | mapInputAndPrepareUpdate | @Override
public @NotNull Computable<Boolean> mapInputAndPrepareUpdate(int inputId, @Nullable FileContent content) {
try {
int fileTypeId = getFileTypeId(content == null ? null : content.getFileType());
if (LOG.isTraceEnabled()) {
if (content == null) {
LOG.trace("Map input: inputId(" + inputId + ") -> null, because content is null");
}
else {
LOG.trace("Map input: inputId(" + inputId + ") -> fileType(" + content.getFileType() + ", fileTypeId=" + fileTypeId + ")");
}
}
return () -> updateIndex(inputId, checkFileTypeIdIsShort(fileTypeId));
}
catch (StorageException e) {
throw new RuntimeException(e);
}
} | [
48,
72
] | @Override
public @NotNull Computable<Boolean> mapInputAndPrepareUpdate(int inputId, @Nullable FileContent content) | 712 | 204,361 |
../intellij-community/platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java | getAccessibleContext | @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleContextDelegate(super.getAccessibleContext()) {
@Override
protected Container getDelegateParent() {
return AbbreviatingRendererComponent.this.getParent();
}
@Override
public String getAccessibleName() {
return myRawText;
}
};
}
return accessibleContext;
} | [
39,
59
] | @Override
public AccessibleContext getAccessibleContext() | 509 | 311,981 |
../intellij-community/platform/core-api/src/com/intellij/psi/search/searches/SmartExtensionPoint.java | dropCache | private void dropCache() {
if (cache == null) {
return;
}
synchronized (lock) {
if (cache != null) {
cache = null;
ExtensionPoint<@NotNull T> extensionPoint = SmartExtensionPoint.this.extensionPoint;
if (extensionPoint != null) {
extensionPoint.removeExtensionPointListener(this);
SmartExtensionPoint.this.extensionPoint = null;
}
}
}
} | [
13,
22
] | private void dropCache() | 481 | 294,898 |
../intellij-community/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java | findBuiltInSchemaByReference | private @Nullable VirtualFile findBuiltInSchemaByReference(@NotNull String reference) {
String id = JsonPointerUtil.normalizeId(reference);
if (!myBuiltInSchemaIds.getValue().contains(id)) return null;
for (VirtualFile file : myState.getFiles()) {
if (id.equals(JsonCachedValues.getSchemaId(file, myProject))) {
return file;
}
}
return null;
} | [
30,
58
] | private @Nullable VirtualFile findBuiltInSchemaByReference(@NotNull String reference) | 385 | 513,024 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertGStringToStringIntention.java | prepareExpression | private static String prepareExpression(GrExpression expr) {
if (PsiUtil.isThisOrSuperRef(expr)) return expr.getText();
String text = expr.getText();
final PsiType type = expr.getType();
if (type != null && CommonClassNames.JAVA_LANG_STRING.equals(type.getCanonicalText())) {
if (expr instanceof GrBinaryExpression && GroovyTokenTypes.mPLUS.equals(((GrBinaryExpression)expr).getOperationTokenType())) {
return '(' + text + ')';
}
else {
return text;
}
}
else {
return "String.valueOf(" + text + ")";
}
} | [
22,
39
] | private static String prepareExpression(GrExpression expr) | 580 | 170,398 |
../intellij-community/plugins/groovy/rt/classLoader/src/com/intellij/util/lang/java6/ClasspathCache.java | addPossiblyDuplicateNameEntry | void addPossiblyDuplicateNameEntry(@NotNull String name) {
name = transformName(name);
myUsedNameFingerprints.add(NameFilter.toNameFingerprint(name));
} | [
5,
34
] | void addPossiblyDuplicateNameEntry(@NotNull String name) | 168 | 168,897 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/psi/impl/references/PyImportReference.java | alreadyHasImportKeyword | private boolean alreadyHasImportKeyword() {
if (PsiTreeUtil.getParentOfType(myElement, PyImportStatement.class) != null) {
return true;
}
ASTNode node = myElement.getNode();
while (node != null) {
final IElementType nodeType = node.getElementType();
if (nodeType == PyTokenTypes.IMPORT_KEYWORD) {
return true;
}
node = node.getTreeNext();
}
return false;
} | [
16,
39
] | private boolean alreadyHasImportKeyword() | 420 | 11,051 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/inspections/PyDictDuplicateKeysInspection.java | visitPyCallExpression | @Override
public void visitPyCallExpression(@NotNull PyCallExpression node) {
if (!isDict(node)) return;
final MultiMap<String, PsiElement> keyValueAndKeys = new MultiMap<>();
for (PyExpression argument : node.getArguments()) {
argument = PyPsiUtils.flattenParens(argument);
if (argument instanceof PySequenceExpression) {
for (PyExpression element : ((PySequenceExpression)argument).getElements()) {
final Pair<PsiElement, String> keyAndValue = getDictCallKey(element);
if (keyAndValue != null) {
keyValueAndKeys.putValue(keyAndValue.second, keyAndValue.first);
}
}
}
else if (argument instanceof PyKeywordArgument) {
final Pair<PsiElement, String> keyAndValue = getDictCallKey(argument);
if (keyAndValue != null) {
keyValueAndKeys.putValue(keyAndValue.second, keyAndValue.first);
}
}
}
registerProblems(keyValueAndKeys);
} | [
26,
47
] | @Override
public void visitPyCallExpression(@NotNull PyCallExpression node) | 1,017 | 9,063 |
../intellij-community/platform/core-api/src/com/intellij/navigation/DirectNavigationProvider.java | getNavigationElement | @Nullable
PsiElement getNavigationElement(@NotNull PsiElement element); | [
23,
43
] | @Nullable
PsiElement getNavigationElement(@NotNull PsiElement element) | 73 | 291,552 |
../intellij-community/platform/execution-process-mediator/common/gen/com/intellij/execution/process/mediator/common/rpc/QuotaOptions.java | getIsRefreshable | @java.lang.Override
public boolean getIsRefreshable() {
return isRefreshable_;
} | [
37,
53
] | @java.lang.Override
public boolean getIsRefreshable() | 88 | 187,316 |
../intellij-community/plugins/yaml/editing/src/org/jetbrains/yaml/psi/impl/YAMLQuotedTextTextEvaluator.java | getContentRanges | @Override
public @NotNull List<TextRange> getContentRanges() {
final ASTNode firstContentNode = myHost.getFirstContentNode();
if (firstContentNode == null) {
return Collections.emptyList();
}
List<TextRange> result = new ArrayList<>();
TextRange contentRange = TextRange.create(firstContentNode.getStartOffset(), myHost.getTextRange().getEndOffset())
.shiftRight(-myHost.getTextRange().getStartOffset());
final List<String> lines = StringUtil.split(contentRange.substring(myHost.getText()), "\n", true, false);
// First line has opening quote
int cumulativeOffset = contentRange.getStartOffset();
for (int i = 0; i < lines.size(); ++i) {
final String line = lines.get(i);
int lineStart = 0;
int lineEnd = line.length();
if (i == 0) {
lineStart++;
}
else {
while (lineStart < line.length() && YAMLGrammarCharUtil.isSpaceLike(line.charAt(lineStart))) {
lineStart++;
}
}
if (i == lines.size() - 1) {
// Last line has closing quote
lineEnd--;
}
else {
while (lineEnd > lineStart && YAMLGrammarCharUtil.isSpaceLike(line.charAt(lineEnd - 1))) {
lineEnd--;
}
}
result.add(TextRange.create(lineStart, lineEnd).shiftRight(cumulativeOffset));
cumulativeOffset += line.length() + 1;
}
return result;
} | [
44,
60
] | @Override
public @NotNull List<TextRange> getContentRanges() | 1,409 | 149,079 |