當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。