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


Java ExternalSystemTaskLocation类代码示例

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


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

示例1: buildLocation

import com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskLocation; //导入依赖的package包/类
@Nullable
private Location buildLocation() {
  if (mySelectedTaskProvider == null) {
    return null;
  }
  ExternalTaskExecutionInfo task = mySelectedTaskProvider.produce();
  if (task == null) {
    return null;
  }

  String projectPath = task.getSettings().getExternalProjectPath();
  String name = myExternalSystemId.getReadableName() + projectPath + StringUtil.join(task.getSettings().getTaskNames(), " ");
  // We create a dummy text file instead of re-using external system file in order to avoid clashing with other configuration producers.
  // For example gradle files are enhanced groovy scripts but we don't want to run them via regular IJ groovy script runners.
  // Gradle tooling api should be used for running gradle tasks instead. IJ execution sub-system operates on Location objects
  // which encapsulate PsiElement and groovy runners are automatically applied if that PsiElement IS-A GroovyFile.
  PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(name, PlainTextFileType.INSTANCE, "nichts");

  return new ExternalSystemTaskLocation(myProject, file, task);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ExternalSystemTasksPanel.java

示例2: extractLocation

import com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskLocation; //导入依赖的package包/类
@Nullable
private Location extractLocation() {
  final List<ExternalSystemNode> selectedNodes = getSelectedNodes(ExternalSystemNode.class);
  if (selectedNodes.isEmpty()) return null;

  List<TaskData> tasks = ContainerUtil.newSmartList();

  ExternalTaskExecutionInfo taskExecutionInfo = new ExternalTaskExecutionInfo();

  String projectPath = null;

  for (ExternalSystemNode node : selectedNodes) {
    final Object data = node.getData();
    if (data instanceof TaskData) {
      final TaskData taskData = (TaskData)data;
      if (projectPath == null) {
        projectPath = taskData.getLinkedExternalProjectPath();
      }
      else if (!taskData.getLinkedExternalProjectPath().equals(projectPath)) {
        return null;
      }

      taskExecutionInfo.getSettings().getTaskNames().add(taskData.getName());
      taskExecutionInfo.getSettings().getTaskDescriptions().add(taskData.getDescription());
      tasks.add(taskData);
    }
  }

  if(tasks.isEmpty()) return null;

  taskExecutionInfo.getSettings().setExternalSystemIdString(myExternalSystemId.toString());
  taskExecutionInfo.getSettings().setExternalProjectPath(projectPath);

  String name = myExternalSystemId.getReadableName() + projectPath + StringUtil.join(taskExecutionInfo.getSettings().getTaskNames(), " ");
  // We create a dummy text file instead of re-using external system file in order to avoid clashing with other configuration producers.
  // For example gradle files are enhanced groovy scripts but we don't want to run them via regular IJ groovy script runners.
  // Gradle tooling api should be used for running gradle tasks instead. IJ execution sub-system operates on Location objects
  // which encapsulate PsiElement and groovy runners are automatically applied if that PsiElement IS-A GroovyFile.
  PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(name, PlainTextFileType.INSTANCE, "");
  return new ExternalSystemTaskLocation(myProject, file, taskExecutionInfo);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:ExternalProjectsViewImpl.java


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