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


Java FindModel.setDirectoryName方法代码示例

本文整理汇总了Java中com.intellij.find.FindModel.setDirectoryName方法的典型用法代码示例。如果您正苦于以下问题:Java FindModel.setDirectoryName方法的具体用法?Java FindModel.setDirectoryName怎么用?Java FindModel.setDirectoryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.find.FindModel的用法示例。


在下文中一共展示了FindModel.setDirectoryName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: applyTo

import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
  model.setCaseSensitive(myCbCaseSensitive.isSelected());

  if (model.isReplaceState()) {
    model.setPreserveCase(myCbPreserveCase.isSelected());
  }

  model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());

  String selectedSearchContextInUi = (String)mySearchContext.getSelectedItem();
  FindModel.SearchContext searchContext = FindModel.SearchContext.ANY;
  if (FindBundle.message("find.context.in.literals.scope.label").equals(selectedSearchContextInUi)) {
    searchContext = FindModel.SearchContext.IN_STRING_LITERALS;
  }
  else if (FindBundle.message("find.context.in.comments.scope.label").equals(selectedSearchContextInUi)) {
    searchContext = FindModel.SearchContext.IN_COMMENTS;
  }
  else if (FindBundle.message("find.context.except.comments.scope.label").equals(selectedSearchContextInUi)) {
    searchContext = FindModel.SearchContext.EXCEPT_COMMENTS;
  }
  else if (FindBundle.message("find.context.except.literals.scope.label").equals(selectedSearchContextInUi)) {
    searchContext = FindModel.SearchContext.EXCEPT_STRING_LITERALS;
  } else if (FindBundle.message("find.context.except.comments.and.literals.scope.label").equals(selectedSearchContextInUi)) {
    searchContext = FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS;
  }

  model.setSearchContext(searchContext);

  model.setRegularExpressions(myCbRegularExpressions.isSelected());
  String stringToFind = getStringToFind();
  model.setStringToFind(stringToFind);

  if (model.isReplaceState()){
    model.setPromptOnReplace(true);
    model.setReplaceAll(false);
    String stringToReplace = getStringToReplace();
    model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
  }

  if (!model.isMultipleFiles()){
    model.setForward(myRbForward.isSelected());
    model.setFromCursor(myRbFromCursor.isSelected());
    model.setGlobal(myRbGlobal.isSelected());
  }
  else{
    if (myCbToOpenInNewTab != null){
      model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
    }

    model.setProjectScope(myRbProject.isSelected());
    model.setDirectoryName(null);
    model.setModuleName(null);
    model.setCustomScopeName(null);
    model.setCustomScope(null);
    model.setCustomScope(false);

    if (myRbDirectory.isSelected()) {
      String directory = getDirectory();
      model.setDirectoryName(directory == null ? "" : directory);
      model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
    }
    else if (myRbModule.isSelected()) {
      model.setModuleName((String)myModuleComboBox.getSelectedItem());
    }
    else if (myRbCustomScope.isSelected()) {
      SearchScope selectedScope = myScopeCombo.getSelectedScope();
      String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
      model.setCustomScopeName(customScopeName);
      model.setCustomScope(selectedScope == null ? null : selectedScope);
      model.setCustomScope(true);
    }
  }

  model.setFindAll(findAll);

  String mask = getFileTypeMask();
  model.setFileFilter(mask);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:79,代码来源:FindDialog.java

示例5: applyTo

import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
  model.setCaseSensitive(myCbCaseSensitive.isSelected());

  if (model.isReplaceState()) {
    model.setPreserveCase(myCbPreserveCase.isSelected());
  }

  model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
  model.setInStringLiteralsOnly(myCbInStringLiteralsOnly.isSelected());

  model.setInCommentsOnly(myCbInCommentsOnly.isSelected());

  model.setRegularExpressions(myCbRegularExpressions.isSelected());
  String stringToFind = getStringToFind();
  model.setStringToFind(stringToFind);

  if (model.isReplaceState()){
    model.setPromptOnReplace(true);
    model.setReplaceAll(false);
    String stringToReplace = getStringToReplace();
    model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
  }

  if (!model.isMultipleFiles()){
    model.setForward(myRbForward.isSelected());
    model.setFromCursor(myRbFromCursor.isSelected());
    model.setGlobal(myRbGlobal.isSelected());
  }
  else{
    if (myCbToOpenInNewTab != null){
      model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
    }

    model.setProjectScope(myRbProject.isSelected());
    model.setDirectoryName(null);
    model.setModuleName(null);
    model.setCustomScopeName(null);
    model.setCustomScope(null);
    model.setCustomScope(false);

    if (myRbDirectory.isSelected()) {
      String directory = getDirectory();
      model.setDirectoryName(directory == null ? "" : directory);
      model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
    }
    else if (myRbModule.isSelected()) {
      model.setModuleName((String)myModuleComboBox.getSelectedItem());
    }
    else if (myRbCustomScope.isSelected()) {
      SearchScope selectedScope = myScopeCombo.getSelectedScope();
      String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
      model.setCustomScopeName(customScopeName);
      model.setCustomScope(selectedScope == null ? null : selectedScope);
      model.setCustomScope(true);
    }
  }

  model.setFindAll(findAll);

  String mask = getFileTypeMask();
  model.setFileFilter(mask);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:63,代码来源:FindDialog.java


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