本文整理汇总了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);
}
示例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);
}