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


Java ExternalTaskPojo类代码示例

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


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

示例1: convert

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
private static DataNode<ProjectData> convert(@NotNull ProjectSystemId systemId,
                                             @NotNull ExternalProjectPojo rootProject,
                                             @NotNull Collection<ExternalProjectPojo> childProjects,
                                             @NotNull Map<String, Collection<ExternalTaskPojo>> availableTasks) {
  ProjectData projectData = new ProjectData(systemId, rootProject.getName(), rootProject.getPath(), rootProject.getPath());
  DataNode<ProjectData> projectDataNode = new DataNode<ProjectData>(PROJECT, projectData, null);

  for (ExternalProjectPojo childProject : childProjects) {
    String moduleConfigPath = childProject.getPath();
    ModuleData moduleData = new ModuleData(childProject.getName(), systemId,
                                           ModuleTypeId.JAVA_MODULE, childProject.getName(),
                                           moduleConfigPath, moduleConfigPath);
    final DataNode<ModuleData> moduleDataNode = projectDataNode.createChild(MODULE, moduleData);

    final Collection<ExternalTaskPojo> moduleTasks = availableTasks.get(moduleConfigPath);
    if (moduleTasks != null) {
      for (ExternalTaskPojo moduleTask : moduleTasks) {
        TaskData taskData = new TaskData(systemId, moduleTask.getName(), moduleConfigPath, moduleTask.getDescription());
        moduleDataNode.createChild(TASK, taskData);
      }
    }
  }

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

示例2: canExecuteTask

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@Override
public boolean canExecuteTask(RunConfiguration configuration, ExternalSystemBeforeRunTask beforeRunTask) {
  final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();

  final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
  for (String taskName : executionSettings.getTaskNames()) {
    tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
  }
  if (tasks.isEmpty()) return true;

  final Pair<ProgramRunner, ExecutionEnvironment> pair =
    ExternalSystemUtil.createRunner(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, mySystemId);

  if (pair == null) return false;

  final ProgramRunner runner = pair.first;
  final ExecutionEnvironment environment = pair.second;

  return runner.canRun(DefaultRunExecutor.EXECUTOR_ID, environment.getRunProfile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemBeforeRunTaskProvider.java

示例3: getLinkedExternalProjectPath

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@NotNull
private static String getLinkedExternalProjectPath(@NotNull Collection<ExternalTaskPojo> tasks) throws IllegalArgumentException {
  if (tasks.isEmpty()) {
    throw new IllegalArgumentException("Can't execute external tasks. Reason: given tasks list is empty");
  }
  String result = null;
  for (ExternalTaskPojo task : tasks) {
    String path = task.getLinkedExternalProjectPath();
    if (result == null) {
      result = path;
    }
    else if (!result.equals(path)) {
      throw new IllegalArgumentException(String.format(
        "Can't execute given external system tasks. Reason: expected that all of them belong to the same external project " +
        "but they are not (at least two different projects detected - '%s' and '%s'). Tasks: %s",
        result,
        task.getLinkedExternalProjectPath(),
        tasks
      ));
    }
  }
  assert result != null;
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExternalSystemExecuteTaskTask.java

示例4: patchAvailableTasks

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
private static void patchAvailableTasks(@NotNull Map<String, String> adjustedPaths, @NotNull GradleLocalSettings localSettings) {
  Map<String, Collection<ExternalTaskPojo>> adjustedAvailableTasks = ContainerUtilRt.newHashMap();
  for (Map.Entry<String, Collection<ExternalTaskPojo>> entry : localSettings.getAvailableTasks().entrySet()) {
    String newPath = adjustedPaths.get(entry.getKey());
    if (newPath == null) {
      adjustedAvailableTasks.put(entry.getKey(), entry.getValue());
    }
    else {
      for (ExternalTaskPojo task : entry.getValue()) {
        String newTaskPath = adjustedPaths.get(task.getLinkedExternalProjectPath());
        if (newTaskPath != null) {
          task.setLinkedExternalProjectPath(newTaskPath);
        }
      }
      adjustedAvailableTasks.put(newPath, entry.getValue());
    }
  }
  localSettings.setAvailableTasks(adjustedAvailableTasks);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GradleManager.java

示例5: getLinkedExternalProjectPath

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@NotNull
private static String getLinkedExternalProjectPath(@NotNull Collection<ExternalTaskPojo> tasks) throws IllegalArgumentException {
  if (tasks.isEmpty()) {
    throw new IllegalArgumentException("Can't execute external tasks. Reason: given tasks list is empty");
  }
  String result = null;
  for (ExternalTaskPojo task : tasks) {
    String path = task.getLinkedExternalProjectPath();
    if (result == null) {
      result = path;
    }
    else if (!result.equals(path)) {
      throw new IllegalArgumentException(String.format(
        "Can't execute given external system tasks. Reason: expected that all of them belong to the same external project " +
        "but they are not (at least two different projects detected - '%s' and '%s'). Tasks: %s",
        result,
        task.getLinkedExternalProjectPath(),
        tasks));
    }
  }
  assert result != null;
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:ExternalSystemExecuteTaskTask.java

示例6: getLinkedExternalProjectPath

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@Nonnull
private static String getLinkedExternalProjectPath(@Nonnull Collection<ExternalTaskPojo> tasks) throws IllegalArgumentException {
  if (tasks.isEmpty()) {
    throw new IllegalArgumentException("Can't execute external tasks. Reason: given tasks list is empty");
  }
  String result = null;
  for (ExternalTaskPojo task : tasks) {
    String path = task.getLinkedExternalProjectPath();
    if (result == null) {
      result = path;
    }
    else if (!result.equals(path)) {
      throw new IllegalArgumentException(String.format(
        "Can't execute given external system tasks. Reason: expected that all of them belong to the same external project " +
        "but they are not (at least two different projects detected - '%s' and '%s'). Tasks: %s",
        result,
        task.getLinkedExternalProjectPath(),
        tasks
      ));
    }
  }
  assert result != null;
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:ExternalSystemExecuteTaskTask.java

示例7: mergeLocalSettings

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
private void mergeLocalSettings() {
  for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemApiUtil.getAllManagers()) {
    final ProjectSystemId systemId = manager.getSystemId();

    AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(myProject);
    final Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> availableProjects = settings.getAvailableProjects();
    final Map<String, Collection<ExternalTaskPojo>> availableTasks = settings.getAvailableTasks();

    for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : availableProjects.entrySet()) {
      final ExternalProjectPojo projectPojo = entry.getKey();
      final String externalProjectPath = projectPojo.getPath();
      final Pair<ProjectSystemId, File> key = Pair.create(systemId, new File(externalProjectPath));
      InternalExternalProjectInfo externalProjectInfo = myExternalRootProjects.get(key);
      if (externalProjectInfo == null) {
        final DataNode<ProjectData> dataNode = convert(systemId, projectPojo, entry.getValue(), availableTasks);
        externalProjectInfo = new InternalExternalProjectInfo(systemId, externalProjectPath, dataNode);
        myExternalRootProjects.put(key, externalProjectInfo);

        changed.set(true);
      }

      // restore linked project sub-modules
      ExternalProjectSettings linkedProjectSettings =
        manager.getSettingsProvider().fun(myProject).getLinkedProjectSettings(externalProjectPath);
      if (linkedProjectSettings != null && ContainerUtil.isEmpty(linkedProjectSettings.getModules())) {

        final Set<String> modulePaths = ContainerUtil.map2Set(
          ExternalSystemApiUtil.findAllRecursively(externalProjectInfo.getExternalProjectStructure(), ProjectKeys.MODULE),
          new Function<DataNode<ModuleData>, String>() {
            @Override
            public String fun(DataNode<ModuleData> node) {
              return node.getData().getLinkedExternalProjectPath();
            }
          });
        linkedProjectSettings.setModules(modulePaths);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ExternalProjectsDataStorage.java

示例8: ExternalSystemExecuteTaskTask

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
public ExternalSystemExecuteTaskTask(@NotNull ProjectSystemId externalSystemId,
                                     @NotNull Project project,
                                     @NotNull List<ExternalTaskPojo> tasksToExecute,
                                     @Nullable String vmOptions,
                                     @Nullable String scriptParameters,
                                     @Nullable String debuggerSetup) throws IllegalArgumentException {
  super(externalSystemId, ExternalSystemTaskType.EXECUTE_TASK, project, getLinkedExternalProjectPath(tasksToExecute));
  myTasksToExecute = tasksToExecute;
  myVmOptions = vmOptions;
  myScriptParameters = scriptParameters;
  myDebuggerSetup = debuggerSetup;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ExternalSystemExecuteTaskTask.java

示例9: ensureTasks

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
public void ensureTasks(@NotNull String externalProjectConfigPath, @NotNull Collection<ExternalTaskPojo> tasks) {
    if (tasks.isEmpty()) {
      return;
    }
    ExternalSystemNode<ExternalProjectPojo> moduleNode = findProjectNode(externalProjectConfigPath);
    if (moduleNode == null) {
//      LOG.warn(String.format(
//        "Can't proceed tasks for module which external config path is '%s'. Reason: no such module node is found. Tasks: %s",
//        externalProjectConfigPath, tasks
//      ));
      return;
    }
    Set<ExternalTaskExecutionInfo> toAdd = ContainerUtilRt.newHashSet();
    for (ExternalTaskPojo task : tasks) {
      toAdd.add(buildTaskInfo(task));
    }
    for (int i = 0; i < moduleNode.getChildCount(); i++) {
      ExternalSystemNode<?> childNode = moduleNode.getChildAt(i);
      Object element = childNode.getDescriptor().getElement();
      if (element instanceof ExternalTaskExecutionInfo) {
        if (!toAdd.remove(element)) {
          removeNodeFromParent(childNode);
          //noinspection AssignmentToForLoopParameter
          i--;
        }
      }
    }

    if (!toAdd.isEmpty()) {
      for (ExternalTaskExecutionInfo taskInfo : toAdd) {
        insertNodeInto(
          new ExternalSystemNode<ExternalTaskExecutionInfo>(descriptor(taskInfo, taskInfo.getDescription(), myUiAware.getTaskIcon())),
          moduleNode);
      }
    }
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:ExternalSystemTasksTreeModel.java

示例10: buildTaskInfo

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@NotNull
private ExternalTaskExecutionInfo buildTaskInfo(@NotNull ExternalTaskPojo task) {
  ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings();
  settings.setExternalProjectPath(task.getLinkedExternalProjectPath());
  settings.setTaskNames(Collections.singletonList(task.getName()));
  settings.setTaskDescriptions(Collections.singletonList(task.getDescription()));
  settings.setExternalSystemIdString(myExternalSystemId.toString());
  return new ExternalTaskExecutionInfo(settings, DefaultRunExecutor.EXECUTOR_ID);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExternalSystemTasksTreeModel.java

示例11: isApplicableFor

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@Override
public boolean isApplicableFor(@NotNull ExternalSystemTask task) {
  if (task instanceof ExternalSystemExecuteTaskTask) {
    ExternalSystemExecuteTaskTask taskTask = (ExternalSystemExecuteTaskTask)task;
    if (!StringUtil.equals(taskTask.getExternalSystemId().getId(), GradleConstants.SYSTEM_ID.getId())) return false;

    return ContainerUtil.find(taskTask.getTasksToExecute(), new Condition<ExternalTaskPojo>() {
      @Override
      public boolean value(ExternalTaskPojo pojo) {
        return "test".equals(pojo.getName());
      }
    }) != null;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GradleTestsExecutionConsoleManager.java

示例12: checkForAvailableTasks

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的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

示例13: ExternalSystemExecuteTaskTask

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
public ExternalSystemExecuteTaskTask(@NotNull ProjectSystemId externalSystemId,
                                     @NotNull Project project,
                                     @NotNull List<ExternalTaskPojo> tasksToExecute,
                                     @Nullable String vmOptions) throws IllegalArgumentException
{
  super(externalSystemId, ExternalSystemTaskType.EXECUTE_TASK, project, getLinkedExternalProjectPath(tasksToExecute));
  myTasksToExecute = tasksToExecute;
  myVmOptions = vmOptions;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ExternalSystemExecuteTaskTask.java

示例14: ensureTasks

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
public void ensureTasks(@NotNull String externalProjectConfigPath, @NotNull Collection<ExternalTaskPojo> tasks) {
    if (tasks.isEmpty()) {
      return;
    }
    ExternalSystemNode<ExternalProjectPojo> moduleNode = findProjectNode(externalProjectConfigPath);
    if (moduleNode == null) {
//      LOG.warn(String.format(
//        "Can't proceed tasks for module which external config path is '%s'. Reason: no such module node is found. Tasks: %s",
//        externalProjectConfigPath, tasks
//      ));
      return;
    }
    Set<ExternalTaskExecutionInfo> toAdd = ContainerUtilRt.newHashSet();
    for (ExternalTaskPojo task : tasks) {
      toAdd.add(buildTaskInfo(task));
    }
    for (int i = 0; i < moduleNode.getChildCount(); i++) {
      ExternalSystemNode<?> childNode = moduleNode.getChildAt(i);
      Object element = childNode.getDescriptor().getElement();
      if (element instanceof ExternalTaskExecutionInfo) {
        if (!toAdd.remove(element)) {
          moduleNode.remove(childNode);
          myIndexHolder[0] = i;
          myNodeHolder[0] = childNode;
          nodesWereRemoved(moduleNode, myIndexHolder, myNodeHolder);
          //noinspection AssignmentToForLoopParameter
          i--;
        }
      }
    }

    if (!toAdd.isEmpty()) {
      for (ExternalTaskExecutionInfo taskInfo : toAdd) {
        moduleNode.add(new ExternalSystemNode<ExternalTaskExecutionInfo>(descriptor(taskInfo, myUiAware.getTaskIcon())));
        myIndexHolder[0] = moduleNode.getChildCount() - 1;
        nodesWereInserted(moduleNode, myIndexHolder);
      }
    }
    ExternalSystemUiUtil.sort(moduleNode, this, NODE_COMPARATOR);
  }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:ExternalSystemTasksTreeModel.java

示例15: buildTaskInfo

import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo; //导入依赖的package包/类
@NotNull
private ExternalTaskExecutionInfo buildTaskInfo(@NotNull ExternalTaskPojo task) {
  ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings();
  settings.setExternalProjectPath(task.getLinkedExternalProjectPath());
  settings.setTaskNames(Collections.singletonList(task.getName()));
  settings.setExternalSystemIdString(myExternalSystemId.toString());
  return new ExternalTaskExecutionInfo(settings, DefaultRunExecutor.EXECUTOR_ID);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ExternalSystemTasksTreeModel.java


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