use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class SwitchToFind method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
if (KeymapUtil.isEmacsKeymap()) {
// Emacs users are accustomed to the editor that executes 'find next' on subsequent pressing of shortcut that
// activates 'incremental search'. Hence, we do the similar hack here for them.
ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_NEXT).actionPerformed(e);
return;
}
EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
final FindModel findModel = search.getFindModel();
FindUtil.configureFindModel(false, e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE), findModel, false);
search.getComponent().getSearchTextComponent().selectAll();
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class TogglePreserveCaseAction method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY);
FindModel findModel = search != null ? search.getFindModel() : null;
e.getPresentation().setEnabled(findModel != null && !findModel.isRegularExpressions());
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class SearchResults method repairCursorFromStack.
private boolean repairCursorFromStack() {
if (myCursorPositions.size() >= 2) {
final Pair<FindModel, FindResult> oldPosition = myCursorPositions.get(myCursorPositions.size() - 2);
if (oldPosition.first.equals(myFindModel)) {
FindResult newCursor;
if ((newCursor = findOccurrenceEqualTo(oldPosition.second)) != null) {
myCursorPositions.pop();
myCursor = newCursor;
return true;
}
}
}
return false;
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class HighlightHandlerBase method setupFindModel.
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);
}
use of com.intellij.find.FindModel in project intellij-community by JetBrains.
the class SearchInLibsTest method testFindInPathInLibrariesIsNotBrokenAgain.
public void testFindInPathInLibrariesIsNotBrokenAgain() 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);
// to defeat trigram index
model.setStringToFind(/*LibraryClas*/
"s1");
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);
assertEquals(3, usages.size());
}
Aggregations