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

Java ExternalSystemConstants类代码示例

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

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



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

示例1: after

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
  boolean scheduleRefresh = false;
  for (VFileEvent event : events) {
    String changedPath = event.getPath();
    for (MyEntry entry : myAutoImportAware) {
      String projectPath = entry.aware.getAffectedExternalProjectPath(changedPath, myProject);
      if (projectPath == null) {
        continue;
      }
      ExternalProjectSettings projectSettings = entry.systemSettings.getLinkedProjectSettings(projectPath);
      if (projectSettings != null && projectSettings.isUseAutoImport()) {
        addPath(entry.externalSystemId, projectPath);
        scheduleRefresh = true;
        break;
      }
    }
  }
  if (scheduleRefresh) {
    myVfsAlarm.cancelAllRequests();
    myVfsAlarm.addRequest(myFilesRequest, ExternalSystemConstants.AUTO_IMPORT_DELAY_MILLIS);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExternalSystemAutoImporter.java


示例2: getDescription

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public String getDescription(ExternalSystemBeforeRunTask task) {
  final String externalProjectPath = task.getTaskExecutionSettings().getExternalProjectPath();

  if (task.getTaskExecutionSettings().getTaskNames().isEmpty()) {
    return ExternalSystemBundle.message("tasks.before.run.empty", mySystemId.getReadableName());
  }

  String desc = StringUtil.join(task.getTaskExecutionSettings().getTaskNames(), " ");
  for (Module module : ModuleManager.getInstance(myProject).getModules()) {
    if (!mySystemId.toString().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY))) continue;

    if (StringUtil.equals(externalProjectPath, module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY))) {
      desc = module.getName() + ": " + desc;
      break;
    }
  }

  return ExternalSystemBundle.message("tasks.before.run", mySystemId.getReadableName(), desc);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemBeforeRunTaskProvider.java


示例3: enhanceRemoteProcessing

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) throws ExecutionException {
  final Set<String> additionalEntries = ContainerUtilRt.newHashSet();
  for (GradleProjectResolverExtension extension : RESOLVER_EXTENSIONS.getValue()) {
    ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(extension.getClass()));
    for (Class aClass : extension.getExtraProjectModelClasses()) {
      ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(aClass));
    }
    extension.enhanceRemoteProcessing(parameters);
  }

  final PathsList classPath = parameters.getClassPath();
  for (String entry : additionalEntries) {
    classPath.add(entry);
  }

  parameters.getVMParametersList().addProperty(
    ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, GradleConstants.SYSTEM_ID.getId());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleManager.java


示例4: isConfigurationFromContext

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public boolean isConfigurationFromContext(ExternalSystemRunConfiguration configuration, ConfigurationContext context) {
  if (configuration == null) return false;
  if (!GradleConstants.SYSTEM_ID.equals(configuration.getSettings().getExternalSystemId())) return false;

  final PsiPackage psiPackage = JavaRuntimeConfigurationProducerBase.checkPackage(context.getPsiLocation());
  if (psiPackage == null) return false;

  if (context.getModule() == null) return false;

  if (!StringUtil.equals(
    context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY),
    configuration.getSettings().getExternalProjectPath())) {
    return false;
  }
  if (!configuration.getSettings().getTaskNames().containsAll(TASKS_TO_RUN)) return false;

  final String scriptParameters = configuration.getSettings().getScriptParameters() + ' ';
  return psiPackage.getQualifiedName().isEmpty()
         ? scriptParameters.contains("--tests * ")
         : scriptParameters.contains(String.format("--tests %s.* ", psiPackage.getQualifiedName()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AllInPackageGradleConfigurationProducer.java


示例5: applyTestMethodConfiguration

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
private static boolean applyTestMethodConfiguration(@NotNull ExternalSystemRunConfiguration configuration,
                                                    @NotNull ConfigurationContext context,
                                                    @NotNull PsiMethod psiMethod,
                                                    @NotNull PsiClass... containingClasses) {
  if (!StringUtil.equals(
    context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
    GradleConstants.SYSTEM_ID.toString())) {
    return false;
  }

  configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY));
  configuration.getSettings().setTaskNames(TASKS_TO_RUN);

  StringBuilder buf = new StringBuilder();
  for (PsiClass aClass : containingClasses) {
    buf.append(creatTestFilter(aClass, psiMethod));
  }

  configuration.getSettings().setScriptParameters(buf.toString().trim());
  configuration.setName(psiMethod.getName());
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TestMethodGradleConfigurationProducer.java


示例6: getClassRoots

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Nullable
public List<File> getClassRoots(@Nullable Project project, @Nullable String rootProjectPath) {
  if (project == null) return null;

  if(rootProjectPath == null) {
    for (Module module : ModuleManager.getInstance(project).getModules()) {
      rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
      List<File> result = findGradleSdkClasspath(project, rootProjectPath);
      if(!result.isEmpty()) return result;
    }
  } else {
    return findGradleSdkClasspath(project, rootProjectPath);
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GradleInstallationManager.java


示例7: patchResolveScopeInner

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
public GlobalSearchScope patchResolveScopeInner(@Nullable Module module, @NotNull GlobalSearchScope baseScope) {
  if (module == null) return GlobalSearchScope.EMPTY_SCOPE;
  final String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
  if (!GradleConstants.SYSTEM_ID.toString().equals(externalSystemId)) return baseScope;

  GlobalSearchScope result = GlobalSearchScope.EMPTY_SCOPE;
  final Project project = module.getProject();
  for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
    if (entry instanceof JdkOrderEntry) {
      GlobalSearchScope scopeForSdk = LibraryScopeCache.getInstance(project).getScopeForSdk((JdkOrderEntry)entry);
      result = result.uniteWith(scopeForSdk);
    }
  }

  String modulePath = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
  if (modulePath == null) return result;

  final Collection<VirtualFile> files = GradleBuildClasspathManager.getInstance(project).getModuleClasspathEntries(modulePath);

  result = new ExternalModuleBuildGlobalSearchScope(project, result.uniteWith(new NonClasspathDirectoriesScope(files)), modulePath);

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GradleScriptType.java


示例8: setMavenizedModules

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
public void setMavenizedModules(Collection<Module> modules, boolean mavenized) {
  ApplicationManager.getApplication().assertWriteAccessAllowed();
  for (Module m : modules) {
    if (m.isDisposed()) continue;

    if (mavenized) {
      m.setOption(getMavenizedModuleOptionName(), "true");

      // clear external system API options
      // see com.intellij.openapi.externalSystem.service.project.manage.ModuleDataService#setModuleOptions
      m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
      m.clearOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
      m.clearOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
      m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY);
      m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY);
    }
    else {
      m.clearOption(getMavenizedModuleOptionName());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MavenProjectsManager.java


示例9: initComponent

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public void initComponent() {
  // The Pants plugin doesn't do so many computations for building a project
  // to start an external JVM each time.
  // The plugin only calls `export` goal and parses JSON response.
  // So it will be in process all the time.
  final String key = PantsConstants.SYSTEM_ID.getId() + ExternalSystemConstants.USE_IN_PROCESS_COMMUNICATION_REGISTRY_KEY_SUFFIX;
  Registry.get(key).setValue(true);

  // hack to trick BuildProcessClasspathManager
  final String basePath = System.getProperty("pants.plugin.base.path");
  final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PantsConstants.PLUGIN_ID));
  if (StringUtil.isNotEmpty(basePath) && plugin instanceof IdeaPluginDescriptorImpl) {
    ((IdeaPluginDescriptorImpl) plugin).setPath(new File(basePath));
  }

  registerPantsActions();
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:19,代码来源:PantsInitComponentImpl.java


示例10: filterExistingModules

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@NotNull
private Collection<DataNode<ModuleData>> filterExistingModules(@NotNull Collection<DataNode<ModuleData>> modules,
                                                               @NotNull Project project)
{
  Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
  for (DataNode<ModuleData> node : modules) {
    ModuleData moduleData = node.getData();
    Module module = myProjectStructureHelper.findIdeModule(moduleData, project);
    if (module == null) {
      result.add(node);
    }
    else {
      module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
      module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ModuleDataService.java


示例11: after

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
public void after(@Nonnull List<? extends VFileEvent> events) {
  boolean scheduleRefresh = false;
  for (VFileEvent event : events) {
    String changedPath = event.getPath();
    for (MyEntry entry : myAutoImportAware) {
      String projectPath = entry.aware.getAffectedExternalProjectPath(changedPath, myProject);
      if (projectPath == null) {
        continue;
      }
      ExternalProjectSettings projectSettings = entry.systemSettings.getLinkedProjectSettings(projectPath);
      if (projectSettings != null && projectSettings.isUseAutoImport()) {
        addPath(entry.externalSystemId, projectPath);
        scheduleRefresh = true;
        break;
      }
    }
  }
  if (scheduleRefresh) {
    myVfsAlarm.cancelAllRequests();
    myVfsAlarm.addRequest(myFilesRequest, ExternalSystemConstants.AUTO_IMPORT_DELAY_MILLIS);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:ExternalSystemAutoImporter.java


示例12: testEnsureSize

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Test
public void testEnsureSize() throws Exception {
  List<ExternalTaskExecutionInfo> tasks = ContainerUtilRt.newArrayList();

  // test task list widening
  myModel.setTasks(tasks);
  myModel.ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER);
  Assert.assertEquals("task list widening failed", ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize());

  // test task list reduction
  for (int i = 0; i < ExternalSystemConstants.RECENT_TASKS_NUMBER + 1; i++) {
    tasks.add(new ExternalTaskExecutionInfo(new ExternalSystemTaskExecutionSettings(), "task" + i));
  }
  myModel.setTasks(tasks);
  Assert.assertEquals(ExternalSystemConstants.RECENT_TASKS_NUMBER + 1, myModel.getSize());

  myModel.ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER);
  Assert.assertEquals("task list reduction failed", ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:ExternalSystemRecentTaskListModelTest.java


示例13: main

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
  if (args.length < 1) {
    throw new IllegalArgumentException(
      "Can't create external system facade. Reason: given arguments don't contain information about external system resolver to use");
  }
  final Class<ExternalSystemProjectResolver<?>> resolverClass = (Class<ExternalSystemProjectResolver<?>>)Class.forName(args[0]);
  if (!ExternalSystemProjectResolver.class.isAssignableFrom(resolverClass)) {
    throw new IllegalArgumentException(String.format(
      "Can't create external system facade. Reason: given external system resolver class (%s) must be IS-A '%s'",
      resolverClass,
      ExternalSystemProjectResolver.class));
  }

  if (args.length < 2) {
    throw new IllegalArgumentException(
      "Can't create external system facade. Reason: given arguments don't contain information about external system build manager to use"
    );
  }
  final Class<ExternalSystemTaskManager<?>> buildManagerClass = (Class<ExternalSystemTaskManager<?>>)Class.forName(args[1]);
  if (!ExternalSystemProjectResolver.class.isAssignableFrom(resolverClass)) {
    throw new IllegalArgumentException(String.format(
      "Can't create external system facade. Reason: given external system build manager (%s) must be IS-A '%s'",
      buildManagerClass, ExternalSystemTaskManager.class
    ));
  }

  // running the code indicates remote communication mode with external system
  Registry.get(
    System.getProperty(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY) +
    ExternalSystemConstants.USE_IN_PROCESS_COMMUNICATION_REGISTRY_KEY_SUFFIX).setValue(false);

  RemoteExternalSystemFacadeImpl facade = new RemoteExternalSystemFacadeImpl(resolverClass, buildManagerClass);
  facade.init();
  start(facade);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:RemoteExternalSystemFacadeImpl.java


示例14: getRootProjectPath

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Nullable
private static String getRootProjectPath(@NotNull Module module) {
  String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
  if (externalSystemId == null || !GradleConstants.SYSTEM_ID.toString().equals(externalSystemId)) {
    return null;
  }

  String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
  return StringUtil.isEmpty(path) ? null : path;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:UseDistributionWithSourcesNotificationProvider.java


示例15: setupConfigurationFromContext

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(ExternalSystemRunConfiguration configuration,
                                                ConfigurationContext context,
                                                Ref<PsiElement> sourceElement) {

  final PsiPackage psiPackage = JavaRuntimeConfigurationProducerBase.checkPackage(context.getPsiLocation());
  if (psiPackage == null) return false;
  sourceElement.set(psiPackage);

  final Module module = context.getModule();
  if (module == null) return false;

  if (!StringUtil.equals(
    module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
    GradleConstants.SYSTEM_ID.toString())) {
    return false;
  }

  final String linkedGradleProject = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
  if (linkedGradleProject == null) return false;
  configuration.getSettings().setExternalProjectPath(linkedGradleProject);
  configuration.getSettings().setTaskNames(TASKS_TO_RUN);
  if (psiPackage.getQualifiedName().isEmpty()) {
    configuration.getSettings().setScriptParameters("--tests *");
  }
  else {
    configuration.getSettings()
      .setScriptParameters(String.format("--tests %s.*", psiPackage.getQualifiedName()));
  }
  configuration.setName(suggestName(psiPackage, module));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AllInPackageGradleConfigurationProducer.java


示例16: checkForAvailableTasks

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
private static void checkForAvailableTasks(int level,
                                           @Nullable String taskName,
                                           @NotNull PsiScopeProcessor processor,
                                           @NotNull ResolveState state,
                                           @NotNull PsiElement place) {
  if (taskName == null) return;
  final GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  PsiClass gradleApiProjectClass = psiManager.findClassWithCache(GRADLE_API_PROJECT, place.getResolveScope());
  if (canBeMethodOf(taskName, gradleApiProjectClass)) return;
  if (canBeMethodOf(GroovyPropertyUtils.getGetterNameNonBoolean(taskName), gradleApiProjectClass)) return;

  final String className = BUILT_IN_TASKS.get(taskName);
  if (className != null) {
    if (level <= 1) {
      GradleResolverUtil.addImplicitVariable(processor, state, place, className);
    }
    processTask(taskName, className, psiManager, processor, state, place);
    return;
  }

  Module module = ModuleUtilCore.findModuleForPsiElement(place);
  if (module == null) return;
  String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
  GradleLocalSettings localSettings = GradleLocalSettings.getInstance(place.getProject());
  Collection<ExternalTaskPojo> taskPojos = localSettings.getAvailableTasks().get(path);
  if (taskPojos == null) return;

  for (ExternalTaskPojo taskPojo : taskPojos) {
    if (taskName.equals(taskPojo.getName())) {
      processTask(taskName, GRADLE_API_TASK, psiManager, processor, state, place);
      return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:GradleImplicitContributor.java


示例17: getConfigPath

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
/**
 * Allows to build file system path to the target gradle sub-project given the root project path.
 *
 * @param subProject       target sub-project which config path we're interested in
 * @param rootProjectPath  path to root project's directory which contains 'build.gradle'
 * @return                 path to the given sub-project's directory which contains 'build.gradle'
 */
@NotNull
public static String getConfigPath(@NotNull GradleProject subProject, @NotNull String rootProjectPath) {
  try {
    GradleScript script = subProject.getBuildScript();
    if (script != null) {
      File file = script.getSourceFile();
      if (file != null) {
        if (file.isFile()) {
          // The file points to 'build.gradle' at the moment but we keep it's parent dir path instead.
          file = file.getParentFile();
        }
        return ExternalSystemApiUtil.toCanonicalPath(file.getCanonicalPath());
      }
    }
  }
  catch (Exception e) {
    // As said by gradle team: 'One thing I'm interested in is whether you have any thoughts about how the tooling API should
    // deal with missing details from the model - for example, when asking for details about the build scripts when using
    // a version of Gradle that does not supply that information. Currently, you'll get a `UnsupportedOperationException`
    // when you call the `getBuildScript()` method'.
    //
    // So, just ignore it and assume that the user didn't define any custom build file name.
  }
  File rootProjectParent = new File(rootProjectPath);
  StringBuilder buffer = new StringBuilder(FileUtil.toCanonicalPath(rootProjectParent.getAbsolutePath()));
  Stack<String> stack = ContainerUtilRt.newStack();
  for (GradleProject p = subProject; p != null; p = p.getParent()) {
    stack.push(p.getName());
  }

  // pop root project
  stack.pop();
  while (!stack.isEmpty()) {
    buffer.append(ExternalSystemConstants.PATH_SEPARATOR).append(stack.pop());
  }
  return buffer.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:GradleUtil.java


示例18: setUp

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  myModule.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, PantsConstants.SYSTEM_ID.getId());

  final String pyPluginId = "PythonCore";
  final IdeaPluginDescriptor pyPlugin = PluginManager.getPlugin(PluginId.getId(pyPluginId));
  assertNotNull(
    "Python Community Edition plugin should be in classpath for tests\n" +
    "You need to include jars from ~/Library/Application Support/IdeaIC14/python/lib/",
    pyPlugin
  );

  if (!pyPlugin.isEnabled()) {
    assertTrue("Failed to enable Python plugin!", PluginManagerCore.enablePlugin(pyPluginId));
  }

  final String testUserHome = VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(PantsTestUtils.BASE_TEST_DATA_PATH + "/userHome"));
  final Optional<VirtualFile> folderWithPex =
    PantsUtil.findFolderWithPex(Optional.ofNullable(VirtualFileManager.getInstance().findFileByUrl(testUserHome)));
  assertTrue("Folder with pex files should be configured", folderWithPex.isPresent());
  final VirtualFile[] pexFiles = folderWithPex.get().getChildren();
  assertTrue("There should be only one pex file!", pexFiles.length == 1);

  ApplicationManager.getApplication().runWriteAction(
    new Runnable() {
      @Override
      public void run() {
        configurePantsLibrary(myFixture.getProject(), pexFiles[0]);
      }
    }
  );
  assertNotNull(
    "Pants lib not configured!",
    ProjectLibraryTable.getInstance(myFixture.getProject()).getLibraryByName(PantsConstants.PANTS_LIBRARY_NAME)
  );
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:39,代码来源:PantsCodeInsightFixtureTestCase.java


示例19: createModuleWithSerializedAddresses

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
private Module createModuleWithSerializedAddresses(String path, Set addresses) {
  Module module = ModuleManager.getInstance(myProject).newModule(path, ModuleTypeId.JAVA_MODULE);
  // Make it a Pants module
  module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, PantsConstants.SYSTEM_ID.getId());
  module.setOption(PantsConstants.PANTS_TARGET_ADDRESSES_KEY, PantsUtil.dehydrateTargetAddresses(addresses)
  );
  return module;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:9,代码来源:IntelliJRunnerAddressInvocationTest.java


示例20: registerPaths

import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; //导入依赖的package包/类
@SuppressWarnings("MethodMayBeStatic")
public void registerPaths(@NotNull final Map<OrderRootType, Collection<File>> libraryFiles,
                          @NotNull Library.ModifiableModel model,
                          @NotNull String libraryName)
{
  for (Map.Entry<OrderRootType, Collection<File>> entry : libraryFiles.entrySet()) {
    for (File file : entry.getValue()) {
      VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
      if (virtualFile == null) {
        if (ExternalSystemConstants.VERBOSE_PROCESSING && entry.getKey() == OrderRootType.CLASSES) {
          LOG.warn(
            String.format("Can't find %s of the library '%s' at path '%s'", entry.getKey(), libraryName, file.getAbsolutePath())
          );
        }
        String url = VfsUtil.getUrlForLibraryRoot(file);
        model.addRoot(url, entry.getKey());
        continue;
      }
      if (virtualFile.isDirectory()) {
        model.addRoot(virtualFile, entry.getKey());
      }
      else {
        VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(virtualFile);
        if (jarRoot == null) {
          LOG.warn(String.format(
            "Can't parse contents of the jar file at path '%s' for the library '%s''", file.getAbsolutePath(), libraryName
          ));
          continue;
        }
        model.addRoot(jarRoot, entry.getKey());
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:LibraryDataService.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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