mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -44,7 +44,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.usageView.UsageViewTypeLocation;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -222,7 +221,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
|
||||
|
||||
@Nullable
|
||||
@PsiModifier.ModifierConstant
|
||||
public String getPossibleAccess(@Nullable RefJavaElement refElement) {
|
||||
private String getPossibleAccess(@Nullable RefJavaElement refElement) {
|
||||
if (refElement == null) return null;
|
||||
String curAccess = refElement.getAccessModifier();
|
||||
String weakestAccess = PsiModifier.PRIVATE;
|
||||
@@ -553,7 +552,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
|
||||
private static class AcceptSuggestedAccess implements LocalQuickFix{
|
||||
private final RefManager myManager;
|
||||
@PsiModifier.ModifierConstant private final String myHint;
|
||||
private String myName;
|
||||
private final String myName;
|
||||
|
||||
private AcceptSuggestedAccess(final RefManager manager, @PsiModifier.ModifierConstant String hint, String name) {
|
||||
myManager = manager;
|
||||
|
||||
@@ -22,13 +22,14 @@ import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.impl.search.ThrowSearchUtil;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.psi.search.searches.*;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
@@ -41,7 +42,10 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -94,8 +98,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiElement[] getParameterElementsToSearch(@NotNull PsiParameter parameter) {
|
||||
final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
|
||||
private static PsiElement[] getParameterElementsToSearch(@NotNull PsiParameter parameter, @NotNull PsiMethod method) {
|
||||
PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
|
||||
for (int i = 0; i < overrides.length; i++) {
|
||||
final PsiElement navigationElement = overrides[i].getNavigationElement();
|
||||
@@ -131,7 +134,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
|
||||
boolean hasOverridden = OverridingMethodsSearch.search(method).findFirst() != null;
|
||||
if (hasOverridden && askWhetherShouldSearchForParameterInOverridingMethods(element, parameter)) {
|
||||
return getParameterElementsToSearch(parameter);
|
||||
return getParameterElementsToSearch(parameter, method);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,9 +224,8 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
|
||||
@Override
|
||||
protected boolean isSearchForTextOccurencesAvailable(@NotNull PsiElement psiElement, boolean isSingleFile) {
|
||||
if (isSingleFile) return false;
|
||||
return new JavaNonCodeSearchElementDescriptionProvider().getElementDescription(psiElement, NonCodeSearchDescriptionLocation.NON_JAVA) != null;
|
||||
|
||||
return !isSingleFile &&
|
||||
new JavaNonCodeSearchElementDescriptionProvider().getElementDescription(psiElement, NonCodeSearchDescriptionLocation.NON_JAVA) != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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,10 +23,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author max
|
||||
*/
|
||||
public class LightEmptyImplementsList extends LightElement implements PsiReferenceList {
|
||||
public LightEmptyImplementsList(PsiManager manager) {
|
||||
public LightEmptyImplementsList(@NotNull PsiManager manager) {
|
||||
super(manager, JavaLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiReferenceList";
|
||||
}
|
||||
|
||||
@@ -23,16 +23,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author peter
|
||||
*/
|
||||
public class LightParameter extends LightVariableBuilder<LightVariableBuilder> implements PsiParameter {
|
||||
public static final LightParameter[] EMPTY_ARRAY = new LightParameter[0];
|
||||
|
||||
private final PsiElement myDeclarationScope;
|
||||
private final boolean myVarArgs;
|
||||
|
||||
public LightParameter(@NotNull String name, @NotNull PsiType type, PsiElement declarationScope, Language language) {
|
||||
public LightParameter(@NotNull String name, @NotNull PsiType type, @NotNull PsiElement declarationScope, @NotNull Language language) {
|
||||
this(name, type, declarationScope, language, type instanceof PsiEllipsisType);
|
||||
}
|
||||
|
||||
public LightParameter(@NotNull String name, @NotNull PsiType type, PsiElement declarationScope, Language language, boolean isVarArgs) {
|
||||
public LightParameter(@NotNull String name, @NotNull PsiType type, @NotNull PsiElement declarationScope, @NotNull Language language, boolean isVarArgs) {
|
||||
super(declarationScope.getManager(), name, type, language);
|
||||
myDeclarationScope = declarationScope;
|
||||
myVarArgs = isVarArgs;
|
||||
@@ -51,6 +49,7 @@ public class LightParameter extends LightVariableBuilder<LightVariableBuilder> i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Light Parameter";
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LightVariableBuilder<T extends LightVariableBuilder> extends LightE
|
||||
setNavigationElement(navigationElement);
|
||||
}
|
||||
|
||||
public LightVariableBuilder(PsiManager manager, @NotNull String name, @NotNull PsiType type, Language language) {
|
||||
public LightVariableBuilder(PsiManager manager, @NotNull String name, @NotNull PsiType type, @NotNull Language language) {
|
||||
super(manager, language);
|
||||
myName = name;
|
||||
myType = type;
|
||||
@@ -152,9 +152,4 @@ public class LightVariableBuilder<T extends LightVariableBuilder> extends LightE
|
||||
public void setOriginInfo(@Nullable String originInfo) {
|
||||
myOriginInfo = originInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -26,10 +26,8 @@ import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
|
||||
import com.intellij.psi.impl.java.stubs.PsiTypeParameterListStub;
|
||||
import com.intellij.psi.impl.java.stubs.PsiTypeParameterStub;
|
||||
import com.intellij.psi.impl.light.LightEmptyImplementsList;
|
||||
import com.intellij.psi.impl.meta.MetaRegistry;
|
||||
import com.intellij.psi.impl.source.JavaStubPsiElement;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.meta.PsiMetaData;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -46,13 +44,6 @@ import java.util.List;
|
||||
* @author dsl
|
||||
*/
|
||||
public class PsiTypeParameterImpl extends JavaStubPsiElement<PsiTypeParameterStub> implements PsiTypeParameter {
|
||||
private final LightEmptyImplementsList myLightEmptyImplementsList = new LightEmptyImplementsList(null) {
|
||||
@Override
|
||||
public PsiManager getManager() {
|
||||
return PsiTypeParameterImpl.this.getManager();
|
||||
}
|
||||
};
|
||||
|
||||
public PsiTypeParameterImpl(final PsiTypeParameterStub stub) {
|
||||
super(stub, JavaStubElementTypes.TYPE_PARAMETER);
|
||||
}
|
||||
@@ -245,7 +236,7 @@ public class PsiTypeParameterImpl extends JavaStubPsiElement<PsiTypeParameterStu
|
||||
|
||||
@Override
|
||||
public PsiReferenceList getImplementsList() {
|
||||
return myLightEmptyImplementsList;
|
||||
return new LightEmptyImplementsList(getManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,15 +350,12 @@ public class PsiTypeParameterImpl extends JavaStubPsiElement<PsiTypeParameterStu
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "PsiTypeParameter:" + getName();
|
||||
}
|
||||
|
||||
public PsiMetaData getMetaData() {
|
||||
return MetaRegistry.getMeta(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getElementIcon(final int flags) {
|
||||
return PsiClassImplUtil.getClassIcon(flags, this);
|
||||
|
||||
@@ -77,6 +77,7 @@ public abstract class LocalInspectionTool extends InspectionProfileEntry {
|
||||
return getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
@Nullable
|
||||
public String getAlternativeID() {
|
||||
@@ -178,8 +179,7 @@ public abstract class LocalInspectionTool extends InspectionProfileEntry {
|
||||
@Deprecated()
|
||||
public void inspectionFinished(@NotNull LocalInspectionToolSession session) {}
|
||||
@NotNull
|
||||
public List<ProblemDescriptor> processFile(@NotNull PsiFile file,
|
||||
@NotNull InspectionManager manager) {
|
||||
public List<ProblemDescriptor> processFile(@NotNull PsiFile file, @NotNull InspectionManager manager) {
|
||||
final ProblemsHolder holder = new ProblemsHolder(manager, file, false);
|
||||
LocalInspectionToolSession session = new LocalInspectionToolSession(file, 0, file.getTextLength());
|
||||
final PsiElementVisitor customVisitor = buildVisitor(holder, false, session);
|
||||
@@ -200,6 +200,4 @@ public abstract class LocalInspectionTool extends InspectionProfileEntry {
|
||||
|
||||
return holder.getResults();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+28
-55
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -162,65 +162,38 @@ public abstract class DefaultHighlightVisitorBasedInspection extends GlobalSimpl
|
||||
final Project project = file.getProject();
|
||||
Document document = PsiDocumentManager.getInstance(project).getDocument(file);
|
||||
if (document == null) return;
|
||||
//final HighlightInfoFilter[] filters = ApplicationManager.getApplication().getExtensions(HighlightInfoFilter.EXTENSION_POINT_NAME);
|
||||
DaemonProgressIndicator progress = new DaemonProgressIndicator();
|
||||
progress.start();
|
||||
TextEditorHighlightingPassRegistrarEx passRegistrarEx = TextEditorHighlightingPassRegistrarEx.getInstanceEx(project);
|
||||
List<TextEditorHighlightingPass> passes = passRegistrarEx.instantiateMainPasses(file, document, HighlightInfoProcessor.getEmpty());
|
||||
List<GeneralHighlightingPass> gpasses = ContainerUtil.collect(passes.iterator(), FilteringIterator.instanceOf(GeneralHighlightingPass.class));
|
||||
for (final GeneralHighlightingPass gpass : gpasses) {
|
||||
gpass.setHighlightVisitorProducer(new NotNullProducer<HighlightVisitor[]>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public HighlightVisitor[] produce() {
|
||||
gpass.incVisitorUsageCount(1);
|
||||
return new HighlightVisitor[]{new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true)};
|
||||
try {
|
||||
TextEditorHighlightingPassRegistrarEx passRegistrarEx = TextEditorHighlightingPassRegistrarEx.getInstanceEx(project);
|
||||
List<TextEditorHighlightingPass> passes = passRegistrarEx.instantiateMainPasses(file, document, HighlightInfoProcessor.getEmpty());
|
||||
List<GeneralHighlightingPass> gpasses = ContainerUtil.collect(passes.iterator(), FilteringIterator.instanceOf(GeneralHighlightingPass.class));
|
||||
for (final GeneralHighlightingPass gpass : gpasses) {
|
||||
gpass.setHighlightVisitorProducer(new NotNullProducer<HighlightVisitor[]>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public HighlightVisitor[] produce() {
|
||||
gpass.incVisitorUsageCount(1);
|
||||
return new HighlightVisitor[]{new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true)};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (TextEditorHighlightingPass pass : gpasses) {
|
||||
pass.doCollectInformation(progress);
|
||||
List<HighlightInfo> infos = pass.getInfos();
|
||||
for (HighlightInfo info : infos) {
|
||||
if (info == null) continue;
|
||||
//if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) continue;
|
||||
if (info.getSeverity().compareTo(HighlightSeverity.INFORMATION) <= 0) continue;
|
||||
result.add(Pair.create(file, info));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (TextEditorHighlightingPass pass : gpasses) {
|
||||
pass.doCollectInformation(progress);
|
||||
List<HighlightInfo> infos = pass.getInfos();
|
||||
for (HighlightInfo info : infos) {
|
||||
if (info == null) continue;
|
||||
//if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) continue;
|
||||
if (info.getSeverity().compareTo(HighlightSeverity.INFORMATION) <= 0) continue;
|
||||
result.add(Pair.create(file, info));
|
||||
}
|
||||
}
|
||||
//GeneralHighlightingPass pass =
|
||||
// new GeneralHighlightingPass(project, file, document, 0, file.getTextLength(), true, new ProperTextRange(0, document.getTextLength()), null, HighlightInfoProcessor.getEmpty()) {
|
||||
// @NotNull
|
||||
// @Override
|
||||
// protected HighlightVisitor[] createHighlightVisitors() {
|
||||
// return new HighlightVisitor[]{new DefaultHighlightVisitor(project, highlightErrorElements, runAnnotators, true)};
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected HighlightInfoHolder createInfoHolder(final PsiFile file) {
|
||||
// return new CustomHighlightInfoHolder(file, getColorsScheme(), filters) {
|
||||
// @Override
|
||||
// public boolean add(@Nullable HighlightInfo info) {
|
||||
// if (info == null) return true;
|
||||
// if (info.type == HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT) return true;
|
||||
// if (info.getSeverity() == HighlightSeverity.INFORMATION) return true;
|
||||
//
|
||||
// result.add(Pair.create(file, info));
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected boolean isFailFastOnAcquireReadAction() {
|
||||
// return myOnTheFly;
|
||||
// }
|
||||
// };
|
||||
//progress.start();
|
||||
//pass.collectInformation(progress);
|
||||
finally {
|
||||
progress.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public class FCTSBackedLighterAST extends LighterAST {
|
||||
@NotNull
|
||||
private final FlyweightCapableTreeStructure<LighterASTNode> myTreeStructure;
|
||||
|
||||
public FCTSBackedLighterAST(final CharTable charTable, final FlyweightCapableTreeStructure<LighterASTNode> treeStructure) {
|
||||
public FCTSBackedLighterAST(@NotNull CharTable charTable, @NotNull FlyweightCapableTreeStructure<LighterASTNode> treeStructure) {
|
||||
super(charTable);
|
||||
myTreeStructure = treeStructure;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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,7 +27,7 @@ import java.util.List;
|
||||
public abstract class LighterAST {
|
||||
private final CharTable myCharTable;
|
||||
|
||||
public LighterAST(final CharTable charTable) {
|
||||
public LighterAST(@NotNull CharTable charTable) {
|
||||
myCharTable = charTable;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -40,27 +41,28 @@ public class LayeredIcon implements Icon {
|
||||
myVShifts = new int[layerCount];
|
||||
}
|
||||
|
||||
public LayeredIcon(Icon... icons) {
|
||||
public LayeredIcon(@NotNull Icon... icons) {
|
||||
this(icons.length);
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
setIcon(icons[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
public static LayeredIcon createHorizontalIcon(Icon... icons) {
|
||||
LayeredIcon icon = new LayeredIcon(icons.length);
|
||||
int hShift = 0;
|
||||
public static LayeredIcon createHorizontalIcon(@NotNull Icon... icons) {
|
||||
LayeredIcon result = new LayeredIcon(icons.length);
|
||||
int maxHeight = 0;
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
maxHeight = Math.max(maxHeight, icons[i].getIconHeight());
|
||||
for (Icon icon : icons) {
|
||||
maxHeight = Math.max(maxHeight, icon.getIconHeight());
|
||||
}
|
||||
int hShift = 0;
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icon.setIcon(icons[i], i, hShift, (maxHeight - icons[i].getIconHeight()) / 2);
|
||||
result.setIcon(icons[i], i, hShift, (maxHeight - icons[i].getIconHeight()) / 2);
|
||||
hShift +=icons[i].getIconWidth() + 1;
|
||||
}
|
||||
return icon;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof LayeredIcon)) return false;
|
||||
@@ -78,6 +80,7 @@ public class LayeredIcon implements Icon {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
@@ -104,7 +107,7 @@ public class LayeredIcon implements Icon {
|
||||
recalculateSize();
|
||||
}
|
||||
|
||||
private void checkIHaventIconInsideMe(final Icon icon) {
|
||||
private void checkIHaventIconInsideMe(Icon icon) {
|
||||
LOG.assertTrue(icon != this);
|
||||
for (Icon child : myIcons) {
|
||||
if (child instanceof LayeredIcon) ((LayeredIcon)child).checkIHaventIconInsideMe(icon);
|
||||
|
||||
@@ -101,9 +101,9 @@ public abstract class DocumentCommitProcessor {
|
||||
}
|
||||
|
||||
@Nullable("returns runnable to execute under write action in AWT to finish the commit")
|
||||
public Processor<Document> doCommit(@NotNull final CommitTask task,
|
||||
@NotNull final PsiFile file,
|
||||
final boolean synchronously) {
|
||||
Processor<Document> doCommit(@NotNull final CommitTask task,
|
||||
@NotNull final PsiFile file,
|
||||
final boolean synchronously) {
|
||||
Document document = task.document;
|
||||
final long startDocModificationTimeStamp = document.getModificationStamp();
|
||||
final FileElement myTreeElementBeingReparsedSoItWontBeCollected = ((PsiFileImpl)file).calcTreeElement();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -32,7 +32,7 @@ public abstract class LightElement extends PsiElementBase {
|
||||
private final Language myLanguage;
|
||||
private volatile PsiElement myNavigationElement = this;
|
||||
|
||||
protected LightElement(PsiManager manager, final Language language) {
|
||||
protected LightElement(@NotNull PsiManager manager, @NotNull Language language) {
|
||||
myManager = manager;
|
||||
myLanguage = language;
|
||||
}
|
||||
@@ -126,6 +126,7 @@ public abstract class LightElement extends PsiElementBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
|
||||
@Override
|
||||
|
||||
+6
-8
@@ -47,9 +47,9 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class OfflineProblemDescriptorNode extends ProblemDescriptionNode {
|
||||
public OfflineProblemDescriptorNode(@NotNull OfflineProblemDescriptor descriptor,
|
||||
@NotNull LocalInspectionToolWrapper toolWrapper,
|
||||
@NotNull InspectionToolPresentation presentation) {
|
||||
OfflineProblemDescriptorNode(@NotNull OfflineProblemDescriptor descriptor,
|
||||
@NotNull LocalInspectionToolWrapper toolWrapper,
|
||||
@NotNull InspectionToolPresentation presentation) {
|
||||
super(descriptor, toolWrapper, presentation);
|
||||
}
|
||||
|
||||
@@ -141,11 +141,9 @@ public class OfflineProblemDescriptorNode extends ProblemDescriptionNode {
|
||||
LocalInspectionToolSession session = new LocalInspectionToolSession(containingFile, startOffset, endOffset);
|
||||
final PsiElementVisitor visitor = localTool.buildVisitor(holder, false, session);
|
||||
localTool.inspectionStarted(session, false);
|
||||
final PsiElement[] elementsInRange = getElementsIntersectingRange(containingFile,
|
||||
startOffset,
|
||||
endOffset);
|
||||
for (PsiElement el : elementsInRange) {
|
||||
el.accept(visitor);
|
||||
final PsiElement[] elementsInRange = getElementsIntersectingRange(containingFile, startOffset, endOffset);
|
||||
for (PsiElement element : elementsInRange) {
|
||||
element.accept(visitor);
|
||||
}
|
||||
localTool.inspectionFinished(session, holder);
|
||||
if (holder.hasResults()) {
|
||||
|
||||
+1
@@ -113,6 +113,7 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
myProgress.cancel();
|
||||
EditorWindowImpl.disposeInvalidEditors();
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -22,7 +22,9 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.impl.TransferToPooledThreadQueue;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.ExportableApplicationComponent;
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.components.StoragePathMacros;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
@@ -275,7 +277,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
reDetectQueue.drain();
|
||||
}
|
||||
@TestOnly
|
||||
public void reDetectAsync(boolean enable) {
|
||||
void reDetectAsync(boolean enable) {
|
||||
RE_DETECT_ASYNC = enable;
|
||||
}
|
||||
|
||||
@@ -1237,11 +1239,12 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
return PlatformUtils.isIdeaCommunity() ? "CommunityFileTypes" : "FileTypeManager";
|
||||
}
|
||||
|
||||
public FileTypeAssocTable getExtensionMap() {
|
||||
@NotNull
|
||||
FileTypeAssocTable getExtensionMap() {
|
||||
return myPatternsTable;
|
||||
}
|
||||
|
||||
public void setPatternsTable(@NotNull Set<FileType> fileTypes, @NotNull FileTypeAssocTable<FileType> assocTable) {
|
||||
void setPatternsTable(@NotNull Set<FileType> fileTypes, @NotNull FileTypeAssocTable<FileType> assocTable) {
|
||||
fireBeforeFileTypesChanged();
|
||||
for (FileType existing : getRegisteredFileTypes()) {
|
||||
if (!fileTypes.contains(existing)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -16,11 +16,11 @@
|
||||
package com.intellij.spellchecker.compress;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
public final class Alphabet {
|
||||
|
||||
private final char[] letters;
|
||||
private int lastIndexUsed = 0;
|
||||
private int lastIndexUsed;
|
||||
private static final int MAX_INDEX = UnitBitSet.MAX_UNIT_VALUE;
|
||||
|
||||
public char getLetter(int position) {
|
||||
@@ -57,7 +57,7 @@ public final class Alphabet {
|
||||
return lastIndexUsed;
|
||||
}
|
||||
|
||||
public int add(char c) {
|
||||
private int add(char c) {
|
||||
if(lastIndexUsed>=letters.length-1) return -1;
|
||||
lastIndexUsed++;
|
||||
letters[lastIndexUsed] = c;
|
||||
@@ -75,8 +75,10 @@ public final class Alphabet {
|
||||
}
|
||||
|
||||
// TODO: this should be ONLY way to create it to sped up getIndex
|
||||
@TestOnly
|
||||
Alphabet(@NotNull CharSequence alphabet) {
|
||||
this(alphabet.length() + 1);
|
||||
assert alphabet.length() != 0;
|
||||
for (int i = 0; i < alphabet.length(); i++) {
|
||||
add(alphabet.charAt(i));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -162,6 +162,7 @@ public final class CompressedDictionary implements Dictionary {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CompressedDictionary" + "{wordsCount=" + wordsCount + ", name='" + name + '\'' + '}';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,17 +20,16 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class Encoder {
|
||||
|
||||
private final Alphabet alphabet;
|
||||
private static final int offset = 0;
|
||||
static final UnitBitSet WORD_OF_ENTIRELY_UNKNOWN_LETTERS = new UnitBitSet(new byte[1],new Alphabet());
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.spellchecker.compress");
|
||||
|
||||
public Encoder() {
|
||||
alphabet = new Alphabet();
|
||||
this(new Alphabet());
|
||||
}
|
||||
|
||||
public Encoder(Alphabet alphabet) {
|
||||
public Encoder(@NotNull Alphabet alphabet) {
|
||||
this.alphabet = alphabet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user