Move MethodReferencesSearch (and necessary closure) to java-indexing-api.

Remove references to StfFileTypes from SimpleAccessorReferencesSearch and extract them into one more CustomPropertyScopeProvider
This commit is contained in:
Evgeny Pasynkov
2012-07-30 11:24:30 +02:00
parent 78fc86e7db
commit 3944360e63
16 changed files with 34 additions and 7 deletions
@@ -24,7 +24,6 @@ import com.intellij.codeInsight.generation.PsiFieldMember;
import com.intellij.codeInsight.generation.PsiMethodMember;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.impl.AssignFieldFromParameterAction;
import com.intellij.codeInsight.intention.impl.CreateFieldFromParameterAction;
import com.intellij.codeInsight.intention.impl.FieldFromParameterUtils;
import com.intellij.ide.util.MemberChooser;
import com.intellij.openapi.application.ApplicationManager;
@@ -47,7 +47,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class JavaDocInfoGenerator {
@@ -0,0 +1,29 @@
/*
* 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.search;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.SearchScope;
public class SimpleAccessorScopeProvider implements CustomPropertyScopeProvider {
public SearchScope getScope(final Project project) {
return GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project),
StdFileTypes.JSP, StdFileTypes.JSPX,
StdFileTypes.XML, StdFileTypes.XHTML);
}
}
@@ -9,6 +9,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="core-api" />
<orderEntry type="module" module-name="java-psi-api" />
<orderEntry type="module" module-name="indexing-api" />
</component>
</module>
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.search;
import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
@@ -51,10 +50,7 @@ public class SimpleAccessorReferenceSearcher extends QueryExecutorBase<PsiRefere
static void addPropertyAccessUsages(PsiMethod method, SearchScope scope, SearchRequestCollector collector) {
final String propertyName = PropertyUtil.getPropertyName(method);
if (StringUtil.isNotEmpty(propertyName)) {
SearchScope additional = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(method.getProject()),
StdFileTypes.JSP, StdFileTypes.JSPX,
StdFileTypes.XML, StdFileTypes.XHTML);
SearchScope additional = GlobalSearchScope.EMPTY_SCOPE;
for (CustomPropertyScopeProvider provider : Extensions.getExtensions(CustomPropertyScopeProvider.EP_NAME)) {
additional = additional.union(provider.getScope(method.getProject()));
}
+1
View File
@@ -8,6 +8,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="core-api" exported="" />
<orderEntry type="module" module-name="projectModel-api" />
</component>
</module>
+2
View File
@@ -181,6 +181,8 @@
<codeInsight.lineMarkerProvider language="" implementationClass="com.intellij.ui.ColorLineMarkerProvider"/>
<!--<expectedTypesProvider implementation="com.intellij.codeInsight.JavaExpectedTypesProvider"/>-->
<customPropertyScopeProvider implementation="com.intellij.psi.impl.search.SimpleAccessorScopeProvider"/>
<referencesSearch implementation="com.intellij.psi.impl.search.PsiAnnotationMethodReferencesSearcher"/>
<referencesSearch implementation="com.intellij.psi.impl.search.ConstructorReferencesSearcher"/>
<referencesSearch implementation="com.intellij.psi.impl.search.SimpleAccessorReferenceSearcher"/>