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


Java ContentEntry类代码示例

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


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

示例1: configureBackOfficeRoots

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configureBackOfficeRoots(
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final ContentEntry contentEntry
) {
    Validate.notNull(moduleDescriptor);
    Validate.notNull(contentEntry);

    final File backOfficeModuleDirectory = new File(
        moduleDescriptor.getRootDirectory(), BACK_OFFICE_MODULE_DIRECTORY
    );

    final File backOfficeSrcDirectory = new File(backOfficeModuleDirectory, SRC_DIRECTORY);
    contentEntry.addSourceFolder(
        VfsUtil.pathToUrl(backOfficeSrcDirectory.getAbsolutePath()),
        JavaSourceRootType.SOURCE
    );

    addTestSourceRoots(contentEntry, backOfficeModuleDirectory);

    final File hmcResourcesDirectory = new File(backOfficeModuleDirectory, RESOURCES_DIRECTORY);
    contentEntry.addSourceFolder(
        VfsUtil.pathToUrl(hmcResourcesDirectory.getAbsolutePath()),
        JavaResourceRootType.RESOURCE
    );
    excludeDirectory(contentEntry, new File(backOfficeModuleDirectory, CLASSES_DIRECTORY));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:RegularContentRootConfigurator.java

示例2: configurePlatformRoots

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configurePlatformRoots(
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final ContentEntry contentEntry
) {
    Validate.notNull(moduleDescriptor);
    Validate.notNull(contentEntry);

    if (!HybrisConstants.PLATFORM_EXTENSION_NAME.equalsIgnoreCase(moduleDescriptor.getName())) {
        return;
    }
    final File rootDirectory = moduleDescriptor.getRootDirectory();
    final File platformBootstrapDirectory = new File(rootDirectory, PLATFORM_BOOTSTRAP_DIRECTORY);

    if (!moduleDescriptor.getRootProjectDescriptor().isImportOotbModulesInReadOnlyMode()) {

        final File platformBootstrapResourcesDirectory = new File(platformBootstrapDirectory, RESOURCES_DIRECTORY);
        contentEntry.addSourceFolder(
            VfsUtil.pathToUrl(platformBootstrapResourcesDirectory.getAbsolutePath()),
            JavaResourceRootType.RESOURCE
        );
    }

    excludeDirectory(contentEntry, new File(platformBootstrapDirectory, PLATFORM_MODEL_CLASSES_DIRECTORY));
    excludeDirectory(contentEntry, new File(rootDirectory, PLATFORM_TOMCAT_DIRECTORY));
    contentEntry.addExcludePattern("apache-ant-*");
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:RegularContentRootConfigurator.java

示例3: configureWebInf

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configureWebInf(
    final ContentEntry contentEntry,
    final HybrisModuleDescriptor moduleDescriptor,
    final File webModuleDirectory
) {
    final File rootDirectory = moduleDescriptor.getRootDirectory();

    if (moduleDescriptor.getDescriptorType() == CUSTOM) {
        excludeDirectory(contentEntry, new File(rootDirectory, WEB_INF_CLASSES_DIRECTORY));
    } else {
        final File webSrcDirectory = new File(webModuleDirectory, SRC_DIRECTORY);

        if (webSrcDirectory.exists()) {
            excludeDirectory(contentEntry, new File(rootDirectory, WEB_INF_CLASSES_DIRECTORY));
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:RegularContentRootConfigurator.java

示例4: configureAdditionalRoots

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configureAdditionalRoots(
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final String directoryName,
    @NotNull final ContentEntry contentEntry,
    @NotNull final File parentDirectory
) {
    Validate.notNull(moduleDescriptor);
    Validate.notNull(directoryName);
    Validate.notNull(contentEntry);
    Validate.notNull(parentDirectory);

    final File additionalModuleDirectory = new File(parentDirectory, directoryName);
    if (!additionalModuleDirectory.exists() || additionalModuleDirectory.isFile()) {
        return;
    }

    final File additionalClassesDirectory = new File(additionalModuleDirectory, CLASSES_DIRECTORY);
    contentEntry.addExcludeFolder(
        VfsUtil.pathToUrl(additionalClassesDirectory.getAbsolutePath())
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:ReadOnlyContentRootConfigurator.java

示例5: configureBackOfficeRoots

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configureBackOfficeRoots(
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final ContentEntry contentEntry
) {
    Validate.notNull(moduleDescriptor);
    Validate.notNull(contentEntry);

    final File backOfficeModuleDirectory = new File(
        moduleDescriptor.getRootDirectory(), BACK_OFFICE_MODULE_DIRECTORY
    );

    final File hmcClassesDirectory = new File(backOfficeModuleDirectory, CLASSES_DIRECTORY);
    contentEntry.addExcludeFolder(
        VfsUtil.pathToUrl(hmcClassesDirectory.getAbsolutePath())
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:ReadOnlyContentRootConfigurator.java

示例6: configureWebModuleRoots

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void configureWebModuleRoots(
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    final @NotNull ContentEntry contentEntry,
    final File webModuleDirectory
) {
    Validate.notNull(moduleDescriptor);

    final File webAddonSrcDirectory = new File(webModuleDirectory, ADDON_SRC_DIRECTORY);
    contentEntry.addExcludeFolder(
        VfsUtil.pathToUrl(webAddonSrcDirectory.getAbsolutePath())
    );

    final File webTestClassesDirectory = new File(webModuleDirectory, TEST_CLASSES_DIRECTORY);
    contentEntry.addExcludeFolder(
        VfsUtil.pathToUrl(webTestClassesDirectory.getAbsolutePath())
    );

    final File commonWebSrcDirectory = new File(webModuleDirectory, COMMON_WEB_SRC_DIRECTORY);
    contentEntry.addExcludeFolder(
        VfsUtil.pathToUrl(commonWebSrcDirectory.getAbsolutePath())
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:ReadOnlyContentRootConfigurator.java

示例7: suitableTestSourceFolders

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
@Nullable
private static SourceFolder suitableTestSourceFolders(Project project, Module module) {
  ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries();
  for (ContentEntry contentEntry : contentEntries) {
    List<SourceFolder> testSourceFolders =
        contentEntry.getSourceFolders(JavaSourceRootType.TEST_SOURCE);
    for (SourceFolder testSourceFolder : testSourceFolders) {
      if (testSourceFolder.getFile() != null) {
        if (!JavaProjectRootsUtil.isInGeneratedCode(testSourceFolder.getFile(), project)) {
          return testSourceFolder;
        }
      }
    }
  }

  return null;
}
 
开发者ID:uber,项目名称:RIBs,代码行数:18,代码来源:GenerateAction.java

示例8: setupRootModel

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
@Override
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
	ContentEntry contentEntry = doAddContentEntry(rootModel);
	if (contentEntry != null) {
		final List<Pair<String, String>> sourcePaths = getSourcePaths();

		if (sourcePaths != null) {
			for (final Pair<String, String> sourcePath : sourcePaths) {
				String first = sourcePath.first;
				new File(first).mkdirs();
				final VirtualFile sourceRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(first));
				if (sourceRoot != null) {
					contentEntry.addSourceFolder(sourceRoot, false, sourcePath.second);
				}
			}
		}
	}
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:19,代码来源:ArmaModuleBuilder.java

示例9: testClassUnderExcludedFolder

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
public void testClassUnderExcludedFolder() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      PsiTestUtil.addExcludedRoot(myModule, myPackDir);

      PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
      assertNull(psiClass);

      ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
      final ContentEntry content = rootModel.getContentEntries()[0];
      content.removeExcludeFolder(content.getExcludeFolders()[0]);
      rootModel.commit();

      psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
      assertEquals("p.A", psiClass.getQualifiedName());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FindClassTest.java

示例10: createContentRootPane

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
@Override
protected ContentRootPanel createContentRootPane() {
  return new ContentRootPanel(this, getEditHandlers()) {
    @Nullable
    @Override
    protected ContentEntry getContentEntry() {
      return JavaContentEntryEditor.this.getContentEntry();
    }

    @Nullable
    @Override
    protected JComponent createRootPropertiesEditor(ModuleSourceRootEditHandler<?> editor, SourceFolder folder) {
      return editor.createPropertiesEditor(folder, this, myCallback);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaContentEntryEditor.java

示例11: createContentEntry

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
protected void createContentEntry(@NotNull final Module module, @NotNull final VirtualFile srcRoot) {
  updateModel(module, new Consumer<ModifiableRootModel>() {
    @Override
    public void consume(ModifiableRootModel model) {
      Sdk sdk = getSdk();
      if (sdk != null) {
        model.setSdk(sdk);
      }

      ContentEntry contentEntry = model.addContentEntry(srcRoot);
      contentEntry.addSourceFolder(srcRoot, false);

      configureModule(module, model, contentEntry);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LightProjectDescriptor.java

示例12: customizeCellRenderer

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
  if (editor != null) {
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (userObject instanceof NodeDescriptor) {
      final Object element = ((NodeDescriptor)userObject).getElement();
      if (element instanceof FileElement) {
        final VirtualFile file = ((FileElement)element).getFile();
        if (file != null && file.isDirectory()) {
          final ContentEntry contentEntry = editor.getContentEntry();
          if (contentEntry != null) {
            final String prefix = getPresentablePrefix(contentEntry, file);
            if (!prefix.isEmpty()) {
              append(" (" + prefix + ")", new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
            }
            setIcon(updateIcon(contentEntry, file, getIcon()));
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ContentEntryTreeCellRenderer.java

示例13: initializeSourceFolders

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
@Override
public ImmutableMap<File, SourceFolder> initializeSourceFolders(ContentEntry contentEntry) {
  Map<File, SourceFolder> map = new HashMap<>();
  BlazeContentEntry javaContentEntry =
      blazeContentEntries.get(UrlUtil.urlToFile(contentEntry.getUrl()));
  if (javaContentEntry != null) {
    for (BlazeSourceDirectory sourceDirectory : javaContentEntry.sources) {
      File file = sourceDirectory.getDirectory();
      if (map.containsKey(file)) {
        continue;
      }
      SourceFolder sourceFolder = addSourceFolderToContentEntry(contentEntry, sourceDirectory);
      map.put(file, sourceFolder);
    }
  }
  return ImmutableMap.copyOf(map);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:18,代码来源:JavaSourceFolderProvider.java

示例14: addSourceRoot

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
private static void addSourceRoot(Project project, final VirtualFile baseDir, final VirtualFile root, final boolean unique) {
  final Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length > 0 && root != null) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        final ModifiableRootModel model = ModuleRootManager.getInstance(modules[0]).getModifiableModel();
        final ContentEntry[] contentEntries = model.getContentEntries();
        for (ContentEntry contentEntry : contentEntries) {
          if (Comparing.equal(contentEntry.getFile(), baseDir)) {
            final SourceFolder[] sourceFolders = contentEntry.getSourceFolders();
            if (!unique || sourceFolders.length == 0) {
              contentEntry.addSourceFolder(root, false);
            }
          }
        }
        model.commit();
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PythonSourceRootConfigurator.java

示例15: updateLibraryDependency

import com.intellij.openapi.roots.ContentEntry; //导入依赖的package包/类
public static void updateLibraryDependency(@NotNull Module module,
                                           @NotNull IdeModifiableModelsProvider modelsProvider,
                                           @NotNull LibraryDependency dependency,
                                           @NotNull AndroidProject androidProject) {
  Collection<String> binaryPaths = dependency.getPaths(BINARY);
  setUpLibraryDependency(module, modelsProvider, dependency.getName(), dependency.getScope(), binaryPaths);

  File buildFolder = androidProject.getBuildFolder();

  // Exclude jar files that are in "jars" folder in "build" folder.
  // see https://code.google.com/p/android/issues/detail?id=123788
  ContentEntry[] contentEntries = modelsProvider.getModifiableRootModel(module).getContentEntries();
  for (String binaryPath : binaryPaths) {
    File parent = new File(binaryPath).getParentFile();
    if (parent != null && FD_JARS.equals(parent.getName()) && isAncestor(buildFolder, parent, true)) {
      ContentEntry parentContentEntry = findParentContentEntry(parent, contentEntries);
      if (parentContentEntry != null) {
        parentContentEntry.addExcludeFolder(pathToIdeaUrl(parent));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DependenciesModuleCustomizer.java


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