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


Java JpsModuleSourceRootType类代码示例

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


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

示例1: addSourceFolder

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
private void addSourceFolder(@NotNull IdeaAndroidProject androidProject,
                             @NotNull Collection<ContentEntry> contentEntries,
                             @NotNull SourceProvider sourceProvider,
                             boolean isTest,
                             @NotNull List<RootSourceFolder> orphans) {
  JpsModuleSourceRootType sourceType = getResourceSourceType(isTest);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getResDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getResourcesDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getAssetsDirectories(), sourceType, false, orphans);

  sourceType = getSourceType(isTest);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getAidlDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getJavaDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getCDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getCppDirectories(), sourceType, false, orphans);
  addSourceFolders(androidProject, contentEntries, sourceProvider.getRenderscriptDirectories(), sourceType, false, orphans);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ContentRootModuleCustomizer.java

示例2: init

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
public void init(@NotNull Module module, @NotNull ModifiableRootModel modifiableRootModel) {
  myRootModel = modifiableRootModel;

  myDummyJpsModule = JpsElementFactory.getInstance()
    .createModule(module.getName(), JpsJavaModuleType.INSTANCE, JpsElementFactory.getInstance().createDummyElement());
  myDummyJpsRootModel = new JpsRootModel(module, myDummyJpsModule);

  for (JpsSourceFolder folder : myJpsSourceFolders) {
    Disposer.dispose(folder);
  }
  myJpsSourceFolders.clear();

  for (ContentEntry eachEntry : modifiableRootModel.getContentEntries()) {
    for (SourceFolder eachFolder : eachEntry.getSourceFolders()) {
      //noinspection unchecked
      final JpsModuleSourceRoot jpsModuleSourceRoot =
        JpsElementFactory.getInstance().createModuleSourceRoot(
          eachFolder.getUrl(),
          (JpsModuleSourceRootType<JpsElement>)eachFolder.getRootType(),
          eachFolder.getJpsElement().getProperties().getBulkModificationSupport().createCopy());

      addJspSourceFolder(jpsModuleSourceRoot, eachFolder.getUrl());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MavenSourceFoldersModuleExtension.java

示例3: addSourceFolder

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
public <P extends JpsElement> void addSourceFolder(final @NotNull Url url,
                                                   final @NotNull JpsModuleSourceRootType<P> rootType,
                                                   final @NotNull P properties) {
  for (Iterator<JpsSourceFolder> iterator = myJpsSourceFolders.iterator(); iterator.hasNext(); ) {
    JpsSourceFolder eachFolder = iterator.next();
    if (VfsUtilCore.isEqualOrAncestor(url.getUrl(), eachFolder.getUrl()) ||
        VfsUtilCore.isEqualOrAncestor(eachFolder.getUrl(), url.getUrl())) {
      iterator.remove();
      Disposer.dispose(eachFolder);
    }
  }

  final JpsModuleSourceRoot jpsModuleSourceRoot =
    JpsElementFactory.getInstance().createModuleSourceRoot(url.getUrl(), rootType, properties);
  addJspSourceFolder(jpsModuleSourceRoot, url.getUrl());

  isJpsSourceFoldersChanged = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenSourceFoldersModuleExtension.java

示例4: getProperties

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@Override
public <P extends JpsElement> P getProperties(@NotNull JpsModuleSourceRootType<P> type) {
  if (myRootType.equals(type)) {
    //noinspection unchecked
    return (P)myContainer.getChild(myRootType.getPropertiesRole());
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JpsModuleSourceRootImpl.java

示例5: checkInfo

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
private void checkInfo(VirtualFile file,
                       @Nullable Module module,
                       boolean isInLibrary,
                       boolean isInLibrarySource,
                       @Nullable String packageName, 
                       @Nullable final JpsModuleSourceRootType<?> moduleSourceRootType,
                       Module... modulesOfOrderEntries) {
  DirectoryInfo info = assertInProject(file);
  assertEquals(module, info.getModule());
  if (moduleSourceRootType != null) {
    assertTrue("isInModuleSource", info.isInModuleSource());
    assertEquals(moduleSourceRootType, myIndex.getSourceRootType(info));
  }
  else {
    assertFalse("isInModuleSource", info.isInModuleSource());
  }
  assertEquals(isInLibrary, info.hasLibraryClassRoot());
  assertEquals(isInLibrarySource, info.isInLibrarySource());

  if (file.isDirectory()) {
    assertEquals(packageName, myFileIndex.getPackageNameByDirectory(file));
  }

  assertEquals(Arrays.toString(myIndex.getOrderEntries(info)), modulesOfOrderEntries.length, myIndex.getOrderEntries(info).length);
  for (Module aModule : modulesOfOrderEntries) {
    OrderEntry found = ModuleFileIndexImpl.findOrderEntryWithOwnerModule(aModule, myIndex.getOrderEntries(info));
    assertNotNull("not found: " + aModule + " in " + Arrays.toString(myIndex.getOrderEntries(info)), found);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DirectoryIndexTest.java

示例6: getSourceFolders

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public List<SourceFolder> getSourceFolders(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
  List<SourceFolder> folders = new SmartList<SourceFolder>();
  for (JpsSourceFolder folder : mySourceFolders) {
    if (rootTypes.contains(folder.getRootType())) {
      folders.add(folder);
    }
  }
  return folders;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JpsContentEntry.java

示例7: addSourceFolder

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public <P extends JpsElement> SourceFolder addSourceFolder(@NotNull VirtualFile file,
                                                           @NotNull JpsModuleSourceRootType<P> type,
                                                           @NotNull P properties) {
  final JpsModuleSourceRoot sourceRoot = myModule.addSourceRoot(file.getUrl(), type, properties);
  final JpsSourceFolder sourceFolder = new JpsSourceFolder(sourceRoot, this);
  mySourceFolders.add(sourceFolder);
  return sourceFolder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JpsContentEntry.java

示例8: getRootTypeId

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
private int getRootTypeId(@NotNull JpsModuleSourceRootType<?> rootType) {
  if (myRootTypeId.containsKey(rootType)) {
    return myRootTypeId.get(rootType);
  }

  int id = myRootTypes.size();
  if (id > DirectoryInfoImpl.MAX_ROOT_TYPE_ID) {
    LOG.error("Too many different types of module source roots (" + id + ") registered: " + myRootTypes);
  }
  myRootTypes.add(rootType);
  myRootTypeId.put(rootType, id);
  return id;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:RootIndex.java

示例9: getSourceFolders

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public List<SourceFolder> getSourceFolders(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
  SmartList<SourceFolder> folders = new SmartList<SourceFolder>();
  for (SourceFolder folder : mySourceFolders) {
    if (rootTypes.contains(folder.getRootType())) {
      folders.add(folder);
    }
  }
  return folders;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ContentEntryImpl.java

示例10: addSourceFolder

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@Override
@NotNull
public <P extends JpsElement> SourceFolder addSourceFolder(@NotNull VirtualFile file, @NotNull JpsModuleSourceRootType<P> type,
                                                           @NotNull P properties) {
  assertCanAddFolder(file);
  return addSourceFolder(new SourceFolderImpl(file, JpsElementFactory.getInstance().createModuleSourceRoot(file.getUrl(), type, properties), this));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ContentEntryImpl.java

示例11: getSourceRoots

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public List<VirtualFile> getSourceRoots(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
  List<VirtualFile> result = new SmartList<VirtualFile>();
  for (ContentEntry contentEntry : getContent()) {
    final List<SourceFolder> sourceFolders = contentEntry.getSourceFolders(rootTypes);
    for (SourceFolder sourceFolder : sourceFolders) {
      final VirtualFile file = sourceFolder.getFile();
      if (file != null) {
        result.add(file);
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RootModelBase.java

示例12: getModuleSourceRoots

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public List<VirtualFile> getModuleSourceRoots(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
  List<VirtualFile> roots = new ArrayList<VirtualFile>();
  for (Module module : getModuleManager().getModules()) {
    roots.addAll(ModuleRootManager.getInstance(module).getSourceRoots(rootTypes));
  }
  return roots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectRootManagerImpl.java

示例13: createSourceRootIfAbsent

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
private static void createSourceRootIfAbsent(
  @NotNull ContentEntry entry, @NotNull final SourceRoot root, @NotNull String moduleName,
  @NotNull JpsModuleSourceRootType<?> sourceRootType, boolean generated, boolean createEmptyContentRootDirectories) {
  List<SourceFolder> folders = entry.getSourceFolders(sourceRootType);
  for (SourceFolder folder : folders) {
    VirtualFile file = folder.getFile();
    if (file == null) {
      continue;
    }
    if (ExternalSystemApiUtil.getLocalFileSystemPath(file).equals(root.getPath())) {
      return;
    }
  }
  LOG.debug(String.format("Importing %s for content root '%s' of module '%s'", root, entry.getUrl(), moduleName));
  SourceFolder sourceFolder = entry.addSourceFolder(toVfsUrl(root.getPath()), sourceRootType);
  if (!StringUtil.isEmpty(root.getPackagePrefix())) {
    sourceFolder.setPackagePrefix(root.getPackagePrefix());
  }
  if (generated) {
    JavaSourceRootProperties properties = sourceFolder.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
    if(properties != null) {
      properties.setForGeneratedSources(true);
    }
  }
  if(createEmptyContentRootDirectories) {
    ExternalSystemApiUtil.doWriteAction(new Runnable() {
      @Override
      public void run() {
        try {
          VfsUtil.createDirectoryIfMissing(root.getPath());
        }
        catch (IOException e) {
          LOG.warn(String.format("Unable to create directory for the path: %s", root.getPath()), e);
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ContentRootDataService.java

示例14: addSourceRoot

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
public static <P extends JpsElement> void addSourceRoot(Module module, final VirtualFile vDir,
                                                        @NotNull final JpsModuleSourceRootType<P> rootType, final P properties) {
  ModuleRootModificationUtil.updateModel(module, new Consumer<ModifiableRootModel>() {
    @SuppressWarnings("unchecked")
    @Override
    public void consume(ModifiableRootModel model) {
      ContentEntry entry = findContentEntry(model, vDir);
      if (entry == null) entry = model.addContentEntry(vDir);
      entry.addSourceFolder(vDir, rootType, properties);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PsiTestUtil.java

示例15: isSupportedRootType

import org.jetbrains.jps.model.module.JpsModuleSourceRootType; //导入依赖的package包/类
public static boolean isSupportedRootType(Project project, JpsModuleSourceRootType sourceRootType) {
  Module[] modules = ModuleManager.getInstance(project).getModules();
  for (Module module : modules) {
    if (ModuleType.get(module).isSupportedRootType(sourceRootType)) {
      return true;
    }
  }
  return modules.length == 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ModuleUtil.java


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