mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,10 +33,10 @@ import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.stubs.StubTreeLoader;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.indexing.IndexingDataKeys;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
@@ -174,7 +174,7 @@ public class JavaParserUtil {
|
||||
text = chameleon.getChars();
|
||||
}
|
||||
else {
|
||||
text = psi.getUserData(StubTreeLoader.FILE_TEXT_CONTENT_KEY);
|
||||
text = psi.getUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY);
|
||||
if (text == null) text = chameleon.getChars();
|
||||
}
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
|
||||
final StubTree derefd = derefStub();
|
||||
if (derefd != null) return derefd;
|
||||
|
||||
StubTree stubHolder = StubTreeLoader.getInstance().readOrBuild(getProject(), getVirtualFile());
|
||||
StubTree stubHolder = StubTreeLoader.getInstance().readOrBuild(getProject(), getVirtualFile(), this);
|
||||
if (stubHolder == null) {
|
||||
// Must be corrupted classfile
|
||||
LOG.info("Class file is corrupted: " + getVirtualFile().getPresentableUrl());
|
||||
|
||||
@@ -470,11 +470,9 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
PsiType bound = intersectAllExtends(typeParam, arg);
|
||||
return new Pair<PsiType, ConstraintType>(bound, ConstraintType.SUPERTYPE);
|
||||
}
|
||||
/*
|
||||
if (psiClass == null && arg instanceof PsiClassType) {
|
||||
return Pair.create(arg, ConstraintType.EQUALS);
|
||||
}
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
if (paramClass == null) return null;
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
}
|
||||
|
||||
public void testCastInThrow() throws Exception { doTest(); }
|
||||
public void _testNonExistentGenericAfterNew() throws Exception { doTest(); }
|
||||
public void testNonExistentGenericAfterNew() throws Exception { doTest(); }
|
||||
|
||||
public void testParenAfterNewWithinInnerExpr() throws Exception {
|
||||
String path = "/afterNew";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -656,7 +656,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
final VirtualFile vFile = getVirtualFile();
|
||||
if (!(vFile instanceof VirtualFileWithId)) return null;
|
||||
|
||||
StubTree stubHolder = StubTreeLoader.getInstance().readOrBuild(getProject(), vFile);
|
||||
StubTree stubHolder = StubTreeLoader.getInstance().readOrBuild(getProject(), vFile, this);
|
||||
if (stubHolder == null) return null;
|
||||
|
||||
final IElementType contentElementType = getContentElementType();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,11 +22,13 @@ import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
import com.intellij.psi.tree.IStubFileElementType;
|
||||
import com.intellij.util.indexing.FileContent;
|
||||
import com.intellij.util.indexing.FileContentImpl;
|
||||
import com.intellij.util.indexing.IndexingDataKeys;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -35,7 +37,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public class CoreStubTreeLoader extends StubTreeLoader {
|
||||
@Override
|
||||
public StubTree readOrBuild(Project project, VirtualFile vFile) {
|
||||
public StubTree readOrBuild(Project project, VirtualFile vFile, @Nullable PsiFile psiFile) {
|
||||
if (!canHaveStub(vFile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
import com.intellij.psi.tree.IStubFileElementType;
|
||||
import com.intellij.util.indexing.FileContent;
|
||||
import com.intellij.util.indexing.IndexingDataKeys;
|
||||
import com.intellij.util.indexing.SubstitutedFileType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -58,7 +59,7 @@ public class StubTreeBuilder {
|
||||
|
||||
PsiFile psi = inputData.getPsiFile();
|
||||
CharSequence contentAsText = inputData.getContentAsText();
|
||||
psi.putUserData(StubTreeLoader.FILE_TEXT_CONTENT_KEY, contentAsText);
|
||||
psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, contentAsText);
|
||||
|
||||
try {
|
||||
if (type instanceof IStubFileElementType) {
|
||||
@@ -72,7 +73,7 @@ public class StubTreeBuilder {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
psi.putUserData(StubTreeLoader.FILE_TEXT_CONTENT_KEY, null);
|
||||
psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,20 +17,20 @@ package com.intellij.psi.stubs;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class StubTreeLoader {
|
||||
public static final Key<CharSequence> FILE_TEXT_CONTENT_KEY = Key.create("file text content cached by stub indexer");
|
||||
|
||||
public static StubTreeLoader getInstance() {
|
||||
return ServiceManager.getService(StubTreeLoader.class);
|
||||
}
|
||||
|
||||
public abstract StubTree readOrBuild(Project project, final VirtualFile vFile);
|
||||
public abstract StubTree readOrBuild(Project project, final VirtualFile vFile, @Nullable final PsiFile psiFile);
|
||||
|
||||
public abstract StubTree readFromVFile(Project project, final VirtualFile vFile);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -174,6 +174,10 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
|
||||
if (myFileType.isBinary()) {
|
||||
throw new IllegalDataException("Cannot obtain text for binary file type : " + myFileType.getDescription());
|
||||
}
|
||||
final CharSequence content = getUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY);
|
||||
if (content != null) {
|
||||
return content;
|
||||
}
|
||||
if (myContentAsText == null) {
|
||||
if (myContent != null) {
|
||||
myContentAsText = LoadTextUtil.getTextByBinaryPresentation(myContent, myCharset);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,7 @@ public class IndexingDataKeys {
|
||||
public static final Key<VirtualFile> VIRTUAL_FILE = new Key<VirtualFile>("Context virtual file");
|
||||
public static final Key<Project> PROJECT = new Key<Project>("Context project");
|
||||
public static final Key<PsiFile> PSI_FILE = new Key<PsiFile>("PSI for stubs");
|
||||
public static final Key<CharSequence> FILE_TEXT_CONTENT_KEY = Key.create("file text content cached by stub indexer");
|
||||
|
||||
private IndexingDataKeys() {
|
||||
}
|
||||
|
||||
+3
-2
@@ -34,6 +34,7 @@ import com.intellij.psi.WeighingService;
|
||||
import com.intellij.psi.statistics.StatisticsInfo;
|
||||
import com.intellij.psi.statistics.StatisticsManager;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.THashMap;
|
||||
@@ -107,7 +108,7 @@ public class CompletionLookupArranger extends LookupArranger {
|
||||
}
|
||||
Classifier<LookupElement> classifier = myClassifiers.get(sorter);
|
||||
if (classifier != null) {
|
||||
classifier.describeItems(subMap);
|
||||
classifier.describeItems(subMap, new ProcessingContext());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ public class CompletionLookupArranger extends LookupArranger {
|
||||
|
||||
final List<LookupElement> byRelevance = new ArrayList<LookupElement>();
|
||||
for (CompletionSorterImpl sorter : myClassifiers.keySet()) {
|
||||
ContainerUtil.addAll(byRelevance, myClassifiers.get(sorter).classify((List<LookupElement>)inputBySorter.get(sorter)));
|
||||
ContainerUtil.addAll(byRelevance, myClassifiers.get(sorter).classify(inputBySorter.get(sorter), new ProcessingContext()));
|
||||
}
|
||||
|
||||
LinkedHashSet<LookupElement> model = new LinkedHashSet<LookupElement>();
|
||||
|
||||
+17
-20
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.completion.impl;
|
||||
|
||||
import com.intellij.codeInsight.lookup.Classifier;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -73,19 +74,25 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<LookupElement> classify(List<LookupElement> source) {
|
||||
return liftShorterElements(source, new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY));
|
||||
public Iterable<LookupElement> classify(Iterable<LookupElement> source, ProcessingContext context) {
|
||||
return liftShorterElements(source, new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY), context);
|
||||
}
|
||||
|
||||
private List<LookupElement> liftShorterElements(List<LookupElement> source, THashSet<LookupElement> lifted) {
|
||||
final Set<LookupElement> srcSet = new THashSet<LookupElement>(source, TObjectHashingStrategy.IDENTITY);
|
||||
private List<LookupElement> liftShorterElements(Iterable<LookupElement> source, THashSet<LookupElement> lifted, ProcessingContext context) {
|
||||
final Set<LookupElement> srcSet = new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY);
|
||||
ContainerUtil.addAll(srcSet, source);
|
||||
final Set<LookupElement> processed = new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY);
|
||||
|
||||
final List<LookupElement> result = new ArrayList<LookupElement>();
|
||||
for (LookupElement element : myNext.classify(source)) {
|
||||
for (LookupElement element : myNext.classify(source, context)) {
|
||||
assert srcSet.contains(element) : myNext;
|
||||
if (processed.add(element)) {
|
||||
for (String prefix : getSortedPrefixes(element)) {
|
||||
final List<String> prefixes = new SmartList<String>();
|
||||
for (String string : getAllLookupStrings(element)) {
|
||||
prefixes.addAll(myPrefixes.get(string));
|
||||
}
|
||||
Collections.sort(prefixes);
|
||||
for (String prefix : prefixes) {
|
||||
List<LookupElement> shorter = new SmartList<LookupElement>();
|
||||
for (LookupElement shorterElement : myElements.get(prefix)) {
|
||||
if (srcSet.contains(shorterElement) && processed.add(shorterElement)) {
|
||||
@@ -95,7 +102,7 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
|
||||
|
||||
lifted.addAll(shorter);
|
||||
|
||||
ContainerUtil.addAll(result, myNext.classify(shorter));
|
||||
ContainerUtil.addAll(result, myNext.classify(shorter, context));
|
||||
}
|
||||
result.add(element);
|
||||
}
|
||||
@@ -103,24 +110,14 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
|
||||
return result;
|
||||
}
|
||||
|
||||
private String[] getSortedPrefixes(LookupElement element) {
|
||||
final List<String> prefixes = new SmartList<String>();
|
||||
for (String string : getAllLookupStrings(element)) {
|
||||
prefixes.addAll(myPrefixes.get(string));
|
||||
}
|
||||
String[] result = prefixes.toArray(new String[prefixes.size()]);
|
||||
Arrays.sort(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Set<String> getAllLookupStrings(LookupElement element) {
|
||||
return element.getAllLookupStrings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeItems(LinkedHashMap<LookupElement, StringBuilder> map) {
|
||||
public void describeItems(LinkedHashMap<LookupElement, StringBuilder> map, ProcessingContext context) {
|
||||
final HashSet<LookupElement> lifted = new HashSet<LookupElement>();
|
||||
liftShorterElements(new ArrayList<LookupElement>(map.keySet()), new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY));
|
||||
liftShorterElements(new ArrayList<LookupElement>(map.keySet()), new THashSet<LookupElement>(TObjectHashingStrategy.IDENTITY), new ProcessingContext());
|
||||
if (!lifted.isEmpty()) {
|
||||
for (LookupElement element : map.keySet()) {
|
||||
final StringBuilder builder = map.get(element);
|
||||
@@ -131,6 +128,6 @@ class LiftShorterItemsClassifier extends Classifier<LookupElement> {
|
||||
builder.append("liftShorter=").append(lifted.contains(element));
|
||||
}
|
||||
}
|
||||
myNext.describeItems(map);
|
||||
myNext.describeItems(map, context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.util.ProcessingContext;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -24,8 +25,8 @@ import java.util.List;
|
||||
public abstract class Classifier<T> {
|
||||
public abstract void addElement(T t);
|
||||
|
||||
public abstract Iterable<T> classify(List<T> source);
|
||||
public abstract Iterable<T> classify(Iterable<T> source, ProcessingContext context);
|
||||
|
||||
public abstract void describeItems(LinkedHashMap<T, StringBuilder> map);
|
||||
public abstract void describeItems(LinkedHashMap<T, StringBuilder> map, ProcessingContext context);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.util.ProcessingContext;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -40,12 +42,12 @@ public abstract class ClassifierFactory<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> classify(List<T> source) {
|
||||
public Iterable<T> classify(Iterable<T> source, ProcessingContext context) {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeItems(LinkedHashMap<T, StringBuilder> map) {
|
||||
public void describeItems(LinkedHashMap<T, StringBuilder> map, ProcessingContext context) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -41,7 +42,7 @@ public abstract class ComparingClassifier<T> extends Classifier<T> {
|
||||
myNext.addElement(t);
|
||||
}
|
||||
|
||||
private TreeMap<Comparable, List<T>> groupByWeights(List<T> source) {
|
||||
private TreeMap<Comparable, List<T>> groupByWeights(Iterable<T> source) {
|
||||
TreeMap<Comparable, List<T>> map = new TreeMap<Comparable, List<T>>();
|
||||
for (T t : source) {
|
||||
final Comparable weight = getWeight(t);
|
||||
@@ -55,16 +56,16 @@ public abstract class ComparingClassifier<T> extends Classifier<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> classify(List<T> source) {
|
||||
public Iterable<T> classify(Iterable<T> source, ProcessingContext context) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
for (List<T> list : groupByWeights(source).values()) {
|
||||
ContainerUtil.addAll(result, myNext.classify(list));
|
||||
ContainerUtil.addAll(result, myNext.classify(list, context));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeItems(LinkedHashMap<T, StringBuilder> map) {
|
||||
public void describeItems(LinkedHashMap<T, StringBuilder> map, ProcessingContext context) {
|
||||
final TreeMap<Comparable, List<T>> treeMap = groupByWeights(new ArrayList<T>(map.keySet()));
|
||||
if (treeMap.size() > 1 || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
for (Map.Entry<Comparable, List<T>> entry: treeMap.entrySet()){
|
||||
@@ -78,6 +79,6 @@ public abstract class ComparingClassifier<T> extends Classifier<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
myNext.describeItems(map);
|
||||
myNext.describeItems(map, context);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -91,11 +91,12 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
|
||||
data.addText(directoryFile.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
|
||||
}
|
||||
|
||||
if (parentValue instanceof Project) {
|
||||
final boolean canAttach = ProjectAttachProcessor.canAttachToProject();
|
||||
if (parentValue instanceof Project && !canAttach) {
|
||||
final String location = FileUtil.getLocationRelativeToUserHome(((Project)parentValue).getPresentableUrl());
|
||||
data.addText(" (" + location + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
}
|
||||
else if (parentValue instanceof Module) {
|
||||
else if (parentValue instanceof Module || (parentValue instanceof Project && canAttach)) {
|
||||
data.addText(" (" + directoryFile.getPresentableUrl() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
}
|
||||
else if (ProjectRootsUtil.isSourceOrTestRoot(directoryFile, project)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.intellij.psi.stubs;
|
||||
|
||||
import com.intellij.diagnostic.LogMessageEx;
|
||||
import com.intellij.diagnostic.errordialog.Attachment;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
@@ -289,7 +291,26 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
|
||||
else {
|
||||
final List<StubElement<?>> plained = stubTree.getPlainList();
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
Psi psi = (Psi)plained.get(value.get(i)).getPsi();
|
||||
final int stubTreeIndex = value.get(i);
|
||||
if (stubTreeIndex >= plained.size()) {
|
||||
final VirtualFile virtualFile = psiFile.getVirtualFile();
|
||||
StubTree stubTreeFromIndex = StubTreeLoader.getInstance().readFromVFile(project, file);
|
||||
LOG.error(LogMessageEx.createEvent("PSI and index do not match: PSI " + psiFile + ", first stub " + plained.get(0),
|
||||
"Please report the problem to JetBrains with the file attached",
|
||||
new Attachment(virtualFile != null ? virtualFile.getPath() : "vFile.txt", psiFile.getText()),
|
||||
new Attachment("stubTree.txt", ((PsiFileStubImpl)stubTree.getRoot()).printTree()),
|
||||
new Attachment("stubTreeFromIndex.txt", stubTreeFromIndex == null ? "null" : ((PsiFileStubImpl)stubTreeFromIndex.getRoot()).printTree())));
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fileBasedIndex.requestReindex(file);
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
|
||||
break;
|
||||
}
|
||||
Psi psi = (Psi)plained.get(stubTreeIndex).getPsi();
|
||||
if (!processor.process(psi)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.indexing.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -38,7 +39,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StubTree readOrBuild(Project project, final VirtualFile vFile) {
|
||||
public StubTree readOrBuild(Project project, final VirtualFile vFile, @Nullable PsiFile psiFile) {
|
||||
final StubTree fromIndices = readFromVFile(project, vFile);
|
||||
if (fromIndices != null) {
|
||||
return fromIndices;
|
||||
@@ -51,6 +52,12 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
try {
|
||||
final FileContent fc = new FileContentImpl(vFile, vFile.contentsToByteArray());
|
||||
fc.putUserData(IndexingDataKeys.PROJECT, project);
|
||||
if (psiFile != null) {
|
||||
fc.putUserData(IndexingDataKeys.PSI_FILE, psiFile);
|
||||
if (!vFile.getFileType().isBinary()) {
|
||||
fc.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, psiFile.getViewProvider().getContents());
|
||||
}
|
||||
}
|
||||
final StubElement element = StubTreeBuilder.buildStubTree(fc);
|
||||
if (element instanceof PsiFileStub) {
|
||||
return new StubTree((PsiFileStub)element);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<orderEntry type="module" module-name="git4idea" />
|
||||
<orderEntry type="library" name="http-client-3.1" level="project" />
|
||||
<orderEntry type="module" module-name="vcs-impl" />
|
||||
<orderEntry type="module" module-name="tasks-core" />
|
||||
<orderEntry type="module" module-name="tasks-api" />
|
||||
<orderEntry type="module" module-name="tasks-core" exported="" />
|
||||
<orderEntry type="module" module-name="tasks-api" exported="" />
|
||||
<orderEntry type="module" module-name="platform-impl" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="library" name="gson" level="project" />
|
||||
|
||||
Reference in New Issue
Block a user