IDEA-63340 Add "find usage" to fields in database [initial]

This commit is contained in:
Gregory Shrago
2011-04-14 16:48:05 +04:00
parent 0b6f18b18b
commit e71480a25c
3 changed files with 40 additions and 0 deletions
@@ -0,0 +1,31 @@
/*
* 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.
*/
package com.intellij.find.findUsages;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiElement;
import com.intellij.usages.Usage;
import com.intellij.util.Processor;
/**
* @author gregsh
*/
public abstract class CustomUsageSearcher {
public static final ExtensionPointName<CustomUsageSearcher> EP_NAME = ExtensionPointName.create("com.intellij.customUsageSearcher");
public abstract void processElementUsages(final PsiElement element, final Processor<Usage> processor, final FindUsagesOptions options);
}
@@ -380,6 +380,14 @@ public class FindUsagesManager implements JDOMExternalizable {
}
});
handler.processElementUsages(element, usageInfoProcessor, options);
for (CustomUsageSearcher searcher : Extensions.getExtensions(CustomUsageSearcher.EP_NAME)) {
try {
searcher.processElementUsages(element, processor, options);
}
catch (Exception e) {
LOG.error(e);
}
}
}
Project project = ApplicationManager.getApplication().runReadAction(new Computable<Project>() {
@@ -313,6 +313,7 @@
<extensionPoint name="renameInputValidator" interface="com.intellij.refactoring.rename.RenameInputValidator"/>
<extensionPoint name="findUsagesHandlerFactory" interface="com.intellij.find.findUsages.FindUsagesHandlerFactory" area="IDEA_PROJECT"/>
<extensionPoint name="customUsageSearcher" interface="com.intellij.find.findUsages.CustomUsageSearcher"/>
<extensionPoint name="readWriteAccessDetector" interface="com.intellij.codeInsight.highlighting.ReadWriteAccessDetector"/>