本文整理汇总了Java中com.intellij.find.FindManager类的典型用法代码示例。如果您正苦于以下问题:Java FindManager类的具体用法?Java FindManager怎么用?Java FindManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FindManager类属于com.intellij.find包,在下文中一共展示了FindManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showSettings
import com.intellij.find.FindManager; //导入依赖的package包/类
@NotNull
private AnAction showSettings() {
final ConfigurableUsageTarget configurableUsageTarget = getConfigurableTarget(myTargets);
String description = null;
try {
description = configurableUsageTarget == null ? null : "Show settings for "+configurableUsageTarget.getLongDescriptiveName();
}
catch (IndexNotReadyException ignored) {
}
if (description == null) {
description = "Show find usages settings dialog";
}
return new AnAction("Settings...", description, AllIcons.General.ProjectSettings) {
{
KeyboardShortcut shortcut = configurableUsageTarget == null ? getShowUsagesWithSettingsShortcut() : configurableUsageTarget.getShortcut();
if (shortcut != null) {
registerCustomShortcutSet(new CustomShortcutSet(shortcut), getComponent());
}
}
@Override
public void actionPerformed(AnActionEvent e) {
FindManager.getInstance(getProject()).showSettingsAndFindUsages(myTargets);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:UsageViewImpl.java
示例2: findUsages
import com.intellij.find.FindManager; //导入依赖的package包/类
@NotNull
public Collection<UsageInfo> findUsages(@NotNull final PsiElement targetElement, @Nullable SearchScope scope) {
final Project project = getProject();
final FindUsagesHandler handler =
((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager().getFindUsagesHandler(targetElement, false);
final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
Assert.assertNotNull("Cannot find handler for: " + targetElement, handler);
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements());
final FindUsagesOptions options = handler.getFindUsagesOptions(null);
if (scope != null) options.searchScope = scope;
for (PsiElement psiElement : psiElements) {
handler.processElementUsages(psiElement, processor, options);
}
return processor.getResults();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CodeInsightTestFixtureImpl.java
示例3: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
Editor editor = e.getRequiredData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
if (project.isDisposed()) return;
FindModel oldModel = FindManager.getInstance(project).getFindInFileModel();
FindModel newModel = oldModel.clone();
String text = search.getTextInField();
if (StringUtil.isEmpty(text)) return;
newModel.setStringToFind(text);
FindUtil.findAllAndShow(project, editor, newModel);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FindAllAction.java
示例4: highlightUsages
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void highlightUsages(@NotNull PsiFile file, @NotNull Editor editor, boolean clearHighlights) {
PsiElement target = getElement();
if (file instanceof PsiCompiledFile) file = ((PsiCompiledFile)file).getDecompiledPsiFile();
Project project = target.getProject();
final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
final FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(target, true);
// in case of injected file, use host file to highlight all occurrences of the target in each injected file
PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
SearchScope searchScope = new LocalSearchScope(context);
Collection<PsiReference> refs = handler == null
? ReferencesSearch.search(target, searchScope, false).findAll()
: handler.findReferencesToHighlight(target, searchScope);
new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<PsiReference>(refs), project, target,
editor, context, clearHighlights).run();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PsiElement2UsageTargetAdapter.java
示例5: navigateToSelectedUsage
import com.intellij.find.FindManager; //导入依赖的package包/类
private void navigateToSelectedUsage(JBTable source) {
int[] rows = source.getSelectedRows();
List<Usage> navigations = null;
for(int row:rows) {
Object valueAt = source.getModel().getValueAt(row, 0);
if (valueAt instanceof Usage) {
if (navigations == null) navigations = new SmartList<Usage>();
Usage at = (Usage)valueAt;
navigations.add(at);
}
}
if (navigations != null) {
applyTo(FindManager.getInstance(myProject).getFindInProjectModel(), false);
doCancelAction();
navigations.get(0).navigate(true);
for(int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FindDialog.java
示例6: FindResultUsageInfo
import com.intellij.find.FindManager; //导入依赖的package包/类
public FindResultUsageInfo(@NotNull FindManager finder, @NotNull PsiFile file, int offset, @NotNull FindModel findModel, @NotNull FindResult result) {
super(file, result.getStartOffset(), result.getEndOffset());
myFindManager = finder;
myFindModel = findModel;
assert result.isStringFound();
if (myFindModel.isRegularExpressions() ||
myFindModel.isInCommentsOnly() ||
myFindModel.isInStringLiteralsOnly() ||
myFindModel.isExceptStringLiterals() ||
myFindModel.isExceptCommentsAndStringLiterals() ||
myFindModel.isExceptComments()
) {
myAnchor = SmartPointerManager.getInstance(getProject()).createSmartPsiFileRangePointer(file, TextRange.from(offset, 0));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FindResultUsageInfo.java
示例7: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
if (editor == null || project == null) return;
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
FindManager findManager = FindManager.getInstance(project);
if(!findManager.selectNextOccurrenceWasPerformed() && findManager.findNextUsageInEditor(editor)) {
return;
}
FindUtil.searchAgain(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.next"),
null
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SearchAgainAction.java
示例8: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
FindManager findManager = FindManager.getInstance(project);
if(!findManager.selectNextOccurrenceWasPerformed() && findManager.findPreviousUsageInEditor(editor)) {
return;
}
FindUtil.searchBack(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.previous"),
null
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SearchBackAction.java
示例9: showFindUsages
import com.intellij.find.FindManager; //导入依赖的package包/类
private static void showFindUsages(@NotNull Project project,
@NotNull String propertyName,
@NotNull String selectedString,
@NotNull String replaceWith,
@NotNull MavenDomProjectModel model) {
UsageViewManager manager = UsageViewManager.getInstance(project);
if (manager == null) return;
assureFindToolWindowRegistered(project);
FindManager findManager = FindManager.getInstance(project);
FindModel findModel = createFindModel(findManager, selectedString, replaceWith);
final UsageViewPresentation presentation = FindInProjectUtil.setupViewPresentation(true, findModel);
final FindUsagesProcessPresentation processPresentation = FindInProjectUtil.setupProcessPresentation(project, true, presentation);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = (FindModel)findModel.clone();
ReplaceInProjectManager.getInstance(project)
.searchAndShowUsages(manager, new MyUsageSearcherFactory(model, propertyName, selectedString), findModelCopy, presentation,
processPresentation,
findManager);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IntroducePropertyAction.java
示例10: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(PlatformDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
if (editor == null || project == null) return;
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
if(FindManager.getInstance(project).findNextUsageInEditor(editor)) {
return;
}
FindUtil.searchAgain(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.next"),
null
);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:SearchAgainAction.java
示例11: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(PlatformDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
if(FindManager.getInstance(project).findPreviousUsageInEditor(editor)) {
return;
}
FindUtil.searchBack(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.previous"),
null
);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:SearchBackAction.java
示例12: highlightUsages
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void highlightUsages(@Nonnull PsiFile file, @Nonnull Editor editor, boolean clearHighlights) {
PsiElement target = getElement();
if (file instanceof PsiCompiledFile) file = ((PsiCompiledFile)file).getDecompiledPsiFile();
Project project = target.getProject();
final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
final FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(target, true);
// in case of injected file, use host file to highlight all occurrences of the target in each injected file
PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file);
SearchScope searchScope = new LocalSearchScope(context);
Collection<PsiReference> refs = handler == null ? ReferencesSearch.search(target, searchScope, false).findAll() : handler.findReferencesToHighlight(target, searchScope);
new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<>(refs), project, target, editor, context, clearHighlights).run();
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PsiElement2UsageTargetAdapter.java
示例13: FindResultUsageInfo
import com.intellij.find.FindManager; //导入依赖的package包/类
public FindResultUsageInfo(@Nonnull FindManager finder, @Nonnull PsiFile file, int offset, @Nonnull FindModel findModel, @Nonnull FindResult result) {
super(file, result.getStartOffset(), result.getEndOffset());
myFindManager = finder;
myFindModel = findModel;
assert result.isStringFound();
if (myFindModel.isRegularExpressions() ||
myFindModel.isInCommentsOnly() ||
myFindModel.isInStringLiteralsOnly() ||
myFindModel.isExceptStringLiterals() ||
myFindModel.isExceptCommentsAndStringLiterals() ||
myFindModel.isExceptComments()
) {
myAnchor = SmartPointerManager.getInstance(getProject()).createSmartPsiFileRangePointer(file, TextRange.from(offset, 0));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FindResultUsageInfo.java
示例14: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
if (editor == null || project == null) return;
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
if(FindManager.getInstance(project).findNextUsageInEditor(editor)) {
return;
}
FindUtil.searchAgain(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.next"),
null
);
}
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:SearchAgainAction.java
示例15: actionPerformed
import com.intellij.find.FindManager; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final FileEditor editor = e.getData(PlatformDataKeys.FILE_EDITOR);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(
project, new Runnable() {
@Override
public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
if(FindManager.getInstance(project).findPreviousUsageInEditor(editor)) {
return;
}
FindUtil.searchBack(project, editor, e.getDataContext());
}
},
IdeBundle.message("command.find.previous"),
null
);
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:SearchBackAction.java
示例16: findAll
import com.intellij.find.FindManager; //导入依赖的package包/类
public void findAll() {
FindManager findManager = FindManager.getInstance(project);
FindModel findModel = createFindModel(findManager);
findResults = new ArrayList<FindResult>();
CharSequence text = document.getCharsSequence();
int offset = 0;
while (true) {
FindResult result = findManager.findString(text, offset, findModel);
if (!result.isStringFound()) {
return;
}
offset = result.getEndOffset();
findResults.add(result);
}
}
开发者ID:andresdominguez,项目名称:ddescriber,代码行数:22,代码来源:JasmineFinder.java
示例17: findExpressionOccurrences
import com.intellij.find.FindManager; //导入依赖的package包/类
public PsiExpression[] findExpressionOccurrences() {
if (myMainOccurence instanceof PsiLiteralExpression && !myMainOccurence.isPhysical()) {
final FindManager findManager = FindManager.getInstance(getScope().getProject());
final FindModel findModel = (FindModel)findManager.getFindInFileModel().clone();
findModel.setCaseSensitive(true);
findModel.setRegularExpressions(false);
String value = StringUtil.stripQuotesAroundValue(myMainOccurence.getText());
if (value.length() > 0) {
findModel.setStringToFind(value);
final List<PsiExpression> results = new ArrayList<PsiExpression>();
final PsiFile file = getScope().getContainingFile();
final String text = getScope().getText();
final int offset = getScope().getTextRange().getStartOffset();
FindResult result = findManager.findString(text, 0, findModel);
final Set<PsiLiteralExpression> literals = new HashSet<PsiLiteralExpression>();
while (result.isStringFound()) {
final int startOffset = offset + result.getStartOffset();
final int endOffset = result.getEndOffset();
final PsiLiteralExpression literalExpression =
PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), PsiLiteralExpression.class);
if (literalExpression != null && !literals.contains(literalExpression)) { //enum. occurrences inside string literals
final PsiExpression expression =
IntroduceVariableBase.getSelectedExpression(file.getProject(), file, startOffset, offset + endOffset);
if (expression != null && IntroduceVariableBase.getErrorMessage(expression) == null) {
results.add(expression);
literals.add(literalExpression);
}
}
result = findManager.findString(text, endOffset, findModel);
}
return results.toArray(new PsiExpression[results.size()]);
}
}
return CodeInsightUtil.findExpressionOccurrences(myScope, myMainOccurence);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:ExpressionOccurrenceManager.java
示例18: createGotToOptionsListener
import com.intellij.find.FindManager; //导入依赖的package包/类
@NotNull
private HyperlinkListener createGotToOptionsListener(@NotNull final UsageTarget[] targets) {
return new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
if (e.getDescription().equals(FIND_OPTIONS_HREF_TARGET)) {
FindManager.getInstance(myProject).showSettingsAndFindUsages(targets);
}
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SearchForUsagesRunnable.java
示例19: createSearchInProjectListener
import com.intellij.find.FindManager; //导入依赖的package包/类
@NotNull
private HyperlinkListener createSearchInProjectListener() {
return new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
if (e.getDescription().equals(SEARCH_IN_PROJECT_HREF_TARGET)) {
PsiElement psiElement = getPsiElement(mySearchFor);
if (psiElement != null) {
FindManager.getInstance(myProject).findUsagesInScope(psiElement, GlobalSearchScope.projectScope(myProject));
}
}
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SearchForUsagesRunnable.java
示例20: setupFindModel
import com.intellij.find.FindManager; //导入依赖的package包/类
static void setupFindModel(final Project project) {
final FindManager findManager = FindManager.getInstance(project);
FindModel model = findManager.getFindNextModel();
if (model == null) {
model = findManager.getFindInFileModel();
}
model.setSearchHighlighters(true);
findManager.setFindWasPerformed();
findManager.setFindNextModel(model);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HighlightHandlerBase.java
注:本文中的com.intellij.find.FindManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论