本文整理汇总了Java中com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType类的典型用法代码示例。如果您正苦于以下问题:Java ExternalSystemSourceType类的具体用法?Java ExternalSystemSourceType怎么用?Java ExternalSystemSourceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExternalSystemSourceType类属于com.intellij.openapi.externalSystem.model.project包,在下文中一共展示了ExternalSystemSourceType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private static void syncPaths(@NotNull final Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull final ModuleData data) {
final ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module);
CompilerModuleExtension extension = modifiableRootModel.getModuleExtension(CompilerModuleExtension.class);
if (extension == null) {
modifiableRootModel.dispose();
final String errorMsg =
String.format("Can't sync paths for module '%s'. Reason: no compiler extension is found for it", module.getName());
throw new RuntimeException(errorMsg);
}
String compileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.SOURCE);
if (compileOutputPath != null) {
extension.setCompilerOutputPath(VfsUtilCore.pathToUrl(compileOutputPath));
}
String testCompileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.TEST);
if (testCompileOutputPath != null) {
extension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(testCompileOutputPath));
}
extension.inheritCompilerOutputPath(data.isInheritProjectCompileOutputPath());
}
示例2: addOutputModuleRoots
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private static void addOutputModuleRoots(@Nullable ExternalSourceSet externalSourceSet,
@NotNull ExternalSystemSourceType sourceType,
@NotNull Collection<String> result) {
if (externalSourceSet == null) return;
final ExternalSourceDirectorySet directorySet = externalSourceSet.getSources().get(sourceType);
if (directorySet == null) return;
if (directorySet.isCompilerOutputPathInherited()) return;
final String path = directorySet.getOutputDir().getAbsolutePath();
VirtualFile virtualFile = VirtualFileManager.getInstance().findFileByUrl(path);
if (virtualFile == null) {
if(!directorySet.getOutputDir().exists()){
FileUtil.createDirectory(directorySet.getOutputDir());
}
ApplicationEx app = (ApplicationEx)ApplicationManager.getApplication();
if (app.isDispatchThread() || !app.holdsReadLock()) {
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directorySet.getOutputDir());
}
}
result.add(VfsUtilCore.pathToUrl(path));
}
示例3: syncPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private static void syncPaths(@NotNull Module module, @NotNull ModuleData data) {
ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
CompilerModuleExtension extension = modifiableModel.getModuleExtension(CompilerModuleExtension.class);
if (extension == null) {
modifiableModel.dispose();
LOG.warn(String.format("Can't sync paths for module '%s'. Reason: no compiler extension is found for it", module.getName()));
return;
}
try {
String compileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.SOURCE);
if (compileOutputPath != null) {
extension.setCompilerOutputPath(compileOutputPath);
}
String testCompileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.TEST);
if (testCompileOutputPath != null) {
extension.setCompilerOutputPathForTests(testCompileOutputPath);
}
extension.inheritCompilerOutputPath(data.isInheritProjectCompileOutputPath());
}
finally {
modifiableModel.commit();
}
}
示例4: testCustomizeModule
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
public void testCustomizeModule() throws Exception {
final IdeModifiableModelsProviderImpl modelsProvider = new IdeModifiableModelsProviderImpl(myProject);
try {
myCustomizer.customizeModule(myProject, myModule, modelsProvider, myIdeaAndroidProject);
modelsProvider.commit();
}
catch (Throwable t) {
modelsProvider.dispose();
ExceptionUtil.rethrowAllAsUnchecked(t);
}
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(myModule);
ContentEntry contentEntry = moduleRootManager.getContentEntries()[0];
SourceFolder[] sourceFolders = contentEntry.getSourceFolders();
List<String> sourcePaths = Lists.newArrayListWithExpectedSize(sourceFolders.length);
for (SourceFolder folder : sourceFolders) {
if (!folder.isTestSource()) {
VirtualFile file = folder.getFile();
assertNotNull(file);
sourcePaths.add(file.getPath());
}
}
ContentRootSourcePaths expectedPaths = new ContentRootSourcePaths();
expectedPaths.storeExpectedSourcePaths(myAndroidProject);
List<String> allExpectedPaths = Lists.newArrayList();
allExpectedPaths.addAll(expectedPaths.getPaths(ExternalSystemSourceType.SOURCE));
allExpectedPaths.addAll(expectedPaths.getPaths(ExternalSystemSourceType.SOURCE_GENERATED));
allExpectedPaths.addAll(expectedPaths.getPaths(ExternalSystemSourceType.RESOURCE));
sort(allExpectedPaths);
sort(sourcePaths);
assertEquals(allExpectedPaths, sourcePaths);
}
示例5: addGeneratedDirPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private void addGeneratedDirPaths(@NotNull AndroidArtifactStub androidArtifact, boolean isTest) {
ExternalSystemSourceType sourceType = isTest ? ExternalSystemSourceType.TEST_GENERATED : ExternalSystemSourceType.SOURCE_GENERATED;
addSourceDirPaths(sourceType, androidArtifact.getGeneratedSourceFolders());
sourceType = isTest ? ExternalSystemSourceType.TEST_RESOURCE : ExternalSystemSourceType.RESOURCE;
addSourceDirPaths(sourceType, androidArtifact.getGeneratedResourceFolders());
}
示例6: addSourceDirPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private void addSourceDirPaths(@NotNull SourceProvider sourceProvider, boolean isTest) {
ExternalSystemSourceType sourceType = isTest ? ExternalSystemSourceType.TEST : ExternalSystemSourceType.SOURCE;
addSourceDirPaths(sourceType, sourceProvider.getAidlDirectories());
addSourceDirPaths(sourceType, sourceProvider.getAssetsDirectories());
addSourceDirPaths(sourceType, sourceProvider.getJavaDirectories());
addSourceDirPaths(sourceType, sourceProvider.getCppDirectories());
addSourceDirPaths(sourceType, sourceProvider.getCDirectories());
addSourceDirPaths(sourceType, sourceProvider.getRenderscriptDirectories());
sourceType = isTest ? ExternalSystemSourceType.TEST_RESOURCE : ExternalSystemSourceType.RESOURCE;
addSourceDirPaths(sourceType, sourceProvider.getResDirectories());
addSourceDirPaths(sourceType, sourceProvider.getResourcesDirectories());
}
示例7: assertCorrectStoredDirPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
public void assertCorrectStoredDirPaths(@NotNull Collection<String> paths, @NotNull ExternalSystemSourceType sourceType) {
List<String> sortedPaths = Lists.newArrayList(paths);
Collections.sort(sortedPaths);
List<String> expectedPaths = getPaths(sourceType);
String msg = String.format("Source paths (%s)", sourceType.toString().toLowerCase());
Assert.assertEquals(msg, expectedPaths, sortedPaths);
}
示例8: DefaultExternalSourceSet
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
public DefaultExternalSourceSet(ExternalSourceSet sourceSet) {
this();
myName = sourceSet.getName();
for (Map.Entry<IExternalSystemSourceType, ExternalSourceDirectorySet> entry : sourceSet.getSources().entrySet()) {
mySources.put(ExternalSystemSourceType.from(entry.getKey()), new DefaultExternalSourceDirectorySet(entry.getValue()));
}
}
示例9: addResources
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private static void addResources(@NotNull List<ResourceRootConfiguration> container,
@Nullable ExternalSourceSet externalSourceSet,
@NotNull ExternalSystemSourceType sourceType) {
if (externalSourceSet == null) return;
final ExternalSourceDirectorySet directorySet = externalSourceSet.getSources().get(sourceType);
if (directorySet == null) return;
for (File file : directorySet.getSrcDirs()) {
final String dir = file.getPath();
final ResourceRootConfiguration rootConfiguration = new ResourceRootConfiguration();
rootConfiguration.directory = FileUtil.toSystemIndependentName(dir);
final String target = directorySet.getOutputDir().getPath();
rootConfiguration.targetPath = FileUtil.toSystemIndependentName(target);
rootConfiguration.includes.clear();
for (String include : directorySet.getIncludes()) {
rootConfiguration.includes.add(include.trim());
}
rootConfiguration.excludes.clear();
for (String exclude : directorySet.getExcludes()) {
rootConfiguration.excludes.add(exclude.trim());
}
rootConfiguration.isFiltered = !directorySet.getFilters().isEmpty();
rootConfiguration.filters.clear();
for (ExternalFilter filter : directorySet.getFilters()) {
final ResourceRootFilter resourceRootFilter = new ResourceRootFilter();
resourceRootFilter.filterType = filter.getFilterType();
resourceRootFilter.properties = filter.getPropertiesAsJsonMap();
rootConfiguration.filters.add(resourceRootFilter);
}
container.add(rootConfiguration);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GradleResourceCompilerConfigurationGenerator.java
示例10: syncPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
private static void syncPaths(@Nonnull Module module, @Nonnull ModuleData data) {
ModuleCompilerPathsManager compilerPathsManager = ModuleCompilerPathsManager.getInstance(module);
compilerPathsManager.setInheritedCompilerOutput(data.isInheritProjectCompileOutputPath());
if (!data.isInheritProjectCompileOutputPath()) {
String compileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.SOURCE);
if (compileOutputPath != null) {
compilerPathsManager.setCompilerOutputUrl(ProductionContentFolderTypeProvider.getInstance(), VfsUtilCore.pathToUrl(compileOutputPath));
}
String testCompileOutputPath = data.getCompileOutputPath(ExternalSystemSourceType.TEST);
if (testCompileOutputPath != null) {
compilerPathsManager.setCompilerOutputUrl(TestContentFolderTypeProvider.getInstance(), VfsUtilCore.pathToUrl(testCompileOutputPath));
}
}
}
示例11: ContentRootSourcePaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
public ContentRootSourcePaths() {
for (ExternalSystemSourceType sourceType : ALL_SOURCE_TYPES) {
myDirectoryPathsBySourceType.put(sourceType, new ArrayList<String>());
}
}
示例12: getPaths
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
@NotNull
public List<String> getPaths(@NotNull ExternalSystemSourceType sourceType) {
return myDirectoryPathsBySourceType.get(sourceType);
}
示例13: resolveProjectInfoImpl
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; //导入依赖的package包/类
@NotNull
private DataNode<ProjectData> resolveProjectInfoImpl(
@NotNull ExternalSystemTaskId id,
@NotNull final PantsCompileOptionsExecutor executor,
@NotNull ExternalSystemTaskNotificationListener listener,
boolean isPreviewMode,
boolean isEnableIncrementalImport
) throws ExternalSystemException, IllegalArgumentException, IllegalStateException {
// todo(fkorotkov): add ability to choose a name for a project
final ProjectData projectData = new ProjectData(
PantsConstants.SYSTEM_ID,
executor.getProjectName(),
executor.getBuildRoot().getPath() + "/.idea/pants-projects/" + executor.getProjectRelativePath(),
executor.getProjectPath()
);
final DataNode<ProjectData> projectDataNode = new DataNode<>(ProjectKeys.PROJECT, projectData, null);
PantsUtil.findPantsExecutable(executor.getProjectPath())
.flatMap(file -> PantsUtil.getDefaultJavaSdk(file.getPath(), null))
.ifPresent(sdk -> projectDataNode.createChild(PantsConstants.SDK_KEY, sdk));
if (!isPreviewMode) {
PantsExternalMetricsListenerManager.getInstance().logIsIncrementalImport(isEnableIncrementalImport);
resolveUsingPantsGoal(id, executor, listener, projectDataNode);
if (!containsContentRoot(projectDataNode, executor.getProjectDir())) {
// Add a module with content root as import project directory path.
// This will allow all the files in the imported project directory will be indexed by the plugin.
final String moduleName = executor.getRootModuleName();
final ModuleData moduleData = new ModuleData(
PantsConstants.PANTS_PROJECT_MODULE_ID_PREFIX + moduleName,
PantsConstants.SYSTEM_ID,
ModuleTypeId.JAVA_MODULE,
moduleName + PantsConstants.PANTS_PROJECT_MODULE_SUFFIX,
projectData.getIdeProjectFileDirectoryPath() + "/" + moduleName,
executor.getProjectPath()
);
final DataNode<ModuleData> moduleDataNode = projectDataNode.createChild(ProjectKeys.MODULE, moduleData);
final ContentRootData contentRoot = new ContentRootData(PantsConstants.SYSTEM_ID, executor.getProjectDir());
if (FileUtil.filesEqual(executor.getBuildRoot(), new File(executor.getProjectPath()))) {
contentRoot.storePath(ExternalSystemSourceType.EXCLUDED, executor.getBuildRoot().getPath() + "/.idea");
}
moduleDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRoot);
}
}
return projectDataNode;
}