当前位置: 首页>>代码示例>>Java>>正文


Java FindModel类代码示例

本文整理汇总了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());
}
 
开发者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


注:本文中的com.intellij.find.FindModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。