Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
288,100
boolean (final @NotNull T t, final ProcessingContext context) { final PsiReference[] references = t.getReferences(); for (final PsiReference reference : references) { if (targetPattern.accepts(reference.resolve(), context)) return true; if (reference instanceof PsiPolyVariantReference) { for (final ResolveResult result : ((PsiPolyVariantReference)reference).multiResolve(true)) { if (targetPattern.accepts(result.getElement(), context)) return true; } } } return false; }
accepts
288,101
Self () { return with(new PatternCondition<T>("compiled") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { return t instanceof PsiCompiledElement; } }); }
compiled
288,102
boolean (@NotNull T t, ProcessingContext context) { return t instanceof PsiCompiledElement; }
accepts
288,103
Self (final ElementPattern<? extends PsiElement> ancestor) { return with(new PatternCondition<T>("withTreeParent") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { return ancestor.accepts(t.getParent(), context); } }); }
withTreeParent
288,104
boolean (@NotNull T t, ProcessingContext context) { return ancestor.accepts(t.getParent(), context); }
accepts
288,105
Self (final ElementPattern<? extends PsiElement> ancestor) { return with(new PatternCondition<PsiElement>("insideStarting") { @Override public boolean accepts(@NotNull PsiElement start, ProcessingContext context) { PsiElement element = getParent(start); TextRange range = start.getTextRange(); if (range == null) return false; int startOffset = range.getStartOffset(); while (element != null && element.getTextRange() != null && element.getTextRange().getStartOffset() == startOffset) { if (ancestor.accepts(element, context)) { return true; } element = getParent(element); } return false; } }); }
insideStarting
288,106
boolean (@NotNull PsiElement start, ProcessingContext context) { PsiElement element = getParent(start); TextRange range = start.getTextRange(); if (range == null) return false; int startOffset = range.getStartOffset(); while (element != null && element.getTextRange() != null && element.getTextRange().getStartOffset() == startOffset) { if (ancestor.accepts(element, context)) { return true; } element = getParent(element); } return false; }
accepts
288,107
Self (final @NotNull ElementPattern skip, final @NotNull ElementPattern pattern) { return with(new PatternCondition<T>("withLastChildSkipping") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { PsiElement last = t.getLastChild(); while (last != null && skip.accepts(last)) { last = last.getPrevSibling(); } return pattern.accepts(last); } }); }
withLastChildSkipping
288,108
boolean (@NotNull T t, ProcessingContext context) { PsiElement last = t.getLastChild(); while (last != null && skip.accepts(last)) { last = last.getPrevSibling(); } return pattern.accepts(last); }
accepts
288,109
boolean (final @Nullable Object o, final ProcessingContext context) { return o instanceof Collection; }
accepts
288,110
CollectionPattern<T> (final ElementPattern<? extends T> pattern) { return with(new PatternCondition<Collection<T>>("all") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { for (final T t : collection) { if (!pattern.accepts(t, context)) return false; } return true; } }); }
all
288,111
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { for (final T t : collection) { if (!pattern.accepts(t, context)) return false; } return true; }
accepts
288,112
CollectionPattern<T> (final ElementPattern<? extends T> pattern) { return with(new PatternCondition<Collection<T>>("atLeastOne") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { for (final T t : collection) { if (pattern.accepts(t, context)) return true; } return false; } }); }
atLeastOne
288,113
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { for (final T t : collection) { if (pattern.accepts(t, context)) return true; } return false; }
accepts
288,114
CollectionPattern<T> (final ElementPattern<? extends T> elementPattern, final ElementPattern<Collection<T>> continuationPattern) { return with(new PatternCondition<Collection<T>>("filter") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { List<T> filtered = new ArrayList<>(); for (final T t : collection) { if (elementPattern.accepts(t, context)) { filtered.add(t); } } return continuationPattern.accepts(filtered, context); } }); }
filter
288,115
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { List<T> filtered = new ArrayList<>(); for (final T t : collection) { if (elementPattern.accepts(t, context)) { filtered.add(t); } } return continuationPattern.accepts(filtered, context); }
accepts
288,116
CollectionPattern<T> (final ElementPattern<? extends T> elementPattern) { return with(new PatternCondition<Collection<T>>("first") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { return !collection.isEmpty() && elementPattern.accepts(collection.iterator().next(), context); } }); }
first
288,117
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { return !collection.isEmpty() && elementPattern.accepts(collection.iterator().next(), context); }
accepts
288,118
CollectionPattern<T> () { return size(0); }
empty
288,119
CollectionPattern<T> () { return atLeast(1); }
notEmpty
288,120
CollectionPattern<T> (final int size) { return with(new PatternCondition<Collection<T>>("atLeast") { @Override public boolean accepts(final @NotNull Collection<T> ts, final ProcessingContext context) { return ts.size() >= size; } }); }
atLeast
288,121
boolean (final @NotNull Collection<T> ts, final ProcessingContext context) { return ts.size() >= size; }
accepts
288,122
CollectionPattern<T> (final int size) { return with(new PatternCondition<Collection<T>>("size") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { return size == collection.size(); } }); }
size
288,123
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { return size == collection.size(); }
accepts
288,124
CollectionPattern<T> (final ElementPattern elementPattern) { return with(new PatternCondition<Collection<T>>("last") { @Override public boolean accepts(final @NotNull Collection<T> collection, final ProcessingContext context) { if (collection.isEmpty()) { return false; } T last = null; for (final T t : collection) { last = t; } return elementPattern.accepts(last, context); } }); }
last
288,125
boolean (final @NotNull Collection<T> collection, final ProcessingContext context) { if (collection.isEmpty()) { return false; } T last = null; for (final T t : collection) { last = t; } return elementPattern.accepts(last, context); }
accepts
288,126
String () { return myDebugMethodName; }
getDebugMethodName
288,127
void (final StringBuilder builder, final String indent, final Object obj) { if (obj instanceof ElementPattern) { ((ElementPattern)obj).getCondition().append(builder, indent + " "); } else if (obj instanceof Object[]) { appendArray(builder, indent, (Object[])obj); } else if (obj instanceof Collection) { appendArray(builder, indent, ((Collection<?>) obj).toArray()); } else if (obj instanceof String) { builder.append('\"').append(obj).append('\"'); } else { builder.append(obj); } }
appendValue
288,128
void (final StringBuilder builder, final String indent, final Object[] objects) { builder.append("["); boolean first = true; for (final Object o : objects) { if (!first) { builder.append(", "); } first = false; appendValue(builder, indent, o); } builder.append("]"); }
appendArray
288,129
void (StringBuilder builder, String indent) { builder.append(myDebugMethodName); builder.append("("); appendParams(builder, indent); builder.append(")"); }
append
288,130
void (final StringBuilder builder, final String indent) { processParameters(new PairProcessor<String, Object>() { int count; String prevName; int prevOffset; @Override public boolean process(String name, Object value) { count ++; if (count == 2) builder.insert(prevOffset, prevName +"="); if (count > 1) builder.append(", "); prevOffset = builder.length(); if (count > 1) builder.append(name).append("="); appendValue(builder, indent, value); prevName = name; return true; } }); }
appendParams
288,131
boolean (String name, Object value) { count ++; if (count == 2) builder.insert(prevOffset, prevName +"="); if (count > 1) builder.append(", "); prevOffset = builder.length(); if (count > 1) builder.append(name).append("="); appendValue(builder, indent, value); prevName = name; return true; }
process
288,132
boolean (final PairProcessor<? super String, Object> processor) { for (Class aClass = getClass(); aClass != null; aClass = aClass.getSuperclass()) { for (final Field field : aClass.getDeclaredFields()) { if (!Modifier.isStatic(field.getModifiers()) && (!field.isSynthetic() && !aClass.equals(PatternCondition.class) || field.getName().startsWith(PARAMETER_FIELD_PREFIX))) { final String name = field.getName(); final String fixedName = name.startsWith(PARAMETER_FIELD_PREFIX) ? name.substring(PARAMETER_FIELD_PREFIX.length()) : name; final Object value = getFieldValue(field); if (!processor.process(fixedName, value)) return false; } } } return true; }
processParameters
288,133
Object (Field field) { final boolean accessible = field.isAccessible(); try { field.setAccessible(true); return field.get(this); } catch (IllegalAccessException e) { LOG.error(e); } finally { field.setAccessible(accessible); } return null; }
getFieldValue
288,134
PatternCompilerFactory () { return ApplicationManager.getApplication().getService(PatternCompilerFactory.class); }
getFactory
288,135
String () { return psiElementClass; }
getKey
288,136
boolean (@NotNull BuildNumber build) { return since.compareTo(build) <= 0 && build.compareTo(until) <= 0; }
inRange
288,137
BuildRange (@Nullable String sinceVal, @Nullable String untilVal) { BuildNumber since = BuildNumber.fromString(sinceVal); BuildNumber until = BuildNumber.fromString(untilVal); return since != null && until != null ? new BuildRange(since, until) : null; }
fromStrings
288,138
long () { return myCounter; }
getModificationCount
288,139
void () { UPDATER.incrementAndGet(this); }
incModificationCount
288,140
boolean (String value) { return "__BUILD_NUMBER__".equals(value) || "__BUILD__".equals(value); }
isPlaceholder
288,141
String () { return myProductCode; }
getProductCode
288,142
int () { return myComponents[0]; }
getBaselineVersion
288,143
boolean () { int result = -1; for (int i = 0; i < myComponents.length; i++) { if (myComponents[i] == SNAPSHOT_VALUE) { result = i; break; } } return result != -1; }
isSnapshot
288,144
BuildNumber () { return myProductCode.isEmpty() ? this : new BuildNumber("", myComponents); }
withoutProductCode
288,145
String () { return asString(false, false); }
asStringWithoutProductCodeAndSnapshot
288,146
String (boolean includeProductCode, boolean withSnapshotMarker) { StringBuilder builder = new StringBuilder(); if (includeProductCode && !myProductCode.isEmpty()) { builder.append(myProductCode).append('-'); } for (int each : myComponents) { if (each != SNAPSHOT_VALUE) { builder.append(each); } else if (withSnapshotMarker) { builder.append(SNAPSHOT); } builder.append('.'); } if (builder.charAt(builder.length() - 1) == '.') { builder.setLength(builder.length() - 1); } return builder.toString(); }
asString
288,147
int (String version, @NotNull String code, String pluginName) { if (SNAPSHOT.equals(code) || isPlaceholder(code) || STAR.equals(code)) { return SNAPSHOT_VALUE; } try { return Integer.parseInt(code); } catch (NumberFormatException e) { throw new RuntimeException("Invalid version number: " + version + "; plugin name: " + pluginName); } }
parseBuildNumber
288,148
int (@NotNull BuildNumber o) { int[] c1 = myComponents; int[] c2 = o.myComponents; for (int i = 0; i < Math.min(c1.length, c2.length); i++) { if (c1[i] == c2[i] && c1[i] == SNAPSHOT_VALUE) return 0; if (c1[i] == SNAPSHOT_VALUE) return 1; if (c2[i] == SNAPSHOT_VALUE) return -1; int result = c1[i] - c2[i]; if (result != 0) return result; } return c1.length - c2.length; }
compareTo
288,149
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BuildNumber that = (BuildNumber)o; if (!myProductCode.equals(that.myProductCode)) return false; return Arrays.equals(myComponents, that.myComponents); }
equals
288,150
int () { int result = myProductCode.hashCode(); result = 31 * result + Arrays.hashCode(myComponents); return result; }
hashCode
288,151
String () { return asString(); }
toString
288,152
int (int bn) { if (bn >= 10000) return 88; // Maia, 9x builds if (bn >= 9500) return 85; // 8.1 builds if (bn >= 9100) return 81; // 8.0.x builds if (bn >= 8000) return 80; // 8.0, including pre-release builds if (bn >= 7500) return 75; // 7.0.2+ if (bn >= 7200) return 72; // 7.0 final if (bn >= 6900) return 69; // 7.0 pre-M2 if (bn >= 6500) return 65; // 7.0 pre-M1 if (bn >= 6000) return 60; // 6.0.2+ if (bn >= 5000) return 55; // 6.0 branch, including all 6.0 EAP builds if (bn >= 4000) return 50; // 5.1 branch return 40; }
getBaseLineForHistoricBuilds
288,153
BuildNumber () { String homePath = PathManager.getHomePath(); Path home = Paths.get(homePath); BuildNumber result = readFile(home.resolve("build.txt")); if (result != null) { return result; } if (SystemInfoRt.isMac) { result = readFile(home.resolve("Resources/build.txt")); if (result != null) { return result; } } String communityHomePath = PathManager.getCommunityHomePath(); if (!communityHomePath.equals(homePath)) { result = readFile(Paths.get(communityHomePath, "build.txt")); if (result != null) { return result; } } return Objects.requireNonNull(fromString(FALLBACK_VERSION)); }
fromFile
288,154
BuildNumber () { return CURRENT_VERSION.get(); }
currentVersion
288,155
String (@NotNull Class<?> key) { return key.getName(); }
keyToString
288,156
PersistentList<T> (@NotNull String key, @NotNull Class classKey) { Set<String> allSupers = new LinkedHashSet<>(); collectSupers(classKey, allSupers); return buildExtensionsWithInheritance(allSupers); }
buildExtensions
288,157
PersistentList<T> (Set<String> supers) { List<KeyedLazyInstance<T>> extensions = getExtensions(); synchronized (lock) { PersistentList<T> result = persistentListOf(); for (String aSuper : supers) { result = result.addAll(buildExtensionsFromExplicitRegistration(key -> aSuper.equals(key))); } for (String aSuper : supers) { result = result.addAll(buildExtensionsFromExtensionPoint(bean -> aSuper.equals(bean.getKey()), extensions)); } return result; } }
buildExtensionsWithInheritance
288,158
void (@NotNull Class<?> classKey, @NotNull Set<? super String> allSupers) { allSupers.add(classKey.getName()); for (Class<?> anInterface : classKey.getInterfaces()) { collectSupers(anInterface, allSupers); } Class<?> superClass = classKey.getSuperclass(); if (superClass != null) { collectSupers(superClass, allSupers); } }
collectSupers
288,159
void (String key) { clearCache(); }
invalidateCacheForExtension
288,160
long () { return super.getModificationCount() + myAdditionalTracker.getModificationCount(); }
getModificationCount
288,161
T () { InvocationHandler handler = new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) { List<KeyedFactoryEPBean> epBeans = myEpName.getExtensionList(); //noinspection unchecked KeyT keyArg = (KeyT) args [0]; String key = getKey(keyArg); Object result = getByKey(epBeans, key, method, args); if (result == null) { result = getByKey(epBeans, null, method, args); } return result; } }; return ReflectionUtil.proxy(myInterfaceClass.getClassLoader(), myInterfaceClass, handler); }
get
288,162
Object (Object proxy, Method method, Object[] args) { List<KeyedFactoryEPBean> epBeans = myEpName.getExtensionList(); //noinspection unchecked KeyT keyArg = (KeyT) args [0]; String key = getKey(keyArg); Object result = getByKey(epBeans, key, method, args); if (result == null) { result = getByKey(epBeans, null, method, args); } return result; }
invoke
288,163
T (@NotNull KeyT key) { return findByKey(getKey(key), myEpName, componentManager); }
getByKey
288,164
T (@NotNull List<KeyedFactoryEPBean> epBeans, @Nullable String key, @NotNull Method method, Object[] args) { for (KeyedFactoryEPBean epBean : epBeans) { if (!(epBean.key == null ? "" : epBean.key).equals(key == null ? "" : key)) { continue; } if (epBean.implementationClass != null) { return componentManager.instantiateClass(epBean.implementationClass, epBean.getPluginDescriptor()); } Object factory = componentManager.instantiateClass(epBean.factoryClass, epBean.getPluginDescriptor()); try { //noinspection unchecked T result = (T)method.invoke(factory, args); if (result != null) { return result; } } catch (RuntimeException e) { if (e instanceof ControlFlowException) { throw e; } throw componentManager.createError(e, epBean.getPluginDescriptor().getPluginId()); } catch (Exception e) { throw componentManager.createError(e, epBean.getPluginDescriptor().getPluginId()); } } return null; }
getByKey
288,165
void () { synchronized (lock) { cache = cache.clear(); tracker.incModificationCount(); } }
clearCache
288,166
void (@NotNull ExtensionPoint<@NotNull KeyedLazyInstance<T>> point) { if (myEpListenerAdded.compareAndSet(false, true)) { point.addExtensionPointListener(new MyExtensionPointListener(), false, null); } }
addExtensionPointListener
288,167
void (String key) { synchronized (lock) { if (key != null) { cache = cache.remove(key); } tracker.incModificationCount(); } }
invalidateCacheForExtension
288,168
void (@NotNull KeyT key, @NotNull T t) { String stringKey = keyToString(key); synchronized (lock) { PersistentList<T> value = explicitExtensions.get(stringKey); explicitExtensions = explicitExtensions.put(stringKey, value == null ? persistentListOf(t) : value.add(t)); invalidateCacheForExtension(stringKey); } }
addExplicitExtension
288,169
void (@NotNull KeyT key, @NotNull T t, @NotNull Disposable parentDisposable) { addExplicitExtension(key, t); Disposer.register(parentDisposable, () -> removeExplicitExtension(key, t)); }
addExplicitExtension
288,170
void (@NotNull KeyT key, @NotNull T t) { String stringKey = keyToString(key); synchronized (lock) { PersistentList<T> list = explicitExtensions.get(stringKey); if (list != null) { list = list.remove(t); explicitExtensions = list.isEmpty() ? explicitExtensions.remove(stringKey) : explicitExtensions.put(stringKey, list); } invalidateCacheForExtension(stringKey); } }
removeExplicitExtension
288,171
String (@NotNull KeyT key) { return key.toString(); }
keyToString
288,172
List<T> (@NotNull KeyT key) { String stringKey = keyToString(key); PersistentList<T> cached = cache.get(stringKey); if (cached != null) { return cached; } cached = buildExtensions(stringKey, key); synchronized (lock) { PersistentList<T> recent = cache.get(stringKey); if (recent != null) { return recent; } cache = cache.put(stringKey, cached); return cached; } }
forKey
288,173
T (@NotNull KeyT key) { List<T> list = forKey(key); return list.isEmpty() ? null : list.get(0); }
findSingle
288,174
PersistentList<T> (@NotNull String stringKey, @NotNull KeyT key) { // compute out of our lock (https://youtrack.jetbrains.com/issue/IDEA-208060) List<KeyedLazyInstance<T>> extensions = getExtensions(); synchronized (lock) { PersistentList<T> explicit = explicitExtensions.get(stringKey); PersistentList<T> result = buildExtensionsFromExtensionPoint(bean -> stringKey.equals(bean.getKey()), extensions); return explicit == null ? result : explicit.addAll(result); } }
buildExtensions
288,175
List<KeyedLazyInstance<T>> () { ExtensionPoint<@NotNull KeyedLazyInstance<T>> point = getPoint(); if (point == null) { return Collections.emptyList(); } else { addExtensionPointListener(point); return point.getExtensionList(); } }
getExtensions
288,176
PersistentList<T> (@NotNull Predicate<? super KeyedLazyInstance<T>> isMyBean, @NotNull List<? extends KeyedLazyInstance<T>> extensions) { PersistentList<T> result = persistentListOf(); for (KeyedLazyInstance<T> bean : extensions) { if (!isMyBean.test(bean)) { continue; } T instance = instantiate(bean); if (instance == null) { continue; } result = result.add(instance); } return result; }
buildExtensionsFromExtensionPoint
288,177
PersistentList<T> (@NotNull Set<String> keys) { List<KeyedLazyInstance<T>> extensions = getExtensions(); synchronized (lock) { PersistentList<T> explicit = buildExtensionsFromExplicitRegistration(keys::contains); PersistentList<T> result = buildExtensionsFromExtensionPoint(bean -> keys.contains(bean.getKey()), extensions); return explicit.addAll(result); } }
buildExtensions
288,178
PersistentList<T> (@NotNull Predicate<? super String> isMyBean) { PersistentList<T> result = persistentListOf(); for (Map.Entry<String, PersistentList<T>> entry : explicitExtensions.entrySet()) { String key = entry.getKey(); if (isMyBean.test(key)) { result = result.addAll(entry.getValue()); } } return result; }
buildExtensionsFromExplicitRegistration
288,179
boolean () { synchronized (lock) { if (!explicitExtensions.isEmpty()) { return true; } } ExtensionPoint<@NotNull KeyedLazyInstance<T>> point = getPoint(); return point != null && point.size() != 0; }
hasAnyExtensions
288,180
String () { return epName; }
getName
288,181
long () { return tracker.getModificationCount(); }
getModificationCount
288,182
void () { ExtensionPoint<@NotNull KeyedLazyInstance<T>> point = getPoint(); if (point != null) { for (KeyedLazyInstance<T> bean : point.getExtensionList()) { bean.getInstance(); } } }
ensureValuesLoaded
288,183
void (@NotNull KeyedLazyInstance<T> bean, @NotNull PluginDescriptor pluginDescriptor) { if (bean.getKey() == null) { throw new PluginException("No key specified for extension of class " + bean.getInstance().getClass(), pluginDescriptor.getPluginId()); } invalidateCacheForExtension(bean.getKey()); }
extensionAdded
288,184
void (@NotNull KeyedLazyInstance<T> bean, @NotNull PluginDescriptor pluginDescriptor) { invalidateCacheForExtension(bean.getKey()); }
extensionRemoved
288,185
void (@NotNull ExtensionsArea area) { synchronized (lock) { cache = cache.clear(); tracker.incModificationCount(); } }
areaReplaced
288,186
void () { if (myDone.setExecuted()) { myRejected.clear(); Disposer.dispose(this); } }
setDone
288,187
boolean () { return myDone.isExecuted(); }
isDone
288,188
boolean () { return myRejected.isExecuted(); }
isRejected
288,189
boolean () { return isDone() || isRejected(); }
isProcessed
288,190
void () { if (myRejected.setExecuted()) { myDone.clear(); Disposer.dispose(this); } }
setRejected
288,191
ActionCallback (@NonNls String error) { myError = error; setRejected(); return this; }
reject
288,192
ActionCallback (final @NotNull Runnable runnable) { myDone.doWhenExecuted(runnable); return this; }
doWhenDone
288,193
ActionCallback (final @NotNull Runnable runnable) { myRejected.doWhenExecuted(runnable); return this; }
doWhenRejected
288,194
ActionCallback (final @NotNull Consumer<? super String> consumer) { myRejected.doWhenExecuted(() -> consumer.accept(myError)); return this; }
doWhenRejected
288,195
ActionCallback (final @NotNull Runnable runnable) { doWhenDone(runnable); doWhenRejected(runnable); return this; }
doWhenProcessed
288,196
ActionCallback (final @NotNull ActionCallback child) { return doWhenDone(child.createSetDoneRunnable()); }
notifyWhenDone
288,197
ActionCallback (final @NotNull ActionCallback child) { return doWhenRejected(() -> child.reject(myError)); }
notifyWhenRejected
288,198
ActionCallback (final @NotNull ActionCallback child) { return doWhenDone(child.createSetDoneRunnable()).notifyWhenRejected(child); }
notify
288,199
void (@NotNull Runnable runnable, boolean requiresDone) { if (requiresDone) { doWhenDone(runnable); return; } runnable.run(); }
processOnDone