本文整理汇总了Java中com.intellij.find.FindModel类的典型用法代码示例。如果您正苦于以下问题:Java FindModel类的具体用法?Java FindModel怎么用?Java FindModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FindModel类属于com.intellij.find包,在下文中一共展示了FindModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindInPathInLibraryDirActuallySearchesInTheirSourcesToo
import com.intellij.find.FindModel; //导入依赖的package包/类
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 = new ArrayList<>();
FindInProjectUtil.findUsages(model, getProject(),
new CommonProcessors.CollectProcessor<>(
usages), FindInProjectUtil
.setupProcessPresentation(getProject(), false, FindInProjectUtil.setupViewPresentation(false, model)));
assertEquals(2, usages.size());
}
示例2: testFindInPathInLibrarySourceDirShouldSearchJustInThisDirectoryOnly
import com.intellij.find.FindModel; //导入依赖的package包/类
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 = new ArrayList<>();
FindInProjectUtil.findUsages(model, getProject(),
new CommonProcessors.CollectProcessor<>(
usages), FindInProjectUtil
.setupProcessPresentation(getProject(), false, FindInProjectUtil.setupViewPresentation(false, model)));
UsageInfo info = assertOneElement(usages);
assertEquals("X.java", info.getFile().getName());
}
示例3: actionPerformed
import com.intellij.find.FindModel; //导入依赖的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);
}
示例4: showReplacementPreview
import com.intellij.find.FindModel; //导入依赖的package包/类
private void showReplacementPreview() {
hideBalloon();
if (!mySearchResults.isUpToDate()) return;
final FindResult cursor = mySearchResults.getCursor();
final Editor editor = mySearchResults.getEditor();
if (myDelegate != null && cursor != null) {
String replacementPreviewText = myDelegate.getStringToReplace(editor, cursor);
if (StringUtil.isEmpty(replacementPreviewText)) {
replacementPreviewText = EMPTY_STRING_DISPLAY_TEXT;
}
final FindModel findModel = mySearchResults.getFindModel();
if (findModel.isRegularExpressions() && findModel.isReplaceState()) {
showBalloon(editor, replacementPreviewText);
}
}
}
示例5: initModelBySetings
import com.intellij.find.FindModel; //导入依赖的package包/类
@Override
public void initModelBySetings(@NotNull FindModel model){
model.setCaseSensitive(isCaseSensitive());
model.setForward(isForward());
model.setFromCursor(isFromCursor());
model.setGlobal(isGlobal());
model.setRegularExpressions(isRegularExpressions());
model.setWholeWordsOnly(isWholeWordsOnly());
FindModel.SearchContext searchContext = isInCommentsOnly() ?
FindModel.SearchContext.IN_COMMENTS :
isInStringLiteralsOnly() ?
FindModel.SearchContext.IN_STRING_LITERALS :
isExceptComments() ?
FindModel.SearchContext.EXCEPT_COMMENTS :
isExceptStringLiterals() ?
FindModel.SearchContext.EXCEPT_STRING_LITERALS :
isExceptCommentsAndLiterals() ?
FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS :
FindModel.SearchContext.ANY;
model.setSearchContext(searchContext);
model.setWithSubdirectories(isWithSubdirectories());
model.setFileFilter(FILE_MASK);
model.setCustomScopeName(FIND_SCOPE);
}
示例6: FindDialog
import com.intellij.find.FindModel; //导入依赖的package包/类
public FindDialog(@NotNull Project project, @NotNull FindModel model, @NotNull Consumer<FindModel> myOkHandler){
super(project, true);
myProject = project;
myModel = model;
this.myOkHandler = myOkHandler;
updateTitle();
setOKButtonText(FindBundle.message("find.button"));
init();
initByModel();
updateReplaceVisibility();
if (haveResultsPreview()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
scheduleResultsUpdate();
}
}, ModalityState.any());
}
}
示例7: doOKAction
import com.intellij.find.FindModel; //导入依赖的package包/类
private void doOKAction(boolean findAll) {
FindModel validateModel = myModel.clone();
applyTo(validateModel, findAll);
ValidationInfo validationInfo = getValidationInfo(validateModel);
if (validationInfo == null) {
myModel.copyFrom(validateModel);
updateFindSettings();
rememberResultsPreviewWasOpen();
super.doOKAction();
myOkHandler.consume(myModel);
}
else {
String message = validationInfo.message;
Messages.showMessageDialog(
myProject,
message,
CommonBundle.getErrorTitle(),
Messages.getErrorIcon()
);
}
}
示例8: getPresentableName
import com.intellij.find.FindModel; //导入依赖的package包/类
public static String getPresentableName(@NotNull FindModel.SearchContext searchContext) {
@PropertyKey(resourceBundle = "messages.FindBundle") String messageKey = null;
if (searchContext == FindModel.SearchContext.ANY) {
messageKey = "find.context.anywhere.scope.label";
} else if (searchContext == FindModel.SearchContext.EXCEPT_COMMENTS) {
messageKey = "find.context.except.comments.scope.label";
} else if (searchContext == FindModel.SearchContext.EXCEPT_STRING_LITERALS) {
messageKey = "find.context.except.literals.scope.label";
} else if (searchContext == FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS) {
messageKey = "find.context.except.comments.and.literals.scope.label";
} else if (searchContext == FindModel.SearchContext.IN_COMMENTS) {
messageKey = "find.context.in.comments.scope.label";
} else if (searchContext == FindModel.SearchContext.IN_STRING_LITERALS) {
messageKey = "find.context.in.literals.scope.label";
}
return messageKey != null ? FindBundle.message(messageKey) : searchContext.toString();
}
示例9: FindResultUsageInfo
import com.intellij.find.FindModel; //导入依赖的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));
}
}
示例10: showFindUsages
import com.intellij.find.FindModel; //导入依赖的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);
}
示例11: showReplacementPreview
import com.intellij.find.FindModel; //导入依赖的package包/类
private void showReplacementPreview() {
hideBalloon();
final FindResult cursor = mySearchResults.getCursor();
final Editor editor = mySearchResults.getEditor();
if (myDelegate != null && cursor != null) {
String replacementPreviewText = myDelegate.getStringToReplace(editor, cursor);
if (StringUtil.isEmpty(replacementPreviewText)) {
replacementPreviewText = EMPTY_STRING_DISPLAY_TEXT;
}
final FindModel findModel = mySearchResults.getFindModel();
if (findModel.isRegularExpressions() && findModel.isReplaceState()) {
showBalloon(cursor, editor, replacementPreviewText);
}
}
}
示例12: doOKAction
import com.intellij.find.FindModel; //导入依赖的package包/类
private void doOKAction(boolean findAll) {
FindModel validateModel = (FindModel)myModel.clone();
applyTo(validateModel, findAll);
ValidationInfo validationInfo = getValidationInfo(validateModel);
if (validationInfo == null) {
myModel.copyFrom(validateModel);
updateFindSettings();
super.doOKAction();
myOkHandler.consume(myModel);
}
else {
String message = validationInfo.message;
Messages.showMessageDialog(
myProject,
message,
CommonBundle.getErrorTitle(),
Messages.getErrorIcon()
);
}
}
示例13: showReplacementPreview
import com.intellij.find.FindModel; //导入依赖的package包/类
private void showReplacementPreview() {
hideBalloon();
final FindResult cursor = mySearchResults.getCursor();
final Editor editor = mySearchResults.getEditor();
if (myDelegate != null && cursor != null) {
String replacementPreviewText = myDelegate.getStringToReplace(editor, cursor);
if (StringUtil.isEmpty(replacementPreviewText)) {
replacementPreviewText = EMPTY_STRING_DISPLAY_TEXT;
}
final FindModel findModel = mySearchResults.getFindModel();
if (findModel.isRegularExpressions() && findModel.isReplaceState()) {
showBalloon(editor, replacementPreviewText);
}
}
}
示例14: initModelBySetings
import com.intellij.find.FindModel; //导入依赖的package包/类
@Override
public void initModelBySetings(@Nonnull FindModel model){
model.setCaseSensitive(isCaseSensitive());
model.setForward(isForward());
model.setFromCursor(isFromCursor());
model.setGlobal(isGlobal());
model.setRegularExpressions(isRegularExpressions());
model.setWholeWordsOnly(isWholeWordsOnly());
FindModel.SearchContext searchContext = isInCommentsOnly() ?
FindModel.SearchContext.IN_COMMENTS :
isInStringLiteralsOnly() ?
FindModel.SearchContext.IN_STRING_LITERALS :
isExceptComments() ?
FindModel.SearchContext.EXCEPT_COMMENTS :
isExceptStringLiterals() ?
FindModel.SearchContext.EXCEPT_STRING_LITERALS :
isExceptCommentsAndLiterals() ?
FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS :
FindModel.SearchContext.ANY;
model.setSearchContext(searchContext);
model.setWithSubdirectories(isWithSubdirectories());
model.setFileFilter(FILE_MASK);
model.setCustomScopeName(FIND_SCOPE);
}
示例15: FindResultUsageInfo
import com.intellij.find.FindModel; //导入依赖的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));
}
}