• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ContentFolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.roots.ContentFolder的典型用法代码示例。如果您正苦于以下问题:Java ContentFolder类的具体用法?Java ContentFolder怎么用?Java ContentFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContentFolder类属于com.intellij.openapi.roots包,在下文中一共展示了ContentFolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCreationOfSourceFolderWithFile

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfSourceFolderWithFile() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addSourceFolder(dir, false);
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());

  dir.delete(null);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ManagingContentRootFoldersTest.java


示例2: testCreationOfExcludedFolderWithFile

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfExcludedFolderWithFile() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addExcludeFolder(dir);
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());

  dir.delete(null);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ManagingContentRootFoldersTest.java


示例3: createFolderDeleteComponent

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private JComponent createFolderDeleteComponent(final ContentFolder folder, @Nullable ModuleSourceRootEditHandler<?> editor) {
  final String tooltipText;
  if (folder.getFile() != null && getContentEntry().getFile() != null) {
    if (editor != null) {
      tooltipText = editor.getUnmarkRootButtonText();
    }
    else if (folder instanceof ExcludeFolder) {
      tooltipText = ProjectBundle.message("module.paths.include.excluded.tooltip");
    }
    else {
      tooltipText = null;
    }
  }
  else {
    tooltipText = ProjectBundle.message("module.paths.remove.tooltip");
  }
  return new IconActionComponent(AllIcons.Modules.DeleteContentFolder, AllIcons.Modules.DeleteContentFolderRollover, tooltipText, new Runnable() {
    @Override
    public void run() {
      myCallback.deleteContentFolder(getContentEntry(), folder);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ContentRootPanel.java


示例4: createFolderDeleteComponent

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private JComponent createFolderDeleteComponent(final ContentFolder folder) {
  final String tooltipText;
  if (folder.getFile() != null && getContentEntry().getFile() != null) {
    if (folder instanceof SourceFolder) {
      tooltipText = ((SourceFolder)folder).isTestSource()
                    ? ProjectBundle.message("module.paths.unmark.tests.tooltip")
                    : ProjectBundle.message("module.paths.unmark.source.tooltip");
    }
    else if (folder instanceof ExcludeFolder) {
      tooltipText = ProjectBundle.message("module.paths.include.excluded.tooltip");
    }
    else {
      tooltipText = null;
    }
  }
  else {
    tooltipText = ProjectBundle.message("module.paths.remove.tooltip");
  }
  return new IconActionComponent(AllIcons.Modules.DeleteContentFolder, AllIcons.Modules.DeleteContentFolderRollover, tooltipText, new Runnable() {
    @Override
    public void run() {
      myCallback.deleteContentFolder(getContentEntry(), folder);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:ContentRootPanel.java


示例5: getFolders0

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private List<ContentFolder> getFolders0(Predicate<ContentFolderTypeProvider> predicate) {
  List<ContentFolder> list = new ArrayList<>(myContentFolders.size());
  for (ContentFolder contentFolder : myContentFolders) {
    if (predicate.apply(contentFolder.getType())) {
      list.add(contentFolder);
    }
  }

  Module module = getModuleRootLayer().getModule();
  if(module.getModuleDirUrl() == null) {
    return list;
  }

  if (predicate.apply(ExcludedContentFolderTypeProvider.getInstance())) {
    for (DirectoryIndexExcludePolicy excludePolicy : DirectoryIndexExcludePolicy.EP_NAME.getExtensions(getRootModel().getProject())) {
      final VirtualFilePointer[] files = excludePolicy.getExcludeRootsForModule(myModuleRootLayer);
      for (VirtualFilePointer file : files) {
        list.add(new LightContentFolderImpl(file, ExcludedContentFolderTypeProvider.getInstance(), this));
      }
    }
  }
  return list;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:ContentEntryImpl.java


示例6: getSourceRoots

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
@Nonnull
@Override
public Collection<VirtualFile> getSourceRoots(PackagingElementResolvingContext context) {
  Module module = NamedPointerUtil.get(myModulePointer);
  if (module == null) {
    return Collections.emptyList();
  }

  List<VirtualFile> roots = new SmartList<VirtualFile>();
  ModuleRootModel rootModel = context.getModulesProvider().getRootModel(module);
  for (ContentEntry entry : rootModel.getContentEntries()) {
    for (ContentFolder folder : entry.getFolders(ContentFolderScopes.of(myContentFolderType))) {
      ContainerUtil.addIfNotNull(folder.getFile(), roots);
    }
  }
  return roots;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ModuleOutputPackagingElementImpl.java


示例7: ContentFolderPropertiesDialog

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public ContentFolderPropertiesDialog(@Nullable Project project, ContentFolder contentFolder) {
  super(project);
  myProject = project;
  myContentFolder = contentFolder;

  for (Map.Entry<Key, Object> entry : contentFolder.getProperties().entrySet()) {
    ContentFolderPropertyProvider provider = null;
    for (ContentFolderPropertyProvider propertyProvider : ContentFolderPropertyProvider.EP_NAME.getExtensions()) {
      if (propertyProvider.getKey() == entry.getKey()) {
        provider = propertyProvider;
        break;
      }
    }

    myItems.add(new Item(provider, entry.getKey(), entry.getValue()));
  }

  setTitle(ProjectBundle.message("module.paths.properties.tooltip"));

  init();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ContentFolderPropertiesDialog.java


示例8: formatRelativePath

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
@Nonnull
private static CellAppearanceEx formatRelativePath(@Nonnull final ContentFolder folder, @Nonnull final Icon icon) {
  LightFilePointer folderFile = new LightFilePointer(folder.getUrl());
  VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(folder.getContentEntry().getUrl());
  if (file == null) return FileAppearanceService.getInstance().forInvalidUrl(folderFile.getPresentableUrl());

  String contentPath = file.getPath();
  String relativePath;
  SimpleTextAttributes textAttributes;
  VirtualFile folderFileFile = folderFile.getFile();
  if (folderFileFile == null) {
    String absolutePath = folderFile.getPresentableUrl();
    relativePath = absolutePath.startsWith(contentPath) ? absolutePath.substring(contentPath.length()) : absolutePath;
    textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
  else {
    relativePath = VfsUtilCore.getRelativePath(folderFileFile, file, File.separatorChar);
    textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }

  relativePath = StringUtil.isEmpty(relativePath) ? "." + File.separatorChar : relativePath;
  return new SimpleTextCellAppearance(relativePath, icon, textAttributes);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:OrderEntryAppearanceServiceImpl.java


示例9: addFolder

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
@Nullable
public ContentFolder addFolder(@Nonnull final VirtualFile file, ContentFolderTypeProvider contentFolderType) {
  final ContentEntry contentEntry = getContentEntry();
  if (contentEntry != null) {
    final ContentFolder contentFolder = contentEntry.addFolder(file, contentFolderType);
    try {
      return contentFolder;
    }
    finally {
      myEventDispatcher.getMulticaster().folderAdded(this, contentFolder);
      update();
    }
  }

  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ContentEntryEditor.java


示例10: createFolderDeleteComponent

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private JComponent createFolderDeleteComponent(final ContentFolder folder, @Nonnull ContentFolderTypeProvider editor) {
  final String tooltipText;
  if (folder.getFile() != null && getContentEntry().getFile() != null) {
    tooltipText = ProjectBundle.message("module.paths.unmark.0.tooltip", editor.getName());
  }
  else {
    tooltipText = ProjectBundle.message("module.paths.remove.tooltip");
  }
  return new IconActionComponent(AllIcons.Modules.DeleteContentFolder, AllIcons.Modules.DeleteContentFolderRollover, tooltipText,
                                 new Runnable() {
                                   @Override
                                   public void run() {
                                     myCallback.deleteContentFolder(getContentEntry(), folder);
                                   }
                                 });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ContentRootPanel.java


示例11: canUnmark

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public boolean canUnmark(AnActionEvent e) {
  Module module = e.getData(LangDataKeys.MODULE);
  VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  if (module == null || vFiles == null) {
    return false;
  }
  ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
  final ContentEntry[] contentEntries = moduleRootManager.getContentEntries();

  for (VirtualFile vFile : vFiles) {
    if (!vFile.isDirectory()) {
      continue;
    }

    for (ContentEntry contentEntry : contentEntries) {
      for (ContentFolder contentFolder : contentEntry.getFolders(ContentFolderScopes.all())) {
        if (Comparing.equal(contentFolder.getFile(), vFile)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:UnmarkRootAction.java


示例12: getIcon

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
@RequiredDispatchThread
@Nonnull
public Icon getIcon() {
  if (myDirectory != null) {
    VirtualFile virtualFile = myDirectory.getVirtualFile();
    List<ContentFolder> contentFolders = ModuleUtilCore.getContentFolders(myDirectory.getProject());
    for (ContentFolder contentFolder : contentFolders) {
      VirtualFile file = contentFolder.getFile();
      if(file == null) {
        continue;
      }
      if(VfsUtil.isAncestor(file, virtualFile, false)) {
        return contentFolder.getType().getIcon(contentFolder.getProperties());
      }
    }
  }
  return AllIcons.Nodes.Folder;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:DirectoryChooser.java


示例13: checkForTestRoots

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private static void checkForTestRoots(final Module srcModule, final Set<VirtualFile> testFolders, final Set<Module> processed) {
  final boolean isFirst = processed.isEmpty();
  if (!processed.add(srcModule)) return;

  final ContentEntry[] entries = ModuleRootManager.getInstance(srcModule).getContentEntries();
  for (ContentEntry entry : entries) {
    for (ContentFolder sourceFolder : entry.getFolders(ContentFolderScopes.of(TestContentFolderTypeProvider.getInstance()))) {
      final VirtualFile sourceFolderFile = sourceFolder.getFile();
      if (sourceFolderFile != null) {
        testFolders.add(sourceFolderFile);
      }
    }
  }
  if (isFirst && !testFolders.isEmpty()) return;

  final HashSet<Module> modules = new HashSet<Module>();
  ModuleUtilCore.collectModulesDependsOn(srcModule, modules);
  for (Module module : modules) {

    checkForTestRoots(module, testFolders, processed);
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:CreateTestAction.java


示例14: testCreationOfSourceFolderWithFile

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfSourceFolderWithFile() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addFolder(dir, ProductionContentFolderTypeProvider.getInstance());
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());

  dir.delete(null);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:ManagingContentRootFoldersTest.java


示例15: testCreationOfExcludedFolderWithFile

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfExcludedFolderWithFile() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addFolder(dir, ExcludedContentFolderTypeProvider.getInstance());
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());

  dir.delete(null);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:ManagingContentRootFoldersTest.java


示例16: replaceSourceRoot

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
private void replaceSourceRoot(final VirtualFile newSourceRoot) {
  ApplicationManager.getApplication().runWriteAction(
      new Runnable() {
        @Override
        public void run() {
          final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
          final ContentEntry[] content = rootModel.getContentEntries();
          boolean contentToChangeFound = false;
          for (ContentEntry contentEntry : content) {
            final ContentFolder[] sourceFolders = contentEntry.getFolders(ContentFolderScopes.of(ProductionContentFolderTypeProvider.getInstance()));
            for (ContentFolder sourceFolder : sourceFolders) {
              contentEntry.removeFolder(sourceFolder);
            }
            final VirtualFile contentRoot = contentEntry.getFile();
            if (contentRoot != null && VfsUtilCore.isAncestor(contentRoot, newSourceRoot, false)) {
              contentEntry.addFolder(newSourceRoot, ProductionContentFolderTypeProvider.getInstance());
              contentToChangeFound = true;
            }
          }
          assertTrue(contentToChangeFound);
          rootModel.commit();
        }
      }
  );
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:SrcRepositoryUseTest.java


示例17: testCreationOfSourceFolderWithUrl

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfSourceFolderWithUrl() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();
  dir.delete(null);

  ContentFolder f = entry.addSourceFolder(url, false);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ManagingContentRootFoldersTest.java


示例18: testCreationOfSourceFolderWithUrlWhenFileExists

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfSourceFolderWithUrlWhenFileExists() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addSourceFolder(url, false);
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ManagingContentRootFoldersTest.java


示例19: testCreationOfExcludedFolderWithUrl

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfExcludedFolderWithUrl() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();
  dir.delete(null);

  ContentFolder f = entry.addExcludeFolder(url);
  assertNull(f.getFile());
  assertEquals(url, f.getUrl());

  dir = root.createChildDirectory(null, "src");
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ManagingContentRootFoldersTest.java


示例20: testCreationOfExcludedFolderWithUrlWhenFileExists

import com.intellij.openapi.roots.ContentFolder; //导入依赖的package包/类
public void testCreationOfExcludedFolderWithUrlWhenFileExists() throws IOException {
  VirtualFile dir = root.createChildDirectory(null, "src");
  String url = dir.getUrl();

  ContentFolder f = entry.addExcludeFolder(url);
  assertEquals(dir, f.getFile());
  assertEquals(url, f.getUrl());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ManagingContentRootFoldersTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExternalProcessBuilder类代码示例发布时间:2022-05-23
下一篇:
Java Document类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap