use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class GrFindManagerTest method testFindInJavaDocs.
public void testFindInJavaDocs() {
FindModel findModel = FindManagerTestUtils.configureFindModel("done");
String text = "/** done done done */";
FindManagerTestUtils.runFindForwardAndBackward(myFindManager, findModel, text, "groovy");
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class GrFindManagerTest method testFindInLiteralToSkipQuotes.
public void testFindInLiteralToSkipQuotes() {
FindModel findModel = FindManagerTestUtils.configureFindModel("^done$");
findModel.setRegularExpressions(true);
findModel.setInStringLiteralsOnly(true);
findModel.setInCommentsOnly(false);
String text = "def n = \"\"\"done\"\"\"\n def n = /done/\n def n = \"done\"\n def n = \"done2\"";
FindManagerTestUtils.runFindForwardAndBackward(myFindManager, findModel, text, "groovy");
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class SearchInLibsTest method testFindInPathInLibraryDirActuallySearchesInTheirSourcesToo.
public void testFindInPathInLibraryDirActuallySearchesInTheirSourcesToo() throws Exception {
FindModel model = new FindModel();
final PsiClass aClass = myJavaFacade.findClass("LibraryClass1");
assertNotNull(aClass);
model.setDirectoryName(aClass.getContainingFile().getContainingDirectory().getVirtualFile().getPath());
model.setCaseSensitive(true);
model.setCustomScope(false);
model.setStringToFind("LibraryClass1");
model.setProjectScope(false);
List<UsageInfo> usages = Collections.synchronizedList(new ArrayList<>());
CommonProcessors.CollectProcessor<UsageInfo> consumer = new CommonProcessors.CollectProcessor<>(usages);
FindUsagesProcessPresentation presentation = FindInProjectUtil.setupProcessPresentation(getProject(), false, FindInProjectUtil.setupViewPresentation(false, model));
FindInProjectUtil.findUsages(model, getProject(), consumer, presentation);
assertSize(2, usages);
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class SearchInLibsTest method testFindInPathInLibrarySourceDirShouldSearchJustInThisDirectoryOnly.
public void testFindInPathInLibrarySourceDirShouldSearchJustInThisDirectoryOnly() throws Exception {
FindModel model = new FindModel();
final PsiClass aClass = myJavaFacade.findClass("x.X");
assertNotNull(aClass);
String classDirPath = aClass.getContainingFile().getContainingDirectory().getVirtualFile().getPath();
String sourceDirPath = ((PsiFile) aClass.getContainingFile().getNavigationElement()).getContainingDirectory().getVirtualFile().getPath();
assertFalse(classDirPath.equals(sourceDirPath));
model.setDirectoryName(sourceDirPath);
model.setCaseSensitive(true);
model.setCustomScope(false);
model.setStringToFind("xxx");
model.setProjectScope(false);
List<UsageInfo> usages = Collections.synchronizedList(new ArrayList<>());
CommonProcessors.CollectProcessor<UsageInfo> consumer = new CommonProcessors.CollectProcessor<>(usages);
FindUsagesProcessPresentation presentation = FindInProjectUtil.setupProcessPresentation(getProject(), false, FindInProjectUtil.setupViewPresentation(false, model));
FindInProjectUtil.findUsages(model, getProject(), consumer, presentation);
UsageInfo info = assertOneElement(usages);
assertEquals("X.java", info.getFile().getName());
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class UsageViewManagerTest method testScopeCreatedForFindInDirectory.
public void testScopeCreatedForFindInDirectory() {
VirtualFile dir = getProject().getBaseDir();
FindModel findModel = new FindModel();
findModel.setDirectoryName(dir.getPath());
findModel.setWithSubdirectories(true);
findModel.setProjectScope(false);
UsageTarget target = new FindInProjectUtil.StringUsageTarget(getProject(), findModel);
UsageViewManagerImpl manager = (UsageViewManagerImpl) UsageViewManager.getInstance(getProject());
SearchScope scope = manager.getMaxSearchScopeToWarnOfFallingOutOf(new UsageTarget[] { target });
assertEquals(scope, GlobalSearchScopesCore.directoryScope(getProject(), dir, true));
}
Aggregations