本文整理汇总了Java中com.intellij.find.FindModel类的典型用法代码示例。如果您正苦于以下问题:Java FindModel类的具体用法?Java FindModel怎么用?Java FindModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FindModel类属于com.intellij.find包,在下文中一共展示了FindModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SearchInLibsTest.java
示例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());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SearchInLibsTest.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FindAllAction.java
示例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);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LivePreview.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:FindSettingsImpl.java
示例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());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FindDialog.java
示例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()
);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FindDialog.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FindDialog.java
示例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));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FindResultUsageInfo.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IntroducePropertyAction.java
示例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);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:LivePreview.java
示例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()
);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:FindDialog.java
示例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);
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:LivePreview.java
示例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);
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:FindSettingsImpl.java
示例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));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FindResultUsageInfo.java
示例16: initByModel
import com.intellij.find.FindModel; //导入依赖的package包/类
public void initByModel(@Nonnull FindModel findModel) {
final String directoryName = findModel.getDirectoryName();
java.util.List<String> strings = FindInProjectSettings.getInstance(myProject).getRecentDirectories();
if (myDirectoryComboBox.getItemCount() > 0) {
myDirectoryComboBox.removeAllItems();
}
if (directoryName != null && !directoryName.isEmpty()) {
if (strings.contains(directoryName)) {
strings.remove(directoryName);
}
myDirectoryComboBox.addItem(directoryName);
}
for (int i = strings.size() - 1; i >= 0; i--) {
myDirectoryComboBox.addItem(strings.get(i));
}
if (myDirectoryComboBox.getItemCount() == 0) {
myDirectoryComboBox.addItem("");
}
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:FindPopupDirectoryChooser.java
示例17: findAll
import com.intellij.find.FindModel; //导入依赖的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
示例18: findExpressionOccurrences
import com.intellij.find.FindModel; //导入依赖的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
示例19: testScopeCreatedForFindInDirectory
import com.intellij.find.FindModel; //导入依赖的package包/类
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));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:UsageViewManagerTest.java
示例20: testScopeCreatedForFindInModuleContent
import com.intellij.find.FindModel; //导入依赖的package包/类
public void testScopeCreatedForFindInModuleContent() {
FindModel findModel = new FindModel();
findModel.setModuleName(getModule().getName());
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, getModule().getModuleContentScope());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:UsageViewManagerTest.java
注:本文中的com.intellij.find.FindModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论