diff --git a/.idea/modules.xml b/.idea/modules.xml
index ed5c32e269fe..8500e622a7bf 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -91,6 +91,7 @@
+
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index f299b61a63fd..19c53fae82b7 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -226,6 +226,12 @@ public def layoutCommunityPlugins(String home) {
module("gradle")
}
}
+
+ layoutPlugin("rearranger") {
+ jar("rearranger.jar") {
+ module("rearranger")
+ }
+ }
layoutPlugin("git4idea") {
jar("git4idea-rt.jar") {
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index af1934b4e9a6..56dea509d8bc 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -237,6 +237,7 @@ binding.setVariable("platformApiModules", [
binding.setVariable("platformImplementationModules", [
"core-impl",
+ "indexing-impl",
"platform-impl",
"vcs-impl",
"lang-impl",
diff --git a/community-main.iml b/community-main.iml
index 0dbcfb09ce10..68ce7b7be166 100644
--- a/community-main.iml
+++ b/community-main.iml
@@ -89,6 +89,7 @@
+
diff --git a/images/src/org/intellij/images/index/ImageInfoIndex.java b/images/src/org/intellij/images/index/ImageInfoIndex.java
index 472fb9545f4c..ec1ee69b8384 100644
--- a/images/src/org/intellij/images/index/ImageInfoIndex.java
+++ b/images/src/org/intellij/images/index/ImageInfoIndex.java
@@ -36,7 +36,7 @@ import java.io.IOException;
public class ImageInfoIndex extends SingleEntryFileBasedIndexExtension {
public static final ID INDEX_ID = ID.create("ImageFileInfoIndex");
- private final InputFilter myInputFilter = new InputFilter() {
+ private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(final VirtualFile file) {
return (file.getFileSystem() == LocalFileSystem.getInstance() || file.getFileSystem() instanceof TempFileSystem) &&
@@ -89,7 +89,7 @@ public class ImageInfoIndex extends SingleEntryFileBasedIndexExtension pointers = task.getArtifactPointers();
- if (!task.isEnabled() || pointers.isEmpty()) {
+ if (pointers.isEmpty()) {
return CompilerBundle.message("build.artifacts.before.run.description.empty");
}
if (pointers.size() == 1) {
diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
index 7d1ea6033393..032d56d85e1e 100644
--- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
+++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
@@ -16,7 +16,6 @@
package com.intellij.execution.application;
import com.intellij.execution.ExecutionBundle;
-import com.intellij.execution.RunConfigurationExtension;
import com.intellij.execution.configuration.ConfigurationFactoryEx;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
@@ -48,11 +47,6 @@ public class ApplicationConfigurationType implements ConfigurationType {
return new ApplicationConfiguration("", project, ApplicationConfigurationType.this);
}
- @Override
- public Icon getIcon(@NotNull final RunConfiguration configuration) {
- return getIcon();
- }
-
@Override
public void onNewConfigurationCreated(@NotNull RunConfiguration configuration) {
((ModuleBasedConfiguration)configuration).onNewConfigurationCreated();
diff --git a/java/java-impl/src/com/intellij/application/options/CodeStyleImportsPanel.java b/java/java-impl/src/com/intellij/application/options/CodeStyleImportsPanel.java
index 7a890c7081bc..56399a3f7dde 100644
--- a/java/java-impl/src/com/intellij/application/options/CodeStyleImportsPanel.java
+++ b/java/java-impl/src/com/intellij/application/options/CodeStyleImportsPanel.java
@@ -120,7 +120,7 @@ public class CodeStyleImportsPanel extends JPanel {
}
private JPanel createGeneralOptionsPanel() {
- OptionGroup group = new OptionGroup(ApplicationBundle.message("title.general"), true);
+ OptionGroup group = new OptionGroup(ApplicationBundle.message("title.general"));
myCbUseSingleClassImports = new JCheckBox(ApplicationBundle.message("checkbox.use.single.class.import"));
group.add(myCbUseSingleClassImports);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java
index a351c62ddcb4..4a26b2c25866 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java
@@ -32,7 +32,6 @@ import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.AllOverridingMethodsSearch;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
@@ -61,8 +60,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
private static final Icon IMPLEMENTED_INTERFACE_MARKER_RENDERER = IMPLEMENTED_METHOD_MARKER_RENDERER;
private static final Icon SUBCLASSED_CLASS_MARKER_RENDERER = OVERRIDEN_METHOD_MARKER_RENDERER;
- private static final Icon RECURSIVE_METHOD_ICON = IconLoader.getIcon("/gutter/recursiveMethod.png");
-
protected final DaemonCodeAnalyzerSettings myDaemonSettings;
protected final EditorColorsManager myColorsManager;
@@ -167,11 +164,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
}
else if (element instanceof PsiClass && !(element instanceof PsiTypeParameter)) {
collectInheritingClasses((PsiClass)element, result);
- } else if(element instanceof PsiMethodCallExpression){
- final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)element;
- if (isRecursiveMethodCall(methodCall)){
- result.add(new RecursiveMethodCallMarkerInfo(methodCall));
- }
}
}
if (!methods.isEmpty()) {
@@ -179,14 +171,6 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
}
}
- private static boolean isRecursiveMethodCall(@NotNull PsiMethodCallExpression methodCall){
- PsiMethod referencedMethod = methodCall.resolveMethod();
-
- TextRange rmRange = referencedMethod == null ? null : referencedMethod.getTextRange();
- int mcOffset = methodCall.getTextRange().getStartOffset();
- return rmRange != null && rmRange.contains(mcOffset);
- }
-
private static void collectInheritingClasses(PsiClass aClass, Collection result) {
if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
return;
@@ -292,36 +276,4 @@ public class JavaLineMarkerProvider implements LineMarkerProvider, DumbAware {
};
}
}
-
- private static class RecursiveMethodCallMarkerInfo extends MergeableLineMarkerInfo {
- private RecursiveMethodCallMarkerInfo(@NotNull PsiMethodCallExpression methodCall) {
- super(methodCall,
- methodCall.getTextRange(),
- RECURSIVE_METHOD_ICON,
- Pass.UPDATE_OVERRIDEN_MARKERS,
- FunctionUtil.constant("Recursive call"),
- null,
- GutterIconRenderer.Alignment.RIGHT
- );
- }
-
- @Override
- public boolean canMergeWith(@NotNull MergeableLineMarkerInfo> info) {
- if (!(info instanceof RecursiveMethodCallMarkerInfo)) return false;
- PsiElement otherElement = info.getElement();
- PsiElement myElement = getElement();
- return otherElement != null && myElement != null;
- }
-
-
- @Override
- public Icon getCommonIcon(@NotNull List infos) {
- return myIcon;
- }
-
- @Override
- public Function super PsiElement, String> getCommonTooltip(@NotNull List infos) {
- return FunctionUtil.constant("Multiple recursive calls");
- }
- }
}
diff --git a/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java b/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
index bbe8b5f463b8..89aa34787572 100644
--- a/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
+++ b/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
@@ -19,18 +19,22 @@ import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.reference.*;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.WriteExternalException;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.OverridingMethodsSearch;
+import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.util.IncorrectOperationException;
+import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
@@ -40,6 +44,8 @@ import java.util.List;
public class UnusedReturnValue extends GlobalJavaInspectionTool{
private MakeVoidQuickFix myQuickFix;
+ public boolean IGNORE_BUILDER_PATTERN = false;
+
@Nullable
public CommonProblemDescriptor[] checkElement(RefEntity refEntity,
AnalysisScope scope,
@@ -54,8 +60,11 @@ public class UnusedReturnValue extends GlobalJavaInspectionTool{
if (refMethod.getInReferences().size() == 0) return null;
if (!refMethod.isReturnValueUsed()) {
- return new ProblemDescriptor[]{manager.createProblemDescriptor(refMethod.getElement().getNavigationElement(),
- InspectionsBundle.message("inspection.unused.return.value.problem.descriptor"),
+ final PsiMethod psiMethod = (PsiMethod)refMethod.getElement();
+ if (IGNORE_BUILDER_PATTERN && PropertyUtil.isSimplePropertySetter(psiMethod)) return null;
+ return new ProblemDescriptor[]{manager.createProblemDescriptor(psiMethod.getNavigationElement(),
+ InspectionsBundle
+ .message("inspection.unused.return.value.problem.descriptor"),
getFix(processor), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
false)};
}
@@ -64,6 +73,17 @@ public class UnusedReturnValue extends GlobalJavaInspectionTool{
return null;
}
+ @Override
+ public void writeSettings(Element node) throws WriteExternalException {
+ if (IGNORE_BUILDER_PATTERN) {
+ super.writeSettings(node);
+ }
+ }
+
+ @Override
+ public JComponent createOptionsPanel() {
+ return new SingleCheckboxOptionsPanel("Ignore simple setters", this, "IGNORE_BUILDER_PATTERN");
+ }
protected boolean queryExternalUsagesRequests(final RefManager manager, final GlobalJavaInspectionContext globalContext,
final ProblemDescriptionsProcessor processor) {
diff --git a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java
index 866e90051289..a2c2fde1d155 100644
--- a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java
+++ b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java
@@ -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.
@@ -25,6 +25,8 @@ import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.JavaDocTokenType;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.StringEscapesTokenTypes;
+import com.intellij.psi.TokenType;
+import com.intellij.psi.impl.source.tree.ElementType;
import com.intellij.psi.impl.source.tree.JavaDocElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.xml.XmlTokenType;
@@ -51,9 +53,8 @@ public class JavaFileHighlighter extends SyntaxHighlighterBase {
ourMap1 = new HashMap();
ourMap2 = new HashMap();
- fillMap(ourMap1, JavaTokenType.KEYWORD_BIT_SET, SyntaxHighlighterColors.KEYWORD);
- fillMap(ourMap1, JavaTokenType.OPERATION_BIT_SET, SyntaxHighlighterColors.OPERATION_SIGN);
- fillMap(ourMap1, JavaTokenType.OPERATION_BIT_SET, SyntaxHighlighterColors.OPERATION_SIGN);
+ fillMap(ourMap1, ElementType.KEYWORD_BIT_SET, SyntaxHighlighterColors.KEYWORD);
+ fillMap(ourMap1, ElementType.OPERATION_BIT_SET, SyntaxHighlighterColors.OPERATION_SIGN);
for (IElementType type : JavaDocTokenType.ALL_JAVADOC_TOKENS.getTypes()) {
ourMap1.put(type, SyntaxHighlighterColors.DOC_COMMENT);
@@ -86,12 +87,10 @@ public class JavaFileHighlighter extends SyntaxHighlighterBase {
ourMap1.put(JavaTokenType.DOT, SyntaxHighlighterColors.DOT);
ourMap1.put(JavaTokenType.SEMICOLON, SyntaxHighlighterColors.JAVA_SEMICOLON);
- //ourMap1[JavaTokenType.BOOLEAN_LITERAL] = HighlighterColors.JAVA_KEYWORD;
- //ourMap1[JavaTokenType.NULL_LITERAL] = HighlighterColors.JAVA_KEYWORD;
ourMap1.put(JavaTokenType.C_STYLE_COMMENT, SyntaxHighlighterColors.JAVA_BLOCK_COMMENT);
ourMap1.put(JavaDocElementType.DOC_COMMENT, SyntaxHighlighterColors.DOC_COMMENT);
ourMap1.put(JavaTokenType.END_OF_LINE_COMMENT, SyntaxHighlighterColors.LINE_COMMENT);
- ourMap1.put(JavaTokenType.BAD_CHARACTER, HighlighterColors.BAD_CHARACTER);
+ ourMap1.put(TokenType.BAD_CHARACTER, HighlighterColors.BAD_CHARACTER);
ourMap1.put(JavaDocTokenType.DOC_TAG_NAME, SyntaxHighlighterColors.DOC_COMMENT);
ourMap2.put(JavaDocTokenType.DOC_TAG_NAME, SyntaxHighlighterColors.DOC_COMMENT_TAG);
diff --git a/java/java-impl/src/com/intellij/psi/impl/cache/impl/idCache/JavaFilterLexer.java b/java/java-impl/src/com/intellij/psi/impl/cache/impl/idCache/JavaFilterLexer.java
index 4ecc16fc6986..44207d32b640 100644
--- a/java/java-impl/src/com/intellij/psi/impl/cache/impl/idCache/JavaFilterLexer.java
+++ b/java/java-impl/src/com/intellij/psi/impl/cache/impl/idCache/JavaFilterLexer.java
@@ -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.
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.cache.impl.idCache;
import com.intellij.lexer.Lexer;
import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.TokenType;
import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
import com.intellij.psi.impl.source.tree.ElementType;
@@ -30,7 +31,7 @@ import com.intellij.psi.tree.TokenSet;
public class JavaFilterLexer extends BaseFilterLexer {
private static final TokenSet ourSkipWordsScanSet = TokenSet.orSet(
TokenSet.create(
- JavaTokenType.WHITE_SPACE,
+ TokenType.WHITE_SPACE,
JavaTokenType.LPARENTH,
JavaTokenType.RPARENTH,
JavaTokenType.LBRACE,
@@ -43,7 +44,7 @@ public class JavaFilterLexer extends BaseFilterLexer {
JavaTokenType.ELLIPSIS,
JavaTokenType.AT
),
- JavaTokenType.OPERATION_BIT_SET
+ ElementType.OPERATION_BIT_SET
);
public JavaFilterLexer(final Lexer originalLexer, final OccurrenceConsumer table) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
index c5124896d19b..6011081b0051 100644
--- a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
+++ b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
@@ -26,7 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JspPsiUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
-import com.intellij.psi.impl.cache.impl.id.IdTableBuilding;
+import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
import com.intellij.psi.impl.source.tree.StdTokenSets;
import com.intellij.psi.jsp.JspFile;
import com.intellij.psi.jsp.JspTokenType;
@@ -47,7 +47,7 @@ public class JspIndexPatternBuilder implements IndexPatternBuilder {
boolean alreadyInitializedHighlighter = false;
if ((cachedEditorHighlighter = EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document)) != null &&
- IdTableBuilding.checkCanUseCachedEditorHighlighter(file.getText(), cachedEditorHighlighter)) {
+ PlatformIdTableBuilding.checkCanUseCachedEditorHighlighter(file.getText(), cachedEditorHighlighter)) {
highlighter = cachedEditorHighlighter;
alreadyInitializedHighlighter = true;
}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
index ed7ec70859e1..76ac3ac6a49b 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
@@ -1,1061 +1,1039 @@
-/*
- * Copyright 2000-2011 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @author max
- */
-package com.intellij.psi.impl.source.codeStyle;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.util.text.StringUtilRt;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.*;
-import com.intellij.psi.impl.CheckUtil;
-import com.intellij.psi.impl.source.SourceTreeToPsiMap;
-import com.intellij.psi.impl.source.jsp.jspJava.JspxImportStatement;
-import com.intellij.psi.impl.source.tree.TreeElement;
-import com.intellij.psi.statistics.JavaStatisticsManager;
-import com.intellij.psi.util.*;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashSet;
-import gnu.trove.TObjectHashingStrategy;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.beans.Introspector;
-import java.util.*;
-
-public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
- private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.codeStyle.JavaCodeStyleManagerImpl");
-
- @NonNls private static final String IMPL_TYPNAME_SUFFIX = "Impl";
- @NonNls private static final String GET_PREFIX = "get";
- @NonNls private static final String IS_PREFIX = "is";
- @NonNls private static final String FIND_PREFIX = "find";
- @NonNls private static final String CREATE_PREFIX = "create";
- @NonNls private static final String WITH_PREFIX = "with";
- @NonNls private static final String SET_PREFIX = "set";
-
- private final Project myProject;
-
- public JavaCodeStyleManagerImpl(final Project project) {
- myProject = project;
- }
-
- @Override
- public PsiElement shortenClassReferences(@NotNull PsiElement element) throws IncorrectOperationException {
- return shortenClassReferences(element, 0);
- }
-
- @Override
- public PsiElement shortenClassReferences(@NotNull PsiElement element, int flags) throws IncorrectOperationException {
- CheckUtil.checkWritable(element);
- if (!SourceTreeToPsiMap.hasTreeElement(element)) return element;
-
- return SourceTreeToPsiMap.treeElementToPsi(
- new ReferenceAdjuster(myProject).process((TreeElement)element.getNode(), (flags & DO_NOT_ADD_IMPORTS) == 0,
- (flags & UNCOMPLETE_CODE) != 0));
- }
-
- @Override
- public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset)
- throws IncorrectOperationException {
- CheckUtil.checkWritable(element);
- if (SourceTreeToPsiMap.hasTreeElement(element)) {
- new ReferenceAdjuster(myProject).processRange((TreeElement)element.getNode(), startOffset, endOffset);
- }
- }
-
- @Override
- public PsiElement qualifyClassReferences(@NotNull PsiElement element) {
- return SourceTreeToPsiMap.treeElementToPsi(new ReferenceAdjuster(true, true).process((TreeElement)element.getNode(), false, false));
- }
-
- @Override
- public void optimizeImports(@NotNull PsiFile file) throws IncorrectOperationException {
- CheckUtil.checkWritable(file);
- if (file instanceof PsiJavaFile) {
- PsiImportList newList = prepareOptimizeImportsResult((PsiJavaFile)file);
- if (newList != null) {
- final PsiImportList importList = ((PsiJavaFile)file).getImportList();
- if (importList != null) {
- importList.replace(newList);
- }
- }
- }
- }
-
- @Override
- public PsiImportList prepareOptimizeImportsResult(@NotNull PsiJavaFile file) {
- return new ImportHelper(getSettings()).prepareOptimizeImportsResult(file);
- }
-
- @Override
- public boolean addImport(@NotNull PsiJavaFile file, @NotNull PsiClass refClass) {
- return new ImportHelper(getSettings()).addImport(file, refClass);
- }
-
- @Override
- public void removeRedundantImports(@NotNull final PsiJavaFile file) throws IncorrectOperationException {
- final Collection redundants = findRedundantImports(file);
- if (redundants == null) return;
-
- for (final PsiImportStatementBase importStatement : redundants) {
- final PsiJavaCodeReferenceElement ref = importStatement.getImportReference();
- //Do not remove non-resolving refs
- if (ref == null || ref.resolve() == null) {
- continue;
- }
-
- importStatement.delete();
- }
- }
-
- @Override
- @Nullable
- public Collection findRedundantImports(final PsiJavaFile file) {
- final PsiImportList importList = file.getImportList();
- if (importList == null) return null;
- final PsiImportStatementBase[] imports = importList.getAllImportStatements();
- if( imports.length == 0 ) return null;
-
- Set allImports = new THashSet(Arrays.asList(imports));
- final Collection redundants;
- if (JspPsiUtil.isInJspFile(file)) {
- // remove only duplicate imports
- redundants = new THashSet(TObjectHashingStrategy.IDENTITY);
- ContainerUtil.addAll(redundants, imports);
- redundants.removeAll(allImports);
- for (PsiImportStatementBase importStatement : imports) {
- if (importStatement instanceof JspxImportStatement && ((JspxImportStatement)importStatement).isForeignFileImport()) {
- redundants.remove(importStatement);
- }
- }
- }
- else {
- redundants = allImports;
- final List roots = file.getViewProvider().getAllFiles();
- for (PsiElement root : roots) {
- root.accept(new JavaRecursiveElementWalkingVisitor() {
- @Override public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
- if (!reference.isQualified()) {
- final JavaResolveResult resolveResult = reference.advancedResolve(false);
- if (!inTheSamePackage(file, resolveResult.getElement())) {
- final PsiElement resolveScope = resolveResult.getCurrentFileResolveScope();
- if (resolveScope instanceof PsiImportStatementBase) {
- final PsiImportStatementBase importStatementBase = (PsiImportStatementBase)resolveScope;
- redundants.remove(importStatementBase);
- }
- }
- }
- super.visitReferenceElement(reference);
- }
-
- private boolean inTheSamePackage(PsiJavaFile file, PsiElement element) {
- if (element instanceof PsiClass && ((PsiClass)element).getContainingClass() == null) {
- final PsiFile containingFile = element.getContainingFile();
- if (containingFile instanceof PsiJavaFile) {
- return Comparing.strEqual(file.getPackageName(), ((PsiJavaFile)containingFile).getPackageName());
- }
- }
- return false;
- }
- });
- }
- }
- return redundants;
- }
-
- @Override
- public int findEntryIndex(@NotNull PsiImportStatementBase statement) {
- return new ImportHelper(getSettings()).findEntryIndex(statement);
- }
-
- @Override
- public VariableKind getVariableKind(@NotNull PsiVariable variable) {
- if (variable instanceof PsiField) {
- if (variable.hasModifierProperty(PsiModifier.STATIC)) {
- if (variable.hasModifierProperty(PsiModifier.FINAL)) {
- return VariableKind.STATIC_FINAL_FIELD;
- }
- return VariableKind.STATIC_FIELD;
- }
- return VariableKind.FIELD;
- }
- else {
- if (variable instanceof PsiParameter) {
- if (((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement) {
- return VariableKind.LOCAL_VARIABLE;
- }
- return VariableKind.PARAMETER;
- }
- return VariableKind.LOCAL_VARIABLE;
- }
- }
-
- @Override
- public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
- @Nullable final String propertyName,
- @Nullable final PsiExpression expr,
- @Nullable PsiType type,
- final boolean correctKeywords) {
- LinkedHashSet names = new LinkedHashSet();
-
- if (expr != null && type == null) {
- type = expr.getType();
- }
-
- if (propertyName != null) {
- String[] namesByName = getSuggestionsByName(propertyName, kind, false, correctKeywords);
- sortVariableNameSuggestions(namesByName, kind, propertyName, null);
- ContainerUtil.addAll(names, namesByName);
- }
-
- final NamesByExprInfo namesByExpr;
- if (expr != null) {
- namesByExpr = suggestVariableNameByExpression(expr, kind, correctKeywords);
- if (namesByExpr.propertyName != null) {
- sortVariableNameSuggestions(namesByExpr.names, kind, namesByExpr.propertyName, null);
- }
- ContainerUtil.addAll(names, namesByExpr.names);
- }
- else {
- namesByExpr = null;
- }
-
- if (type != null) {
- String[] namesByType = suggestVariableNameByType(type, kind, correctKeywords);
- sortVariableNameSuggestions(namesByType, kind, null, type);
- ContainerUtil.addAll(names, namesByType);
- }
-
- final String _propertyName;
- if (propertyName != null) {
- _propertyName = propertyName;
- }
- else {
- _propertyName = namesByExpr != null ? namesByExpr.propertyName : null;
- }
-
- addNamesFromStatistics(names, kind, _propertyName, type);
-
- String[] namesArray = ArrayUtil.toStringArray(names);
- sortVariableNameSuggestions(namesArray, kind, _propertyName, type);
-
- final PsiType _type = type;
- return new SuggestedNameInfo(namesArray) {
- @Override
- public void nameChoosen(String name) {
- if (_propertyName != null || _type != null && _type.isValid()) {
- JavaStatisticsManager.incVariableNameUseCount(name, kind, _propertyName, _type);
- }
- }
- };
- }
-
- private static void addNamesFromStatistics(Set names, VariableKind variableKind, @Nullable String propertyName, @Nullable PsiType type) {
- String[] allNames = JavaStatisticsManager.getAllVariableNamesUsed(variableKind, propertyName, type);
-
- int maxFrequency = 0;
- for (String name : allNames) {
- int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
- maxFrequency = Math.max(maxFrequency, count);
- }
-
- int frequencyLimit = Math.max(5, maxFrequency / 2);
-
- for (String name : allNames) {
- if( names.contains( name ) )
- {
- continue;
- }
- int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
- if (LOG.isDebugEnabled()) {
- LOG.debug("new name:" + name + " count:" + count);
- LOG.debug("frequencyLimit:" + frequencyLimit);
- }
- if (count >= frequencyLimit) {
- names.add(name);
- }
- }
-
- if (propertyName != null && type != null) {
- addNamesFromStatistics(names, variableKind, propertyName, null);
- addNamesFromStatistics(names, variableKind, null, type);
- }
- }
-
- private String[] suggestVariableNameByType(PsiType type, final VariableKind variableKind, boolean correctKeywords) {
- String longTypeName = getLongTypeName(type);
- CodeStyleSettings.TypeToNameMap map = getMapByVariableKind(variableKind);
- if (map != null && longTypeName != null) {
- if (type.equals(PsiType.NULL)) {
- longTypeName = CommonClassNames.JAVA_LANG_OBJECT;
- }
- String name = map.nameByType(longTypeName);
- if (name != null && isIdentifier(name)) {
- return new String[]{name};
- }
- }
-
- Collection suggestions = new LinkedHashSet();
-
- suggestNamesForCollectionInheritors(type, variableKind, suggestions, correctKeywords);
- suggestNamesFromGenericParameters(type, variableKind, suggestions, correctKeywords);
-
- String typeName = normalizeTypeName(getTypeName(type));
- if (typeName != null) {
- ContainerUtil.addAll(suggestions, getSuggestionsByName(typeName, variableKind, type instanceof PsiArrayType, correctKeywords));
- }
-
- return ArrayUtil.toStringArray(suggestions);
- }
-
- private void suggestNamesFromGenericParameters(final PsiType type,
- final VariableKind variableKind,
- final Collection suggestions, boolean correctKeywords) {
- if (!(type instanceof PsiClassType)) {
- return;
- }
- StringBuilder fullNameBuilder = new StringBuilder();
- final PsiType[] parameters = ((PsiClassType)type).getParameters();
- for (PsiType parameter : parameters) {
- if (parameter instanceof PsiClassType) {
- final String typeName = normalizeTypeName(getTypeName(parameter));
- if (typeName != null) {
- fullNameBuilder.append(typeName);
- }
- }
- }
- String baseName = normalizeTypeName(getTypeName(type));
- if (baseName != null) {
- fullNameBuilder.append(baseName);
- ContainerUtil.addAll(suggestions, getSuggestionsByName(fullNameBuilder.toString(), variableKind, false, correctKeywords));
- }
- }
-
- private void suggestNamesForCollectionInheritors(final PsiType type,
- final VariableKind variableKind,
- Collection suggestions, boolean correctKeywords) {
- PsiType componentType = PsiUtil.extractIterableTypeParameter(type, false);
- if( componentType == null ) {
- return;
- }
- String typeName = normalizeTypeName(getTypeName(componentType));
- if (typeName != null) {
- ContainerUtil.addAll(suggestions, getSuggestionsByName(typeName, variableKind, true, correctKeywords));
- }
- }
-
- @Nullable
- private static String normalizeTypeName(String typeName) {
- if( typeName == null )
- {
- return null;
- }
- if (typeName.endsWith(IMPL_TYPNAME_SUFFIX) && typeName.length() > IMPL_TYPNAME_SUFFIX.length()) {
- return typeName.substring(0, typeName.length() - IMPL_TYPNAME_SUFFIX.length());
- }
- return typeName;
- }
-
- @Nullable
- private static String getTypeName(PsiType type) {
- type = type.getDeepComponentType();
- if (type instanceof PsiClassType) {
- final PsiClassType classType = (PsiClassType)type;
- final String className = classType.getClassName();
- if (className != null) {
- return className;
- }
- else {
- final PsiClass aClass = classType.resolve();
- if (aClass instanceof PsiAnonymousClass) {
- return ((PsiAnonymousClass)aClass).getBaseClassType().getClassName();
- }
- else {
- return null;
- }
- }
- }
- else {
- if (type instanceof PsiPrimitiveType) {
- return type.getPresentableText();
- }
- else {
- if (type instanceof PsiWildcardType) {
- return getTypeName(((PsiWildcardType)type).getExtendsBound());
- }
- else {
- if (type instanceof PsiIntersectionType) {
- return getTypeName(((PsiIntersectionType)type).getRepresentative());
- }
- else {
- if (type instanceof PsiCapturedWildcardType) {
- return getTypeName(((PsiCapturedWildcardType)type).getWildcard());
- }
- else {
- if (type instanceof PsiDisjunctionType) {
- return getTypeName(((PsiDisjunctionType)type).getLeastUpperBound());
- }
- else {
- LOG.error("Unknown type:" + type);
- return null;
- }
- }
- }
- }
- }
- }
- }
-
- @Nullable
- private static String getLongTypeName(PsiType type) {
- if (type instanceof PsiClassType) {
- PsiClass aClass = ((PsiClassType)type).resolve();
- if( aClass == null )
- {
- return null;
- }
- if (aClass instanceof PsiAnonymousClass) {
- PsiClass baseClass = ((PsiAnonymousClass)aClass).getBaseClassType().resolve();
- if( baseClass == null )
- {
- return null;
- }
- return baseClass.getQualifiedName();
- }
- return aClass.getQualifiedName();
- }
- else {
- if (type instanceof PsiArrayType) {
- return getLongTypeName(((PsiArrayType)type).getComponentType()) + "[]";
- }
- else {
- if (type instanceof PsiPrimitiveType) {
- return type.getPresentableText();
- }
- else {
- if (type instanceof PsiWildcardType) {
- final PsiType bound = ((PsiWildcardType)type).getBound();
- if (bound != null) {
- return getLongTypeName(bound);
- }
- else {
- return "java.lang.Object";
- }
- }
- else {
- if (type instanceof PsiCapturedWildcardType) {
- final PsiType bound = ((PsiCapturedWildcardType)type).getWildcard().getBound();
- if (bound != null) {
- return getLongTypeName(bound);
- }
- else {
- return "java.lang.Object";
- }
- }
- else {
- if (type instanceof PsiIntersectionType) {
- return getLongTypeName(((PsiIntersectionType)type).getRepresentative());
- }
- else {
- if (type instanceof PsiDisjunctionType) {
- return getLongTypeName(((PsiDisjunctionType)type).getLeastUpperBound());
- }
- else {
- LOG.error("Unknown type:" + type);
- return null;
- }
- }
- }
- }
- }
- }
- }
- }
-
- private static class NamesByExprInfo {
- final String[] names;
- final String propertyName;
-
- public NamesByExprInfo(String propertyName, String... names) {
- this.names = names;
- this.propertyName = propertyName;
- }
- }
-
- private NamesByExprInfo suggestVariableNameByExpression(PsiExpression expr, VariableKind variableKind, boolean correctKeywords) {
- final NamesByExprInfo names1 = suggestVariableNameByExpressionOnly(expr, variableKind, correctKeywords);
- final NamesByExprInfo names2 = suggestVariableNameByExpressionPlace(expr, variableKind, correctKeywords);
-
- PsiType type = expr.getType();
- final String[] names3;
- if (type != null) {
- names3 = suggestVariableNameByType(type, variableKind, correctKeywords);
- }
- else {
- names3 = null;
- }
-
- final LinkedHashSet names = new LinkedHashSet();
- final String[] fromLiterals = suggestVariableNameFromLiterals(expr, variableKind, correctKeywords);
- if (fromLiterals != null) {
- ContainerUtil.addAll(names, fromLiterals);
- }
- ContainerUtil.addAll(names, names1.names);
- ContainerUtil.addAll(names, names2.names);
- if (names3 != null) {
- ContainerUtil.addAll(names, names3);
- }
-
- String[] namesArray = ArrayUtil.toStringArray(names);
- String propertyName = names1.propertyName != null ? names1.propertyName : names2.propertyName;
- return new NamesByExprInfo(propertyName, namesArray);
- }
-
- @Nullable
- private String[] suggestVariableNameFromLiterals(PsiExpression expr, VariableKind variableKind, boolean correctKeywords) {
- final PsiElement[] literals = PsiTreeUtil.collectElements(expr, new PsiElementFilter() {
- @Override
- public boolean isAccepted(PsiElement element) {
- if (isStringPsiLiteral(element) && StringUtil.isJavaIdentifier(StringUtil.unquoteString(element.getText()))) {
- final PsiElement exprList = element.getParent();
- if (exprList instanceof PsiExpressionList) {
- final PsiElement call = exprList.getParent();
- if (call instanceof PsiNewExpression) {
- return true;
- } else if (call instanceof PsiMethodCallExpression) {
- //TODO: exclude or not getA().getB("name").getC(); or getA(getB("name").getC()); It works fine for now in the most cases
- return true;
- }
- }
- }
- return false;
- }
- });
-
- if (literals.length == 1) {
- final String text = StringUtil.unquoteString(literals[0].getText());
- return getSuggestionsByName(text, variableKind, expr.getType() instanceof PsiArrayType, correctKeywords);
- }
- return null;
- }
-
- private NamesByExprInfo suggestVariableNameByExpressionOnly(PsiExpression expr, final VariableKind variableKind, boolean correctKeywords) {
- if (expr instanceof PsiMethodCallExpression) {
- PsiReferenceExpression methodExpr = ((PsiMethodCallExpression)expr).getMethodExpression();
- String methodName = methodExpr.getReferenceName();
- if (methodName != null) {
- String[] words = NameUtil.nameToWords(methodName);
- if (words.length > 0) {
- final String firstWord = words[0];
- if (GET_PREFIX.equals(firstWord)
- || IS_PREFIX.equals(firstWord)
- || FIND_PREFIX.equals(firstWord)
- || CREATE_PREFIX.equals(firstWord)) {
- if (words.length > 1) {
- final String propertyName = methodName.substring(firstWord.length());
- String[] names = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
- final PsiExpression qualifierExpression = methodExpr.getQualifierExpression();
- if (qualifierExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifierExpression).resolve() instanceof PsiVariable) {
- names = ArrayUtil.append(names, StringUtil.sanitizeJavaIdentifier(changeIfNotIdentifier(qualifierExpression.getText() + StringUtil.capitalize(propertyName))));
- }
- return new NamesByExprInfo(propertyName, names);
- }
- }
- else if (words.length == 1) {
- return new NamesByExprInfo(methodName, getSuggestionsByName(methodName, variableKind, false, correctKeywords));
- }
- }
- }
- }
- else if (expr instanceof PsiReferenceExpression) {
- String propertyName = ((PsiReferenceExpression)expr).getReferenceName();
- PsiElement refElement = ((PsiReferenceExpression)expr).resolve();
- if (refElement instanceof PsiVariable) {
- VariableKind refVariableKind = getVariableKind((PsiVariable)refElement);
- propertyName = variableNameToPropertyName(propertyName, refVariableKind);
- }
- if (refElement != null && propertyName != null) {
- String[] names = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
- return new NamesByExprInfo(propertyName, names);
- }
- }
- else if (expr instanceof PsiArrayAccessExpression) {
- PsiExpression arrayExpr = ((PsiArrayAccessExpression)expr).getArrayExpression();
- if (arrayExpr instanceof PsiReferenceExpression) {
- String arrayName = ((PsiReferenceExpression)arrayExpr).getReferenceName();
- PsiElement refElement = ((PsiReferenceExpression)arrayExpr).resolve();
- if (refElement instanceof PsiVariable) {
- VariableKind refVariableKind = getVariableKind((PsiVariable)refElement);
- arrayName = variableNameToPropertyName(arrayName, refVariableKind);
- }
-
- if (arrayName != null) {
- String name = StringUtil.unpluralize(arrayName);
- if (name != null) {
- String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
- return new NamesByExprInfo(name, names);
- }
- }
- }
- }
- else if (expr instanceof PsiLiteralExpression && variableKind == VariableKind.STATIC_FINAL_FIELD) {
- final PsiLiteralExpression literalExpression = (PsiLiteralExpression)expr;
- final Object value = literalExpression.getValue();
- if (value instanceof String) {
- final String stringValue = (String)value;
- String[] names = getSuggestionsByValue(stringValue);
- if (names.length > 0) {
- return new NamesByExprInfo(null, constantValueToConstantName(names));
- }
- }
- } else if (expr instanceof PsiParenthesizedExpression) {
- return suggestVariableNameByExpressionOnly(((PsiParenthesizedExpression)expr).getExpression(), variableKind, correctKeywords);
- } else if (expr instanceof PsiTypeCastExpression) {
- return suggestVariableNameByExpressionOnly(((PsiTypeCastExpression)expr).getOperand(), variableKind, correctKeywords);
- } else if (expr instanceof PsiLiteralExpression) {
- final String text = StringUtil.stripQuotesAroundValue(expr.getText());
- if (isIdentifier(text)) {
- return new NamesByExprInfo(text, getSuggestionsByName(text, variableKind, false, correctKeywords));
- }
- }
-
- return new NamesByExprInfo(null, ArrayUtil.EMPTY_STRING_ARRAY);
- }
-
- private static String constantValueToConstantName(final String[] names) {
- final StringBuilder result = new StringBuilder();
- for (int i = 0; i < names.length; i++) {
- if (i > 0) result.append("_");
- result.append(names[i]);
- }
- return result.toString();
- }
-
- private static String[] getSuggestionsByValue(final String stringValue) {
- List result = new ArrayList();
- StringBuffer currentWord = new StringBuffer();
-
- boolean prevIsUpperCase = false;
-
- for (int i = 0; i < stringValue.length(); i++) {
- final char c = stringValue.charAt(i);
- if (Character.isUpperCase(c)) {
- if (currentWord.length() > 0 && !prevIsUpperCase) {
- result.add(currentWord.toString());
- currentWord = new StringBuffer();
- }
- currentWord.append(c);
- } else if (Character.isLowerCase(c)) {
- currentWord.append(Character.toUpperCase(c));
- } else if (Character.isJavaIdentifierPart(c) && c != '_') {
- if (Character.isJavaIdentifierStart(c) || currentWord.length() > 0 || !result.isEmpty()) {
- currentWord.append(c);
- }
- } else {
- if (currentWord.length() > 0) {
- result.add(currentWord.toString());
- currentWord = new StringBuffer();
- }
- }
-
- prevIsUpperCase = Character.isUpperCase(c);
- }
-
- if (currentWord.length() > 0) {
- result.add(currentWord.toString());
- }
- return ArrayUtil.toStringArray(result);
- }
-
- private NamesByExprInfo suggestVariableNameByExpressionPlace(PsiExpression expr, final VariableKind variableKind, boolean correctKeywords) {
- if (expr.getParent() instanceof PsiExpressionList) {
- PsiExpressionList list = (PsiExpressionList)expr.getParent();
- PsiElement listParent = list.getParent();
- PsiSubstitutor subst = PsiSubstitutor.EMPTY;
- PsiMethod method = null;
- if (listParent instanceof PsiMethodCallExpression) {
- final JavaResolveResult resolveResult = ((PsiMethodCallExpression)listParent).getMethodExpression().advancedResolve(false);
- method = (PsiMethod)resolveResult.getElement();
- subst = resolveResult.getSubstitutor();
- }
- else {
- if (listParent instanceof PsiAnonymousClass) {
- listParent = listParent.getParent();
- }
- if (listParent instanceof PsiNewExpression) {
- method = ((PsiNewExpression)listParent).resolveConstructor();
- }
- }
-
- if (method != null) {
- final PsiElement navElement = method.getNavigationElement();
- if (navElement instanceof PsiMethod) {
- method = (PsiMethod)navElement;
- }
- PsiExpression[] expressions = list.getExpressions();
- int index = -1;
- for (int i = 0; i < expressions.length; i++) {
- if (expressions[i] == expr) {
- index = i;
- break;
- }
- }
- PsiParameter[] parms = method.getParameterList().getParameters();
- if (index < parms.length) {
- String name = parms[index].getName();
- if (name != null && TypeConversionUtil.areTypesAssignmentCompatible(subst.substitute(parms[index].getType()), expr)) {
- name = variableNameToPropertyName(name, VariableKind.PARAMETER);
- String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
- if (expressions.length == 1) {
- final String methodName = method.getName();
- String[] words = NameUtil.nameToWords(methodName);
- if (words.length > 0) {
- final String firstWord = words[0];
- if (SET_PREFIX.equals(firstWord)) {
- final String propertyName = methodName.substring(firstWord.length());
- final String[] setterNames = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
- names = ArrayUtil.mergeArrays(names, setterNames);
- }
- }
- }
- return new NamesByExprInfo(name, names);
- }
- }
- }
- }
- else if (expr.getParent() instanceof PsiAssignmentExpression && variableKind == VariableKind.PARAMETER) {
- final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expr.getParent();
- if (expr == assignmentExpression.getRExpression()) {
- final PsiExpression leftExpression = assignmentExpression.getLExpression();
- if (leftExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression) leftExpression).getQualifier() == null) {
- String name = leftExpression.getText();
- if (name != null) {
- final PsiElement resolve = ((PsiReferenceExpression)leftExpression).resolve();
- if (resolve instanceof PsiVariable) {
- name = variableNameToPropertyName(name, getVariableKind((PsiVariable)resolve));
- }
- String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
- return new NamesByExprInfo(name, names);
- }
- }
- }
- }
-
- return new NamesByExprInfo(null, ArrayUtil.EMPTY_STRING_ARRAY);
- }
-
- @Override
- public String variableNameToPropertyName(String name, VariableKind variableKind) {
- if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
- StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < name.length(); i++) {
- char c = name.charAt(i);
- if (c != '_') {
- if( Character.isLowerCase( c ) )
- {
- return variableNameToPropertyNameInner( name, variableKind );
- }
-
- buffer.append(Character.toLowerCase(c));
- continue;
- }
- i++;
- if (i < name.length()) {
- c = name.charAt(i);
- buffer.append(c);
- }
- }
- return buffer.toString();
- }
-
- return variableNameToPropertyNameInner(name, variableKind);
- }
-
- private String variableNameToPropertyNameInner(String name, VariableKind variableKind) {
- String prefix = getPrefixByVariableKind(variableKind);
- String suffix = getSuffixByVariableKind(variableKind);
- boolean doDecapitalize = false;
-
- if (name.startsWith(prefix) && name.length() > prefix.length()) {
- name = name.substring(prefix.length());
- doDecapitalize = true;
- }
-
- if (name.endsWith(suffix) && name.length() > suffix.length()) {
- name = name.substring(0, name.length() - suffix.length());
- doDecapitalize = true;
- }
-
- if (name.startsWith(IS_PREFIX) && name.length() > IS_PREFIX.length() && Character.isUpperCase(name.charAt(IS_PREFIX.length()))) {
- name = name.substring(IS_PREFIX.length());
- doDecapitalize = true;
- }
-
- if (doDecapitalize) {
- name = Introspector.decapitalize(name);
- }
-
- return name;
- }
-
- @Override
- public String propertyNameToVariableName(String propertyName, VariableKind variableKind) {
- if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
- String[] words = NameUtil.nameToWords(propertyName);
- StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < words.length; i++) {
- String word = words[i];
- if (i > 0) {
- buffer.append("_");
- }
- buffer.append(StringUtilRt.toUpperCase(word));
- }
- return buffer.toString();
- }
-
- String prefix = getPrefixByVariableKind(variableKind);
- String name = propertyName;
- if (name.length() > 0 && prefix.length() > 0 && !StringUtil.endsWithChar(prefix, '_')) {
- name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- }
- name = prefix + name + getSuffixByVariableKind(variableKind);
- name = changeIfNotIdentifier(name);
- return name;
- }
-
- private String[] getSuggestionsByName(String name, VariableKind variableKind, boolean isArray, boolean correctKeywords) {
- boolean upperCaseStyle = variableKind == VariableKind.STATIC_FINAL_FIELD;
- boolean preferLongerNames = getSettings().PREFER_LONGER_NAMES;
- String prefix = getPrefixByVariableKind(variableKind);
- String suffix = getSuffixByVariableKind(variableKind);
-
- List answer = new ArrayList();
- for (String suggestion : NameUtil.getSuggestionsByName(name, prefix, suffix, upperCaseStyle, preferLongerNames, isArray)) {
- answer.add(correctKeywords ? changeIfNotIdentifier(suggestion) : suggestion);
- }
-
- return ArrayUtil.toStringArray(answer);
- }
-
- @Override
- public String suggestUniqueVariableName(String baseName, PsiElement place, boolean lookForward) {
- int index = 0;
- PsiElement scope = PsiTreeUtil.getNonStrictParentOfType(place, PsiStatement.class, PsiCodeBlock.class, PsiMethod.class);
- NextName:
- while (true) {
- String name = baseName;
- if (index > 0) {
- name += index;
- }
- index++;
- if (PsiUtil.isVariableNameUnique(name, place)) {
- if (lookForward) {
- final String name1 = name;
- PsiElement run = scope;
- while (run != null) {
- class CancelException extends RuntimeException {
- }
- try {
- run.accept(new JavaRecursiveElementWalkingVisitor() {
- @Override
- public void visitAnonymousClass(final PsiAnonymousClass aClass) {
- }
-
- @Override public void visitVariable(PsiVariable variable) {
- if (name1.equals(variable.getName())) {
- throw new CancelException();
- }
- }
- });
- }
- catch (CancelException e) {
- continue NextName;
- }
- run = run.getNextSibling();
- if (scope instanceof PsiMethod) {//do not check next member for param name conflict
- break;
- }
- }
-
- }
- return name;
- }
- }
- }
-
- @Override
- @NotNull
- public SuggestedNameInfo suggestUniqueVariableName(@NotNull final SuggestedNameInfo baseNameInfo,
- PsiElement place,
- boolean ignorePlaceName,
- boolean lookForward) {
- final String[] names = baseNameInfo.names;
- final LinkedHashSet uniqueNames = new LinkedHashSet(names.length);
- for (String name : names) {
- if (ignorePlaceName && place instanceof PsiNamedElement) {
- final String placeName = ((PsiNamedElement)place).getName();
- if (Comparing.strEqual(placeName, name)) {
- uniqueNames.add(name);
- continue;
- }
- }
- uniqueNames.add(suggestUniqueVariableName(name, place, lookForward));
- }
-
- return new SuggestedNameInfo(ArrayUtil.toStringArray(uniqueNames)) {
- @Override
- public void nameChoosen(String name) {
- baseNameInfo.nameChoosen(name);
- }
- };
- }
-
- private static void sortVariableNameSuggestions(String[] names,
- final VariableKind variableKind,
- @Nullable final String propertyName,
- @Nullable final PsiType type) {
- if( names.length <= 1 ) {
- return;
- }
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("sorting names:" + variableKind);
- if (propertyName != null) {
- LOG.debug("propertyName:" + propertyName);
- }
- if (type != null) {
- LOG.debug("type:" + type);
- }
- for (String name : names) {
- int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
- LOG.debug(name + " : " + count);
- }
- }
-
- Comparator comparator = new Comparator() {
- @Override
- public int compare(String s1, String s2) {
- int count1 = JavaStatisticsManager.getVariableNameUseCount(s1, variableKind, propertyName, type);
- int count2 = JavaStatisticsManager.getVariableNameUseCount(s2, variableKind, propertyName, type);
- return count2 - count1;
- }
- };
- Arrays.sort(names, comparator);
- }
-
- @Override
- @NotNull
- public String getPrefixByVariableKind(VariableKind variableKind) {
- String prefix = "";
- switch (variableKind) {
- case FIELD:
- prefix = getSettings().FIELD_NAME_PREFIX;
- break;
- case STATIC_FIELD:
- prefix = getSettings().STATIC_FIELD_NAME_PREFIX;
- break;
- case PARAMETER:
- prefix = getSettings().PARAMETER_NAME_PREFIX;
- break;
- case LOCAL_VARIABLE:
- prefix = getSettings().LOCAL_VARIABLE_NAME_PREFIX;
- break;
- case STATIC_FINAL_FIELD:
- prefix = "";
- break;
- default:
- LOG.assertTrue(false);
- break;
- }
- if (prefix == null) {
- prefix = "";
- }
- return prefix;
- }
-
- @Override
- @NotNull
- public String getSuffixByVariableKind(VariableKind variableKind) {
- String suffix = "";
- switch (variableKind) {
- case FIELD:
- suffix = getSettings().FIELD_NAME_SUFFIX;
- break;
- case STATIC_FIELD:
- suffix = getSettings().STATIC_FIELD_NAME_SUFFIX;
- break;
- case PARAMETER:
- suffix = getSettings().PARAMETER_NAME_SUFFIX;
- break;
- case LOCAL_VARIABLE:
- suffix = getSettings().LOCAL_VARIABLE_NAME_SUFFIX;
- break;
- case STATIC_FINAL_FIELD:
- suffix = "";
- break;
- default:
- LOG.assertTrue(false);
- break;
- }
- if (suffix == null) {
- suffix = "";
- }
- return suffix;
- }
-
- @Nullable
- private CodeStyleSettings.TypeToNameMap getMapByVariableKind(VariableKind variableKind) {
- if (variableKind == VariableKind.FIELD) return getSettings().FIELD_TYPE_TO_NAME;
- if (variableKind == VariableKind.STATIC_FIELD) return getSettings().STATIC_FIELD_TYPE_TO_NAME;
- if (variableKind == VariableKind.PARAMETER) return getSettings().PARAMETER_TYPE_TO_NAME;
- if (variableKind == VariableKind.LOCAL_VARIABLE) return getSettings().LOCAL_VARIABLE_TYPE_TO_NAME;
- return null;
- }
-
- @NonNls
- private String changeIfNotIdentifier(String name) {
- if (!isIdentifier(name)) {
- return StringUtil.fixVariableNameDerivedFromPropertyName(name);
- }
- return name;
- }
-
- private boolean isIdentifier(String name) {
- return JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(name, LanguageLevel.HIGHEST);
- }
-
- private CodeStyleSettings getSettings() {
- return CodeStyleSettingsManager.getSettings(myProject);
- }
-
- public static boolean isStringPsiLiteral(PsiElement element) {
- if (element instanceof PsiLiteralExpression) {
- final String text = element.getText();
- return text.length() > 1 && StringUtil.isQuotedString(text);
- }
- return false;
- }
-}
+/*
+ * Copyright 2000-2011 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.source.codeStyle;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.util.text.StringUtilRt;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.*;
+import com.intellij.psi.impl.CheckUtil;
+import com.intellij.psi.impl.source.SourceTreeToPsiMap;
+import com.intellij.psi.impl.source.jsp.jspJava.JspxImportStatement;
+import com.intellij.psi.impl.source.tree.TreeElement;
+import com.intellij.psi.statistics.JavaStatisticsManager;
+import com.intellij.psi.util.*;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.containers.ContainerUtil;
+import gnu.trove.THashSet;
+import gnu.trove.TObjectHashingStrategy;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.beans.Introspector;
+import java.util.*;
+
+public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.codeStyle.JavaCodeStyleManagerImpl");
+
+ @NonNls private static final String IMPL_TYPNAME_SUFFIX = "Impl";
+ @NonNls private static final String GET_PREFIX = "get";
+ @NonNls private static final String IS_PREFIX = "is";
+ @NonNls private static final String FIND_PREFIX = "find";
+ @NonNls private static final String CREATE_PREFIX = "create";
+ @NonNls private static final String WITH_PREFIX = "with";
+ @NonNls private static final String SET_PREFIX = "set";
+
+ private final Project myProject;
+
+ public JavaCodeStyleManagerImpl(final Project project) {
+ myProject = project;
+ }
+
+ @Override
+ public PsiElement shortenClassReferences(@NotNull PsiElement element) throws IncorrectOperationException {
+ return shortenClassReferences(element, 0);
+ }
+
+ @Override
+ public PsiElement shortenClassReferences(@NotNull PsiElement element, int flags) throws IncorrectOperationException {
+ CheckUtil.checkWritable(element);
+ if (!SourceTreeToPsiMap.hasTreeElement(element)) return element;
+
+ return SourceTreeToPsiMap.treeElementToPsi(
+ new ReferenceAdjuster(myProject).process((TreeElement)element.getNode(), (flags & DO_NOT_ADD_IMPORTS) == 0,
+ (flags & UNCOMPLETE_CODE) != 0));
+ }
+
+ @Override
+ public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset)
+ throws IncorrectOperationException {
+ CheckUtil.checkWritable(element);
+ if (SourceTreeToPsiMap.hasTreeElement(element)) {
+ new ReferenceAdjuster(myProject).processRange((TreeElement)element.getNode(), startOffset, endOffset);
+ }
+ }
+
+ @Override
+ public PsiElement qualifyClassReferences(@NotNull PsiElement element) {
+ return SourceTreeToPsiMap.treeElementToPsi(new ReferenceAdjuster(true, true).process((TreeElement)element.getNode(), false, false));
+ }
+
+ @Override
+ public void optimizeImports(@NotNull PsiFile file) throws IncorrectOperationException {
+ CheckUtil.checkWritable(file);
+ if (file instanceof PsiJavaFile) {
+ PsiImportList newList = prepareOptimizeImportsResult((PsiJavaFile)file);
+ if (newList != null) {
+ final PsiImportList importList = ((PsiJavaFile)file).getImportList();
+ if (importList != null) {
+ importList.replace(newList);
+ }
+ }
+ }
+ }
+
+ @Override
+ public PsiImportList prepareOptimizeImportsResult(@NotNull PsiJavaFile file) {
+ return new ImportHelper(getSettings()).prepareOptimizeImportsResult(file);
+ }
+
+ @Override
+ public boolean addImport(@NotNull PsiJavaFile file, @NotNull PsiClass refClass) {
+ return new ImportHelper(getSettings()).addImport(file, refClass);
+ }
+
+ @Override
+ public void removeRedundantImports(@NotNull final PsiJavaFile file) throws IncorrectOperationException {
+ final Collection redundants = findRedundantImports(file);
+ if (redundants == null) return;
+
+ for (final PsiImportStatementBase importStatement : redundants) {
+ final PsiJavaCodeReferenceElement ref = importStatement.getImportReference();
+ //Do not remove non-resolving refs
+ if (ref == null || ref.resolve() == null) {
+ continue;
+ }
+
+ importStatement.delete();
+ }
+ }
+
+ @Override
+ @Nullable
+ public Collection findRedundantImports(final PsiJavaFile file) {
+ final PsiImportList importList = file.getImportList();
+ if (importList == null) return null;
+ final PsiImportStatementBase[] imports = importList.getAllImportStatements();
+ if( imports.length == 0 ) return null;
+
+ Set allImports = new THashSet(Arrays.asList(imports));
+ final Collection redundants;
+ if (JspPsiUtil.isInJspFile(file)) {
+ // remove only duplicate imports
+ redundants = new THashSet(TObjectHashingStrategy.IDENTITY);
+ ContainerUtil.addAll(redundants, imports);
+ redundants.removeAll(allImports);
+ for (PsiImportStatementBase importStatement : imports) {
+ if (importStatement instanceof JspxImportStatement && ((JspxImportStatement)importStatement).isForeignFileImport()) {
+ redundants.remove(importStatement);
+ }
+ }
+ }
+ else {
+ redundants = allImports;
+ final List roots = file.getViewProvider().getAllFiles();
+ for (PsiElement root : roots) {
+ root.accept(new JavaRecursiveElementWalkingVisitor() {
+ @Override public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
+ if (!reference.isQualified()) {
+ final JavaResolveResult resolveResult = reference.advancedResolve(false);
+ if (!inTheSamePackage(file, resolveResult.getElement())) {
+ final PsiElement resolveScope = resolveResult.getCurrentFileResolveScope();
+ if (resolveScope instanceof PsiImportStatementBase) {
+ final PsiImportStatementBase importStatementBase = (PsiImportStatementBase)resolveScope;
+ redundants.remove(importStatementBase);
+ }
+ }
+ }
+ super.visitReferenceElement(reference);
+ }
+
+ private boolean inTheSamePackage(PsiJavaFile file, PsiElement element) {
+ if (element instanceof PsiClass && ((PsiClass)element).getContainingClass() == null) {
+ final PsiFile containingFile = element.getContainingFile();
+ if (containingFile instanceof PsiJavaFile) {
+ return Comparing.strEqual(file.getPackageName(), ((PsiJavaFile)containingFile).getPackageName());
+ }
+ }
+ return false;
+ }
+ });
+ }
+ }
+ return redundants;
+ }
+
+ @Override
+ public int findEntryIndex(@NotNull PsiImportStatementBase statement) {
+ return new ImportHelper(getSettings()).findEntryIndex(statement);
+ }
+
+ @Override
+ public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
+ @Nullable final String propertyName,
+ @Nullable final PsiExpression expr,
+ @Nullable PsiType type,
+ final boolean correctKeywords) {
+ LinkedHashSet names = new LinkedHashSet();
+
+ if (expr != null && type == null) {
+ type = expr.getType();
+ }
+
+ if (propertyName != null) {
+ String[] namesByName = getSuggestionsByName(propertyName, kind, false, correctKeywords);
+ sortVariableNameSuggestions(namesByName, kind, propertyName, null);
+ ContainerUtil.addAll(names, namesByName);
+ }
+
+ final NamesByExprInfo namesByExpr;
+ if (expr != null) {
+ namesByExpr = suggestVariableNameByExpression(expr, kind, correctKeywords);
+ if (namesByExpr.propertyName != null) {
+ sortVariableNameSuggestions(namesByExpr.names, kind, namesByExpr.propertyName, null);
+ }
+ ContainerUtil.addAll(names, namesByExpr.names);
+ }
+ else {
+ namesByExpr = null;
+ }
+
+ if (type != null) {
+ String[] namesByType = suggestVariableNameByType(type, kind, correctKeywords);
+ sortVariableNameSuggestions(namesByType, kind, null, type);
+ ContainerUtil.addAll(names, namesByType);
+ }
+
+ final String _propertyName;
+ if (propertyName != null) {
+ _propertyName = propertyName;
+ }
+ else {
+ _propertyName = namesByExpr != null ? namesByExpr.propertyName : null;
+ }
+
+ addNamesFromStatistics(names, kind, _propertyName, type);
+
+ String[] namesArray = ArrayUtil.toStringArray(names);
+ sortVariableNameSuggestions(namesArray, kind, _propertyName, type);
+
+ final PsiType _type = type;
+ return new SuggestedNameInfo(namesArray) {
+ @Override
+ public void nameChoosen(String name) {
+ if (_propertyName != null || _type != null && _type.isValid()) {
+ JavaStatisticsManager.incVariableNameUseCount(name, kind, _propertyName, _type);
+ }
+ }
+ };
+ }
+
+ private static void addNamesFromStatistics(Set names, VariableKind variableKind, @Nullable String propertyName, @Nullable PsiType type) {
+ String[] allNames = JavaStatisticsManager.getAllVariableNamesUsed(variableKind, propertyName, type);
+
+ int maxFrequency = 0;
+ for (String name : allNames) {
+ int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
+ maxFrequency = Math.max(maxFrequency, count);
+ }
+
+ int frequencyLimit = Math.max(5, maxFrequency / 2);
+
+ for (String name : allNames) {
+ if( names.contains( name ) )
+ {
+ continue;
+ }
+ int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("new name:" + name + " count:" + count);
+ LOG.debug("frequencyLimit:" + frequencyLimit);
+ }
+ if (count >= frequencyLimit) {
+ names.add(name);
+ }
+ }
+
+ if (propertyName != null && type != null) {
+ addNamesFromStatistics(names, variableKind, propertyName, null);
+ addNamesFromStatistics(names, variableKind, null, type);
+ }
+ }
+
+ private String[] suggestVariableNameByType(PsiType type, final VariableKind variableKind, boolean correctKeywords) {
+ String longTypeName = getLongTypeName(type);
+ CodeStyleSettings.TypeToNameMap map = getMapByVariableKind(variableKind);
+ if (map != null && longTypeName != null) {
+ if (type.equals(PsiType.NULL)) {
+ longTypeName = CommonClassNames.JAVA_LANG_OBJECT;
+ }
+ String name = map.nameByType(longTypeName);
+ if (name != null && isIdentifier(name)) {
+ return new String[]{name};
+ }
+ }
+
+ Collection suggestions = new LinkedHashSet();
+
+ suggestNamesForCollectionInheritors(type, variableKind, suggestions, correctKeywords);
+ suggestNamesFromGenericParameters(type, variableKind, suggestions, correctKeywords);
+
+ String typeName = normalizeTypeName(getTypeName(type));
+ if (typeName != null) {
+ ContainerUtil.addAll(suggestions, getSuggestionsByName(typeName, variableKind, type instanceof PsiArrayType, correctKeywords));
+ }
+
+ return ArrayUtil.toStringArray(suggestions);
+ }
+
+ private void suggestNamesFromGenericParameters(final PsiType type,
+ final VariableKind variableKind,
+ final Collection suggestions, boolean correctKeywords) {
+ if (!(type instanceof PsiClassType)) {
+ return;
+ }
+ StringBuilder fullNameBuilder = new StringBuilder();
+ final PsiType[] parameters = ((PsiClassType)type).getParameters();
+ for (PsiType parameter : parameters) {
+ if (parameter instanceof PsiClassType) {
+ final String typeName = normalizeTypeName(getTypeName(parameter));
+ if (typeName != null) {
+ fullNameBuilder.append(typeName);
+ }
+ }
+ }
+ String baseName = normalizeTypeName(getTypeName(type));
+ if (baseName != null) {
+ fullNameBuilder.append(baseName);
+ ContainerUtil.addAll(suggestions, getSuggestionsByName(fullNameBuilder.toString(), variableKind, false, correctKeywords));
+ }
+ }
+
+ private void suggestNamesForCollectionInheritors(final PsiType type,
+ final VariableKind variableKind,
+ Collection suggestions, boolean correctKeywords) {
+ PsiType componentType = PsiUtil.extractIterableTypeParameter(type, false);
+ if( componentType == null ) {
+ return;
+ }
+ String typeName = normalizeTypeName(getTypeName(componentType));
+ if (typeName != null) {
+ ContainerUtil.addAll(suggestions, getSuggestionsByName(typeName, variableKind, true, correctKeywords));
+ }
+ }
+
+ @Nullable
+ private static String normalizeTypeName(String typeName) {
+ if( typeName == null )
+ {
+ return null;
+ }
+ if (typeName.endsWith(IMPL_TYPNAME_SUFFIX) && typeName.length() > IMPL_TYPNAME_SUFFIX.length()) {
+ return typeName.substring(0, typeName.length() - IMPL_TYPNAME_SUFFIX.length());
+ }
+ return typeName;
+ }
+
+ @Nullable
+ private static String getTypeName(PsiType type) {
+ type = type.getDeepComponentType();
+ if (type instanceof PsiClassType) {
+ final PsiClassType classType = (PsiClassType)type;
+ final String className = classType.getClassName();
+ if (className != null) {
+ return className;
+ }
+ else {
+ final PsiClass aClass = classType.resolve();
+ if (aClass instanceof PsiAnonymousClass) {
+ return ((PsiAnonymousClass)aClass).getBaseClassType().getClassName();
+ }
+ else {
+ return null;
+ }
+ }
+ }
+ else {
+ if (type instanceof PsiPrimitiveType) {
+ return type.getPresentableText();
+ }
+ else {
+ if (type instanceof PsiWildcardType) {
+ return getTypeName(((PsiWildcardType)type).getExtendsBound());
+ }
+ else {
+ if (type instanceof PsiIntersectionType) {
+ return getTypeName(((PsiIntersectionType)type).getRepresentative());
+ }
+ else {
+ if (type instanceof PsiCapturedWildcardType) {
+ return getTypeName(((PsiCapturedWildcardType)type).getWildcard());
+ }
+ else {
+ if (type instanceof PsiDisjunctionType) {
+ return getTypeName(((PsiDisjunctionType)type).getLeastUpperBound());
+ }
+ else {
+ LOG.error("Unknown type:" + type);
+ return null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Nullable
+ private static String getLongTypeName(PsiType type) {
+ if (type instanceof PsiClassType) {
+ PsiClass aClass = ((PsiClassType)type).resolve();
+ if( aClass == null )
+ {
+ return null;
+ }
+ if (aClass instanceof PsiAnonymousClass) {
+ PsiClass baseClass = ((PsiAnonymousClass)aClass).getBaseClassType().resolve();
+ if( baseClass == null )
+ {
+ return null;
+ }
+ return baseClass.getQualifiedName();
+ }
+ return aClass.getQualifiedName();
+ }
+ else {
+ if (type instanceof PsiArrayType) {
+ return getLongTypeName(((PsiArrayType)type).getComponentType()) + "[]";
+ }
+ else {
+ if (type instanceof PsiPrimitiveType) {
+ return type.getPresentableText();
+ }
+ else {
+ if (type instanceof PsiWildcardType) {
+ final PsiType bound = ((PsiWildcardType)type).getBound();
+ if (bound != null) {
+ return getLongTypeName(bound);
+ }
+ else {
+ return "java.lang.Object";
+ }
+ }
+ else {
+ if (type instanceof PsiCapturedWildcardType) {
+ final PsiType bound = ((PsiCapturedWildcardType)type).getWildcard().getBound();
+ if (bound != null) {
+ return getLongTypeName(bound);
+ }
+ else {
+ return "java.lang.Object";
+ }
+ }
+ else {
+ if (type instanceof PsiIntersectionType) {
+ return getLongTypeName(((PsiIntersectionType)type).getRepresentative());
+ }
+ else {
+ if (type instanceof PsiDisjunctionType) {
+ return getLongTypeName(((PsiDisjunctionType)type).getLeastUpperBound());
+ }
+ else {
+ LOG.error("Unknown type:" + type);
+ return null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static class NamesByExprInfo {
+ final String[] names;
+ final String propertyName;
+
+ public NamesByExprInfo(String propertyName, String... names) {
+ this.names = names;
+ this.propertyName = propertyName;
+ }
+ }
+
+ private NamesByExprInfo suggestVariableNameByExpression(PsiExpression expr, VariableKind variableKind, boolean correctKeywords) {
+ final NamesByExprInfo names1 = suggestVariableNameByExpressionOnly(expr, variableKind, correctKeywords);
+ final NamesByExprInfo names2 = suggestVariableNameByExpressionPlace(expr, variableKind, correctKeywords);
+
+ PsiType type = expr.getType();
+ final String[] names3;
+ if (type != null) {
+ names3 = suggestVariableNameByType(type, variableKind, correctKeywords);
+ }
+ else {
+ names3 = null;
+ }
+
+ final LinkedHashSet names = new LinkedHashSet();
+ final String[] fromLiterals = suggestVariableNameFromLiterals(expr, variableKind, correctKeywords);
+ if (fromLiterals != null) {
+ ContainerUtil.addAll(names, fromLiterals);
+ }
+ ContainerUtil.addAll(names, names1.names);
+ ContainerUtil.addAll(names, names2.names);
+ if (names3 != null) {
+ ContainerUtil.addAll(names, names3);
+ }
+
+ String[] namesArray = ArrayUtil.toStringArray(names);
+ String propertyName = names1.propertyName != null ? names1.propertyName : names2.propertyName;
+ return new NamesByExprInfo(propertyName, namesArray);
+ }
+
+ @Nullable
+ private String[] suggestVariableNameFromLiterals(PsiExpression expr, VariableKind variableKind, boolean correctKeywords) {
+ final PsiElement[] literals = PsiTreeUtil.collectElements(expr, new PsiElementFilter() {
+ @Override
+ public boolean isAccepted(PsiElement element) {
+ if (isStringPsiLiteral(element) && StringUtil.isJavaIdentifier(StringUtil.unquoteString(element.getText()))) {
+ final PsiElement exprList = element.getParent();
+ if (exprList instanceof PsiExpressionList) {
+ final PsiElement call = exprList.getParent();
+ if (call instanceof PsiNewExpression) {
+ return true;
+ } else if (call instanceof PsiMethodCallExpression) {
+ //TODO: exclude or not getA().getB("name").getC(); or getA(getB("name").getC()); It works fine for now in the most cases
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ });
+
+ if (literals.length == 1) {
+ final String text = StringUtil.unquoteString(literals[0].getText());
+ return getSuggestionsByName(text, variableKind, expr.getType() instanceof PsiArrayType, correctKeywords);
+ }
+ return null;
+ }
+
+ private NamesByExprInfo suggestVariableNameByExpressionOnly(PsiExpression expr, final VariableKind variableKind, boolean correctKeywords) {
+ if (expr instanceof PsiMethodCallExpression) {
+ PsiReferenceExpression methodExpr = ((PsiMethodCallExpression)expr).getMethodExpression();
+ String methodName = methodExpr.getReferenceName();
+ if (methodName != null) {
+ String[] words = NameUtil.nameToWords(methodName);
+ if (words.length > 0) {
+ final String firstWord = words[0];
+ if (GET_PREFIX.equals(firstWord)
+ || IS_PREFIX.equals(firstWord)
+ || FIND_PREFIX.equals(firstWord)
+ || CREATE_PREFIX.equals(firstWord)) {
+ if (words.length > 1) {
+ final String propertyName = methodName.substring(firstWord.length());
+ String[] names = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
+ final PsiExpression qualifierExpression = methodExpr.getQualifierExpression();
+ if (qualifierExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression)qualifierExpression).resolve() instanceof PsiVariable) {
+ names = ArrayUtil.append(names, StringUtil.sanitizeJavaIdentifier(changeIfNotIdentifier(qualifierExpression.getText() + StringUtil.capitalize(propertyName))));
+ }
+ return new NamesByExprInfo(propertyName, names);
+ }
+ }
+ else if (words.length == 1) {
+ return new NamesByExprInfo(methodName, getSuggestionsByName(methodName, variableKind, false, correctKeywords));
+ }
+ }
+ }
+ }
+ else if (expr instanceof PsiReferenceExpression) {
+ String propertyName = ((PsiReferenceExpression)expr).getReferenceName();
+ PsiElement refElement = ((PsiReferenceExpression)expr).resolve();
+ if (refElement instanceof PsiVariable) {
+ VariableKind refVariableKind = getVariableKind((PsiVariable)refElement);
+ propertyName = variableNameToPropertyName(propertyName, refVariableKind);
+ }
+ if (refElement != null && propertyName != null) {
+ String[] names = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
+ return new NamesByExprInfo(propertyName, names);
+ }
+ }
+ else if (expr instanceof PsiArrayAccessExpression) {
+ PsiExpression arrayExpr = ((PsiArrayAccessExpression)expr).getArrayExpression();
+ if (arrayExpr instanceof PsiReferenceExpression) {
+ String arrayName = ((PsiReferenceExpression)arrayExpr).getReferenceName();
+ PsiElement refElement = ((PsiReferenceExpression)arrayExpr).resolve();
+ if (refElement instanceof PsiVariable) {
+ VariableKind refVariableKind = getVariableKind((PsiVariable)refElement);
+ arrayName = variableNameToPropertyName(arrayName, refVariableKind);
+ }
+
+ if (arrayName != null) {
+ String name = StringUtil.unpluralize(arrayName);
+ if (name != null) {
+ String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
+ return new NamesByExprInfo(name, names);
+ }
+ }
+ }
+ }
+ else if (expr instanceof PsiLiteralExpression && variableKind == VariableKind.STATIC_FINAL_FIELD) {
+ final PsiLiteralExpression literalExpression = (PsiLiteralExpression)expr;
+ final Object value = literalExpression.getValue();
+ if (value instanceof String) {
+ final String stringValue = (String)value;
+ String[] names = getSuggestionsByValue(stringValue);
+ if (names.length > 0) {
+ return new NamesByExprInfo(null, constantValueToConstantName(names));
+ }
+ }
+ } else if (expr instanceof PsiParenthesizedExpression) {
+ return suggestVariableNameByExpressionOnly(((PsiParenthesizedExpression)expr).getExpression(), variableKind, correctKeywords);
+ } else if (expr instanceof PsiTypeCastExpression) {
+ return suggestVariableNameByExpressionOnly(((PsiTypeCastExpression)expr).getOperand(), variableKind, correctKeywords);
+ } else if (expr instanceof PsiLiteralExpression) {
+ final String text = StringUtil.stripQuotesAroundValue(expr.getText());
+ if (isIdentifier(text)) {
+ return new NamesByExprInfo(text, getSuggestionsByName(text, variableKind, false, correctKeywords));
+ }
+ }
+
+ return new NamesByExprInfo(null, ArrayUtil.EMPTY_STRING_ARRAY);
+ }
+
+ private static String constantValueToConstantName(final String[] names) {
+ final StringBuilder result = new StringBuilder();
+ for (int i = 0; i < names.length; i++) {
+ if (i > 0) result.append("_");
+ result.append(names[i]);
+ }
+ return result.toString();
+ }
+
+ private static String[] getSuggestionsByValue(final String stringValue) {
+ List result = new ArrayList();
+ StringBuffer currentWord = new StringBuffer();
+
+ boolean prevIsUpperCase = false;
+
+ for (int i = 0; i < stringValue.length(); i++) {
+ final char c = stringValue.charAt(i);
+ if (Character.isUpperCase(c)) {
+ if (currentWord.length() > 0 && !prevIsUpperCase) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuffer();
+ }
+ currentWord.append(c);
+ } else if (Character.isLowerCase(c)) {
+ currentWord.append(Character.toUpperCase(c));
+ } else if (Character.isJavaIdentifierPart(c) && c != '_') {
+ if (Character.isJavaIdentifierStart(c) || currentWord.length() > 0 || !result.isEmpty()) {
+ currentWord.append(c);
+ }
+ } else {
+ if (currentWord.length() > 0) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuffer();
+ }
+ }
+
+ prevIsUpperCase = Character.isUpperCase(c);
+ }
+
+ if (currentWord.length() > 0) {
+ result.add(currentWord.toString());
+ }
+ return ArrayUtil.toStringArray(result);
+ }
+
+ private NamesByExprInfo suggestVariableNameByExpressionPlace(PsiExpression expr, final VariableKind variableKind, boolean correctKeywords) {
+ if (expr.getParent() instanceof PsiExpressionList) {
+ PsiExpressionList list = (PsiExpressionList)expr.getParent();
+ PsiElement listParent = list.getParent();
+ PsiSubstitutor subst = PsiSubstitutor.EMPTY;
+ PsiMethod method = null;
+ if (listParent instanceof PsiMethodCallExpression) {
+ final JavaResolveResult resolveResult = ((PsiMethodCallExpression)listParent).getMethodExpression().advancedResolve(false);
+ method = (PsiMethod)resolveResult.getElement();
+ subst = resolveResult.getSubstitutor();
+ }
+ else {
+ if (listParent instanceof PsiAnonymousClass) {
+ listParent = listParent.getParent();
+ }
+ if (listParent instanceof PsiNewExpression) {
+ method = ((PsiNewExpression)listParent).resolveConstructor();
+ }
+ }
+
+ if (method != null) {
+ final PsiElement navElement = method.getNavigationElement();
+ if (navElement instanceof PsiMethod) {
+ method = (PsiMethod)navElement;
+ }
+ PsiExpression[] expressions = list.getExpressions();
+ int index = -1;
+ for (int i = 0; i < expressions.length; i++) {
+ if (expressions[i] == expr) {
+ index = i;
+ break;
+ }
+ }
+ PsiParameter[] parms = method.getParameterList().getParameters();
+ if (index < parms.length) {
+ String name = parms[index].getName();
+ if (name != null && TypeConversionUtil.areTypesAssignmentCompatible(subst.substitute(parms[index].getType()), expr)) {
+ name = variableNameToPropertyName(name, VariableKind.PARAMETER);
+ String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
+ if (expressions.length == 1) {
+ final String methodName = method.getName();
+ String[] words = NameUtil.nameToWords(methodName);
+ if (words.length > 0) {
+ final String firstWord = words[0];
+ if (SET_PREFIX.equals(firstWord)) {
+ final String propertyName = methodName.substring(firstWord.length());
+ final String[] setterNames = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
+ names = ArrayUtil.mergeArrays(names, setterNames);
+ }
+ }
+ }
+ return new NamesByExprInfo(name, names);
+ }
+ }
+ }
+ }
+ else if (expr.getParent() instanceof PsiAssignmentExpression && variableKind == VariableKind.PARAMETER) {
+ final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)expr.getParent();
+ if (expr == assignmentExpression.getRExpression()) {
+ final PsiExpression leftExpression = assignmentExpression.getLExpression();
+ if (leftExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression) leftExpression).getQualifier() == null) {
+ String name = leftExpression.getText();
+ if (name != null) {
+ final PsiElement resolve = ((PsiReferenceExpression)leftExpression).resolve();
+ if (resolve instanceof PsiVariable) {
+ name = variableNameToPropertyName(name, getVariableKind((PsiVariable)resolve));
+ }
+ String[] names = getSuggestionsByName(name, variableKind, false, correctKeywords);
+ return new NamesByExprInfo(name, names);
+ }
+ }
+ }
+ }
+
+ return new NamesByExprInfo(null, ArrayUtil.EMPTY_STRING_ARRAY);
+ }
+
+ @Override
+ public String variableNameToPropertyName(String name, VariableKind variableKind) {
+ if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < name.length(); i++) {
+ char c = name.charAt(i);
+ if (c != '_') {
+ if( Character.isLowerCase( c ) )
+ {
+ return variableNameToPropertyNameInner( name, variableKind );
+ }
+
+ buffer.append(Character.toLowerCase(c));
+ continue;
+ }
+ i++;
+ if (i < name.length()) {
+ c = name.charAt(i);
+ buffer.append(c);
+ }
+ }
+ return buffer.toString();
+ }
+
+ return variableNameToPropertyNameInner(name, variableKind);
+ }
+
+ private String variableNameToPropertyNameInner(String name, VariableKind variableKind) {
+ String prefix = getPrefixByVariableKind(variableKind);
+ String suffix = getSuffixByVariableKind(variableKind);
+ boolean doDecapitalize = false;
+
+ if (name.startsWith(prefix) && name.length() > prefix.length()) {
+ name = name.substring(prefix.length());
+ doDecapitalize = true;
+ }
+
+ if (name.endsWith(suffix) && name.length() > suffix.length()) {
+ name = name.substring(0, name.length() - suffix.length());
+ doDecapitalize = true;
+ }
+
+ if (name.startsWith(IS_PREFIX) && name.length() > IS_PREFIX.length() && Character.isUpperCase(name.charAt(IS_PREFIX.length()))) {
+ name = name.substring(IS_PREFIX.length());
+ doDecapitalize = true;
+ }
+
+ if (doDecapitalize) {
+ name = Introspector.decapitalize(name);
+ }
+
+ return name;
+ }
+
+ @Override
+ public String propertyNameToVariableName(String propertyName, VariableKind variableKind) {
+ if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
+ String[] words = NameUtil.nameToWords(propertyName);
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < words.length; i++) {
+ String word = words[i];
+ if (i > 0) {
+ buffer.append("_");
+ }
+ buffer.append(StringUtilRt.toUpperCase(word));
+ }
+ return buffer.toString();
+ }
+
+ String prefix = getPrefixByVariableKind(variableKind);
+ String name = propertyName;
+ if (name.length() > 0 && prefix.length() > 0 && !StringUtil.endsWithChar(prefix, '_')) {
+ name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+ }
+ name = prefix + name + getSuffixByVariableKind(variableKind);
+ name = changeIfNotIdentifier(name);
+ return name;
+ }
+
+ private String[] getSuggestionsByName(String name, VariableKind variableKind, boolean isArray, boolean correctKeywords) {
+ boolean upperCaseStyle = variableKind == VariableKind.STATIC_FINAL_FIELD;
+ boolean preferLongerNames = getSettings().PREFER_LONGER_NAMES;
+ String prefix = getPrefixByVariableKind(variableKind);
+ String suffix = getSuffixByVariableKind(variableKind);
+
+ List answer = new ArrayList();
+ for (String suggestion : NameUtil.getSuggestionsByName(name, prefix, suffix, upperCaseStyle, preferLongerNames, isArray)) {
+ answer.add(correctKeywords ? changeIfNotIdentifier(suggestion) : suggestion);
+ }
+
+ return ArrayUtil.toStringArray(answer);
+ }
+
+ @Override
+ public String suggestUniqueVariableName(String baseName, PsiElement place, boolean lookForward) {
+ int index = 0;
+ PsiElement scope = PsiTreeUtil.getNonStrictParentOfType(place, PsiStatement.class, PsiCodeBlock.class, PsiMethod.class);
+ NextName:
+ while (true) {
+ String name = baseName;
+ if (index > 0) {
+ name += index;
+ }
+ index++;
+ if (PsiUtil.isVariableNameUnique(name, place)) {
+ if (lookForward) {
+ final String name1 = name;
+ PsiElement run = scope;
+ while (run != null) {
+ class CancelException extends RuntimeException {
+ }
+ try {
+ run.accept(new JavaRecursiveElementWalkingVisitor() {
+ @Override
+ public void visitAnonymousClass(final PsiAnonymousClass aClass) {
+ }
+
+ @Override public void visitVariable(PsiVariable variable) {
+ if (name1.equals(variable.getName())) {
+ throw new CancelException();
+ }
+ }
+ });
+ }
+ catch (CancelException e) {
+ continue NextName;
+ }
+ run = run.getNextSibling();
+ if (scope instanceof PsiMethod) {//do not check next member for param name conflict
+ break;
+ }
+ }
+
+ }
+ return name;
+ }
+ }
+ }
+
+ @Override
+ @NotNull
+ public SuggestedNameInfo suggestUniqueVariableName(@NotNull final SuggestedNameInfo baseNameInfo,
+ PsiElement place,
+ boolean ignorePlaceName,
+ boolean lookForward) {
+ final String[] names = baseNameInfo.names;
+ final LinkedHashSet uniqueNames = new LinkedHashSet(names.length);
+ for (String name : names) {
+ if (ignorePlaceName && place instanceof PsiNamedElement) {
+ final String placeName = ((PsiNamedElement)place).getName();
+ if (Comparing.strEqual(placeName, name)) {
+ uniqueNames.add(name);
+ continue;
+ }
+ }
+ uniqueNames.add(suggestUniqueVariableName(name, place, lookForward));
+ }
+
+ return new SuggestedNameInfo(ArrayUtil.toStringArray(uniqueNames)) {
+ @Override
+ public void nameChoosen(String name) {
+ baseNameInfo.nameChoosen(name);
+ }
+ };
+ }
+
+ private static void sortVariableNameSuggestions(String[] names,
+ final VariableKind variableKind,
+ @Nullable final String propertyName,
+ @Nullable final PsiType type) {
+ if( names.length <= 1 ) {
+ return;
+ }
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("sorting names:" + variableKind);
+ if (propertyName != null) {
+ LOG.debug("propertyName:" + propertyName);
+ }
+ if (type != null) {
+ LOG.debug("type:" + type);
+ }
+ for (String name : names) {
+ int count = JavaStatisticsManager.getVariableNameUseCount(name, variableKind, propertyName, type);
+ LOG.debug(name + " : " + count);
+ }
+ }
+
+ Comparator comparator = new Comparator() {
+ @Override
+ public int compare(String s1, String s2) {
+ int count1 = JavaStatisticsManager.getVariableNameUseCount(s1, variableKind, propertyName, type);
+ int count2 = JavaStatisticsManager.getVariableNameUseCount(s2, variableKind, propertyName, type);
+ return count2 - count1;
+ }
+ };
+ Arrays.sort(names, comparator);
+ }
+
+ @Override
+ @NotNull
+ public String getPrefixByVariableKind(VariableKind variableKind) {
+ String prefix = "";
+ switch (variableKind) {
+ case FIELD:
+ prefix = getSettings().FIELD_NAME_PREFIX;
+ break;
+ case STATIC_FIELD:
+ prefix = getSettings().STATIC_FIELD_NAME_PREFIX;
+ break;
+ case PARAMETER:
+ prefix = getSettings().PARAMETER_NAME_PREFIX;
+ break;
+ case LOCAL_VARIABLE:
+ prefix = getSettings().LOCAL_VARIABLE_NAME_PREFIX;
+ break;
+ case STATIC_FINAL_FIELD:
+ prefix = "";
+ break;
+ default:
+ LOG.assertTrue(false);
+ break;
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ return prefix;
+ }
+
+ @Override
+ @NotNull
+ public String getSuffixByVariableKind(VariableKind variableKind) {
+ String suffix = "";
+ switch (variableKind) {
+ case FIELD:
+ suffix = getSettings().FIELD_NAME_SUFFIX;
+ break;
+ case STATIC_FIELD:
+ suffix = getSettings().STATIC_FIELD_NAME_SUFFIX;
+ break;
+ case PARAMETER:
+ suffix = getSettings().PARAMETER_NAME_SUFFIX;
+ break;
+ case LOCAL_VARIABLE:
+ suffix = getSettings().LOCAL_VARIABLE_NAME_SUFFIX;
+ break;
+ case STATIC_FINAL_FIELD:
+ suffix = "";
+ break;
+ default:
+ LOG.assertTrue(false);
+ break;
+ }
+ if (suffix == null) {
+ suffix = "";
+ }
+ return suffix;
+ }
+
+ @Nullable
+ private CodeStyleSettings.TypeToNameMap getMapByVariableKind(VariableKind variableKind) {
+ if (variableKind == VariableKind.FIELD) return getSettings().FIELD_TYPE_TO_NAME;
+ if (variableKind == VariableKind.STATIC_FIELD) return getSettings().STATIC_FIELD_TYPE_TO_NAME;
+ if (variableKind == VariableKind.PARAMETER) return getSettings().PARAMETER_TYPE_TO_NAME;
+ if (variableKind == VariableKind.LOCAL_VARIABLE) return getSettings().LOCAL_VARIABLE_TYPE_TO_NAME;
+ return null;
+ }
+
+ @NonNls
+ private String changeIfNotIdentifier(String name) {
+ if (!isIdentifier(name)) {
+ return StringUtil.fixVariableNameDerivedFromPropertyName(name);
+ }
+ return name;
+ }
+
+ private boolean isIdentifier(String name) {
+ return JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(name, LanguageLevel.HIGHEST);
+ }
+
+ private CodeStyleSettings getSettings() {
+ return CodeStyleSettingsManager.getSettings(myProject);
+ }
+
+ public static boolean isStringPsiLiteral(PsiElement element) {
+ if (element instanceof PsiLiteralExpression) {
+ final String text = element.getText();
+ return text.length() > 1 && StringUtil.isQuotedString(text);
+ }
+ return false;
+ }
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
index a69df03db346..8f5a4e1e69de 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
@@ -121,7 +121,7 @@ public class MoveMembersDialog extends RefactoringDialog implements MoveMembersO
}
myMemberInfos = memberList;
String fqName = initialTargetClass != null && !sourceClass.equals(initialTargetClass) ? initialTargetClass.getQualifiedName() : "";
- myTfTargetClassName = new ReferenceEditorComboWithBrowseButton(new ChooseClassAction(), fqName, myProject, true, RECENTS_KEY);
+ myTfTargetClassName = new ReferenceEditorComboWithBrowseButton(new ChooseClassAction(), fqName, myProject, true, JavaCodeFragment.VisibilityChecker.PROJECT_SCOPE_VISIBLE, RECENTS_KEY);
init();
}
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/naming/ConstructorParameterOnFieldRenameRenamer.java b/java/java-impl/src/com/intellij/refactoring/rename/naming/ConstructorParameterOnFieldRenameRenamer.java
index b2517c4a586e..345b3129defb 100644
--- a/java/java-impl/src/com/intellij/refactoring/rename/naming/ConstructorParameterOnFieldRenameRenamer.java
+++ b/java/java-impl/src/com/intellij/refactoring/rename/naming/ConstructorParameterOnFieldRenameRenamer.java
@@ -60,7 +60,9 @@ public class ConstructorParameterOnFieldRenameRenamer extends AutomaticRenamer {
if (constructor instanceof LightElement) continue;
final PsiParameter[] parameters = constructor.getParameterList().getParameters();
for (final PsiParameter parameter : parameters) {
- if (paramName.equals(parameter.getName())) {
+ final String parameterName = parameter.getName();
+ if (paramName.equals(parameterName) ||
+ propertyName.equals(styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER))) {
toRename.add(parameter);
}
}
diff --git a/java/java-impl/src/com/intellij/ui/ReferenceEditorComboWithBrowseButton.java b/java/java-impl/src/com/intellij/ui/ReferenceEditorComboWithBrowseButton.java
index eef311a5b05c..286e897e82ec 100644
--- a/java/java-impl/src/com/intellij/ui/ReferenceEditorComboWithBrowseButton.java
+++ b/java/java-impl/src/com/intellij/ui/ReferenceEditorComboWithBrowseButton.java
@@ -34,7 +34,16 @@ public class ReferenceEditorComboWithBrowseButton extends ComponentWithBrowseBut
final String text,
@NotNull final Project project,
boolean toAcceptClasses, final String recentsKey) {
- super(new EditorComboBox(createDocument(text, project, toAcceptClasses), project, StdFileTypes.JAVA), browseActionListener);
+ this(browseActionListener, text, project, toAcceptClasses, JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE, recentsKey);
+ }
+
+ public ReferenceEditorComboWithBrowseButton(final ActionListener browseActionListener,
+ final String text,
+ @NotNull final Project project,
+ boolean toAcceptClasses,
+ final JavaCodeFragment.VisibilityChecker visibilityChecker, final String recentsKey) {
+ super(new EditorComboBox(createDocument(text, project, toAcceptClasses, visibilityChecker), project, StdFileTypes.JAVA),
+ browseActionListener);
final List recentEntries = RecentsManager.getInstance(project).getRecentEntries(recentsKey);
if (recentEntries != null) {
setHistory(ArrayUtil.toStringArray(recentEntries));
@@ -44,10 +53,13 @@ public class ReferenceEditorComboWithBrowseButton extends ComponentWithBrowseBut
}
}
- private static Document createDocument(final String text, Project project, boolean isClassesAccepted) {
+ private static Document createDocument(final String text,
+ Project project,
+ boolean isClassesAccepted,
+ final JavaCodeFragment.VisibilityChecker visibilityChecker) {
PsiPackage defaultPackage = JavaPsiFacade.getInstance(project).findPackage("");
final JavaCodeFragment fragment = JavaCodeFragmentFactory.getInstance(project).createReferenceCodeFragment(text, defaultPackage, true, isClassesAccepted);
- fragment.setVisibilityChecker(JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE);
+ fragment.setVisibilityChecker(visibilityChecker);
return PsiDocumentManager.getInstance(project).getDocument(fragment);
}
diff --git a/java/java-psi-api/src/com/intellij/psi/JavaCodeFragment.java b/java/java-psi-api/src/com/intellij/psi/JavaCodeFragment.java
index 8c99369179bf..25f4ad4c60c4 100644
--- a/java/java-psi-api/src/com/intellij/psi/JavaCodeFragment.java
+++ b/java/java-psi-api/src/com/intellij/psi/JavaCodeFragment.java
@@ -139,6 +139,13 @@ public interface JavaCodeFragment extends PsiImportHolder, PsiCodeFragment {
return Visibility.VISIBLE;
}
};
+
+ VisibilityChecker PROJECT_SCOPE_VISIBLE = new VisibilityChecker() {
+ @Override
+ public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
+ return declaration.getManager().isInProject(declaration) ? Visibility.VISIBLE : Visibility.NOT_VISIBLE;
+ }
+ };
}
/**
diff --git a/java/java-psi-api/src/com/intellij/psi/JavaTokenType.java b/java/java-psi-api/src/com/intellij/psi/JavaTokenType.java
index 81db31947f2b..e9a5f0a8ee54 100644
--- a/java/java-psi-api/src/com/intellij/psi/JavaTokenType.java
+++ b/java/java-psi-api/src/com/intellij/psi/JavaTokenType.java
@@ -20,8 +20,7 @@ import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.tree.java.IJavaElementType;
import com.intellij.psi.tree.java.IKeywordElementType;
-
-public interface JavaTokenType extends TokenType{
+public interface JavaTokenType extends TokenType {
IElementType IDENTIFIER = new IJavaElementType("IDENTIFIER");
IElementType C_STYLE_COMMENT = new IJavaElementType("C_STYLE_COMMENT");
IElementType END_OF_LINE_COMMENT = new IJavaElementType("END_OF_LINE_COMMENT");
@@ -87,7 +86,6 @@ public interface JavaTokenType extends TokenType{
IElementType TRY_KEYWORD = new IKeywordElementType("TRY_KEYWORD");
IElementType VOLATILE_KEYWORD = new IKeywordElementType("VOLATILE_KEYWORD");
IElementType THROWS_KEYWORD = new IKeywordElementType("THROWS_KEYWORD");
- IElementType NONE_KEYWORD = new IKeywordElementType("NONE_KEYWORD");
IElementType LPARENTH = new IJavaElementType("LPARENTH");
IElementType RPARENTH = new IJavaElementType("RPARENTH");
@@ -143,13 +141,15 @@ public interface JavaTokenType extends TokenType{
IElementType DOUBLE_COLON = new IJavaElementType("DOUBLE_COLON");
IElementType ARROW = new IJavaElementType("ARROW");
- TokenSet OPERATION_BIT_SET = TokenSet.create(
+ /** @deprecated use {@linkplain com.intellij.psi.impl.source.tree.ElementType#OPERATION_BIT_SET} (to remove in IDEA 13) */
+ @SuppressWarnings("UnusedDeclaration") TokenSet OPERATION_BIT_SET = TokenSet.create(
EQ, GT, LT, EXCL, TILDE, QUEST, COLON, PLUS, MINUS, ASTERISK, DIV, AND, OR, XOR,
PERC, EQEQ, LE, GE, NE, ANDAND, OROR, PLUSPLUS, MINUSMINUS, LTLT, GTGT, GTGTGT,
PLUSEQ, MINUSEQ, ASTERISKEQ, DIVEQ, ANDEQ, OREQ, XOREQ, PERCEQ, LTLTEQ, GTGTEQ, GTGTGTEQ
);
- TokenSet KEYWORD_BIT_SET = TokenSet.create(
+ /** @deprecated use {@linkplain com.intellij.psi.impl.source.tree.ElementType#KEYWORD_BIT_SET} (to remove in IDEA 13) */
+ @SuppressWarnings("UnusedDeclaration") TokenSet KEYWORD_BIT_SET = TokenSet.create(
ABSTRACT_KEYWORD, ASSERT_KEYWORD, BOOLEAN_KEYWORD, BREAK_KEYWORD, BYTE_KEYWORD, CASE_KEYWORD,
CATCH_KEYWORD, CHAR_KEYWORD, CLASS_KEYWORD, CONST_KEYWORD, CONTINUE_KEYWORD,
DEFAULT_KEYWORD, DO_KEYWORD, DOUBLE_KEYWORD, ELSE_KEYWORD, ENUM_KEYWORD, EXTENDS_KEYWORD,
@@ -162,7 +162,8 @@ public interface JavaTokenType extends TokenType{
VOID_KEYWORD, VOLATILE_KEYWORD, WHILE_KEYWORD, TRUE_KEYWORD, FALSE_KEYWORD, NULL_KEYWORD
);
- TokenSet MODIFIER_BIT_SET = TokenSet.create(
+ /** @deprecated use {@linkplain com.intellij.psi.impl.source.tree.ElementType#MODIFIER_BIT_SET} (to remove in IDEA 13) */
+ @SuppressWarnings("UnusedDeclaration") TokenSet MODIFIER_BIT_SET = TokenSet.create(
PUBLIC_KEYWORD, PROTECTED_KEYWORD, PRIVATE_KEYWORD, STATIC_KEYWORD,
ABSTRACT_KEYWORD, FINAL_KEYWORD, NATIVE_KEYWORD, STRICTFP_KEYWORD,
SYNCHRONIZED_KEYWORD, TRANSIENT_KEYWORD, VOLATILE_KEYWORD
diff --git a/java/java-psi-api/src/com/intellij/psi/codeStyle/JavaCodeStyleManager.java b/java/java-psi-api/src/com/intellij/psi/codeStyle/JavaCodeStyleManager.java
index 5bc23c8e1cf1..9f24c2a5085c 100644
--- a/java/java-psi-api/src/com/intellij/psi/codeStyle/JavaCodeStyleManager.java
+++ b/java/java-psi-api/src/com/intellij/psi/codeStyle/JavaCodeStyleManager.java
@@ -1,194 +1,213 @@
-/*
- * Copyright 2000-2011 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @author max
- */
-package com.intellij.psi.codeStyle;
-
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.util.IncorrectOperationException;
-import org.intellij.lang.annotations.MagicConstant;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-
-public abstract class JavaCodeStyleManager {
- public static JavaCodeStyleManager getInstance(Project project) {
- return ServiceManager.getService(project, JavaCodeStyleManager.class);
- }
-
- public static final int DO_NOT_ADD_IMPORTS = 0x1000;
- public static final int UNCOMPLETE_CODE = 0x2000;
-
- public abstract boolean addImport(@NotNull PsiJavaFile file, @NotNull PsiClass refClass);
- public abstract PsiElement shortenClassReferences(@NotNull PsiElement element, @MagicConstant(flags = {DO_NOT_ADD_IMPORTS, UNCOMPLETE_CODE}) int flags) throws IncorrectOperationException;
-
- @NotNull public abstract String getPrefixByVariableKind(VariableKind variableKind);
- @NotNull public abstract String getSuffixByVariableKind(VariableKind variableKind);
-
- public abstract int findEntryIndex(@NotNull PsiImportStatementBase statement);
-
- /**
- * Replaces fully-qualified class names in the contents of the specified element with
- * non-qualified names and adds import statements as necessary.
- *
- * @param element the element to shorten references in.
- * @return the element in the PSI tree after the shorten references operation corresponding
- * to the original element.
- * @throws com.intellij.util.IncorrectOperationException if the file to shorten references in is read-only.
- */
- public abstract PsiElement shortenClassReferences(@NotNull PsiElement element) throws IncorrectOperationException;
-
- /**
- * Replaces fully-qualified class names in a part of contents of the specified element with
- * non-qualified names and adds import statements as necessary.
- *
- * @param element the element to shorten references in.
- * @param startOffset the start offset in the element of the part where class references are
- * shortened.
- * @param endOffset the end offset in the element of the part where class references are
- * shortened.
- * @throws IncorrectOperationException if the file to shorten references in is read-only.
- */
- public abstract void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException;
-
- /**
- * Optimizes imports in the specified Java or JSP file.
- *
- * @param file the file to optimize the imports in.
- * @throws IncorrectOperationException if the file is read-only.
- */
- public abstract void optimizeImports(@NotNull PsiFile file) throws IncorrectOperationException;
-
- /**
- * Calculates the import list that would be substituted in the specified Java or JSP
- * file if an Optimize Imports operation was performed on it.
- *
- * @param file the file to calculate the import list for.
- * @return the calculated import list.
- */
- public abstract PsiImportList prepareOptimizeImportsResult(@NotNull PsiJavaFile file);
-
- /**
- * Returns the kind of the specified variable (local, parameter, field, static field or static
- * final field).
- *
- * @param variable the variable to get the kind for.
- * @return the variable kind.
- */
- public abstract VariableKind getVariableKind(@NotNull PsiVariable variable);
-
- public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
- @Nullable final String propertyName,
- @Nullable final PsiExpression expr,
- @Nullable PsiType type) {
- return suggestVariableName(kind, propertyName, expr, type, true);
- }
-
-
- public abstract SuggestedNameInfo suggestVariableName(@NotNull VariableKind kind,
- @Nullable String propertyName,
- @Nullable PsiExpression expr,
- @Nullable PsiType type,
- boolean correctKeywords);
- /**
- * Generates a stripped-down name (with no code style defined prefixes or suffixes, usable as
- * a property name) from the specified name of a variable of the specified kind.
- *
- * @param name the name of the variable.
- * @param variableKind the kind of the variable.
- * @return the stripped-down name.
- */
- public abstract String variableNameToPropertyName(@NonNls String name, VariableKind variableKind);
-
- /**
- * Appends code style defined prefixes and/or suffixes for the specified variable kind
- * to the specified variable name.
- *
- * @param propertyName the base name of the variable.
- * @param variableKind the kind of the variable.
- * @return the variable name.
- */
- public abstract String propertyNameToVariableName(@NonNls String propertyName, VariableKind variableKind);
-
- /**
- * Suggests a unique name for the variable used at the specified location.
- *
- * @param baseName the base name for the variable.
- * @param place the location where the variable will be used.
- * @param lookForward if true, the existing variables are searched in both directions; if false - only backward
- * @return the generated unique name,
- */
- public abstract String suggestUniqueVariableName(@NonNls String baseName, PsiElement place, boolean lookForward);
-
- /**
- * Suggests a unique name for the variable used at the specified location.
- *
- * @param baseNameInfo the base name info for the variable.
- * @param place the location where the variable will be used.
- * @param lookForward if true, the existing variables are searched in both directions; if false - only backward
- * @return the generated unique name
- */
- @NotNull
- public SuggestedNameInfo suggestUniqueVariableName(@NotNull SuggestedNameInfo baseNameInfo,
- PsiElement place,
- boolean lookForward) {
- return suggestUniqueVariableName(baseNameInfo, place, false, lookForward);
- }
-
- /**
- * Suggests a unique name for the variable used at the specified location.
- *
- *
- * @param baseNameInfo the base name info for the variable.
- * @param place the location where the variable will be used.
- * @param ignorePlaceName if true and place is PsiNamedElement, place.getName() would be still treated as unique name
- * @param lookForward if true, the existing variables are searched in both directions; if false - only backward @return the generated unique name,
- * @return the generated unique name
- */
- @NotNull public abstract SuggestedNameInfo suggestUniqueVariableName(@NotNull SuggestedNameInfo baseNameInfo,
- PsiElement place,
- boolean ignorePlaceName,
- boolean lookForward);
-
- /**
- * Replaces all references to Java classes in the contents of the specified element,
- * except for references to classes in the same package or in implicitly imported packages,
- * with full-qualified references.
- *
- * @param element the element to replace the references in.
- * @return the element in the PSI tree after the qualify operation corresponding to the
- * original element.
- */
- public abstract PsiElement qualifyClassReferences(@NotNull PsiElement element);
-
- /**
- * Removes unused import statements from the specified Java file.
- *
- * @param file the file to remove the import statements from.
- * @throws IncorrectOperationException if the operation fails for some reason (for example,
- * the file is read-only).
- */
- public abstract void removeRedundantImports(@NotNull PsiJavaFile file) throws IncorrectOperationException;
-
- @Nullable
- public abstract Collection findRedundantImports(PsiJavaFile file);
-}
+/*
+ * Copyright 2000-2011 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.codeStyle;
+
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.util.IncorrectOperationException;
+import org.intellij.lang.annotations.MagicConstant;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+public abstract class JavaCodeStyleManager {
+ public static JavaCodeStyleManager getInstance(Project project) {
+ return ServiceManager.getService(project, JavaCodeStyleManager.class);
+ }
+
+ public static final int DO_NOT_ADD_IMPORTS = 0x1000;
+ public static final int UNCOMPLETE_CODE = 0x2000;
+
+ public abstract boolean addImport(@NotNull PsiJavaFile file, @NotNull PsiClass refClass);
+ public abstract PsiElement shortenClassReferences(@NotNull PsiElement element, @MagicConstant(flags = {DO_NOT_ADD_IMPORTS, UNCOMPLETE_CODE}) int flags) throws IncorrectOperationException;
+
+ @NotNull public abstract String getPrefixByVariableKind(VariableKind variableKind);
+ @NotNull public abstract String getSuffixByVariableKind(VariableKind variableKind);
+
+ public abstract int findEntryIndex(@NotNull PsiImportStatementBase statement);
+
+ /**
+ * Replaces fully-qualified class names in the contents of the specified element with
+ * non-qualified names and adds import statements as necessary.
+ *
+ * @param element the element to shorten references in.
+ * @return the element in the PSI tree after the shorten references operation corresponding
+ * to the original element.
+ * @throws com.intellij.util.IncorrectOperationException if the file to shorten references in is read-only.
+ */
+ public abstract PsiElement shortenClassReferences(@NotNull PsiElement element) throws IncorrectOperationException;
+
+ /**
+ * Replaces fully-qualified class names in a part of contents of the specified element with
+ * non-qualified names and adds import statements as necessary.
+ *
+ * @param element the element to shorten references in.
+ * @param startOffset the start offset in the element of the part where class references are
+ * shortened.
+ * @param endOffset the end offset in the element of the part where class references are
+ * shortened.
+ * @throws IncorrectOperationException if the file to shorten references in is read-only.
+ */
+ public abstract void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException;
+
+ /**
+ * Optimizes imports in the specified Java or JSP file.
+ *
+ * @param file the file to optimize the imports in.
+ * @throws IncorrectOperationException if the file is read-only.
+ */
+ public abstract void optimizeImports(@NotNull PsiFile file) throws IncorrectOperationException;
+
+ /**
+ * Calculates the import list that would be substituted in the specified Java or JSP
+ * file if an Optimize Imports operation was performed on it.
+ *
+ * @param file the file to calculate the import list for.
+ * @return the calculated import list.
+ */
+ public abstract PsiImportList prepareOptimizeImportsResult(@NotNull PsiJavaFile file);
+
+ /**
+ * Returns the kind of the specified variable (local, parameter, field, static field or static
+ * final field).
+ *
+ * @param variable the variable to get the kind for.
+ * @return the variable kind.
+ */
+ public VariableKind getVariableKind(@NotNull PsiVariable variable){
+ if (variable instanceof PsiField) {
+ if (variable.hasModifierProperty(PsiModifier.STATIC)) {
+ if (variable.hasModifierProperty(PsiModifier.FINAL)) {
+ return VariableKind.STATIC_FINAL_FIELD;
+ }
+ return VariableKind.STATIC_FIELD;
+ }
+ return VariableKind.FIELD;
+ }
+ else {
+ if (variable instanceof PsiParameter) {
+ if (((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement) {
+ return VariableKind.LOCAL_VARIABLE;
+ }
+ return VariableKind.PARAMETER;
+ }
+ return VariableKind.LOCAL_VARIABLE;
+ }
+ }
+
+ public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
+ @Nullable final String propertyName,
+ @Nullable final PsiExpression expr,
+ @Nullable PsiType type) {
+ return suggestVariableName(kind, propertyName, expr, type, true);
+ }
+
+
+ public abstract SuggestedNameInfo suggestVariableName(@NotNull VariableKind kind,
+ @Nullable String propertyName,
+ @Nullable PsiExpression expr,
+ @Nullable PsiType type,
+ boolean correctKeywords);
+ /**
+ * Generates a stripped-down name (with no code style defined prefixes or suffixes, usable as
+ * a property name) from the specified name of a variable of the specified kind.
+ *
+ * @param name the name of the variable.
+ * @param variableKind the kind of the variable.
+ * @return the stripped-down name.
+ */
+ public abstract String variableNameToPropertyName(@NonNls String name, VariableKind variableKind);
+
+ /**
+ * Appends code style defined prefixes and/or suffixes for the specified variable kind
+ * to the specified variable name.
+ *
+ * @param propertyName the base name of the variable.
+ * @param variableKind the kind of the variable.
+ * @return the variable name.
+ */
+ public abstract String propertyNameToVariableName(@NonNls String propertyName, VariableKind variableKind);
+
+ /**
+ * Suggests a unique name for the variable used at the specified location.
+ *
+ * @param baseName the base name for the variable.
+ * @param place the location where the variable will be used.
+ * @param lookForward if true, the existing variables are searched in both directions; if false - only backward
+ * @return the generated unique name,
+ */
+ public abstract String suggestUniqueVariableName(@NonNls String baseName, PsiElement place, boolean lookForward);
+
+ /**
+ * Suggests a unique name for the variable used at the specified location.
+ *
+ * @param baseNameInfo the base name info for the variable.
+ * @param place the location where the variable will be used.
+ * @param lookForward if true, the existing variables are searched in both directions; if false - only backward
+ * @return the generated unique name
+ */
+ @NotNull
+ public SuggestedNameInfo suggestUniqueVariableName(@NotNull SuggestedNameInfo baseNameInfo,
+ PsiElement place,
+ boolean lookForward) {
+ return suggestUniqueVariableName(baseNameInfo, place, false, lookForward);
+ }
+
+ /**
+ * Suggests a unique name for the variable used at the specified location.
+ *
+ *
+ * @param baseNameInfo the base name info for the variable.
+ * @param place the location where the variable will be used.
+ * @param ignorePlaceName if true and place is PsiNamedElement, place.getName() would be still treated as unique name
+ * @param lookForward if true, the existing variables are searched in both directions; if false - only backward @return the generated unique name,
+ * @return the generated unique name
+ */
+ @NotNull public abstract SuggestedNameInfo suggestUniqueVariableName(@NotNull SuggestedNameInfo baseNameInfo,
+ PsiElement place,
+ boolean ignorePlaceName,
+ boolean lookForward);
+
+ /**
+ * Replaces all references to Java classes in the contents of the specified element,
+ * except for references to classes in the same package or in implicitly imported packages,
+ * with full-qualified references.
+ *
+ * @param element the element to replace the references in.
+ * @return the element in the PSI tree after the qualify operation corresponding to the
+ * original element.
+ */
+ public abstract PsiElement qualifyClassReferences(@NotNull PsiElement element);
+
+ /**
+ * Removes unused import statements from the specified Java file.
+ *
+ * @param file the file to remove the import statements from.
+ * @throws IncorrectOperationException if the operation fails for some reason (for example,
+ * the file is read-only).
+ */
+ public abstract void removeRedundantImports(@NotNull PsiJavaFile file) throws IncorrectOperationException;
+
+ @Nullable
+ public abstract Collection findRedundantImports(PsiJavaFile file);
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/search/PackageScope.java b/java/java-psi-api/src/com/intellij/psi/search/PackageScope.java
index e0571b284682..22f7f066b520 100644
--- a/java/java-psi-api/src/com/intellij/psi/search/PackageScope.java
+++ b/java/java-psi-api/src/com/intellij/psi/search/PackageScope.java
@@ -25,6 +25,9 @@ import com.intellij.openapi.roots.PackageIndex;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiClassOwner;
+import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiPackage;
import org.jetbrains.annotations.NotNull;
@@ -35,6 +38,9 @@ public class PackageScope extends GlobalSearchScope {
private final PsiPackage myPackage;
private final boolean myIncludeSubpackages;
private final boolean myIncludeLibraries;
+ protected final boolean myPartOfPackagePrefix;
+ protected final String myPackageQualifiedName;
+ protected final String myPackageQNamePrefix;
public PackageScope(@NotNull PsiPackage aPackage, boolean includeSubpackages, final boolean includeLibraries) {
super(aPackage.getProject());
@@ -42,8 +48,12 @@ public class PackageScope extends GlobalSearchScope {
myIncludeSubpackages = includeSubpackages;
Project project = myPackage.getProject();
- myDirs = PackageIndex.getInstance(project).getDirsByPackageName(myPackage.getQualifiedName(), true).findAll();
+ myPackageQualifiedName = myPackage.getQualifiedName();
+ myDirs = PackageIndex.getInstance(project).getDirsByPackageName(myPackageQualifiedName, true).findAll();
myIncludeLibraries = includeLibraries;
+
+ myPartOfPackagePrefix = JavaPsiFacade.getInstance(getProject()).isPartOfPackagePrefix(myPackageQualifiedName);
+ myPackageQNamePrefix = myPackageQualifiedName + ".";
}
@Override
@@ -54,6 +64,14 @@ public class PackageScope extends GlobalSearchScope {
: Comparing.equal(file.getParent(), scopeDir);
if (inDir) return true;
}
+ if (myPartOfPackagePrefix && myIncludeSubpackages) {
+ final PsiFile psiFile = myPackage.getManager().findFile(file);
+ if (psiFile instanceof PsiClassOwner) {
+ final String packageName = ((PsiClassOwner)psiFile).getPackageName();
+ if (myPackageQualifiedName.equals(packageName) ||
+ packageName.startsWith(myPackageQNamePrefix)) return true;
+ }
+ }
return false;
}
diff --git a/java/java-psi-impl/src/com/intellij/core/CoreJavaCodeStyleManager.java b/java/java-psi-impl/src/com/intellij/core/CoreJavaCodeStyleManager.java
new file mode 100644
index 000000000000..4e9f5e68a6f8
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/core/CoreJavaCodeStyleManager.java
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.core;
+
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.codeStyle.SuggestedNameInfo;
+import com.intellij.psi.codeStyle.VariableKind;
+import com.intellij.util.IncorrectOperationException;
+import org.intellij.lang.annotations.MagicConstant;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+public class CoreJavaCodeStyleManager extends JavaCodeStyleManager {
+ @Override
+ public boolean addImport(@NotNull PsiJavaFile file, @NotNull PsiClass refClass) {
+ return false;
+ }
+
+ @Override
+ public PsiElement shortenClassReferences(@NotNull PsiElement element,
+ @MagicConstant(flags = {DO_NOT_ADD_IMPORTS, UNCOMPLETE_CODE}) int flags)
+ throws IncorrectOperationException {
+ return null;
+ }
+
+ @NotNull
+ @Override
+ public String getPrefixByVariableKind(VariableKind variableKind) {
+ return "";
+ }
+
+ @NotNull
+ @Override
+ public String getSuffixByVariableKind(VariableKind variableKind) {
+ return "";
+ }
+
+ @Override
+ public int findEntryIndex(@NotNull PsiImportStatementBase statement) {
+ return 0;
+ }
+
+ @Override
+ public PsiElement shortenClassReferences(@NotNull PsiElement element) throws IncorrectOperationException {
+ return null;
+ }
+
+ @Override
+ public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException {
+ }
+
+ @Override
+ public void optimizeImports(@NotNull PsiFile file) throws IncorrectOperationException {
+ }
+
+ @Override
+ public PsiImportList prepareOptimizeImportsResult(@NotNull PsiJavaFile file) {
+ return null;
+ }
+
+ @Override
+ public SuggestedNameInfo suggestVariableName(@NotNull VariableKind kind,
+ @Nullable String propertyName,
+ @Nullable PsiExpression expr,
+ @Nullable PsiType type,
+ boolean correctKeywords) {
+ return SuggestedNameInfo.NULL_INFO;
+ }
+
+ @Override
+ public String variableNameToPropertyName(@NonNls String name, VariableKind variableKind) {
+ return null;
+ }
+
+ @Override
+ public String propertyNameToVariableName(@NonNls String propertyName, VariableKind variableKind) {
+ return null;
+ }
+
+ @Override
+ public String suggestUniqueVariableName(@NonNls String baseName, PsiElement place, boolean lookForward) {
+ return null;
+ }
+
+ @NotNull
+ @Override
+ public SuggestedNameInfo suggestUniqueVariableName(@NotNull SuggestedNameInfo baseNameInfo,
+ PsiElement place,
+ boolean ignorePlaceName,
+ boolean lookForward) {
+ return SuggestedNameInfo.NULL_INFO;
+ }
+
+ @Override
+ public PsiElement qualifyClassReferences(@NotNull PsiElement element) {
+ return element;
+ }
+
+ @Override
+ public void removeRedundantImports(@NotNull PsiJavaFile file) throws IncorrectOperationException {
+ }
+
+ @Override
+ public Collection findRedundantImports(PsiJavaFile file) {
+ return null;
+ }
+}
diff --git a/java/java-psi-impl/src/com/intellij/core/JavaCoreEnvironment.java b/java/java-psi-impl/src/com/intellij/core/JavaCoreEnvironment.java
index 46aa4080730f..42e9c4cb9ca2 100644
--- a/java/java-psi-impl/src/com/intellij/core/JavaCoreEnvironment.java
+++ b/java/java-psi-impl/src/com/intellij/core/JavaCoreEnvironment.java
@@ -30,11 +30,9 @@ import com.intellij.openapi.roots.PackageIndex;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.augment.PsiAugmentProvider;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.JavaCodeStyleSettingsFacade;
-import com.intellij.psi.impl.EmptySubstitutorImpl;
-import com.intellij.psi.impl.JavaPsiFacadeImpl;
-import com.intellij.psi.impl.JavaPsiImplementationHelper;
-import com.intellij.psi.impl.PsiElementFactoryImpl;
+import com.intellij.psi.impl.*;
import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
import com.intellij.psi.impl.compiled.ClsStubBuilderFactory;
import com.intellij.psi.impl.compiled.DefaultClsStubBuilderFactory;
@@ -62,6 +60,7 @@ public class JavaCoreEnvironment extends CoreEnvironment {
registerFileType(JavaFileType.INSTANCE, "java");
addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new CoreJavaASTFactory());
addExplicitExtension(LanguageParserDefinitions.INSTANCE, JavaLanguage.INSTANCE, new JavaParserDefinition());
+ addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator());
registerProjectExtensionPoint(PsiElementFinder.EP_NAME, PsiElementFinder.class);
registerExtensionPoint(Extensions.getRootArea(), ClsStubBuilderFactory.EP_NAME, ClsStubBuilderFactory.class);
@@ -79,6 +78,7 @@ public class JavaCoreEnvironment extends CoreEnvironment {
myProject.registerService(PackageIndex.class, myFileManager);
myProject.registerService(JavaResolveCache.class, new JavaResolveCache(null));
myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade());
+ myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager());
JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, myPsiManager, myFileManager, null);
myProject.registerService(CoreJavaFileManager.class, myFileManager);
diff --git a/java/java-psi-impl/src/com/intellij/lexer/JavaLexer.java b/java/java-psi-impl/src/com/intellij/lexer/JavaLexer.java
index cf47bdcb772c..13dd70775356 100644
--- a/java/java-psi-impl/src/com/intellij/lexer/JavaLexer.java
+++ b/java/java-psi-impl/src/com/intellij/lexer/JavaLexer.java
@@ -30,7 +30,6 @@ import java.util.Set;
public class JavaLexer extends LexerBase {
private static final HashTable[] TABLES = new HashTable[]{
- new HashTable(LanguageLevel.JDK_1_8),
new HashTable(LanguageLevel.JDK_1_5),
new HashTable(LanguageLevel.JDK_1_4),
new HashTable(LanguageLevel.JDK_1_3)
@@ -118,9 +117,6 @@ public class JavaLexer extends LexerBase {
add("assert", JavaTokenType.ASSERT_KEYWORD);
if (level.isAtLeast(LanguageLevel.JDK_1_5)) {
add("enum", JavaTokenType.ENUM_KEYWORD);
- if (level.isAtLeast(LanguageLevel.JDK_1_8)) {
- add("none", JavaTokenType.NONE_KEYWORD);
- }
}
}
add("abstract", JavaTokenType.ABSTRACT_KEYWORD);
diff --git a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
index a1335e5ba747..5b62d45a8f4a 100644
--- a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
+++ b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
@@ -12,13 +12,11 @@ import com.intellij.psi.tree.IElementType;
%{
private boolean myAssertKeyword;
private boolean myEnumKeyword;
- private boolean myNoneKeyword;
public _JavaLexer(LanguageLevel level) {
this((java.io.Reader)null);
myAssertKeyword = level.isAtLeast(LanguageLevel.JDK_1_4);
myEnumKeyword = level.isAtLeast(LanguageLevel.JDK_1_5);
- myNoneKeyword = level.isAtLeast(LanguageLevel.JDK_1_8);
}
public void goTo(int offset) {
@@ -154,7 +152,6 @@ ESCAPE_SEQUENCE=\\[^\r\n]
"try" { return JavaTokenType.TRY_KEYWORD; }
"volatile" { return JavaTokenType.VOLATILE_KEYWORD; }
"throws" { return JavaTokenType.THROWS_KEYWORD; }
- "none" { return myNoneKeyword ? JavaTokenType.NONE_KEYWORD : JavaTokenType.IDENTIFIER; }
{IDENTIFIER} { return JavaTokenType.IDENTIFIER; }
diff --git a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
index 6f9733947fd3..702d3f66f20a 100644
--- a/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
+++ b/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-/* The following code was generated by JFlex 1.4.3 on 5/11/12 9:41 PM */
+/* The following code was generated by JFlex 1.4.3 on 5/14/12 1:21 PM */
/* It's an automatically generated code. Do not modify it. */
package com.intellij.lexer;
@@ -29,7 +29,7 @@ import com.intellij.psi.tree.IElementType;
/**
* This class is a scanner generated by
* JFlex 1.4.3
- * on 5/11/12 9:41 PM from the specification file
+ * on 5/14/12 1:21 PM from the specification file
* /home/sher/Projects/IDEA/tools/lexer/../../community/java/java-psi-impl/src/com/intellij/lexer/_JavaLexer.flex
*/
class _JavaLexer implements FlexLexer {
@@ -161,26 +161,26 @@ class _JavaLexer implements FlexLexer {
"\1\27\1\30\1\31\1\32\1\33\1\34\1\35\1\36"+
"\1\37\1\40\1\41\1\42\1\43\1\0\1\44\1\45"+
"\3\46\2\0\3\6\1\46\1\0\1\47\1\50\1\51"+
- "\2\11\2\12\35\3\1\52\3\3\1\53\6\3\1\54"+
+ "\2\11\2\12\34\3\1\52\3\3\1\53\6\3\1\54"+
"\1\55\1\56\1\57\1\60\1\61\1\62\1\63\1\64"+
"\1\65\1\66\1\67\1\70\1\41\1\71\2\46\2\0"+
"\1\6\1\44\1\0\1\6\1\0\1\72\2\3\1\73"+
- "\10\3\1\74\13\3\1\75\12\3\1\76\14\3\1\77"+
+ "\10\3\1\74\13\3\1\75\11\3\1\76\14\3\1\77"+
"\1\0\2\71\4\0\1\46\2\0\1\100\2\3\1\101"+
- "\1\3\1\102\1\103\6\3\1\104\6\3\1\105\1\3"+
- "\1\106\2\3\1\107\1\3\1\110\3\3\1\111\6\3"+
- "\1\112\5\3\1\113\1\3\1\41\4\0\1\45\1\46"+
- "\1\3\1\114\2\3\1\115\1\116\1\117\4\3\1\120"+
- "\1\3\1\121\2\3\1\122\1\3\1\123\1\124\1\3"+
- "\1\125\13\3\1\126\1\3\1\127\1\130\2\3\1\131"+
- "\2\3\1\132\1\3\1\133\1\134\5\3\1\135\1\3"+
- "\1\136\2\3\1\137\3\3\1\140\1\141\3\3\1\142"+
- "\4\3\1\143\1\3\1\144\1\145\2\3\1\146\1\147"+
- "\1\3\1\150\4\3\1\151\1\152\1\3\1\153\2\3"+
- "\1\154\1\3\1\155\1\156\1\3\1\157";
+ "\1\3\1\102\1\103\6\3\1\104\6\3\1\105\3\3"+
+ "\1\106\1\3\1\107\3\3\1\110\6\3\1\111\5\3"+
+ "\1\112\1\3\1\41\4\0\1\45\1\46\1\3\1\113"+
+ "\2\3\1\114\1\115\1\116\4\3\1\117\1\3\1\120"+
+ "\2\3\1\121\1\3\1\122\1\123\1\3\1\124\13\3"+
+ "\1\125\1\3\1\126\1\127\2\3\1\130\2\3\1\131"+
+ "\1\3\1\132\1\133\5\3\1\134\1\3\1\135\2\3"+
+ "\1\136\3\3\1\137\1\140\3\3\1\141\4\3\1\142"+
+ "\1\3\1\143\1\144\2\3\1\145\1\146\1\3\1\147"+
+ "\4\3\1\150\1\151\1\3\1\152\2\3\1\153\1\3"+
+ "\1\154\1\155\1\3\1\156";
private static int [] zzUnpackAction() {
- int [] result = new int[345];
+ int [] result = new int[342];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -217,41 +217,40 @@ class _JavaLexer implements FlexLexer {
"\0\107\0\u0e25\0\u0e6c\0\u0eb3\0\u0efa\0\u0f41\0\u0f88\0\u0fcf"+
"\0\u1016\0\u105d\0\u10a4\0\u10eb\0\u1132\0\u1179\0\u11c0\0\u1207"+
"\0\u124e\0\u1295\0\u12dc\0\u1323\0\u136a\0\u13b1\0\u13f8\0\u143f"+
- "\0\u1486\0\u14cd\0\u1514\0\u155b\0\u15a2\0\u15e9\0\325\0\u1630"+
+ "\0\u1486\0\u14cd\0\u1514\0\u155b\0\u15a2\0\325\0\u15e9\0\u1630"+
"\0\u1677\0\u16be\0\u1705\0\u174c\0\u1793\0\u17da\0\u1821\0\u1868"+
- "\0\u18af\0\107\0\107\0\107\0\107\0\107\0\107\0\107"+
- "\0\u18f6\0\107\0\107\0\107\0\107\0\107\0\u193d\0\u1984"+
- "\0\u19cb\0\u1a12\0\u1a59\0\u1aa0\0\u1ae7\0\u1aa0\0\u1b2e\0\u1b75"+
- "\0\u1bbc\0\107\0\u1c03\0\u1c4a\0\325\0\u1c91\0\u1cd8\0\u1d1f"+
- "\0\u1d66\0\u1dad\0\u1df4\0\u1e3b\0\u1e82\0\325\0\u1ec9\0\u1f10"+
+ "\0\107\0\107\0\107\0\107\0\107\0\107\0\107\0\u18af"+
+ "\0\107\0\107\0\107\0\107\0\107\0\u18f6\0\u193d\0\u1984"+
+ "\0\u19cb\0\u1a12\0\u1a59\0\u1aa0\0\u1a59\0\u1ae7\0\u1b2e\0\u1b75"+
+ "\0\107\0\u1bbc\0\u1c03\0\325\0\u1c4a\0\u1c91\0\u1cd8\0\u1d1f"+
+ "\0\u1d66\0\u1dad\0\u1df4\0\u1e3b\0\325\0\u1e82\0\u1ec9\0\u1f10"+
"\0\u1f57\0\u1f9e\0\u1fe5\0\u202c\0\u2073\0\u20ba\0\u2101\0\u2148"+
- "\0\u218f\0\325\0\u21d6\0\u221d\0\u2264\0\u22ab\0\u22f2\0\u2339"+
+ "\0\325\0\u218f\0\u21d6\0\u221d\0\u2264\0\u22ab\0\u22f2\0\u2339"+
"\0\u2380\0\u23c7\0\u240e\0\u2455\0\u249c\0\u24e3\0\u252a\0\u2571"+
- "\0\u25b8\0\u25ff\0\u2646\0\u268d\0\u26d4\0\u271b\0\u2762\0\u27a9"+
- "\0\u27f0\0\107\0\u2837\0\u287e\0\107\0\u28c5\0\u290c\0\u2953"+
- "\0\u299a\0\u29e1\0\u2a28\0\u2a6f\0\325\0\u2ab6\0\u2afd\0\325"+
- "\0\u2b44\0\325\0\325\0\u2b8b\0\u2bd2\0\u2c19\0\u2c60\0\u2ca7"+
- "\0\u2cee\0\325\0\u2d35\0\u2d7c\0\u2dc3\0\u2e0a\0\u2e51\0\u2e98"+
- "\0\325\0\u2edf\0\325\0\u2f26\0\u2f6d\0\325\0\u2fb4\0\325"+
- "\0\u2ffb\0\u3042\0\u3089\0\325\0\u30d0\0\u3117\0\u315e\0\u31a5"+
- "\0\u31ec\0\u3233\0\325\0\u327a\0\u32c1\0\u3308\0\u334f\0\u3396"+
- "\0\325\0\u33dd\0\107\0\u3424\0\u346b\0\u34b2\0\u34f9\0\u290c"+
- "\0\u290c\0\u3540\0\u3587\0\u35ce\0\u3615\0\325\0\325\0\u365c"+
- "\0\u36a3\0\u36ea\0\u3731\0\u3778\0\325\0\u37bf\0\325\0\u3806"+
- "\0\u384d\0\325\0\u3894\0\325\0\325\0\u38db\0\325\0\u3922"+
- "\0\u3969\0\u39b0\0\u39f7\0\u3a3e\0\u3a85\0\u3acc\0\u3b13\0\u3b5a"+
- "\0\u3ba1\0\u3be8\0\325\0\u3c2f\0\325\0\325\0\u3c76\0\u3cbd"+
- "\0\325\0\u3d04\0\u3d4b\0\325\0\u3d92\0\325\0\325\0\u3dd9"+
- "\0\u3e20\0\u3e67\0\u3eae\0\u3ef5\0\325\0\u3f3c\0\325\0\u3f83"+
- "\0\u3fca\0\325\0\u4011\0\u4058\0\u409f\0\325\0\325\0\u40e6"+
- "\0\u412d\0\u4174\0\325\0\u41bb\0\u4202\0\u4249\0\u4290\0\325"+
- "\0\u42d7\0\325\0\325\0\u431e\0\u4365\0\325\0\325\0\u43ac"+
- "\0\325\0\u43f3\0\u443a\0\u4481\0\u44c8\0\325\0\325\0\u450f"+
- "\0\325\0\u4556\0\u459d\0\325\0\u45e4\0\325\0\325\0\u462b"+
- "\0\325";
+ "\0\u25b8\0\u25ff\0\u2646\0\u268d\0\u26d4\0\u271b\0\u2762\0\107"+
+ "\0\u27a9\0\u27f0\0\107\0\u2837\0\u287e\0\u28c5\0\u290c\0\u2953"+
+ "\0\u299a\0\u29e1\0\325\0\u2a28\0\u2a6f\0\325\0\u2ab6\0\325"+
+ "\0\325\0\u2afd\0\u2b44\0\u2b8b\0\u2bd2\0\u2c19\0\u2c60\0\325"+
+ "\0\u2ca7\0\u2cee\0\u2d35\0\u2d7c\0\u2dc3\0\u2e0a\0\325\0\u2e51"+
+ "\0\u2e98\0\u2edf\0\325\0\u2f26\0\325\0\u2f6d\0\u2fb4\0\u2ffb"+
+ "\0\325\0\u3042\0\u3089\0\u30d0\0\u3117\0\u315e\0\u31a5\0\325"+
+ "\0\u31ec\0\u3233\0\u327a\0\u32c1\0\u3308\0\325\0\u334f\0\107"+
+ "\0\u3396\0\u33dd\0\u3424\0\u346b\0\u287e\0\u287e\0\u34b2\0\u34f9"+
+ "\0\u3540\0\u3587\0\325\0\325\0\u35ce\0\u3615\0\u365c\0\u36a3"+
+ "\0\u36ea\0\325\0\u3731\0\325\0\u3778\0\u37bf\0\325\0\u3806"+
+ "\0\325\0\325\0\u384d\0\325\0\u3894\0\u38db\0\u3922\0\u3969"+
+ "\0\u39b0\0\u39f7\0\u3a3e\0\u3a85\0\u3acc\0\u3b13\0\u3b5a\0\325"+
+ "\0\u3ba1\0\325\0\325\0\u3be8\0\u3c2f\0\325\0\u3c76\0\u3cbd"+
+ "\0\325\0\u3d04\0\325\0\325\0\u3d4b\0\u3d92\0\u3dd9\0\u3e20"+
+ "\0\u3e67\0\325\0\u3eae\0\325\0\u3ef5\0\u3f3c\0\325\0\u3f83"+
+ "\0\u3fca\0\u4011\0\325\0\325\0\u4058\0\u409f\0\u40e6\0\325"+
+ "\0\u412d\0\u4174\0\u41bb\0\u4202\0\325\0\u4249\0\325\0\325"+
+ "\0\u4290\0\u42d7\0\325\0\325\0\u431e\0\325\0\u4365\0\u43ac"+
+ "\0\u43f3\0\u443a\0\325\0\325\0\u4481\0\325\0\u44c8\0\u450f"+
+ "\0\325\0\u4556\0\325\0\325\0\u459d\0\325";
private static int [] zzUnpackRowMap() {
- int [] result = new int[345];
+ int [] result = new int[342];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -308,349 +307,346 @@ class _JavaLexer implements FlexLexer {
"\1\0\1\4\1\0\1\4\4\0\1\127\1\4\1\130"+
"\12\4\1\131\1\132\7\4\1\133\1\4\27\0\2\4"+
"\3\0\13\4\1\0\1\4\1\0\1\4\4\0\2\4"+
- "\1\134\1\135\1\4\1\136\5\4\1\137\14\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\4\1\140\11\4\1\141\1\4\1\142\12\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\5\4\1\143\1\144\4\4\1\145\2\4\1\146\11\4"+
+ "\1\134\1\135\1\4\1\136\22\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\137"+
+ "\11\4\1\140\1\4\1\141\12\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\5\4\1\142"+
+ "\1\143\4\4\1\144\2\4\1\145\11\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\4\4"+
+ "\1\146\3\4\1\147\10\4\1\150\6\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\151\7\4\1\152\14\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\13\4\1\153\14\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\4\4\1\147\3\4\1\150\10\4\1\151\6\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\152\7\4\1\153\14\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\13\4"+
- "\1\154\14\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\4\1\155\1\156\2\4\1\157"+
- "\22\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\13\4\1\160\14\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\16\4\1\161"+
- "\11\4\107\0\1\162\106\0\1\163\106\0\1\164\1\0"+
- "\1\165\104\0\1\166\2\0\1\167\103\0\1\170\3\0"+
- "\1\171\102\0\1\172\5\0\1\173\100\0\1\174\106\0"+
- "\1\175\131\0\1\176\1\0\6\62\1\0\17\62\1\0"+
- "\60\62\5\177\1\200\101\177\7\0\1\7\1\66\1\7"+
- "\1\0\2\7\101\0\1\101\1\0\1\101\1\0\2\101"+
- "\3\0\1\70\1\71\1\0\1\73\11\0\1\73\1\70"+
- "\13\0\1\71\43\0\1\201\1\0\1\201\1\0\2\201"+
- "\3\0\1\70\1\71\2\0\1\202\11\0\1\70\13\0"+
- "\1\71\12\0\1\202\30\0\1\74\1\203\1\74\1\0"+
- "\2\74\3\0\1\70\1\71\1\72\1\73\11\0\1\73"+
- "\1\70\13\0\1\71\43\0\1\74\1\75\1\76\1\0"+
- "\2\76\101\0\1\74\1\75\1\76\1\0\2\76\2\0"+
- "\1\67\1\70\1\71\1\72\1\73\11\0\1\73\1\70"+
- "\1\0\1\67\11\0\1\71\34\0\7\204\1\205\1\204"+
- "\4\205\1\204\1\205\1\206\2\205\1\204\1\205\1\204"+
- "\1\207\1\0\6\204\3\205\1\206\2\204\2\205\5\204"+
- "\1\205\3\204\1\207\30\204\13\0\2\210\2\0\1\67"+
- "\20\0\1\67\55\0\1\101\1\211\1\101\1\0\2\101"+
- "\3\0\1\70\1\71\1\0\1\73\11\0\1\73\1\70"+
- "\13\0\1\71\56\0\1\212\64\0\6\13\1\0\17\13"+
- "\1\0\60\13\6\14\1\0\17\14\1\0\60\14\2\0"+
+ "\4\0\1\4\1\154\1\155\2\4\1\156\22\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\2\4\1\213\2\4\1\214\7\4\1\215\12\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\4\1\216\15\4\1\217\10\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\220\27\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\7\4\1\221\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\2\4\1\222\25\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\223\27\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\6\4\1\224\21\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\13\4\1\225\14\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\4\1\226\26\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\10\4\1\227\17\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\7\4\1\230\20\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\7\4\1\231\20\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\10\4\1\232\17\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\4\1\233\3\4\1\234\22\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\24\4\1\235"+
- "\3\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\10\4\1\236\17\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\13\4\1\237"+
+ "\13\4\1\157\14\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\16\4\1\160\11\4\107\0"+
+ "\1\161\106\0\1\162\106\0\1\163\1\0\1\164\104\0"+
+ "\1\165\2\0\1\166\103\0\1\167\3\0\1\170\102\0"+
+ "\1\171\5\0\1\172\100\0\1\173\106\0\1\174\131\0"+
+ "\1\175\1\0\6\62\1\0\17\62\1\0\60\62\5\176"+
+ "\1\177\101\176\7\0\1\7\1\66\1\7\1\0\2\7"+
+ "\101\0\1\101\1\0\1\101\1\0\2\101\3\0\1\70"+
+ "\1\71\1\0\1\73\11\0\1\73\1\70\13\0\1\71"+
+ "\43\0\1\200\1\0\1\200\1\0\2\200\3\0\1\70"+
+ "\1\71\2\0\1\201\11\0\1\70\13\0\1\71\12\0"+
+ "\1\201\30\0\1\74\1\202\1\74\1\0\2\74\3\0"+
+ "\1\70\1\71\1\72\1\73\11\0\1\73\1\70\13\0"+
+ "\1\71\43\0\1\74\1\75\1\76\1\0\2\76\101\0"+
+ "\1\74\1\75\1\76\1\0\2\76\2\0\1\67\1\70"+
+ "\1\71\1\72\1\73\11\0\1\73\1\70\1\0\1\67"+
+ "\11\0\1\71\34\0\7\203\1\204\1\203\4\204\1\203"+
+ "\1\204\1\205\2\204\1\203\1\204\1\203\1\206\1\0"+
+ "\6\203\3\204\1\205\2\203\2\204\5\203\1\204\3\203"+
+ "\1\206\30\203\13\0\2\207\2\0\1\67\20\0\1\67"+
+ "\55\0\1\101\1\210\1\101\1\0\2\101\3\0\1\70"+
+ "\1\71\1\0\1\73\11\0\1\73\1\70\13\0\1\71"+
+ "\56\0\1\211\64\0\6\13\1\0\17\13\1\0\60\13"+
+ "\6\14\1\0\17\14\1\0\60\14\2\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\2\4\1\212"+
+ "\2\4\1\213\7\4\1\214\12\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\215"+
+ "\15\4\1\216\10\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\1\217\27\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
+ "\1\220\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\2\4\1\221\25\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\222"+
+ "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\6\4\1\223\21\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\13\4\1\224"+
"\14\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\17\4\1\240\10\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\6\4\1\241"+
- "\21\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\26\4\1\242\1\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\243\27\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\10\4\1\244\17\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\245\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\13\4\1\246\14\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\247\27\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\250\6\4\1\251\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\5\4\1\252\22\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\10\4\1\253\17\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\5\4\1\254\22\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\255\6\4\1\256\20\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\24\4\1\257"+
- "\3\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\4\4\1\260\23\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\2\4\1\261"+
- "\25\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\262\27\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\13\4\1\263\3\4"+
- "\1\264\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\11\4\1\265\16\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
- "\1\266\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\6\4\1\267\10\4\1\270\10\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\17\4\1\271\10\4\107\0\1\272\24\0\5\177"+
- "\1\273\101\177\4\274\1\275\1\200\101\274\7\0\1\201"+
- "\1\276\1\201\1\0\2\201\3\0\1\70\1\71\14\0"+
- "\1\70\13\0\1\71\43\0\1\201\1\0\1\201\1\0"+
- "\2\201\3\0\1\70\1\71\14\0\1\70\13\0\1\71"+
- "\43\0\1\74\1\203\1\74\1\0\2\74\101\0\1\277"+
- "\1\0\4\277\1\0\1\277\1\0\2\277\1\0\1\277"+
- "\1\0\1\300\7\0\3\277\3\0\2\277\5\0\1\277"+
- "\3\0\1\300\30\0\7\204\1\205\1\301\4\205\1\204"+
- "\1\205\1\206\2\205\1\204\1\205\1\204\1\207\1\0"+
- "\6\204\3\205\1\206\2\204\2\205\5\204\1\205\3\204"+
- "\1\207\30\204\7\0\1\302\1\0\1\302\1\277\2\302"+
- "\1\0\1\277\1\0\2\277\1\0\1\277\1\303\1\300"+
- "\7\0\3\277\3\0\2\277\5\0\1\277\3\0\1\300"+
- "\6\0\1\303\31\0\1\304\2\0\2\210\2\0\1\67"+
- "\20\0\1\67\55\0\1\101\1\211\1\101\1\0\2\101"+
- "\74\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\305\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\10\4\1\306\17\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\13\4\1\307\14\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\7\4\1\310\20\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\2\4\1\311\25\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\312\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\21\4\1\313\6\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\314\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\7\4\1\315\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\5\4\1\316\22\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\5\4\1\317\22\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\320\24\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\321\27\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\23\4\1\322\4\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\17\4\1\323\10\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\324\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\325\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\12\4\1\326\15\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\4"+
- "\1\327\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\330\27\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\6\4\1\331"+
- "\21\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\17\4\1\332\10\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\3\4\1\333"+
- "\24\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\5\4\1\334\22\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\6\4\1\335"+
- "\21\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\336\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\12\4\1\337"+
- "\15\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\340\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\7\4\1\341"+
- "\20\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\342\6\4\1\343\20\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\4"+
- "\1\344\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\345\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\346"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\6\4\1\347\4\4\1\350\14\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\5\4\1\351\22\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\11\4\1\352\16\4\27\0"+
- "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\13\4\1\353\14\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\354\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\25\4"+
- "\1\355\2\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\6\4\1\356\21\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\14\4"+
- "\1\357\13\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\360\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\20\4"+
- "\1\361\7\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\6\4\1\362\21\4\25\0\4\177"+
- "\1\363\1\273\101\177\5\274\1\364\101\274\7\0\1\201"+
- "\1\276\1\201\1\0\2\201\101\0\1\277\1\365\4\277"+
- "\1\0\1\277\1\0\2\277\1\0\1\277\1\0\1\300"+
- "\7\0\3\277\3\0\2\277\5\0\1\277\3\0\1\300"+
- "\37\0\1\201\1\0\1\201\1\0\2\201\7\0\1\303"+
- "\40\0\1\303\30\0\1\205\1\366\4\205\1\0\1\205"+
- "\1\0\2\205\1\0\1\205\1\0\1\300\7\0\3\205"+
- "\3\0\2\205\5\0\1\205\3\0\1\300\37\0\1\302"+
- "\1\367\1\302\1\277\2\302\1\0\1\277\1\0\1\370"+
- "\1\371\1\0\1\277\1\0\1\300\7\0\1\277\1\370"+
- "\1\277\3\0\2\277\5\0\1\371\3\0\1\300\37\0"+
- "\1\201\1\0\1\201\1\0\2\201\102\0\1\304\2\0"+
- "\2\210\74\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\7\4\1\372\20\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\26\4\1\373"+
- "\1\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\4\1\374\26\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\10\4\1\375"+
+ "\1\4\4\0\1\4\1\225\26\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\10\4\1\226"+
"\17\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\376\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\377\27\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\6\4\1\u0100\21\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\4\1\u0101\26\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\4\1\u0102\26\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\12\4\1\u0103\15\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\17\4\1\u0104\10\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\4\1\u0105\26\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\16\4\1\u0106\11\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\1\u0107\27\4\27\0"+
+ "\1\4\4\0\7\4\1\227\20\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\7\4\1\230"+
+ "\20\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\10\4\1\231\17\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\1\4\1\232"+
+ "\3\4\1\233\22\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\24\4\1\234\3\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\12\4\1\u0108\15\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\25\4\1\u0109\2\4\27\0"+
+ "\10\4\1\235\17\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\13\4\1\236\14\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\14\4\1\u010a\13\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\3\4\1\u010b\24\4\27\0"+
+ "\17\4\1\237\10\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\6\4\1\240\21\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\16\4\1\u010c\11\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\7\4\1\u010d\20\4\27\0"+
+ "\26\4\1\241\1\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\1\242\27\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\243\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\13\4\1\244\14\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\245"+
+ "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\1\246\6\4\1\247\20\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
+ "\1\250\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\10\4\1\251\17\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
+ "\1\252\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\1\253\6\4\1\254\20\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\17\4\1\u010e\10\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\u010f\27\4\27\0\2\4"+
+ "\24\4\1\255\3\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\4\4\1\256\23\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\2\4\1\257\25\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\1\260\27\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\13\4"+
+ "\1\261\3\4\1\262\10\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\11\4\1\263\16\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\12\4\1\264\15\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\6\4\1\265\10\4"+
+ "\1\266\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\17\4\1\267\10\4\107\0\1\270"+
+ "\24\0\5\176\1\271\101\176\4\272\1\273\1\177\101\272"+
+ "\7\0\1\200\1\274\1\200\1\0\2\200\3\0\1\70"+
+ "\1\71\14\0\1\70\13\0\1\71\43\0\1\200\1\0"+
+ "\1\200\1\0\2\200\3\0\1\70\1\71\14\0\1\70"+
+ "\13\0\1\71\43\0\1\74\1\202\1\74\1\0\2\74"+
+ "\101\0\1\275\1\0\4\275\1\0\1\275\1\0\2\275"+
+ "\1\0\1\275\1\0\1\276\7\0\3\275\3\0\2\275"+
+ "\5\0\1\275\3\0\1\276\30\0\7\203\1\204\1\277"+
+ "\4\204\1\203\1\204\1\205\2\204\1\203\1\204\1\203"+
+ "\1\206\1\0\6\203\3\204\1\205\2\203\2\204\5\203"+
+ "\1\204\3\203\1\206\30\203\7\0\1\300\1\0\1\300"+
+ "\1\275\2\300\1\0\1\275\1\0\2\275\1\0\1\275"+
+ "\1\301\1\276\7\0\3\275\3\0\2\275\5\0\1\275"+
+ "\3\0\1\276\6\0\1\301\31\0\1\302\2\0\2\207"+
+ "\2\0\1\67\20\0\1\67\55\0\1\101\1\210\1\101"+
+ "\1\0\2\101\74\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\3\4\1\303\24\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\10\4"+
+ "\1\304\17\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\13\4\1\305\14\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
+ "\1\306\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\2\4\1\307\25\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\310\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\21\4\1\311\6\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\312\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\7\4\1\313\20\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\5\4"+
+ "\1\314\22\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\5\4\1\315\22\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\316\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\1\317\27\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\23\4\1\320"+
+ "\4\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\17\4\1\321\10\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\1\322\27\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\3\4\1\323\24\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\12\4\1\324\15\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\1\4\1\325\26\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\326\27\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\6\4\1\327\21\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\17\4\1\330\10\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\5\4\1\331\22\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\6\4\1\332\21\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\333\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\12\4\1\334\15\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\335\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\7\4\1\336\20\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\1\337\6\4\1\340\20\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\4\1\341\26\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\3\4\1\342\24\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\343\27\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\6\4\1\344\4\4\1\345\14\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\5\4\1\346"+
+ "\22\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\11\4\1\347\16\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\13\4\1\350"+
+ "\14\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\1\351\27\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\25\4\1\352\2\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\6\4\1\353\21\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\14\4\1\354\13\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\5\4\1\355\22\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\20\4\1\356\7\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\6\4\1\357\21\4\25\0\4\176\1\360\1\271"+
+ "\101\176\5\272\1\361\101\272\7\0\1\200\1\274\1\200"+
+ "\1\0\2\200\101\0\1\275\1\362\4\275\1\0\1\275"+
+ "\1\0\2\275\1\0\1\275\1\0\1\276\7\0\3\275"+
+ "\3\0\2\275\5\0\1\275\3\0\1\276\37\0\1\200"+
+ "\1\0\1\200\1\0\2\200\7\0\1\301\40\0\1\301"+
+ "\30\0\1\204\1\363\4\204\1\0\1\204\1\0\2\204"+
+ "\1\0\1\204\1\0\1\276\7\0\3\204\3\0\2\204"+
+ "\5\0\1\204\3\0\1\276\37\0\1\300\1\364\1\300"+
+ "\1\275\2\300\1\0\1\275\1\0\1\365\1\366\1\0"+
+ "\1\275\1\0\1\276\7\0\1\275\1\365\1\275\3\0"+
+ "\2\275\5\0\1\366\3\0\1\276\37\0\1\200\1\0"+
+ "\1\200\1\0\2\200\102\0\1\302\2\0\2\207\74\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\7\4\1\367\20\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\26\4\1\370\1\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\1\4\1\371\26\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\10\4\1\372\17\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\373\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\1\374\27\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\6\4"+
+ "\1\375\21\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\1\4\1\376\26\4\27\0\2\4"+
"\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\4"+
- "\1\u0110\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\u0111\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\u0112\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\1\4\1\u0113\26\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\2\4"+
- "\1\u0114\25\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\6\4\1\u0115\21\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\u0116\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\u0117\22\4\27\0\2\4"+
+ "\1\377\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\12\4\1\u0100\15\4\27\0\2\4"+
"\3\0\13\4\1\0\1\4\1\0\1\4\4\0\17\4"+
- "\1\u0118\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\u0119\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u011a"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\u011b\24\4\25\0\4\274\1\275"+
- "\1\364\101\274\7\0\1\277\1\365\4\277\1\0\1\277"+
- "\1\0\2\277\1\0\1\277\11\0\3\277\3\0\2\277"+
- "\5\0\1\277\43\0\1\205\1\366\4\205\1\0\1\205"+
- "\1\0\2\205\1\0\1\205\11\0\3\205\3\0\2\205"+
- "\5\0\1\205\43\0\1\302\1\367\1\302\1\277\2\302"+
- "\1\0\1\277\1\0\2\277\1\0\1\277\11\0\3\277"+
- "\3\0\2\277\5\0\1\277\36\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\17\4\1\u011c\10\4"+
+ "\1\u0101\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\1\4\1\u0102\26\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\16\4"+
+ "\1\u0103\11\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\1\u0104\27\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\12\4\1\u0105"+
+ "\15\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\25\4\1\u0106\2\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\14\4\1\u0107"+
+ "\13\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\3\4\1\u0108\24\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\16\4\1\u0109"+
+ "\11\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\7\4\1\u010a\20\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\17\4\1\u010b"+
+ "\10\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\1\u010c\27\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\4\1\u010d\26\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\7\4\1\u011d\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\10\4\1\u011e\17\4"+
+ "\4\0\5\4\1\u010e\22\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\3\4\1\u010f\24\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\20\4\1\u011f\7\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\6\4\1\u0120\21\4"+
+ "\4\0\1\4\1\u0110\26\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\2\4\1\u0111\25\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\u0121\27\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\5\4\1\u0122\22\4\27\0"+
+ "\4\0\6\4\1\u0112\21\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\3\4\1\u0113\24\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\5\4\1\u0114\22\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\17\4\1\u0115\10\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\5\4\1\u0116\22\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\u0117\27\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\1\u0123\27\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\12\4\1\u0124\15\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\4"+
- "\1\u0125\26\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\16\4\1\u0126\11\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\u0127\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\5\4\1\u0128\22\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\10\4"+
- "\1\u0129\17\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\4\4\1\u012a\23\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\10\4"+
- "\1\u012b\17\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\21\4\1\u012c\6\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u012d"+
+ "\3\4\1\u0118\24\4\25\0\4\272\1\273\1\361\101\272"+
+ "\7\0\1\275\1\362\4\275\1\0\1\275\1\0\2\275"+
+ "\1\0\1\275\11\0\3\275\3\0\2\275\5\0\1\275"+
+ "\43\0\1\204\1\363\4\204\1\0\1\204\1\0\2\204"+
+ "\1\0\1\204\11\0\3\204\3\0\2\204\5\0\1\204"+
+ "\43\0\1\300\1\364\1\300\1\275\2\300\1\0\1\275"+
+ "\1\0\2\275\1\0\1\275\11\0\3\275\3\0\2\275"+
+ "\5\0\1\275\36\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\17\4\1\u0119\10\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
+ "\1\u011a\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\10\4\1\u011b\17\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\20\4"+
+ "\1\u011c\7\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\6\4\1\u011d\21\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u011e"+
"\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\6\4\1\u012e\21\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\3\4\1\u012f"+
- "\24\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\12\4\1\u0130\15\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\1\u0131\27\4"+
+ "\1\4\4\0\5\4\1\u011f\22\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\1\u0120\27\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\12\4\1\u0132\15\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\23\4\1\u0133\4\4"+
+ "\4\0\12\4\1\u0121\15\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\4\1\u0122\26\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\17\4\1\u0134\10\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\3\4\1\u0135\24\4"+
+ "\4\0\16\4\1\u0123\11\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\3\4\1\u0124\24\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\7\4\1\u0136\20\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\15\4\1\u0137\12\4"+
+ "\4\0\5\4\1\u0125\22\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\10\4\1\u0126\17\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\12\4\1\u0138\15\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\4\4\1\u0139\23\4"+
+ "\4\0\4\4\1\u0127\23\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\10\4\1\u0128\17\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\13\4\1\u013a\14\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\10\4\1\u013b\17\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\2\4\1\u013c\25\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\5\4\1\u013d\22\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\12\4\1\u013e\15\4\27\0\2\4\3\0\13\4"+
+ "\4\0\21\4\1\u0129\6\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\u012a\27\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\6\4\1\u012b\21\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\3\4\1\u012c\24\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\12\4\1\u012d\15\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\1\u012e\27\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
+ "\1\u012f\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\23\4\1\u0130\4\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\17\4"+
+ "\1\u0131\10\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\3\4\1\u0132\24\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
+ "\1\u0133\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\15\4\1\u0134\12\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
+ "\1\u0135\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\4\4\1\u0136\23\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\13\4"+
+ "\1\u0137\14\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\10\4\1\u0138\17\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\2\4"+
+ "\1\u0139\25\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\5\4\1\u013a\22\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\12\4"+
+ "\1\u013b\15\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\3\4\1\u013c\24\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u013d"+
+ "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\1\u013e\27\4\27\0\2\4\3\0\13\4"+
"\1\0\1\4\1\0\1\4\4\0\3\4\1\u013f\24\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\u0140\27\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\1\u0141\27\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
- "\1\u0142\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\u0143\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\6\4"+
- "\1\u0144\21\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\10\4\1\u0145\17\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u0146"+
- "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\24\4\1\u0147\3\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\10\4\1\u0148"+
- "\17\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\u0149\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\12\4\1\u014a"+
- "\15\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\u014b\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\10\4\1\u014c"+
- "\17\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\3\4\1\u014d\24\4\27\0\2\4\3\0"+
- "\13\4\1\0\1\4\1\0\1\4\4\0\3\4\1\u014e"+
- "\24\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
- "\1\4\4\0\1\u014f\27\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\17\4\1\u0150\10\4"+
+ "\4\0\3\4\1\u0140\24\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\6\4\1\u0141\21\4"+
"\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\3\4\1\u0151\24\4\27\0\2\4\3\0\13\4"+
- "\1\0\1\4\1\0\1\4\4\0\13\4\1\u0152\14\4"+
- "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
- "\4\0\1\u0153\27\4\27\0\2\4\3\0\13\4\1\0"+
- "\1\4\1\0\1\4\4\0\20\4\1\u0154\7\4\27\0"+
+ "\4\0\10\4\1\u0142\17\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\1\u0143\27\4\27\0"+
"\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
- "\27\4\1\u0155\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\4\4\1\u0156\23\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\7\4"+
- "\1\u0157\20\4\27\0\2\4\3\0\13\4\1\0\1\4"+
- "\1\0\1\4\4\0\3\4\1\u0158\24\4\27\0\2\4"+
- "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\20\4"+
- "\1\u0159\7\4\25\0";
+ "\24\4\1\u0144\3\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\10\4\1\u0145\17\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\u0146\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\12\4\1\u0147\15\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\u0148\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\10\4\1\u0149\17\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\3\4\1\u014a\24\4\27\0\2\4\3\0\13\4\1\0"+
+ "\1\4\1\0\1\4\4\0\3\4\1\u014b\24\4\27\0"+
+ "\2\4\3\0\13\4\1\0\1\4\1\0\1\4\4\0"+
+ "\1\u014c\27\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\17\4\1\u014d\10\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\3\4"+
+ "\1\u014e\24\4\27\0\2\4\3\0\13\4\1\0\1\4"+
+ "\1\0\1\4\4\0\13\4\1\u014f\14\4\27\0\2\4"+
+ "\3\0\13\4\1\0\1\4\1\0\1\4\4\0\1\u0150"+
+ "\27\4\27\0\2\4\3\0\13\4\1\0\1\4\1\0"+
+ "\1\4\4\0\20\4\1\u0151\7\4\27\0\2\4\3\0"+
+ "\13\4\1\0\1\4\1\0\1\4\4\0\27\4\1\u0152"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\4\4\1\u0153\23\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\7\4\1\u0154\20\4"+
+ "\27\0\2\4\3\0\13\4\1\0\1\4\1\0\1\4"+
+ "\4\0\3\4\1\u0155\24\4\27\0\2\4\3\0\13\4"+
+ "\1\0\1\4\1\0\1\4\4\0\20\4\1\u0156\7\4"+
+ "\25\0";
private static int [] zzUnpackTrans() {
- int [] result = new int[18034];
+ int [] result = new int[17892];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -693,13 +689,13 @@ class _JavaLexer implements FlexLexer {
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\37\1\1\11\3\1\12\11\1\1\1\11"+
"\2\1\2\11\1\0\3\11\2\1\2\0\4\1\1\0"+
- "\4\11\2\1\1\11\50\1\7\11\1\1\5\11\4\1"+
- "\2\0\2\1\1\0\1\1\1\0\1\11\57\1\1\11"+
- "\1\0\1\1\1\11\4\0\1\1\2\0\56\1\1\11"+
+ "\4\11\2\1\1\11\47\1\7\11\1\1\5\11\4\1"+
+ "\2\0\2\1\1\0\1\1\1\0\1\11\56\1\1\11"+
+ "\1\0\1\1\1\11\4\0\1\1\2\0\55\1\1\11"+
"\4\0\142\1";
private static int [] zzUnpackAttribute() {
- int [] result = new int[345];
+ int [] result = new int[342];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -760,13 +756,11 @@ class _JavaLexer implements FlexLexer {
/* user code: */
private boolean myAssertKeyword;
private boolean myEnumKeyword;
- private boolean myNoneKeyword;
public _JavaLexer(LanguageLevel level) {
this((java.io.Reader)null);
myAssertKeyword = level.isAtLeast(LanguageLevel.JDK_1_4);
myEnumKeyword = level.isAtLeast(LanguageLevel.JDK_1_5);
- myNoneKeyword = level.isAtLeast(LanguageLevel.JDK_1_8);
}
public void goTo(int offset) {
@@ -1025,447 +1019,443 @@ class _JavaLexer implements FlexLexer {
case 68:
{ return JavaTokenType.LONG_KEYWORD;
}
- case 112: break;
- case 100:
+ case 111: break;
+ case 99:
{ return JavaTokenType.PRIVATE_KEYWORD;
}
- case 113: break;
+ case 112: break;
case 27:
{ return JavaTokenType.COMMA;
}
- case 114: break;
+ case 113: break;
case 23:
{ return JavaTokenType.RBRACE;
}
- case 115: break;
+ case 114: break;
case 22:
{ return JavaTokenType.LBRACE;
}
- case 116: break;
+ case 115: break;
case 65:
{ return JavaTokenType.THIS_KEYWORD;
}
- case 117: break;
- case 84:
+ case 116: break;
+ case 83:
{ return JavaTokenType.CLASS_KEYWORD;
}
- case 118: break;
+ case 117: break;
case 14:
{ return JavaTokenType.PLUS;
}
- case 119: break;
+ case 118: break;
case 54:
{ return JavaTokenType.XOREQ;
}
- case 120: break;
+ case 119: break;
case 62:
{ return JavaTokenType.INT_KEYWORD;
}
- case 121: break;
- case 81:
+ case 120: break;
+ case 80:
{ return JavaTokenType.SHORT_KEYWORD;
}
- case 122: break;
+ case 121: break;
case 44:
{ return JavaTokenType.EQEQ;
}
- case 123: break;
+ case 122: break;
case 67:
{ return myEnumKeyword ? JavaTokenType.ENUM_KEYWORD : JavaTokenType.IDENTIFIER;
}
- case 124: break;
- case 102:
+ case 123: break;
+ case 101:
{ return JavaTokenType.ABSTRACT_KEYWORD;
}
- case 125: break;
+ case 124: break;
case 69:
{ return JavaTokenType.NULL_KEYWORD;
}
- case 126: break;
- case 96:
+ case 125: break;
+ case 95:
{ return JavaTokenType.EXTENDS_KEYWORD;
}
- case 127: break;
+ case 126: break;
case 51:
{ return JavaTokenType.LTLT;
}
- case 128: break;
+ case 127: break;
case 20:
{ return JavaTokenType.LPARENTH;
}
- case 129: break;
+ case 128: break;
case 12:
{ return JavaTokenType.EXCL;
}
- case 130: break;
- case 103:
+ case 129: break;
+ case 102:
{ return JavaTokenType.STRICTFP_KEYWORD;
}
- case 131: break;
+ case 130: break;
case 34:
{ return JavaTokenType.DIVEQ;
}
- case 132: break;
- case 90:
+ case 131: break;
+ case 89:
{ return JavaTokenType.STATIC_KEYWORD;
}
- case 133: break;
+ case 132: break;
case 39:
{ return JavaTokenType.MINUSMINUS;
}
- case 134: break;
- case 77:
+ case 133: break;
+ case 76:
{ return JavaTokenType.FALSE_KEYWORD;
}
- case 135: break;
+ case 134: break;
case 1:
{ return JavaTokenType.BAD_CHARACTER;
}
- case 136: break;
- case 91:
+ case 135: break;
+ case 90:
{ return JavaTokenType.SWITCH_KEYWORD;
}
- case 137: break;
+ case 136: break;
case 26:
{ return JavaTokenType.SEMICOLON;
}
- case 138: break;
+ case 137: break;
case 18:
{ return JavaTokenType.XOR;
}
- case 139: break;
+ case 138: break;
case 38:
{ return JavaTokenType.DOUBLE_LITERAL;
}
- case 140: break;
+ case 139: break;
case 46:
{ return JavaTokenType.OREQ;
}
- case 141: break;
+ case 140: break;
case 11:
{ return JavaTokenType.EQ;
}
- case 142: break;
+ case 141: break;
case 4:
{ return JavaTokenType.DIV;
}
- case 143: break;
+ case 142: break;
case 66:
{ return JavaTokenType.ELSE_KEYWORD;
}
- case 144: break;
+ case 143: break;
case 61:
{ return JavaTokenType.NEW_KEYWORD;
}
- case 145: break;
+ case 144: break;
case 58:
{ return JavaTokenType.ELLIPSIS;
}
- case 146: break;
+ case 145: break;
case 53:
{ return JavaTokenType.ANDAND;
}
- case 147: break;
- case 82:
+ case 146: break;
+ case 81:
{ return JavaTokenType.BREAK_KEYWORD;
}
- case 148: break;
+ case 147: break;
case 9:
{ return JavaTokenType.CHARACTER_LITERAL;
}
- case 149: break;
+ case 148: break;
case 52:
{ return JavaTokenType.ANDEQ;
}
- case 150: break;
+ case 149: break;
case 6:
{ return JavaTokenType.INTEGER_LITERAL;
}
- case 151: break;
- case 78:
+ case 150: break;
+ case 77:
{ return JavaTokenType.FLOAT_KEYWORD;
}
- case 152: break;
+ case 151: break;
case 10:
{ return JavaTokenType.STRING_LITERAL;
}
- case 153: break;
- case 73:
+ case 152: break;
+ case 72:
{ return JavaTokenType.CHAR_KEYWORD;
}
- case 154: break;
- case 92:
+ case 153: break;
+ case 91:
{ return JavaTokenType.NATIVE_KEYWORD;
}
- case 155: break;
+ case 154: break;
case 43:
{ return JavaTokenType.DO_KEYWORD;
}
- case 156: break;
+ case 155: break;
case 7:
{ return JavaTokenType.DOT;
}
- case 157: break;
+ case 156: break;
case 28:
{ return JavaTokenType.TILDE;
}
- case 158: break;
- case 111:
+ case 157: break;
+ case 110:
{ return JavaTokenType.SYNCHRONIZED_KEYWORD;
}
- case 159: break;
+ case 158: break;
case 32:
{ return JavaTokenType.END_OF_LINE_COMMENT;
}
- case 160: break;
+ case 159: break;
case 35:
{ return JavaTokenType.ASTERISKEQ;
}
- case 161: break;
- case 80:
+ case 160: break;
+ case 79:
{ return JavaTokenType.SUPER_KEYWORD;
}
- case 162: break;
+ case 161: break;
case 40:
{ return JavaTokenType.MINUSEQ;
}
- case 163: break;
+ case 162: break;
case 63:
{ return JavaTokenType.LTLTEQ;
}
- case 164: break;
- case 74:
+ case 163: break;
+ case 73:
{ return JavaTokenType.GOTO_KEYWORD;
}
- case 165: break;
+ case 164: break;
case 25:
{ return JavaTokenType.RBRACKET;
}
- case 166: break;
+ case 165: break;
case 33:
{ return JavaTokenType.C_STYLE_COMMENT;
}
- case 167: break;
+ case 166: break;
case 15:
{ return JavaTokenType.LT;
}
- case 168: break;
+ case 167: break;
case 42:
{ return JavaTokenType.IF_KEYWORD;
}
- case 169: break;
+ case 168: break;
case 8:
{ return JavaTokenType.MINUS;
}
- case 170: break;
- case 86:
+ case 169: break;
+ case 85:
{ return JavaTokenType.WHILE_KEYWORD;
}
- case 171: break;
- case 71:
+ case 170: break;
+ case 70:
{ return JavaTokenType.BYTE_KEYWORD;
}
- case 172: break;
- case 97:
+ case 171: break;
+ case 96:
{ return JavaTokenType.FINALLY_KEYWORD;
}
- case 173: break;
- case 75:
+ case 172: break;
+ case 74:
{ return JavaTokenType.VOID_KEYWORD;
}
- case 174: break;
+ case 173: break;
case 29:
{ return JavaTokenType.QUEST;
}
- case 175: break;
+ case 174: break;
case 19:
{ return JavaTokenType.PERC;
}
- case 176: break;
- case 110:
+ case 175: break;
+ case 109:
{ return JavaTokenType.IMPLEMENTS_KEYWORD;
}
- case 177: break;
- case 87:
+ case 176: break;
+ case 86:
{ return JavaTokenType.THROWS_KEYWORD;
}
- case 178: break;
+ case 177: break;
case 41:
{ return JavaTokenType.ARROW;
}
- case 179: break;
- case 79:
+ case 178: break;
+ case 78:
{ return JavaTokenType.FINAL_KEYWORD;
}
- case 180: break;
- case 94:
+ case 179: break;
+ case 93:
{ return JavaTokenType.DOUBLE_KEYWORD;
}
- case 181: break;
- case 89:
+ case 180: break;
+ case 88:
{ return myAssertKeyword ? JavaTokenType.ASSERT_KEYWORD : JavaTokenType.IDENTIFIER;
}
- case 182: break;
- case 108:
+ case 181: break;
+ case 107:
{ return JavaTokenType.PROTECTED_KEYWORD;
}
- case 183: break;
- case 104:
+ case 182: break;
+ case 103:
{ return JavaTokenType.CONTINUE_KEYWORD;
}
- case 184: break;
- case 101:
+ case 183: break;
+ case 100:
{ return JavaTokenType.PACKAGE_KEYWORD;
}
- case 185: break;
- case 70:
- { return myNoneKeyword ? JavaTokenType.NONE_KEYWORD : JavaTokenType.IDENTIFIER;
- }
- case 186: break;
+ case 184: break;
case 16:
{ return JavaTokenType.GT;
}
- case 187: break;
+ case 185: break;
case 24:
{ return JavaTokenType.LBRACKET;
}
- case 188: break;
+ case 186: break;
case 36:
{ return JavaTokenType.LONG_LITERAL;
}
- case 189: break;
+ case 187: break;
case 60:
{ return JavaTokenType.FOR_KEYWORD;
}
- case 190: break;
- case 99:
+ case 188: break;
+ case 98:
{ return JavaTokenType.DEFAULT_KEYWORD;
}
- case 191: break;
+ case 189: break;
case 48:
{ return JavaTokenType.PLUSEQ;
}
- case 192: break;
- case 88:
+ case 190: break;
+ case 87:
{ return JavaTokenType.RETURN_KEYWORD;
}
- case 193: break;
+ case 191: break;
case 64:
{ return JavaTokenType.TRUE_KEYWORD;
}
- case 194: break;
+ case 192: break;
case 49:
{ return JavaTokenType.PLUSPLUS;
}
- case 195: break;
+ case 193: break;
case 47:
{ return JavaTokenType.OROR;
}
- case 196: break;
+ case 194: break;
case 13:
{ return JavaTokenType.OR;
}
- case 197: break;
+ case 195: break;
case 3:
{ return JavaTokenType.IDENTIFIER;
}
- case 198: break;
+ case 196: break;
case 55:
{ return JavaTokenType.PERCEQ;
}
- case 199: break;
+ case 197: break;
case 30:
{ return JavaTokenType.COLON;
}
- case 200: break;
- case 105:
+ case 198: break;
+ case 104:
{ return JavaTokenType.VOLATILE_KEYWORD;
}
- case 201: break;
- case 107:
+ case 199: break;
+ case 106:
{ return JavaTokenType.INTERFACE_KEYWORD;
}
- case 202: break;
- case 109:
+ case 200: break;
+ case 108:
{ return JavaTokenType.INSTANCEOF_KEYWORD;
}
- case 203: break;
- case 106:
+ case 201: break;
+ case 105:
{ return JavaTokenType.TRANSIENT_KEYWORD;
}
- case 204: break;
- case 98:
+ case 202: break;
+ case 97:
{ return JavaTokenType.BOOLEAN_KEYWORD;
}
- case 205: break;
- case 72:
+ case 203: break;
+ case 71:
{ return JavaTokenType.CASE_KEYWORD;
}
- case 206: break;
+ case 204: break;
case 5:
{ return JavaTokenType.ASTERISK;
}
- case 207: break;
- case 93:
+ case 205: break;
+ case 92:
{ return JavaTokenType.IMPORT_KEYWORD;
}
- case 208: break;
+ case 206: break;
case 31:
{ return JavaTokenType.AT;
}
- case 209: break;
+ case 207: break;
case 45:
{ return JavaTokenType.NE;
}
- case 210: break;
+ case 208: break;
case 59:
{ return JavaTokenType.TRY_KEYWORD;
}
- case 211: break;
- case 83:
+ case 209: break;
+ case 82:
{ return JavaTokenType.CATCH_KEYWORD;
}
- case 212: break;
+ case 210: break;
case 37:
{ return JavaTokenType.FLOAT_LITERAL;
}
- case 213: break;
+ case 211: break;
case 17:
{ return JavaTokenType.AND;
}
- case 214: break;
- case 76:
+ case 212: break;
+ case 75:
{ return JavaTokenType.THROW_KEYWORD;
}
- case 215: break;
+ case 213: break;
case 57:
{ return JavaDocElementType.DOC_COMMENT;
}
- case 216: break;
+ case 214: break;
case 56:
{ return JavaTokenType.DOUBLE_COLON;
}
- case 217: break;
+ case 215: break;
case 21:
{ return JavaTokenType.RPARENTH;
}
- case 218: break;
+ case 216: break;
case 2:
{ return JavaTokenType.WHITE_SPACE;
}
- case 219: break;
- case 95:
+ case 217: break;
+ case 94:
{ return JavaTokenType.PUBLIC_KEYWORD;
}
- case 220: break;
+ case 218: break;
case 50:
{ return JavaTokenType.LE;
}
- case 221: break;
- case 85:
+ case 219: break;
+ case 84:
{ return JavaTokenType.CONST_KEYWORD;
}
- case 222: break;
+ case 220: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
diff --git a/java/java-impl/src/com/intellij/psi/impl/PsiExpressionEvaluator.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiExpressionEvaluator.java
similarity index 100%
rename from java/java-impl/src/com/intellij/psi/impl/PsiExpressionEvaluator.java
rename to java/java-psi-impl/src/com/intellij/psi/impl/PsiExpressionEvaluator.java
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java
index e0c480eba592..b506fd85e094 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/ElementType.java
@@ -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.
@@ -40,6 +40,11 @@ public interface ElementType extends JavaTokenType, JavaDocTokenType,
TRANSIENT_KEYWORD, RETURN_KEYWORD, VOID_KEYWORD, STATIC_KEYWORD, WHILE_KEYWORD, TRY_KEYWORD, VOLATILE_KEYWORD, THROWS_KEYWORD,
ENUM_KEYWORD);
+ TokenSet OPERATION_BIT_SET = TokenSet.create(
+ EQ, GT, LT, EXCL, TILDE, QUEST, COLON, PLUS, MINUS, ASTERISK, DIV, AND, OR, XOR,
+ PERC, EQEQ, LE, GE, NE, ANDAND, OROR, PLUSPLUS, MINUSMINUS, LTLT, GTGT, GTGTGT,
+ PLUSEQ, MINUSEQ, ASTERISKEQ, DIVEQ, ANDEQ, OREQ, XOREQ, PERCEQ, LTLTEQ, GTGTEQ, GTGTGTEQ);
+
TokenSet MODIFIER_BIT_SET = TokenSet.create(
PUBLIC_KEYWORD, PROTECTED_KEYWORD, PRIVATE_KEYWORD, STATIC_KEYWORD, ABSTRACT_KEYWORD, FINAL_KEYWORD, NATIVE_KEYWORD, SYNCHRONIZED_KEYWORD,
STRICTFP_KEYWORD, TRANSIENT_KEYWORD, VOLATILE_KEYWORD);
diff --git a/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/expected.xml b/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/expected.xml
new file mode 100644
index 000000000000..4704d91e891d
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/expected.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/src/Test.java b/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/src/Test.java
new file mode 100644
index 000000000000..8df38c124d67
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedReturnValue/simpleSetter/src/Test.java
@@ -0,0 +1,13 @@
+class Test {
+ private String myStr;
+
+ public Test setStr(String str) {
+ myStr = str;
+ return this;
+ }
+
+ public static void main(String[] args) {
+ final Test test = new Test();
+ test.setStr("");
+ }
+}
diff --git a/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic.java b/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic.java
new file mode 100644
index 000000000000..578b24b5739f
--- /dev/null
+++ b/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic.java
@@ -0,0 +1,7 @@
+class Test {
+ private boolean isFlag = false;
+
+ public Test(boolean isFlag) {
+ this.isFlag = isFlag;
+ }
+}
diff --git a/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic_after.java b/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic_after.java
new file mode 100644
index 000000000000..3474332bf3be
--- /dev/null
+++ b/java/java-tests/testData/refactoring/renameLocal/RenameFieldWithConstructorParamAutomatic_after.java
@@ -0,0 +1,7 @@
+class Test {
+ private boolean pp = false;
+
+ public Test(boolean pp) {
+ this.pp = pp;
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.java
new file mode 100644
index 000000000000..9a45fd5817a2
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
+import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
+import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
+import com.intellij.testFramework.LightIdeaTestCase;
+
+/**
+ * @author Dmitry Avdeev
+ * Date: 5/10/12
+ */
+public class SingleInspectionProfilePanelTest extends LightIdeaTestCase {
+
+ // see IDEA-85700
+ public void testSettingsModification() throws Exception {
+
+ Project project = ProjectManager.getInstance().getDefaultProject();
+ InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
+ InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE);
+ profile.initInspectionTools(project);
+
+ InspectionProfileImpl model = (InspectionProfileImpl)profile.getModifiableModel();
+ SingleInspectionProfilePanel panel = new SingleInspectionProfilePanel(profileManager, PROFILE, model);
+ panel.setVisible(true);
+ panel.reset();
+
+ LocalInspectionToolWrapper wrapper = (LocalInspectionToolWrapper)model.getInspectionTool(myInspection.getShortName());
+ assert wrapper != null;
+ JavaDocLocalInspection tool = (JavaDocLocalInspection)wrapper.getTool();
+ assertEquals("", tool.myAdditionalJavadocTags);
+ tool.myAdditionalJavadocTags = "foo";
+ model.setModified(true);
+ panel.apply();
+
+
+ wrapper = (LocalInspectionToolWrapper)profile.getInspectionTool(myInspection.getShortName());
+ assert wrapper != null;
+ tool = (JavaDocLocalInspection)wrapper.getTool();
+ assertEquals("foo", tool.myAdditionalJavadocTags);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ InspectionProfileImpl.INIT_INSPECTIONS = true;
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ InspectionProfileImpl.INIT_INSPECTIONS = false;
+ super.tearDown();
+ }
+
+ private final JavaDocLocalInspection myInspection = new JavaDocLocalInspection();
+
+ @Override
+ protected LocalInspectionTool[] configureLocalInspectionTools() {
+ return new LocalInspectionTool[] {myInspection};
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedReturnValueTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedReturnValueTest.java
index 4e086f0e7a14..0fcd2ef1a07e 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedReturnValueTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedReturnValueTest.java
@@ -35,4 +35,14 @@ public class UnusedReturnValueTest extends InspectionTestCase {
doTest();
}
+
+ public void testSimpleSetter() throws Exception {
+ try {
+ myTool.IGNORE_BUILDER_PATTERN = true;
+ doTest();
+ }
+ finally {
+ myTool.IGNORE_BUILDER_PATTERN = false;
+ }
+ }
}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java b/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
index 0f5080857a4f..b1639bc4b4be 100644
--- a/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
+++ b/java/java-tests/testSrc/com/intellij/lang/java/lexer/JavaLexerTest.java
@@ -136,7 +136,7 @@ public class JavaLexerTest extends LexerTestCase {
public void testJava8Tokens() {
doTest("none :: ->",
- "NONE_KEYWORD ('none')\nWHITE_SPACE (' ')\nDOUBLE_COLON ('::')\nWHITE_SPACE (' ')\nARROW ('->')");
+ "IDENTIFIER ('none')\nWHITE_SPACE (' ')\nDOUBLE_COLON ('::')\nWHITE_SPACE (' ')\nARROW ('->')");
}
@Override
diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java
index 5ec392f58c23..bb43aac5a141 100644
--- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java
@@ -35,9 +35,8 @@ public class IdCacheTest extends CodeInsightTestCase{
protected void setUp() throws Exception {
super.setUp();
- final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
- fileBasedIndex.requestRebuild(IdIndex.NAME);
- fileBasedIndex.requestRebuild(TodoIndex.NAME);
+ FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
+ FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);
String root = JavaTestUtil.getJavaTestDataPath()+ "/psi/impl/cache/";
diff --git a/java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java b/java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java
index cd2cf6890ac3..9ed5627cc09b 100644
--- a/java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java
@@ -55,8 +55,8 @@ public class UpdateCacheTest extends PsiTestCase{
protected void setUp() throws Exception {
super.setUp();
- FileBasedIndex.requestRebuild(IdIndex.NAME);
- FileBasedIndex.requestRebuild(TodoIndex.NAME);
+ FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
+ FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);
}
@Override
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/RenameLocalTest.java b/java/java-tests/testSrc/com/intellij/refactoring/RenameLocalTest.java
index ed98dc27a235..3aeefbe1459d 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/RenameLocalTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/RenameLocalTest.java
@@ -78,6 +78,10 @@ public class RenameLocalTest extends LightRefactoringTestCase {
public void testRenameInPlaceParamInOverriderAutomaticRenamer() throws Exception {
doTestInplaceRename("pp");
}
+
+ public void testRenameFieldWithConstructorParamAutomatic() throws Exception {
+ doTest("pp");
+ }
public void testRenameInPlaceParamInOverriderAutomaticRenamerConflict() throws Exception {
doTestInplaceRename("pp");
diff --git a/jps/jps-builders/src/META-INF/MANIFEST.MF b/jps/jps-builders/src/META-INF/MANIFEST.MF
new file mode 100644
index 000000000000..63c029fd45be
--- /dev/null
+++ b/jps/jps-builders/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: org.jetbrains.ether.StorageDumper
+
diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/StorageDumper.java b/jps/jps-builders/testSrc/org/jetbrains/ether/StorageDumper.java
new file mode 100644
index 000000000000..bd7049c0a1ce
--- /dev/null
+++ b/jps/jps-builders/testSrc/org/jetbrains/ether/StorageDumper.java
@@ -0,0 +1,145 @@
+package org.jetbrains.ether;
+
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.util.io.FileUtil;
+import org.jetbrains.ether.dependencyView.Mappings;
+import org.jetbrains.jps.Project;
+import org.jetbrains.jps.Sdk;
+import org.jetbrains.jps.idea.IdeaProjectLoader;
+import org.jetbrains.jps.incremental.Utils;
+import org.jetbrains.jps.server.ClasspathBootstrap;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: db
+ * Date: 14.05.12
+ * Time: 13:02
+ * To change this template use File | Settings | File Templates.
+ */
+public class StorageDumper {
+ private static class Env {
+ final String myProjectPath;
+ final String myOutputPath;
+ final String myErrors;
+ final boolean myHelp;
+
+ Env(final String[] args) {
+ int s = 0;
+
+ String projectPath = null;
+ String outputPath = null;
+ boolean help = false;
+
+ final StringBuilder errors = new StringBuilder();
+
+ for (final String arg : args) {
+ switch (s) {
+ case 0: // Initial state
+ if (arg.equals("-o")) {
+ s = 1;
+ }
+ else if (arg.equals("-h")) {
+ help = true;
+ }
+ else if (arg.startsWith("-")) {
+ errors.append("Unrecognized option: ");
+ errors.append(arg);
+ errors.append("\n");
+ }
+ else {
+ if (projectPath != null) {
+ errors.append("Multiple storage paths specified, skipping ");
+ errors.append(arg);
+ errors.append("\n");
+ }
+ else {
+ projectPath = arg;
+ }
+ }
+ break;
+
+ case 1: // -o
+ if (arg.startsWith("-")) {
+ errors.append("Output path expected after \"-o\", but found: ");
+ errors.append(arg);
+ errors.append("\n");
+ }
+ else {
+ if (outputPath != null) {
+ errors.append("Multiple output paths specified, skipping ");
+ errors.append(arg);
+ errors.append("\n");
+ }
+ else {
+ outputPath = arg;
+ }
+ }
+ s = 0;
+ }
+ }
+
+ myOutputPath = outputPath;
+ myProjectPath = projectPath;
+ myHelp = help;
+
+ myErrors = errors.toString();
+ }
+
+ String getProjectPath() {
+ return myProjectPath;
+ }
+
+ String getOutputPath() {
+ return myOutputPath;
+ }
+
+ String getErrors() {
+ return myErrors;
+ }
+
+ void report() {
+ if (myHelp) {
+ System.out.println("Usage: [-o | -h ] ");
+ System.out.println();
+ }
+
+ System.err.println(myErrors);
+ }
+ }
+
+ public static void main(final String[] args) {
+ final Env env = new Env(args);
+
+ env.report();
+
+ final String path = env.getProjectPath();
+ final String oath = env.getOutputPath();
+
+ if (path == null) {
+ System.err.println("No project path specified.");
+ }
+ else {
+ try {
+ final String outputPath = (oath == null ? "" : oath) + File.separator + "snapshot-" + new SimpleDateFormat("dd-MM-yy(hh:mm:ss)").format(new Date()) + ".log";
+ final File dataStorageRoot = new File(path + File.separator + "mappings");
+
+ final Mappings mappings = new Mappings(dataStorageRoot, true);
+ final PrintStream p = new PrintStream(outputPath);
+
+ mappings.toStream(p);
+
+ p.close();
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+}
diff --git a/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java b/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java
index f45e8fa2e304..864c1033fe71 100644
--- a/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java
+++ b/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java
@@ -155,7 +155,7 @@ class ClassfileAnalyzer {
final int methodName = context.get(name);
if (value instanceof Type) {
- final String className = ((Type)value).getClassName();
+ final String className = ((Type)value).getClassName().replace('.', '/');
if (className != null) {
usages.addUsage(residence, UsageRepr.createClassUsage(context, context.get(className)));
diff --git a/platform/platform-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java b/platform/core-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java
rename to platform/core-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java
index b367ea3c9aa7..1e745be27edb 100644
--- a/platform/platform-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java
+++ b/platform/core-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java
@@ -95,15 +95,6 @@ public class EmptyProgressIndicator implements ProgressIndicator {
return false;
}
-
- public void finish(final Task task) {
- myFinished = true;
- }
-
- public boolean isFinished(final Task task) {
- return myFinished;
- }
-
public void setIndeterminate(boolean indeterminate) {
}
diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ContentIterator.java b/platform/core-api/src/com/intellij/openapi/roots/ContentIterator.java
similarity index 100%
rename from platform/platform-api/src/com/intellij/openapi/roots/ContentIterator.java
rename to platform/core-api/src/com/intellij/openapi/roots/ContentIterator.java
diff --git a/platform/core-impl/src/com/intellij/core/CoreEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreEnvironment.java
index f2665a0a3b4e..9d79de825bf8 100644
--- a/platform/core-impl/src/com/intellij/core/CoreEnvironment.java
+++ b/platform/core-impl/src/com/intellij/core/CoreEnvironment.java
@@ -29,6 +29,7 @@ import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.*;
+import com.intellij.openapi.progress.*;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
@@ -151,6 +152,26 @@ public class CoreEnvironment {
myProject.registerService(PsiDirectoryFactory.class, new PsiDirectoryFactoryImpl(myPsiManager));
myProject.registerService(ProjectScopeBuilder.class, new CoreProjectScopeBuilder(myProject, myFileIndexFacade));
myProject.registerService(DumbService.class, new MockDumbService(myProject));
+
+ ProgressIndicatorProvider.ourInstance = new ProgressIndicatorProvider() {
+ @Override
+ public ProgressIndicator getProgressIndicator() {
+ return new EmptyProgressIndicator();
+ }
+
+ @Override
+ protected void doCheckCanceled() throws ProcessCanceledException {
+ }
+
+ @Override
+ public NonCancelableSection startNonCancelableSection() {
+ return new NonCancelableSection() {
+ @Override
+ public void done() {
+ }
+ };
+ }
+ };
}
public Project getProject() {
diff --git a/platform/lang-api/src/com/intellij/lang/cacheBuilder/CacheBuilderRegistry.java b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/CacheBuilderRegistry.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/lang/cacheBuilder/CacheBuilderRegistry.java
rename to platform/indexing-api/src/com/intellij/lang/cacheBuilder/CacheBuilderRegistry.java
diff --git a/platform/lang-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java
rename to platform/indexing-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java
diff --git a/platform/lang-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java
similarity index 98%
rename from platform/lang-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java
rename to platform/indexing-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java
index 0254640eb460..6273654982a9 100644
--- a/platform/lang-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java
+++ b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/SimpleWordsScanner.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java
similarity index 98%
rename from platform/lang-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java
rename to platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java
index 596dce8076d1..9a9018cb9078 100644
--- a/platform/lang-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java
+++ b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordOccurrence.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java
similarity index 97%
rename from platform/lang-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java
rename to platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java
index 4ffba0bc283a..0bfd41d0e483 100644
--- a/platform/lang-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java
+++ b/platform/indexing-api/src/com/intellij/lang/cacheBuilder/WordsScanner.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java b/platform/indexing-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java
similarity index 97%
rename from platform/lang-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java
rename to platform/indexing-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java
index 617cd8c775a6..c3400711ac1b 100644
--- a/platform/lang-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java
+++ b/platform/indexing-api/src/com/intellij/lang/findUsages/EmptyFindUsagesProvider.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java b/platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java
similarity index 98%
rename from platform/lang-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java
rename to platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java
index 9b7ccbc7b733..a56b0e126acc 100644
--- a/platform/lang-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java
+++ b/platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java b/platform/indexing-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java
similarity index 95%
rename from platform/lang-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java
rename to platform/indexing-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java
index 0a2820262e5f..9a830f393286 100644
--- a/platform/lang-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java
+++ b/platform/indexing-api/src/com/intellij/lang/findUsages/LanguageFindUsages.java
@@ -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.
diff --git a/platform/lang-api/src/com/intellij/psi/CustomHighlighterTokenType.java b/platform/indexing-api/src/com/intellij/psi/CustomHighlighterTokenType.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/psi/CustomHighlighterTokenType.java
rename to platform/indexing-api/src/com/intellij/psi/CustomHighlighterTokenType.java
diff --git a/platform/lang-api/src/com/intellij/psi/search/IndexPattern.java b/platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/psi/search/IndexPattern.java
rename to platform/indexing-api/src/com/intellij/psi/search/IndexPattern.java
diff --git a/platform/lang-api/src/com/intellij/psi/search/IndexPatternProvider.java b/platform/indexing-api/src/com/intellij/psi/search/IndexPatternProvider.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/psi/search/IndexPatternProvider.java
rename to platform/indexing-api/src/com/intellij/psi/search/IndexPatternProvider.java
diff --git a/platform/lang-api/src/com/intellij/psi/search/UsageSearchContext.java b/platform/indexing-api/src/com/intellij/psi/search/UsageSearchContext.java
similarity index 96%
rename from platform/lang-api/src/com/intellij/psi/search/UsageSearchContext.java
rename to platform/indexing-api/src/com/intellij/psi/search/UsageSearchContext.java
index ec8e3e86419f..34935e4fbf26 100644
--- a/platform/lang-api/src/com/intellij/psi/search/UsageSearchContext.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/UsageSearchContext.java
@@ -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.
diff --git a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java
new file mode 100644
index 000000000000..29647eccbbfd
--- /dev/null
+++ b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.util.indexing;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.components.BaseComponent;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ContentIterator;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileWithId;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.Processor;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Author: dmitrylomov
+ */
+public abstract class FileBasedIndex implements BaseComponent {
+ public abstract void iterateIndexableFiles(@NotNull ContentIterator processor, @NotNull Project project, ProgressIndicator indicator);
+
+ public abstract void registerIndexableSet(@NotNull IndexableFileSet set, @Nullable Project project);
+
+ public abstract void removeIndexableSet(@NotNull IndexableFileSet set);
+
+ public static FileBasedIndex getInstance() {
+ return ApplicationManager.getApplication().getComponent(FileBasedIndex.class);
+ }
+
+ public static int getFileId(@NotNull final VirtualFile file) {
+ if (file instanceof VirtualFileWithId) {
+ return ((VirtualFileWithId)file).getId();
+ }
+
+ throw new IllegalArgumentException("Virtual file doesn't support id: " + file + ", implementation class: " + file.getClass().getName());
+ }
+
+ public void requestRebuild(ID, ?> indexId) {
+ requestRebuild(indexId, new Throwable());
+ }
+
+
+ @NonNls
+ @NotNull
+ public String getComponentName() {
+ return "FileBasedIndex";
+ }
+
+ @NotNull
+ public abstract List getValues(@NotNull ID indexId, @NotNull K dataKey, @NotNull GlobalSearchScope filter);
+
+ @NotNull
+ public abstract Collection getContainingFiles(@NotNull ID indexId,
+ @NotNull K dataKey,
+ @NotNull GlobalSearchScope filter);
+
+ public abstract boolean processValues(@NotNull ID indexId,
+ @NotNull K dataKey,
+ @Nullable VirtualFile inFile,
+ @NotNull FileBasedIndex.ValueProcessor processor,
+ @NotNull GlobalSearchScope filter);
+
+ public abstract boolean processFilesContainingAllKeys(@NotNull ID indexId,
+ @NotNull Collection dataKeys,
+ @NotNull GlobalSearchScope filter,
+ @Nullable Condition valueChecker,
+ @NotNull Processor processor);
+
+ @NotNull
+ public abstract Collection getAllKeys(@NotNull ID indexId, @NotNull Project project);
+
+ public abstract void ensureUpToDate(@NotNull ID indexId, @Nullable Project project, @Nullable GlobalSearchScope filter);
+
+ public abstract void requestRebuild(ID, ?> indexId, Throwable throwable);
+
+ public abstract void scheduleRebuild(@NotNull ID indexId, @NotNull Throwable e);
+
+ public abstract void requestReindex(@NotNull VirtualFile file);
+
+ public abstract void requestReindexExcluded(@NotNull VirtualFile file);
+
+ public abstract boolean getFilesWithKey(@NotNull ID indexId,
+ @NotNull Set dataKeys,
+ @NotNull Processor processor,
+ @NotNull GlobalSearchScope filter);
+
+ public abstract boolean processAllKeys(@NotNull ID indexId, Processor processor, @Nullable Project project);
+
+ public interface ValueProcessor {
+ /**
+ * @param value a value to process
+ * @param file the file the value came from
+ * @return false if no further processing is needed, true otherwise
+ */
+ boolean process(VirtualFile file, V value);
+ }
+
+ /**
+ * Author: dmitrylomov
+ */
+ public static interface InputFilter {
+ boolean acceptInput(VirtualFile file);
+ }
+}
diff --git a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java
index ceb19fb8040c..51dc7cc449d0 100644
--- a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java
+++ b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java
@@ -44,7 +44,7 @@ public abstract class FileBasedIndexExtension {
public abstract DataExternalizer getValueExternalizer();
- public abstract InputFilter getInputFilter();
+ public abstract FileBasedIndex.InputFilter getInputFilter();
public abstract boolean dependsOnFileContent();
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexableFileSet.java b/platform/indexing-api/src/com/intellij/util/indexing/IndexableFileSet.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/util/indexing/IndexableFileSet.java
rename to platform/indexing-api/src/com/intellij/util/indexing/IndexableFileSet.java
diff --git a/platform/indexing-impl/indexing-impl.iml b/platform/indexing-impl/indexing-impl.iml
index 373eaa417d53..8446a9dbc69c 100644
--- a/platform/indexing-impl/indexing-impl.iml
+++ b/platform/indexing-impl/indexing-impl.iml
@@ -8,6 +8,7 @@
+
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/AbstractCustomLexer.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/AbstractCustomLexer.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/AbstractCustomLexer.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/AbstractCustomLexer.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java
diff --git a/platform/platform-impl/src/com/intellij/ide/highlighter/custom/SyntaxTable.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/SyntaxTable.java
similarity index 100%
rename from platform/platform-impl/src/com/intellij/ide/highlighter/custom/SyntaxTable.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/SyntaxTable.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/BraceTokenParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/BraceTokenParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/BraceTokenParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/BraceTokenParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/HexNumberParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/IdentifierParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/KeywordParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/LineCommentParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/LineCommentParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/LineCommentParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/LineCommentParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/MultilineCommentParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/MultilineCommentParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/MultilineCommentParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/MultilineCommentParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/NumberParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/PrefixedTokenParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/PrefixedTokenParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/PrefixedTokenParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/PrefixedTokenParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/PunctuationParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/PunctuationParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/PunctuationParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/PunctuationParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/QuotedStringParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/QuotedStringParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/QuotedStringParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/QuotedStringParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenInfo.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenInfo.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenInfo.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenInfo.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/TokenParser.java
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/WhitespaceParser.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/WhitespaceParser.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/custom/tokens/WhitespaceParser.java
rename to platform/indexing-impl/src/com/intellij/ide/highlighter/custom/tokens/WhitespaceParser.java
diff --git a/platform/indexing-api/src/com/intellij/util/indexing/InputFilter.java b/platform/indexing-impl/src/com/intellij/openapi/fileTypes/impl/CustomSyntaxTableFileType.java
similarity index 69%
rename from platform/indexing-api/src/com/intellij/util/indexing/InputFilter.java
rename to platform/indexing-impl/src/com/intellij/openapi/fileTypes/impl/CustomSyntaxTableFileType.java
index eeddca80a61a..445f369131bb 100644
--- a/platform/indexing-api/src/com/intellij/util/indexing/InputFilter.java
+++ b/platform/indexing-impl/src/com/intellij/openapi/fileTypes/impl/CustomSyntaxTableFileType.java
@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.util.indexing;
+package com.intellij.openapi.fileTypes.impl;
-import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.ide.highlighter.custom.SyntaxTable;
+import com.intellij.openapi.fileTypes.FileType;
/**
-* Author: dmitrylomov
-*/
-public interface InputFilter {
- boolean acceptInput(VirtualFile file);
+ * Author: dmitrylomov
+ */
+public interface CustomSyntaxTableFileType extends FileType {
+ SyntaxTable getSyntaxTable();
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/IndexPatternUtil.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/IndexPatternUtil.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/IndexPatternUtil.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/IndexPatternUtil.java
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/OccurrenceConsumer.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/OccurrenceConsumer.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/OccurrenceConsumer.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/OccurrenceConsumer.java
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java
similarity index 95%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java
index 3b62ced1aa00..f770ac1d5d97 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/FileTypeIdIndexer.java
@@ -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.
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java
similarity index 97%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java
index 9a940cf41241..2dc2842021db 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexEntry.java
@@ -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.
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java
similarity index 95%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java
index 77fa23144eda..db1fcf6d91b1 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndexers.java
@@ -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.
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java
similarity index 56%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java
index 8e09281d2675..dda845796bd0 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java
+++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdTableBuilding.java
@@ -16,39 +16,26 @@
package com.intellij.psi.impl.cache.impl.id;
-import com.intellij.ide.highlighter.HighlighterFactory;
import com.intellij.ide.highlighter.custom.CustomFileTypeLexer;
-import com.intellij.idea.LoggerFactory;
import com.intellij.lang.Language;
-import com.intellij.lang.LanguageParserDefinitions;
-import com.intellij.lang.ParserDefinition;
import com.intellij.lang.cacheBuilder.*;
import com.intellij.lang.findUsages.FindUsagesProvider;
import com.intellij.lang.findUsages.LanguageFindUsages;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
-import com.intellij.openapi.editor.highlighter.EditorHighlighter;
-import com.intellij.openapi.editor.highlighter.HighlighterIterator;
import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.fileTypes.impl.AbstractFileType;
-import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.psi.CustomHighlighterTokenType;
-import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
-import com.intellij.psi.impl.cache.impl.CacheUtil;
import com.intellij.psi.impl.cache.impl.IndexPatternUtil;
import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
import com.intellij.psi.impl.cache.impl.todo.TodoIndexEntry;
import com.intellij.psi.impl.cache.impl.todo.TodoIndexers;
import com.intellij.psi.search.IndexPattern;
import com.intellij.psi.search.UsageSearchContext;
-import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.Processor;
-import com.intellij.util.containers.CollectionFactory;
-import com.intellij.util.indexing.*;
+import com.intellij.util.indexing.DataIndexer;
+import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.IdDataConsumer;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -123,19 +110,12 @@ public class IdTableBuilding {
}
private static final HashMap ourIdIndexers = new HashMap();
- private static final HashMap> ourTodoIndexers =
- new HashMap>();
@Deprecated
public static void registerIdIndexer(FileType fileType, FileTypeIdIndexer indexer) {
ourIdIndexers.put(fileType, indexer);
}
- @Deprecated
- public static void registerTodoIndexer(FileType fileType, DataIndexer indexer) {
- ourTodoIndexers.put(fileType, indexer);
- }
-
public static boolean isIdIndexerRegistered(FileType fileType) {
return ourIdIndexers.containsKey(fileType) || IdIndexers.INSTANCE.forFileType(fileType) != null;
}
@@ -144,18 +124,7 @@ public class IdTableBuilding {
return ourIdIndexers.containsKey(fileType) || TodoIndexers.INSTANCE.forFileType(fileType) != null;
}
- static {
- registerIdIndexer(FileTypes.PLAIN_TEXT, new PlainTextIndexer());
- registerTodoIndexer(FileTypes.PLAIN_TEXT, new PlainTextTodoIndexer());
- registerIdIndexer(StdFileTypes.IDEA_MODULE, null);
- registerIdIndexer(StdFileTypes.IDEA_WORKSPACE, null);
- registerIdIndexer(StdFileTypes.IDEA_PROJECT, null);
-
- registerTodoIndexer(StdFileTypes.IDEA_MODULE, null);
- registerTodoIndexer(StdFileTypes.IDEA_WORKSPACE, null);
- registerTodoIndexer(StdFileTypes.IDEA_PROJECT, null);
- }
@Nullable
public static FileTypeIdIndexer getFileTypeIndexer(FileType fileType) {
@@ -185,15 +154,15 @@ public class IdTableBuilding {
return new WordsScannerFileTypeIdIndexerAdapter(scanner);
}
- if (fileType instanceof AbstractFileType) {
- return new WordsScannerFileTypeIdIndexerAdapter(createWordScanner((AbstractFileType)fileType));
+ if (fileType instanceof CustomSyntaxTableFileType) {
+ return new WordsScannerFileTypeIdIndexerAdapter(createWordScanner((CustomSyntaxTableFileType)fileType));
}
return null;
}
- private static WordsScanner createWordScanner(final AbstractFileType abstractFileType) {
- return new DefaultWordsScanner(new CustomFileTypeLexer(abstractFileType.getSyntaxTable(), true),
+ private static WordsScanner createWordScanner(final CustomSyntaxTableFileType customSyntaxTableFileType) {
+ return new DefaultWordsScanner(new CustomFileTypeLexer(customSyntaxTableFileType.getSyntaxTable(), true),
TokenSet.create(CustomHighlighterTokenType.IDENTIFIER),
TokenSet.create(CustomHighlighterTokenType.LINE_COMMENT,
CustomHighlighterTokenType.MULTI_LINE_COMMENT),
@@ -201,46 +170,6 @@ public class IdTableBuilding {
}
- private static final TokenSet ABSTRACT_FILE_COMMENT_TOKENS =
- TokenSet.create(CustomHighlighterTokenType.LINE_COMMENT, CustomHighlighterTokenType.MULTI_LINE_COMMENT);
-
- @Nullable
- public static DataIndexer getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
- final DataIndexer indexer = ourTodoIndexers.get(fileType);
-
- if (indexer != null) {
- return indexer;
- }
-
- final DataIndexer extIndexer;
- if (fileType instanceof SubstitutedFileType) {
- SubstitutedFileType sft = (SubstitutedFileType)fileType;
- extIndexer =
- new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
- }
- else {
- extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
- }
- if (extIndexer != null) {
- return extIndexer;
- }
-
- if (fileType instanceof LanguageFileType) {
- final Language lang = ((LanguageFileType)fileType).getLanguage();
- final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
- final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
- if (commentTokens != null) {
- return new TokenSetTodoIndexer(commentTokens, virtualFile);
- }
- }
-
- if (fileType instanceof AbstractFileType) {
- return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
- }
-
- return null;
- }
-
private static class WordsScannerFileTypeIdIndexerAdapter extends FileTypeIdIndexer {
private final WordsScanner myScanner;
@@ -279,102 +208,6 @@ public class IdTableBuilding {
}
}
- private static class CompositeTodoIndexer implements DataIndexer {
-
- private final DataIndexer[] indexers;
-
- public CompositeTodoIndexer(DataIndexer... indexers) {
- this.indexers = indexers;
- }
-
- @NotNull
- @Override
- public Map map(FileContent inputData) {
- Map result = CollectionFactory.newTroveMap();
- for (DataIndexer indexer : indexers) {
- for (Map.Entry entry : indexer.map(inputData).entrySet()) {
- TodoIndexEntry key = entry.getKey();
- if (result.containsKey(key)) {
- result.put(key, result.get(key) + entry.getValue());
- } else {
- result.put(key, entry.getValue());
- }
- }
- }
- return result;
- }
- }
-
- private static class TokenSetTodoIndexer implements DataIndexer {
- @NotNull private final TokenSet myCommentTokens;
- private final VirtualFile myFile;
-
- public TokenSetTodoIndexer(@NotNull final TokenSet commentTokens, @NotNull final VirtualFile file) {
- myCommentTokens = commentTokens;
- myFile = file;
- }
-
- @Override
- @NotNull
- public Map map(final FileContent inputData) {
- if (IndexPatternUtil.getIndexPatternCount() > 0) {
- final CharSequence chars = inputData.getContentAsText();
- final OccurrenceConsumer occurrenceConsumer = new OccurrenceConsumer(null, true);
- EditorHighlighter highlighter;
-
- final EditorHighlighter editorHighlighter = inputData.getUserData(FileBasedIndex.EDITOR_HIGHLIGHTER);
- if (editorHighlighter != null && checkCanUseCachedEditorHighlighter(chars, editorHighlighter)) {
- highlighter = editorHighlighter;
- }
- else {
- highlighter = HighlighterFactory.createHighlighter(null, myFile);
- highlighter.setText(chars);
- }
-
- final int documentLength = chars.length();
- BaseFilterLexer.TodoScanningData[] todoScanningDatas = null;
- final HighlighterIterator iterator = highlighter.createIterator(0);
-
- while (!iterator.atEnd()) {
- final IElementType token = iterator.getTokenType();
-
- if (myCommentTokens.contains(token) || CacheUtil.isInComments(token)) {
- int start = iterator.getStart();
- if (start >= documentLength) break;
- int end = iterator.getEnd();
-
- todoScanningDatas = BaseFilterLexer.advanceTodoItemsCount(
- chars.subSequence(start, Math.min(end, documentLength)),
- occurrenceConsumer,
- todoScanningDatas
- );
- if (end > documentLength) break;
- }
- iterator.advance();
- }
- final Map map = new HashMap();
- for (IndexPattern pattern : IndexPatternUtil.getIndexPatterns()) {
- final int count = occurrenceConsumer.getOccurrenceCount(pattern);
- if (count > 0) {
- map.put(new TodoIndexEntry(pattern.getPatternString(), pattern.isCaseSensitive()), count);
- }
- }
- return map;
- }
- return Collections.emptyMap();
- }
- }
-
- public static boolean checkCanUseCachedEditorHighlighter(final CharSequence chars, final EditorHighlighter editorHighlighter) {
- assert editorHighlighter instanceof LexerEditorHighlighter;
- final boolean b = ((LexerEditorHighlighter)editorHighlighter).checkContentIsEqualTo(chars);
- if (!b) {
- final Logger logger = LoggerFactory.getInstance().getLoggerInstance(IdTableBuilding.class.getName());
- logger.warn("Unexpected mismatch of editor highlighter content with indexing content");
- }
- return b;
- }
-
public static void scanWords(final ScanWordProcessor processor, final CharSequence chars, final int startOffset, final int endOffset) {
scanWords(processor, chars, CharArrayUtil.fromSequenceWithoutCopying(chars), startOffset, endOffset, false);
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexEntry.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexEntry.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexEntry.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexEntry.java
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexers.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexers.java
similarity index 100%
rename from platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexers.java
rename to platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndexers.java
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IdDataConsumer.java b/platform/indexing-impl/src/com/intellij/util/indexing/IdDataConsumer.java
similarity index 97%
rename from platform/lang-impl/src/com/intellij/util/indexing/IdDataConsumer.java
rename to platform/indexing-impl/src/com/intellij/util/indexing/IdDataConsumer.java
index 18088f3b5f61..841be6f90278 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/IdDataConsumer.java
+++ b/platform/indexing-impl/src/com/intellij/util/indexing/IdDataConsumer.java
@@ -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.
@@ -22,7 +22,6 @@ import gnu.trove.THashMap;
import gnu.trove.TIntIntHashMap;
import gnu.trove.TIntIntProcedure;
-import java.util.HashMap;
import java.util.Map;
/**
diff --git a/platform/lang-api/src/com/intellij/execution/BeforeRunTask.java b/platform/lang-api/src/com/intellij/execution/BeforeRunTask.java
index fad6015d02f0..5eb1ed114b42 100644
--- a/platform/lang-api/src/com/intellij/execution/BeforeRunTask.java
+++ b/platform/lang-api/src/com/intellij/execution/BeforeRunTask.java
@@ -55,6 +55,8 @@ public abstract class BeforeRunTask implements Cloneabl
if (attribValue == null) {
attribValue = element.getAttributeValue("value"); // maintain compatibility with old format
}
+ if (attribValue == null)
+ attribValue = "true";
myIsEnabled = Boolean.valueOf(attribValue).booleanValue();
}
diff --git a/platform/lang-api/src/com/intellij/psi/search/PsiSearchHelper.java b/platform/lang-api/src/com/intellij/psi/search/PsiSearchHelper.java
index ed5c1f093bec..15ff4815a4b8 100644
--- a/platform/lang-api/src/com/intellij/psi/search/PsiSearchHelper.java
+++ b/platform/lang-api/src/com/intellij/psi/search/PsiSearchHelper.java
@@ -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.
diff --git a/platform/lang-impl/lang-impl.iml b/platform/lang-impl/lang-impl.iml
index cf57ba46c814..7c6fff5ea654 100644
--- a/platform/lang-impl/lang-impl.iml
+++ b/platform/lang-impl/lang-impl.iml
@@ -22,7 +22,7 @@
-
+
diff --git a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLDialog.java b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLDialog.java
index fa54e202ebf8..70449b615abd 100644
--- a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLDialog.java
@@ -112,7 +112,6 @@ public class ExportToHTMLDialog extends DialogWrapper {
CodeEditorBundle.message("export.to.html.select.output.directory.description"),
project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
labeledComponent.setComponent(targetDirectoryField);
- labeledComponent.setBorder(BorderFactory.createEmptyBorder(5, 4, 0, 0));
return labeledComponent;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
index 39ba70a41730..fe09c10d5f18 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
@@ -29,6 +29,7 @@ import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
@@ -223,8 +224,8 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
private TextRange findCommentedRange(final Commenter commenter) {
final CharSequence text = myDocument.getCharsSequence();
final FileType fileType = myFile.getFileType();
- if (fileType instanceof AbstractFileType) {
- Lexer lexer = new CustomFileTypeLexer(((AbstractFileType)fileType).getSyntaxTable());
+ if (fileType instanceof CustomSyntaxTableFileType) {
+ Lexer lexer = new CustomFileTypeLexer(((CustomSyntaxTableFileType)fileType).getSyntaxTable());
final int caretOffset = myEditor.getCaretModel().getOffset();
int commentStart = CharArrayUtil.lastIndexOf(text, commenter.getBlockCommentPrefix(), caretOffset);
if (commentStart == -1) return null;
@@ -312,7 +313,7 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
@Nullable
private static Commenter findCommenter(PsiFile file, Editor editor) {
final FileType fileType = file.getFileType();
- if (fileType instanceof AbstractFileType) {
+ if (fileType instanceof CustomSyntaxTableFileType) {
return ((AbstractFileType)fileType).getCommenter();
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
index c90b15b822a8..1120ed03e1a0 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
@@ -31,6 +31,7 @@ import com.intellij.openapi.editor.*;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
@@ -210,9 +211,9 @@ public class CommentByLineCommentHandler implements CodeInsightActionHandler {
Commenter blockSuitableCommenter =
languageSuitableForCompleteFragment == null ? LanguageCommenters.INSTANCE.forLanguage(myFile.getLanguage()) : null;
- if (blockSuitableCommenter == null && myFile.getFileType() instanceof AbstractFileType) {
+ if (blockSuitableCommenter == null && myFile.getFileType() instanceof CustomSyntaxTableFileType) {
blockSuitableCommenter = new Commenter() {
- final SyntaxTable mySyntaxTable = ((AbstractFileType)myFile.getFileType()).getSyntaxTable();
+ final SyntaxTable mySyntaxTable = ((CustomSyntaxTableFileType)myFile.getFileType()).getSyntaxTable();
@Nullable
public String getLineCommentPrefix() {
diff --git a/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java b/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java
index db6ea1442367..13a16c6fd8f2 100644
--- a/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java
+++ b/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java
@@ -53,7 +53,10 @@ public abstract class RunManagerEx extends RunManager {
@NotNull
public abstract RunnerAndConfigurationSettings createConfiguration(String name, ConfigurationFactory type);
- public abstract void addConfiguration(RunnerAndConfigurationSettings settings, boolean isShared, List tasks);
+ public abstract void addConfiguration(RunnerAndConfigurationSettings settings,
+ boolean isShared,
+ List tasks,
+ boolean addTemplateTasksIfAbsent);
public abstract void addConfiguration(final RunnerAndConfigurationSettings settings, final boolean isShared);
@@ -62,14 +65,11 @@ public abstract class RunManagerEx extends RunManager {
@NotNull
public abstract List getBeforeRunTasks(RunConfiguration settings);
- @NotNull
- public abstract List getBeforeRunTasks(RunConfiguration settings, boolean includeOnlyActiveTasks);
-
@NotNull
public abstract List getBeforeRunTasks(RunConfiguration settings, Key taskProviderID);
@NotNull
- public abstract List getBeforeRunTasks(Key taskProviderID, boolean includeOnlyActiveTasks);
+ public abstract List getBeforeRunTasks(Key taskProviderID);
public abstract RunnerAndConfigurationSettings findConfigurationByName(@Nullable final String name);
diff --git a/platform/lang-impl/src/com/intellij/execution/actions/CreateAction.java b/platform/lang-impl/src/com/intellij/execution/actions/CreateAction.java
index af9ce1aed324..d7fd9e783393 100644
--- a/platform/lang-impl/src/com/intellij/execution/actions/CreateAction.java
+++ b/platform/lang-impl/src/com/intellij/execution/actions/CreateAction.java
@@ -122,7 +122,8 @@ public class CreateAction extends BaseRunConfigurationAction {
final RunnerAndConfigurationSettings configuration = context.getConfiguration();
final RunnerAndConfigurationSettings template = runManager.getConfigurationTemplate(configuration.getFactory());
final RunConfiguration templateConfiguration = template.getConfiguration();
- runManager.addConfiguration(configuration, runManager.isConfigurationShared(template), runManager.getBeforeRunTasks( templateConfiguration));
+ runManager.addConfiguration(configuration, runManager.isConfigurationShared(template), runManager.getBeforeRunTasks( templateConfiguration),
+ false);
runManager.setActiveConfiguration(configuration);
}
}
@@ -139,7 +140,7 @@ public class CreateAction extends BaseRunConfigurationAction {
final RunManagerImpl runManager = (RunManagerImpl)context.getRunManager();
runManager.addConfiguration(configuration,
runManager.isConfigurationShared(configuration),
- runManager.getBeforeRunTasks(configuration.getConfiguration()));
+ runManager.getBeforeRunTasks(configuration.getConfiguration()), false);
runManager.setActiveConfiguration(configuration);
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/BaseExecuteBeforeRunDialog.java b/platform/lang-impl/src/com/intellij/execution/impl/BaseExecuteBeforeRunDialog.java
index fe59622cc785..31284e67419a 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/BaseExecuteBeforeRunDialog.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/BaseExecuteBeforeRunDialog.java
@@ -235,7 +235,7 @@ public abstract class BaseExecuteBeforeRunDialog extend
tasks.remove(task);
}
}
- runManager.setBeforeRunTasks(config, tasks);
+ runManager.setBeforeRunTasks(config, tasks, false);
}
protected abstract void update(T task);
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/BeforeRunStepsPanel.java b/platform/lang-impl/src/com/intellij/execution/impl/BeforeRunStepsPanel.java
index cc2b4687ea0f..29e34c124e0a 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/BeforeRunStepsPanel.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/BeforeRunStepsPanel.java
@@ -120,7 +120,7 @@ class BeforeRunStepsPanel extends JPanel {
myRunConfiguration = settings.getConfiguration();
originalTasks.clear();
- originalTasks.addAll(RunManagerImpl.getInstanceImpl(myRunConfiguration.getProject()).getBeforeRunTasks(myRunConfiguration, true));
+ originalTasks.addAll(RunManagerImpl.getInstanceImpl(myRunConfiguration.getProject()).getBeforeRunTasks(myRunConfiguration));
myModel.replaceAll(originalTasks);
myShowSettingsBeforeRunCheckBox.setSelected(settings.isEditBeforeRun());
myShowSettingsBeforeRunCheckBox.setEnabled(!(myRunConfiguration instanceof UnknownRunConfiguration));
@@ -205,11 +205,11 @@ class BeforeRunStepsPanel extends JPanel {
= (RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask)task;
RunConfiguration configuration = runTask.getSettings().getConfiguration();
- List tasks = RunManagerImpl.getInstanceImpl(configuration.getProject()).getBeforeRunTasks(configuration, true);
+ List tasks = RunManagerImpl.getInstanceImpl(configuration.getProject()).getBeforeRunTasks(configuration);
for (BeforeRunTask beforeRunTask : tasks) {
if (beforeRunTask instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) {
- configurationSet.add(((RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask)beforeRunTask).getSettings().getConfiguration());
- getAllRunBeforeRuns(beforeRunTask, configurationSet);
+ if (configurationSet.add(((RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask)beforeRunTask).getSettings().getConfiguration()))
+ getAllRunBeforeRuns(beforeRunTask, configurationSet);
}
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConfigurationSettingsEditorWrapper.java b/platform/lang-impl/src/com/intellij/execution/impl/ConfigurationSettingsEditorWrapper.java
index 7d1d7a436db0..61835db7f5b3 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConfigurationSettingsEditorWrapper.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConfigurationSettingsEditorWrapper.java
@@ -114,7 +114,7 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor getStepsBeforeLaunch() {
- return Collections.unmodifiableList(myBeforeRunStepsPanel.getTasks(false));
+ return Collections.unmodifiableList(myBeforeRunStepsPanel.getTasks(true));
}
public boolean isStoreProjectConfiguration() {
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
index f15e9fa2c222..484cb35ac961 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
@@ -97,12 +97,7 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
final List activeTasks = new ArrayList();
- final List tasks = runManager.getBeforeRunTasks(runConfiguration);
- for (BeforeRunTask task : tasks) {
- if (task != null && task.isEnabled()) {
- activeTasks.add(task);
- }
- }
+ activeTasks.addAll(runManager.getBeforeRunTasks(runConfiguration));
ConfigurationPerRunnerSettings configurationSettings = state != null ? state.getConfigurationSettings() : null;
final DataContext projectContext = SimpleDataContext.getProjectContext(myProject);
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
index f462ba509a22..75a880070fbd 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurable.java
@@ -164,12 +164,7 @@ class RunConfigurable extends BaseConfigurable {
if (userObject instanceof SingleConfigurationConfigurable) {
final SingleConfigurationConfigurable> settings = (SingleConfigurationConfigurable)userObject;
RunnerAndConfigurationSettings snapshot;
- try {
- snapshot = settings.getSnapshot();
- }
- catch (ConfigurationException e) {
- snapshot = settings.getSettings();
- }
+ snapshot = settings.getSettings();
configuration = settings.getConfiguration();
name = settings.getNameText();
setIcon(ProgramRunnerUtil.getConfigurationIcon(snapshot, !settings.isValid(), runManager.isTemporary(configuration)));
@@ -645,7 +640,7 @@ class RunConfigurable extends BaseConfigurable {
for (RunConfigurationBean each : stableConfigurations) {
toDeleteSettings.remove(each.getSettings());
- manager.addConfiguration(each.getSettings(), each.isShared(), each.getStepsBeforeLaunch());
+ manager.addConfiguration(each.getSettings(), each.isShared(), each.getStepsBeforeLaunch(), false);
}
RunnerAndConfigurationSettings selected = manager.getSelectedConfiguration();
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
index 25555d1ee971..cc09148e22af 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/RunManagerImpl.java
@@ -67,7 +67,6 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
protected static final String SELECTED_ATTR = "selected";
@NonNls private static final String METHOD = "method";
@NonNls private static final String OPTION = "option";
- @NonNls private static final String VALUE = "value";
private List myUnknownElements = null;
private JDOMExternalizableStringList myOrder = new JDOMExternalizableStringList();
@@ -240,7 +239,7 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
public void addConfiguration(RunnerAndConfigurationSettings settings,
boolean shared,
- List tasks) {
+ List tasks, boolean addEnabledTemplateTasksIfAbsent) {
final RunConfiguration configuration = settings.getConfiguration();
Integer existingId = findConfigurationIdByUniqueName(getUniqueName(settings));
@@ -257,7 +256,8 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
checkRecentsLimit();
mySharedConfigurations.put(newId, shared);
- setBeforeRunTasks(configuration, tasks);
+ getTemplateBeforeRunTask(configuration);
+ setBeforeRunTasks(configuration, tasks, addEnabledTemplateTasksIfAbsent);
if (existingSettings == settings) {
myDispatcher.getMulticaster().runConfigurationChanged(settings);
@@ -455,13 +455,30 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
if (!settings.isTemplate()) {
List beforeRunTasks = getBeforeRunTasks(getConfigurationTemplate(settings.getFactory()).getConfiguration());
templateTasks = new HashMap, BeforeRunTask>();
- for (BeforeRunTask task : beforeRunTasks) {
- templateTasks.put(task.getProviderId(), task);
+ for (BeforeRunTask templateTask : beforeRunTasks) {
+ templateTasks.put(templateTask.getProviderId(), templateTask);
+ if (templateTask.isEnabled()) {
+ boolean found = false;
+ for (BeforeRunTask realTask : tasks) {
+ if (realTask.getProviderId() == templateTask.getProviderId()) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ BeforeRunTask clone = templateTask.clone();
+ clone.setEnabled(false);
+ tasks.add(0, clone);
+ }
+ }
}
}
for (BeforeRunTask task : tasks) {
- if (templateTasks != null && task.equals(templateTasks.get(task.getProviderId())))
- continue; // not neccesary saving if the task is the same as template
+ if (templateTasks != null) {
+ BeforeRunTask templateTask = templateTasks.get(task.getProviderId());
+ if (task.equals(templateTask))
+ continue; // not neccesary saving if the task is the same as template
+ }
final Element child = new Element(OPTION);
child.setAttribute(NAME_ATTR, task.getProviderId().toString());
task.writeExternal(child);
@@ -471,6 +488,7 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
}
}
+
public void readExternal(final Element parentNode) throws InvalidDataException {
clear();
@@ -573,10 +591,10 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
final List tasks = readStepsBeforeRun(methodsElement, settings);
if (settings.isTemplate()) {
myTemplateConfigurationsMap.put(factory.getType().getId() + "." + factory.getName(), settings);
- setBeforeRunTasks(settings.getConfiguration(), tasks);
+ setBeforeRunTasks(settings.getConfiguration(), tasks, true);
}
else {
- addConfiguration(settings, isShared, tasks);
+ addConfiguration(settings, isShared, tasks, true);
if (Boolean.valueOf(element.getAttributeValue(SELECTED_ATTR)).booleanValue()) { //to support old style
setSelectedConfiguration(settings);
}
@@ -657,7 +675,7 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
invalidateConfigurationIcon(tempConfiguration);
addConfiguration(tempConfiguration, isConfigurationShared(tempConfiguration),
- getBeforeRunTasks(tempConfiguration.getConfiguration()));
+ getBeforeRunTasks(tempConfiguration.getConfiguration()), false);
setActiveConfiguration(tempConfiguration);
}
@@ -720,48 +738,30 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
}
@NotNull
- public List getBeforeRunTasks(Key taskProviderID, boolean includeOnlyActiveTasks) {
+ public List getBeforeRunTasks(Key taskProviderID) {
final List tasks = new ArrayList();
- if (includeOnlyActiveTasks) {
- final List checkedTemplates = new ArrayList();
- List settingsList = new ArrayList(myConfigurations.values());
- for (RunnerAndConfigurationSettings settings : settingsList) {
- final List runTasks = getBeforeRunTasks(settings.getConfiguration());
- for (BeforeRunTask task : runTasks) {
- if (task != null && task.isEnabled() && task.getProviderId() == taskProviderID) {
- tasks.add((T)task);
- }
- else {
- final RunnerAndConfigurationSettings template = getConfigurationTemplate(settings.getFactory());
- if (!checkedTemplates.contains(template)) {
- checkedTemplates.add(template);
- final List templateTasks = getBeforeRunTasks(template.getConfiguration());
- for (BeforeRunTask templateTask : templateTasks) {
- if (templateTask != null && templateTask.isEnabled() && templateTask.getProviderId() == taskProviderID) {
- tasks.add((T)templateTask);
- }
+ final List checkedTemplates = new ArrayList();
+ List settingsList = new ArrayList(myConfigurations.values());
+ for (RunnerAndConfigurationSettings settings : settingsList) {
+ final List runTasks = getBeforeRunTasks(settings.getConfiguration());
+ for (BeforeRunTask task : runTasks) {
+ if (task != null && task.isEnabled() && task.getProviderId() == taskProviderID) {
+ tasks.add((T)task);
+ }
+ else {
+ final RunnerAndConfigurationSettings template = getConfigurationTemplate(settings.getFactory());
+ if (!checkedTemplates.contains(template)) {
+ checkedTemplates.add(template);
+ final List templateTasks = getBeforeRunTasks(template.getConfiguration());
+ for (BeforeRunTask templateTask : templateTasks) {
+ if (templateTask != null && templateTask.isEnabled() && templateTask.getProviderId() == taskProviderID) {
+ tasks.add((T)templateTask);
}
}
}
}
}
}
- else {
- for (RunnerAndConfigurationSettings settings : myTemplateConfigurationsMap.values()) {
- final List tasks_ = getBeforeRunTasks(settings.getConfiguration());
- for (BeforeRunTask task : tasks_) {
- if (task != null && task.getProviderId() == taskProviderID)
- tasks.add((T)task);
- }
- }
- for (RunnerAndConfigurationSettings settings : myConfigurations.values()) {
- final List tasks_ = getBeforeRunTasks(settings.getConfiguration());
- for (BeforeRunTask task : tasks_) {
- if (task != null && task.getProviderId() == taskProviderID)
- tasks.add((T)task);
- }
- }
- }
return tasks;
}
@@ -826,32 +826,25 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
@NotNull
public List getBeforeRunTasks(final RunConfiguration settings) {
- return getBeforeRunTasks(settings, false);
- }
- @NotNull
- @Override
- public List getBeforeRunTasks(RunConfiguration settings, boolean includeOnlyActiveTasks) {
final List tasks = myConfigurationToBeforeTasksMap.get(settings);
if (tasks != null) {
- return getCopies(tasks, includeOnlyActiveTasks);
+ return getCopies(tasks);
}
- return getTemplateBeforeRunTask(settings, includeOnlyActiveTasks);
+ return getTemplateBeforeRunTask(settings);
}
- private List getTemplateBeforeRunTask(RunConfiguration settings, boolean includeOnlyActiveTasks) {
+ private List getTemplateBeforeRunTask(RunConfiguration settings) {
final RunnerAndConfigurationSettings template = getConfigurationTemplate(settings.getFactory());
final List templateTasks = myConfigurationToBeforeTasksMap.get(template.getConfiguration());
if (templateTasks != null) {
- return getCopies(templateTasks, includeOnlyActiveTasks);
+ return getCopies(templateTasks);
}
final List _tasks = new ArrayList();
for (BeforeRunTaskProvider extends BeforeRunTask> provider : Extensions
.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myProject)) {
BeforeRunTask task = provider.createTask(settings);
- if (task != null) {
- if (includeOnlyActiveTasks && !task.isEnabled())
- continue;
+ if (task != null && task.isEnabled()) {
Key extends BeforeRunTask> providerID = provider.getId();
_tasks.add(task);
settings.getFactory().configureBeforeRunTaskDefaults(providerID, task);
@@ -861,11 +854,11 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
}
@NotNull
- private static List getCopies(List original, boolean includeOnlyActiveTasks) {
+ private static List getCopies(List original) {
List result = new ArrayList();
if (original != null) {
for (BeforeRunTask task : original) {
- if (includeOnlyActiveTasks && !task.isEnabled())
+ if (!task.isEnabled())
continue;
result.add(task.clone());
}
@@ -883,18 +876,20 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
if (shouldFire) fireRunConfigurationChanged(settings);
}
- public final void setBeforeRunTasks(final RunConfiguration runConfiguration, List tasks) {
- List templates = getTemplateBeforeRunTask(runConfiguration, false);
- Set> idsToSet = new HashSet>();
+ public final void setBeforeRunTasks(final RunConfiguration runConfiguration, @NotNull List tasks, boolean addEnabledTemplateTasksIfAbsent) {
List result = new ArrayList(tasks);
- for (BeforeRunTask task : tasks) {
- idsToSet.add(task.getProviderId());
- }
- int i = 0;
- for (BeforeRunTask template : templates) {
- if (!idsToSet.contains(template.getProviderId())) {
- result.add(i, template);
- i++;
+ if (addEnabledTemplateTasksIfAbsent) {
+ List templates = getTemplateBeforeRunTask(runConfiguration);
+ Set> idsToSet = new HashSet>();
+ for (BeforeRunTask task : tasks) {
+ idsToSet.add(task.getProviderId());
+ }
+ int i = 0;
+ for (BeforeRunTask template : templates) {
+ if (!idsToSet.contains(template.getProviderId())) {
+ result.add(i, template);
+ i++;
+ }
}
}
myConfigurationToBeforeTasksMap.put(runConfiguration, result);
@@ -907,7 +902,7 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
}
public void addConfiguration(final RunnerAndConfigurationSettings settings, final boolean isShared) {
- addConfiguration(settings, isShared, new ArrayList());
+ addConfiguration(settings, isShared, new ArrayList(), false);
}
public static RunManagerImpl getInstanceImpl(final Project project) {
diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/DefaultFindUsagesHandlerFactory.java b/platform/lang-impl/src/com/intellij/find/findUsages/DefaultFindUsagesHandlerFactory.java
index 4bbbef3f1274..5c921cc9471d 100644
--- a/platform/lang-impl/src/com/intellij/find/findUsages/DefaultFindUsagesHandlerFactory.java
+++ b/platform/lang-impl/src/com/intellij/find/findUsages/DefaultFindUsagesHandlerFactory.java
@@ -16,7 +16,6 @@
package com.intellij.find.findUsages;
import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
import com.intellij.lang.findUsages.LanguageFindUsages;
import com.intellij.psi.PsiFileSystemItem;
import org.jetbrains.annotations.NotNull;
diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
index a9c2eb118461..e5601ebb1b87 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java
@@ -502,8 +502,7 @@ public class FindInProjectUtil {
if (!keys.isEmpty()) {
fast = true;
List hits = new ArrayList();
- FileBasedIndex.getInstance()
- .getFilesWithKey(TrigramIndex.INDEX_ID, keys, new CommonProcessors.CollectProcessor(hits), scope);
+ FileBasedIndex.getInstance().getFilesWithKey(TrigramIndex.INDEX_ID, keys, new CommonProcessors.CollectProcessor(hits), scope);
for (VirtualFile hit : hits) {
resultFiles.add(pm.findFile(hit));
diff --git a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
index bcafd8f4c29d..9fdc87e70686 100644
--- a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
+++ b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
@@ -36,13 +36,13 @@ public class TrigramIndex extends ScalarIndexExtension {
public static final ID INDEX_ID = ID.create("Trigram.Index");
- private static final InputFilter INPUT_FILTER = new InputFilter() {
+ private static final FileBasedIndex.InputFilter INPUT_FILTER = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(VirtualFile file) {
return !file.getFileType().isBinary();
}
};
- private static final InputFilter NO_FILES = new InputFilter() {
+ private static final FileBasedIndex.InputFilter NO_FILES = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(VirtualFile file) {
return false;
@@ -82,7 +82,7 @@ public class TrigramIndex extends ScalarIndexExtension {
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
if (ENABLED) {
return INPUT_FILTER;
}
diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java
index 957921ae7316..4c648d3a3ed9 100644
--- a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java
+++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java
@@ -98,7 +98,7 @@ public class FrameworkDetectionIndex extends ScalarIndexExtension {
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
if (myInputFilter == null) {
final Set acceptedTypes = new HashSet();
for (FrameworkDetector detector : FrameworkDetector.EP_NAME.getExtensions()) {
@@ -119,7 +119,7 @@ public class FrameworkDetectionIndex extends ScalarIndexExtension {
return myRegistry.getDetectorsVersion();
}
- private static class FileTypesInputFilter implements InputFilter {
+ private static class FileTypesInputFilter implements FileBasedIndex.InputFilter {
private final Set myAcceptedTypes;
public FileTypesInputFilter(Set acceptedTypes) {
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeHighlighterProvider.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeHighlighterProvider.java
index 3b3208aff5d1..03d312c50c81 100644
--- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeHighlighterProvider.java
+++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeHighlighterProvider.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterProvider;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ide.highlighter.custom.CustomFileHighlighter;
@@ -32,7 +33,7 @@ public class CustomFileTypeHighlighterProvider implements SyntaxHighlighterProvi
@Nullable
public SyntaxHighlighter create(final FileType fileType, @Nullable final Project project, @Nullable final VirtualFile file) {
if (fileType instanceof AbstractFileType) {
- return new CustomFileHighlighter(((AbstractFileType) fileType).getSyntaxTable());
+ return new CustomFileHighlighter(((CustomSyntaxTableFileType) fileType).getSyntaxTable());
}
return null;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/StandardFileTypeRegistrator.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/StandardFileTypeRegistrator.java
index 603bd0278270..a7f7d0da14b3 100644
--- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/StandardFileTypeRegistrator.java
+++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/StandardFileTypeRegistrator.java
@@ -25,6 +25,7 @@ import com.intellij.ide.highlighter.custom.SyntaxTable;
import com.intellij.lang.Commenter;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
public class StandardFileTypeRegistrator implements FileTypeRegistrator {
public void initFileType(final FileType fileType) {
@@ -51,9 +52,9 @@ public class StandardFileTypeRegistrator implements FileTypeRegistrator {
}
private static class MyCommenter implements Commenter {
- private final AbstractFileType myAbstractFileType;
+ private final CustomSyntaxTableFileType myAbstractFileType;
- public MyCommenter(final AbstractFileType abstractFileType) {
+ public MyCommenter(final CustomSyntaxTableFileType abstractFileType) {
myAbstractFileType = abstractFileType;
}
diff --git a/platform/lang-impl/src/com/intellij/indentation/IndentationAnnotatorVisitor.java b/platform/lang-impl/src/com/intellij/indentation/IndentationAnnotatorVisitor.java
index facb47a68a3a..dc42077a1e67 100644
--- a/platform/lang-impl/src/com/intellij/indentation/IndentationAnnotatorVisitor.java
+++ b/platform/lang-impl/src/com/intellij/indentation/IndentationAnnotatorVisitor.java
@@ -83,8 +83,8 @@ public class IndentationAnnotatorVisitor extends PsiElementVisitor {
final int delta = currentIndentLength - lastIndent;
if (currentIndentLength % indentInfoLength != 0 || delta > indentInfoLength) {
final String message = useTab
- ? currentIndentLength + " tabs were used for indentation. Must be indented using " + indentInfoLength + " tabs"
- : currentIndentLength + " spaces were used for indentation. Must be indented using " + indentInfoLength + " spaces";
+ ? delta + " tabs were used for indentation. Must be indented using " + indentInfoLength + " tabs"
+ : delta + " spaces were used for indentation. Must be indented using " + indentInfoLength + " spaces";
myHolder.createErrorAnnotation(leaf, message);
}
lastIndent = currentIndentLength / indentInfoLength * indentInfoLength;
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileTypes/PlainTextSyntaxHighlighterFactory.java b/platform/lang-impl/src/com/intellij/openapi/fileTypes/PlainTextSyntaxHighlighterFactory.java
index 6251aa3a93eb..927e4c729737 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileTypes/PlainTextSyntaxHighlighterFactory.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileTypes/PlainTextSyntaxHighlighterFactory.java
@@ -20,13 +20,11 @@
package com.intellij.openapi.fileTypes;
import com.intellij.ide.highlighter.custom.AbstractCustomLexer;
-import com.intellij.ide.highlighter.custom.CustomHighlighterColors;
import com.intellij.ide.highlighter.custom.tokens.*;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.CustomHighlighterTokenType;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
index c49b1ecbc643..39efab431bb4 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
@@ -842,6 +842,7 @@ public class SingleInspectionProfilePanel extends JPanel {
}
private void setSelectedProfile(final ModifiableModel modifiableModel) {
+ if (mySelectedProfile == modifiableModel) return;
mySelectedProfile = (InspectionProfileImpl)modifiableModel;
if (mySelectedProfile != null) {
myInitialProfile = mySelectedProfile.getName();
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
index 1e7c3d7c7743..7ac97fa442fa 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/BaseFilterLexerUtil.java
@@ -21,7 +21,6 @@ import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.psi.impl.cache.impl.id.IdIndexEntry;
import com.intellij.psi.impl.cache.impl.id.IdTableBuilding;
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
-import com.intellij.psi.impl.cache.impl.todo.LexerBasedTodoIndexer;
import com.intellij.psi.impl.cache.impl.todo.TodoIndexEntry;
import com.intellij.psi.search.IndexPattern;
import com.intellij.util.indexing.FileContent;
@@ -29,7 +28,6 @@ import com.intellij.util.indexing.IdDataConsumer;
import gnu.trove.THashMap;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
public class BaseFilterLexerUtil {
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java
index fa9b7aa17391..62706a9764b3 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java
@@ -19,7 +19,7 @@ package com.intellij.psi.impl.cache.impl.id;
import com.intellij.lang.cacheBuilder.CacheBuilderRegistry;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.indexing.*;
@@ -42,7 +42,7 @@ import java.util.Map;
public class IdIndex extends FileBasedIndexExtension {
@NonNls public static final ID NAME = ID.create("IdIndex");
- private final InputFilter myInputFilter = new InputFilter() {
+ private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(final VirtualFile file) {
final FileType fileType = file.getFileType();
@@ -120,13 +120,13 @@ public class IdIndex extends FileBasedIndexExtension {
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
return myInputFilter;
}
private static boolean isIndexable(FileType fileType) {
return fileType instanceof LanguageFileType ||
- fileType instanceof AbstractFileType ||
+ fileType instanceof CustomSyntaxTableFileType ||
IdTableBuilding.isIdIndexerRegistered(fileType) ||
CacheBuilderRegistry.getInstance().getCacheBuilder(fileType) != null;
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java
new file mode 100644
index 000000000000..c190dbb7fa82
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.impl.cache.impl.id;
+
+import com.intellij.ide.highlighter.HighlighterFactory;
+import com.intellij.lang.Language;
+import com.intellij.lang.LanguageParserDefinitions;
+import com.intellij.lang.ParserDefinition;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
+import com.intellij.openapi.editor.highlighter.EditorHighlighter;
+import com.intellij.openapi.editor.highlighter.HighlighterIterator;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.FileTypes;
+import com.intellij.openapi.fileTypes.LanguageFileType;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.CustomHighlighterTokenType;
+import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
+import com.intellij.psi.impl.cache.impl.CacheUtil;
+import com.intellij.psi.impl.cache.impl.IndexPatternUtil;
+import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
+import com.intellij.psi.impl.cache.impl.todo.TodoIndexEntry;
+import com.intellij.psi.impl.cache.impl.todo.TodoIndexers;
+import com.intellij.psi.search.IndexPattern;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.tree.TokenSet;
+import com.intellij.util.containers.CollectionFactory;
+import com.intellij.util.indexing.DataIndexer;
+import com.intellij.util.indexing.FileBasedIndexImpl;
+import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.SubstitutedFileType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Author: dmitrylomov
+ */
+public abstract class PlatformIdTableBuilding {
+ static final HashMap> ourTodoIndexers =
+ new HashMap>();
+ private static final TokenSet ABSTRACT_FILE_COMMENT_TOKENS =
+ TokenSet.create(CustomHighlighterTokenType.LINE_COMMENT, CustomHighlighterTokenType.MULTI_LINE_COMMENT);
+
+ private PlatformIdTableBuilding() {}
+
+ @Nullable
+ public static DataIndexer getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
+ final DataIndexer indexer = ourTodoIndexers.get(fileType);
+
+ if (indexer != null) {
+ return indexer;
+ }
+
+ final DataIndexer extIndexer;
+ if (fileType instanceof SubstitutedFileType) {
+ SubstitutedFileType sft = (SubstitutedFileType)fileType;
+ extIndexer =
+ new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
+ }
+ else {
+ extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
+ }
+ if (extIndexer != null) {
+ return extIndexer;
+ }
+
+ if (fileType instanceof LanguageFileType) {
+ final Language lang = ((LanguageFileType)fileType).getLanguage();
+ final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
+ final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
+ if (commentTokens != null) {
+ return new TokenSetTodoIndexer(commentTokens, virtualFile);
+ }
+ }
+
+ if (fileType instanceof CustomSyntaxTableFileType) {
+ return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
+ }
+
+ return null;
+ }
+
+ public static boolean checkCanUseCachedEditorHighlighter(final CharSequence chars, final EditorHighlighter editorHighlighter) {
+ assert editorHighlighter instanceof LexerEditorHighlighter;
+ final boolean b = ((LexerEditorHighlighter)editorHighlighter).checkContentIsEqualTo(chars);
+ if (!b) {
+ final Logger logger = Logger.getInstance(IdTableBuilding.class.getName());
+ logger.warn("Unexpected mismatch of editor highlighter content with indexing content");
+ }
+ return b;
+ }
+
+ @Deprecated
+ public static void registerTodoIndexer(FileType fileType, DataIndexer indexer) {
+ ourTodoIndexers.put(fileType, indexer);
+ }
+
+
+ private static class CompositeTodoIndexer implements DataIndexer {
+
+ private final DataIndexer[] indexers;
+
+ public CompositeTodoIndexer(DataIndexer... indexers) {
+ this.indexers = indexers;
+ }
+
+ @NotNull
+ @Override
+ public Map map(FileContent inputData) {
+ Map result = CollectionFactory.newTroveMap();
+ for (DataIndexer indexer : indexers) {
+ for (Map.Entry entry : indexer.map(inputData).entrySet()) {
+ TodoIndexEntry key = entry.getKey();
+ if (result.containsKey(key)) {
+ result.put(key, result.get(key) + entry.getValue());
+ } else {
+ result.put(key, entry.getValue());
+ }
+ }
+ }
+ return result;
+ }
+ }
+
+ private static class TokenSetTodoIndexer implements DataIndexer {
+ @NotNull private final TokenSet myCommentTokens;
+ private final VirtualFile myFile;
+
+ public TokenSetTodoIndexer(@NotNull final TokenSet commentTokens, @NotNull final VirtualFile file) {
+ myCommentTokens = commentTokens;
+ myFile = file;
+ }
+
+ @Override
+ @NotNull
+ public Map map(final FileContent inputData) {
+ if (IndexPatternUtil.getIndexPatternCount() > 0) {
+ final CharSequence chars = inputData.getContentAsText();
+ final OccurrenceConsumer occurrenceConsumer = new OccurrenceConsumer(null, true);
+ EditorHighlighter highlighter;
+
+ final EditorHighlighter editorHighlighter = inputData.getUserData(FileBasedIndexImpl.EDITOR_HIGHLIGHTER);
+ if (editorHighlighter != null && checkCanUseCachedEditorHighlighter(chars, editorHighlighter)) {
+ highlighter = editorHighlighter;
+ }
+ else {
+ highlighter = HighlighterFactory.createHighlighter(null, myFile);
+ highlighter.setText(chars);
+ }
+
+ final int documentLength = chars.length();
+ BaseFilterLexer.TodoScanningData[] todoScanningDatas = null;
+ final HighlighterIterator iterator = highlighter.createIterator(0);
+
+ while (!iterator.atEnd()) {
+ final IElementType token = iterator.getTokenType();
+
+ if (myCommentTokens.contains(token) || CacheUtil.isInComments(token)) {
+ int start = iterator.getStart();
+ if (start >= documentLength) break;
+ int end = iterator.getEnd();
+
+ todoScanningDatas = BaseFilterLexer.advanceTodoItemsCount(
+ chars.subSequence(start, Math.min(end, documentLength)),
+ occurrenceConsumer,
+ todoScanningDatas
+ );
+ if (end > documentLength) break;
+ }
+ iterator.advance();
+ }
+ final Map map = new HashMap();
+ for (IndexPattern pattern : IndexPatternUtil.getIndexPatterns()) {
+ final int count = occurrenceConsumer.getOccurrenceCount(pattern);
+ if (count > 0) {
+ map.put(new TodoIndexEntry(pattern.getPatternString(), pattern.isCaseSensitive()), count);
+ }
+ }
+ return map;
+ }
+ return Collections.emptyMap();
+ }
+ }
+
+ static {
+ IdTableBuilding.registerIdIndexer(FileTypes.PLAIN_TEXT, new IdTableBuilding.PlainTextIndexer());
+ registerTodoIndexer(FileTypes.PLAIN_TEXT, new IdTableBuilding.PlainTextTodoIndexer());
+
+ IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_MODULE, null);
+ IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_WORKSPACE, null);
+ IdTableBuilding.registerIdIndexer(StdFileTypes.IDEA_PROJECT, null);
+
+ registerTodoIndexer(StdFileTypes.IDEA_MODULE, null);
+ registerTodoIndexer(StdFileTypes.IDEA_WORKSPACE, null);
+ registerTodoIndexer(StdFileTypes.IDEA_PROJECT, null);
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
index 594436346a7d..6488c6636892 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/cache/impl/todo/TodoIndex.java
@@ -21,11 +21,12 @@ import com.intellij.lang.LanguageParserDefinitions;
import com.intellij.lang.ParserDefinition;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.fileTypes.impl.AbstractFileType;
+import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.impl.cache.impl.id.IdTableBuilding;
+import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
import com.intellij.psi.search.IndexPatternProvider;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.indexing.*;
@@ -54,7 +55,7 @@ public class TodoIndex extends FileBasedIndexExtension
messageBus.connect().subscribe(IndexPatternProvider.INDEX_PATTERNS_CHANGED, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- FileBasedIndex.requestRebuild(NAME);
+ FileBasedIndex.getInstance().requestRebuild(NAME);
}
});
}
@@ -101,7 +102,8 @@ public class TodoIndex extends FileBasedIndexExtension
@NotNull
public Map map(final FileContent inputData) {
final VirtualFile file = inputData.getFile();
- final DataIndexer indexer = IdTableBuilding.getTodoIndexer(inputData.getFileType(), file);
+ final DataIndexer indexer = PlatformIdTableBuilding
+ .getTodoIndexer(inputData.getFileType(), file);
if (indexer != null) {
return indexer.map(inputData);
}
@@ -109,7 +111,7 @@ public class TodoIndex extends FileBasedIndexExtension
}
};
- private final InputFilter myInputFilter = new InputFilter() {
+ private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(final VirtualFile file) {
if (!(file.getFileSystem() instanceof LocalFileSystem)) {
@@ -129,7 +131,7 @@ public class TodoIndex extends FileBasedIndexExtension
}
return IdTableBuilding.isTodoIndexerRegistered(fileType) ||
- fileType instanceof AbstractFileType;
+ fileType instanceof CustomSyntaxTableFileType;
}
};
@@ -166,7 +168,7 @@ public class TodoIndex extends FileBasedIndexExtension
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
return myInputFilter;
}
}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
index 45fc9b448b2c..f11d1fc871b8 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java
@@ -159,8 +159,8 @@ public class FileIncludeIndex extends FileBasedIndexExtension
- implements InputFilter, KeyDescriptor, DataIndexer {
+ implements FileBasedIndex.InputFilter, KeyDescriptor, DataIndexer {
public static Collection getFiles(FileType fileType, GlobalSearchScope scope) {
@@ -52,7 +52,7 @@ public class FileTypeIndex extends ScalarIndexExtension
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
return this;
}
diff --git a/platform/lang-impl/src/com/intellij/psi/search/FilenameIndex.java b/platform/lang-impl/src/com/intellij/psi/search/FilenameIndex.java
index 25e603f2c894..387612fff350 100644
--- a/platform/lang-impl/src/com/intellij/psi/search/FilenameIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/search/FilenameIndex.java
@@ -57,7 +57,7 @@ public class FilenameIndex extends ScalarIndexExtension {
}
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
return myInputFilter;
}
@@ -102,7 +102,7 @@ public class FilenameIndex extends ScalarIndexExtension {
}
}
- private static class MyInputFilter implements InputFilter {
+ private static class MyInputFilter implements FileBasedIndex.InputFilter {
@Override
public boolean acceptInput(final VirtualFile file) {
return true;
diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
index d11e89e0f5a7..05a5e6d08e00 100644
--- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java
@@ -200,7 +200,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
@NotNull final Project project,
@Nullable final GlobalSearchScope scope,
@NotNull final Processor super Psi> processor) {
- final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
+ final FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
fileBasedIndex.ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, scope);
final PersistentFS fs = (PersistentFS)ManagingFS.getInstance();
@@ -211,11 +211,11 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
try {
try {
// disable up-to-date check to avoid locks on attempt to acquire index write lock while holding at the same time the readLock for this index
- FileBasedIndex.disableUpToDateCheckForCurrentThread();
+ FileBasedIndexImpl.disableUpToDateCheckForCurrentThread();
index.getReadLock().lock();
final ValueContainer container = index.getData(key);
- final FileBasedIndex.ProjectIndexableFilesFilter projectFilesFilter = fileBasedIndex.projectIndexableFiles(project);
+ final FileBasedIndexImpl.ProjectIndexableFilesFilter projectFilesFilter = fileBasedIndex.projectIndexableFiles(project);
return container.forEach(new ValueContainer.ContainerAction() {
@Override
@@ -320,14 +320,14 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
}
finally {
index.getReadLock().unlock();
- FileBasedIndex.enableUpToDateCheckForCurrentThread();
+ FileBasedIndexImpl.enableUpToDateCheckForCurrentThread();
}
}
catch (StorageException e) {
forceRebuild(e);
}
catch (RuntimeException e) {
- final Throwable cause = FileBasedIndex.getCauseToRebuildIndex(e);
+ final Throwable cause = FileBasedIndexImpl.getCauseToRebuildIndex(e);
if (cause != null) {
forceRebuild(cause);
}
@@ -354,7 +354,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
}
private static void requestRebuild() {
- FileBasedIndex.requestRebuild(StubUpdatingIndex.INDEX_ID);
+ FileBasedIndex.getInstance().requestRebuild(StubUpdatingIndex.INDEX_ID);
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java
index 40fa9d8ac2cd..cfb2be18ee98 100644
--- a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java
+++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java
@@ -63,7 +63,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
}
};
- private static final InputFilter INPUT_FILTER = new InputFilter() {
+ private static final FileBasedIndex.InputFilter INPUT_FILTER = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(@NotNull final VirtualFile file) {
return canHaveStub(file);
@@ -144,7 +144,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
@NotNull
@Override
- public InputFilter getInputFilter() {
+ public FileBasedIndex.InputFilter getInputFilter() {
return INPUT_FILTER;
}
@@ -232,7 +232,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
}
catch (StorageException e) {
LOG.info(e);
- FileBasedIndex.requestRebuild(INDEX_ID);
+ FileBasedIndex.getInstance().requestRebuild(INDEX_ID);
}
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/BaseRefactoringProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/BaseRefactoringProcessor.java
index d5cb1d5dd353..091e4f9bc0e5 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/BaseRefactoringProcessor.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/BaseRefactoringProcessor.java
@@ -415,7 +415,7 @@ public abstract class BaseRefactoringProcessor {
for (Iterator iterator = usageInfoSet.iterator(); iterator.hasNext();) {
UsageInfo usageInfo = iterator.next();
final PsiElement element = usageInfo.getElement();
- if (element == null || !element.isWritable()) {
+ if (element == null || !isToBeChanged(usageInfo)) {
iterator.remove();
}
}
@@ -473,6 +473,10 @@ public abstract class BaseRefactoringProcessor {
}
}
+ protected boolean isToBeChanged(UsageInfo usageInfo) {
+ return usageInfo.isWritable();
+ }
+
/**
* Refactorings that spoil PSI (write something directly to documents etc.) should
* do that in this method.
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameDialog.java b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameDialog.java
index 64fbfa6c5348..00a7d80e3a66 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameDialog.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameDialog.java
@@ -135,7 +135,8 @@ public class RenameDialog extends RefactoringDialog {
}
public String[] getSuggestedNames() {
- LinkedHashSet result = new LinkedHashSet();
+ final LinkedHashSet result = new LinkedHashSet();
+ result.add(UsageViewUtil.getShortName(myPsiElement));
final NameSuggestionProvider[] providers = Extensions.getExtensions(NameSuggestionProvider.EP_NAME);
for(NameSuggestionProvider provider: providers) {
SuggestedNameInfo info = provider.getSuggestedNames(myPsiElement, myNameSuggestionContext, result);
@@ -144,9 +145,6 @@ public class RenameDialog extends RefactoringDialog {
if (provider instanceof PreferrableNameSuggestionProvider && !((PreferrableNameSuggestionProvider)provider).shouldCheckOthers()) break;
}
}
- if (result.size() == 0) {
- result.add(UsageViewUtil.getShortName(myPsiElement));
- }
return ArrayUtil.toStringArray(result);
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
index 19ce3bfd0d4e..d6015a1ed694 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/InplaceRefactoring.java
@@ -748,11 +748,6 @@ public abstract class InplaceRefactoring {
documentManager.commitAllDocuments();
finish(false);
moveOffsetAfter(false);
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- public void run() {
- documentManager.doPostponedOperationsAndUnblockDocument(myEditor.getDocument());
- }
- });
}
finally {
try {
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
index 8eedbe64a682..baa446d0025f 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
@@ -223,7 +223,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
elementProcessor.isToSearchInComments(element),
elementProcessor.isToSearchForTextOccurrences(element));
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
- if (factory.isApplicable(element)) {
+ if (factory.getOptionName() != null && factory.isApplicable(element)) {
renameProcessor.addRenamerFactory(factory);
}
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java
index b2382fd586a9..bbadc0c06cc0 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java
@@ -405,6 +405,14 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
}
}
+ @Override
+ protected boolean isToBeChanged(UsageInfo usageInfo) {
+ if (usageInfo instanceof SafeDeleteReferenceUsageInfo) {
+ return ((SafeDeleteReferenceUsageInfo)usageInfo).isSafeDelete() && super.isToBeChanged(usageInfo);
+ }
+ return super.isToBeChanged(usageInfo);
+ }
+
public static boolean validElement(PsiElement element) {
if (element instanceof PsiFile) return true;
if (!element.isPhysical()) return false;
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
similarity index 97%
rename from platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
rename to platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
index 6e8bcf2a307b..a5f15bf670d1 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
@@ -26,7 +26,6 @@ import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.ApplicationAdapter;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
@@ -87,8 +86,8 @@ import java.util.concurrent.atomic.AtomicInteger;
* Date: Dec 20, 2007
*/
-public class FileBasedIndex implements ApplicationComponent {
- private static final Logger LOG = Logger.getInstance("#com.intellij.util.indexing.FileBasedIndex");
+public class FileBasedIndexImpl extends FileBasedIndex {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.util.indexing.FileBasedIndexImpl");
@NonNls
private static final String CORRUPTION_MARKER_NAME = "corruption.marker";
private final Map