本文整理汇总了Java中com.intellij.openapi.externalSystem.model.task.TaskData类的典型用法代码示例。如果您正苦于以下问题:Java TaskData类的具体用法?Java TaskData怎么用?Java TaskData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskData类属于com.intellij.openapi.externalSystem.model.task包,在下文中一共展示了TaskData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的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;
}
示例2: updateExternalProjectData
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public void updateExternalProjectData(ExternalProjectInfo externalProject) {
// update external projects data
ExternalProjectsDataStorage.getInstance(myProject).update(externalProject);
// update shortcuts manager
if (externalProject.getExternalProjectStructure() != null) {
final ProjectData projectData = externalProject.getExternalProjectStructure().getData();
ExternalSystemUtil.scheduleExternalViewStructureUpdate(myProject, projectData.getOwner());
Collection<DataNode<TaskData>> taskData =
ExternalSystemApiUtil.findAllRecursively(externalProject.getExternalProjectStructure(), TASK);
myShortcutsManager.scheduleKeymapUpdate(taskData);
myShortcutsManager.scheduleRunConfigurationKeymapUpdate(projectData.getOwner());
}
}
示例3: createActions
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
private static void createActions(Project project, Collection<DataNode<TaskData>> taskNodes) {
ActionManager actionManager = ActionManager.getInstance();
final ExternalSystemShortcutsManager shortcutsManager = ExternalProjectsManager.getInstance(project).getShortcutsManager();
if (actionManager != null) {
for (DataNode<TaskData> each : taskNodes) {
final DataNode<ModuleData> moduleData = ExternalSystemApiUtil.findParent(each, ProjectKeys.MODULE);
if (moduleData == null || moduleData.isIgnored()) continue;
TaskData taskData = each.getData();
ExternalSystemTaskAction eachAction = new ExternalSystemTaskAction(project, moduleData.getData().getInternalName(), taskData);
actionManager.unregisterAction(eachAction.getId());
if (shortcutsManager.hasShortcuts(taskData.getLinkedExternalProjectPath(), taskData.getName())) {
actionManager.registerAction(eachAction.getId(), eachAction);
}
}
}
}
示例4: processData
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
@Override
protected void processData(@NotNull Collection<DataNode<TaskData>> nodes,
@NotNull Project project)
{
if (nodes.isEmpty()) {
return;
}
ProjectSystemId externalSystemId = nodes.iterator().next().getData().getOwner();
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
assert manager != null;
ExternalSystemKeymapExtension.updateActions(project, nodes);
MultiMap<ExternalConfigPathAware, DataNode<TaskData>> grouped = ExternalSystemApiUtil.groupBy(nodes, TASK_HOLDER_RETRIEVAL_STRATEGY);
Map<String, Collection<ExternalTaskPojo>> data = ContainerUtilRt.newHashMap();
for (Map.Entry<ExternalConfigPathAware, Collection<DataNode<TaskData>>> entry : grouped.entrySet()) {
data.put(entry.getKey().getLinkedExternalProjectPath(), ContainerUtilRt.map2List(entry.getValue(), MAPPER));
}
AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project);
Map<String, Collection<ExternalTaskPojo>> availableTasks = ContainerUtilRt.newHashMap(settings.getAvailableTasks());
availableTasks.putAll(data);
settings.setAvailableTasks(availableTasks);
}
示例5: getTasks
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
@NotNull
private static List<TaskData> getTasks(AnActionEvent e) {
final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
if (selectedNodes == null) return Collections.emptyList();
List<TaskData> tasks = new SmartList<TaskData>();
for (ExternalSystemNode node : selectedNodes) {
if (node instanceof TaskNode && !node.isIgnored()) {
tasks.add((TaskData)node.getData());
}
else if (node instanceof RunConfigurationNode) {
final RunnerAndConfigurationSettings configurationSettings = ((RunConfigurationNode)node).getSettings();
final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)configurationSettings.getConfiguration();
final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings();
tasks.add(new TaskData(taskExecutionSettings.getExternalSystemId(), RUN_CONFIGURATION_TASK_PREFIX + configurationSettings.getName(),
taskExecutionSettings.getExternalProjectPath(), null));
}
else {
return Collections.emptyList();
}
}
return tasks;
}
示例6: perform
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
@Override
protected void perform(@NotNull Project project,
@NotNull ProjectSystemId projectSystemId,
@NotNull TaskData taskData,
@NotNull AnActionEvent e) {
final ExternalTaskExecutionInfo taskExecutionInfo = ExternalSystemActionUtil.buildTaskInfo(taskData);
ExternalSystemUtil.runTask(taskExecutionInfo.getSettings(), taskExecutionInfo.getExecutorId(), project, projectSystemId);
final DataContext dataContext = e.getDataContext();
final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
RunnerAndConfigurationSettings configuration = context.findExisting();
RunManagerEx runManager = (RunManagerEx)context.getRunManager();
if (configuration == null) {
configuration = context.getConfiguration();
if (configuration == null) {
return;
}
runManager.setTemporaryConfiguration(configuration);
}
runManager.setSelectedConfiguration(configuration);
}
示例7: getVariants
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
protected List<LookupElement> getVariants(@NotNull final DataNode<ProjectData> projectDataNode, @NotNull final String modulePath) {
final DataNode<ModuleData> moduleDataNode = findModuleDataNode(projectDataNode, modulePath);
if (moduleDataNode == null) {
return Collections.emptyList();
}
final ModuleData moduleData = moduleDataNode.getData();
final boolean isRoot = projectDataNode.getData().getLinkedExternalProjectPath().equals(moduleData.getLinkedExternalProjectPath());
final Collection<DataNode<TaskData>> tasks = ExternalSystemApiUtil.getChildren(moduleDataNode, ProjectKeys.TASK);
List<LookupElement> elements = ContainerUtil.newArrayListWithCapacity(tasks.size());
for (DataNode<TaskData> taskDataNode : tasks) {
final TaskData taskData = taskDataNode.getData();
elements.add(LookupElementBuilder.create(taskData.getName()).withIcon(ExternalSystemIcons.Task));
if (!taskData.isInherited()) {
elements.add(LookupElementBuilder.create((isRoot ? ':' : moduleData.getId() + ':') + taskData.getName())
.withIcon(ExternalSystemIcons.Task));
}
}
return elements;
}
示例8: TasksNode
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public TasksNode(ExternalProjectsView externalProjectsView, final Collection<DataNode<?>> dataNodes) {
super(externalProjectsView, null, null);
if (dataNodes != null && !dataNodes.isEmpty()) {
for (DataNode<?> dataNode : dataNodes) {
if (!(dataNode.getData() instanceof TaskData)) continue;
if (dataNode.getParent() != null && ProjectKeys.PROJECT.equals(dataNode.getParent().getKey())) break;
String group = ((TaskData)dataNode.getData()).getGroup();
if (group == null) group = "other";
myTasksMap.putValue(StringUtil.toLowerCase(group), new TaskNode(externalProjectsView, (DataNode<TaskData>)dataNode));
}
}
}
示例9: TaskNode
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public TaskNode(@NotNull ExternalProjectsView externalProjectsView, @NotNull DataNode<TaskData> dataNode) {
super(externalProjectsView, null, dataNode);
myTaskData = dataNode.getData();
DataNode parent = ExternalSystemApiUtil.findParent(dataNode, MODULE);
if (parent == null) {
parent = ExternalSystemApiUtil.findParent(dataNode, PROJECT);
}
if(parent != null && parent.getData() instanceof Named) {
moduleOwnerName = ((Named)parent.getData()).getInternalName();
}
}
示例10: isTaskOfPhase
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public boolean isTaskOfPhase(@NotNull TaskData taskData, @NotNull Phase phase) {
final ExternalProjectsStateProvider stateProvider = ExternalProjectsManager.getInstance(myProject).getStateProvider();
final TaskActivationState taskActivationState =
stateProvider.getTasksActivation(taskData.getOwner(), taskData.getLinkedExternalProjectPath());
if (taskActivationState == null) return false;
return taskActivationState.getTasks(phase).contains(taskData.getName());
}
示例11: addTasks
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public void addTasks(@NotNull Collection<TaskData> tasks, @NotNull final Phase phase) {
if (tasks.isEmpty()) return;
addTasks(ContainerUtil.map(tasks, new Function<TaskData, TaskActivationEntry>() {
@Override
public TaskActivationEntry fun(TaskData data) {
return new TaskActivationEntry(data.getOwner(), phase, data.getLinkedExternalProjectPath(), data.getName());
}
}));
fireTasksChanged();
}
示例12: removeTasks
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public void removeTasks(@NotNull Collection<TaskData> tasks, @NotNull final Phase phase) {
if (tasks.isEmpty()) return;
removeTasks(ContainerUtil.map(tasks, new Function<TaskData, TaskActivationEntry>() {
@Override
public TaskActivationEntry fun(TaskData data) {
return new TaskActivationEntry(data.getOwner(), phase, data.getLinkedExternalProjectPath(), data.getName());
}
}));
}
示例13: init
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public void init() {
synchronized (isInitialized) {
if (isInitialized.getAndSet(true)) return;
// load external projects data
ExternalProjectsDataStorage.getInstance(myProject).load();
myRunManagerListener.attach();
// init shortcuts manager
myShortcutsManager.init();
for (ExternalSystemManager<?, ?, ?, ?, ?> systemManager : ExternalSystemApiUtil.getAllManagers()) {
final Collection<ExternalProjectInfo> externalProjects =
ExternalProjectsDataStorage.getInstance(myProject).list(systemManager.getSystemId());
for (ExternalProjectInfo externalProject : externalProjects) {
if (externalProject.getExternalProjectStructure() == null) continue;
Collection<DataNode<TaskData>> taskData =
ExternalSystemApiUtil.findAllRecursively(externalProject.getExternalProjectStructure(), TASK);
myShortcutsManager.scheduleKeymapUpdate(taskData);
}
if (!externalProjects.isEmpty()) {
myShortcutsManager.scheduleRunConfigurationKeymapUpdate(systemManager.getSystemId());
}
}
// init task activation info
myTaskActivator.init();
}
}
示例14: getOrRegisterAction
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public static ExternalSystemAction getOrRegisterAction(Project project, String group, TaskData taskData) {
ExternalSystemTaskAction action = new ExternalSystemTaskAction(project, group, taskData);
ActionManager manager = ActionManager.getInstance();
AnAction anAction = manager.getAction(action.getId());
if (anAction instanceof ExternalSystemTaskAction && action.equals(anAction)) {
return (ExternalSystemAction)anAction;
}
manager.unregisterAction(action.getId());
manager.registerAction(action.getId(), action);
return action;
}
示例15: clearActions
import com.intellij.openapi.externalSystem.model.task.TaskData; //导入依赖的package包/类
public static void clearActions(Project project, Collection<DataNode<TaskData>> taskData) {
ActionManager actionManager = ActionManager.getInstance();
if (actionManager != null) {
for (DataNode<TaskData> each : taskData) {
for (String eachAction : actionManager.getActionIds(getActionPrefix(project, each.getData().getLinkedExternalProjectPath()))) {
AnAction action = actionManager.getAction(eachAction);
if (!(action instanceof ExternalSystemRunConfigurationAction)) {
actionManager.unregisterAction(eachAction);
}
}
}
}
}