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


Java DataNode.getData方法代码示例

本文整理汇总了Java中com.intellij.openapi.externalSystem.model.DataNode.getData方法的典型用法代码示例。如果您正苦于以下问题:Java DataNode.getData方法的具体用法?Java DataNode.getData怎么用?Java DataNode.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.externalSystem.model.DataNode的用法示例。


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

示例1: addModuleNodes

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
private static void addModuleNodes(@NotNull ExternalProjectsView externalProjectsView,
                                   @NotNull MultiMap<Key<?>, DataNode<?>> dataNodes,
                                   @NotNull List<ExternalSystemNode<?>> result) {
  final Collection<DataNode<?>> moduleDataNodes = dataNodes.get(ProjectKeys.MODULE);
  if (!moduleDataNodes.isEmpty()) {
    final AbstractExternalSystemSettings systemSettings =
      ExternalSystemApiUtil.getSettings(externalProjectsView.getProject(), externalProjectsView.getSystemId());

    for (DataNode<?> dataNode : moduleDataNodes) {
      final ModuleData data = (ModuleData)dataNode.getData();

      final ExternalProjectSettings projectSettings = systemSettings.getLinkedProjectSettings(data.getLinkedExternalProjectPath());
      final boolean isRoot =
        projectSettings != null && data.getLinkedExternalProjectPath().equals(projectSettings.getExternalProjectPath());
      //noinspection unchecked
      final ModuleNode moduleNode = new ModuleNode(externalProjectsView, (DataNode<ModuleData>)dataNode, isRoot);
      result.add(moduleNode);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemViewDefaultContributor.java

示例2: filterExistingModules

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static Collection<DataNode<ModuleData>> filterExistingModules(@NotNull Collection<DataNode<ModuleData>> modules,
                                                                      @NotNull IdeModifiableModelsProvider modelsProvider)
{
  Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
  for (DataNode<ModuleData> node : modules) {
    ModuleData moduleData = node.getData();
    Module module = modelsProvider.findIdeModule(moduleData);
    if (module == null) {
      result.add(node);
    }
    else {
      setModuleOptions(module, node);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleDataService.java

示例3: mixNames

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
/**
 * Tries to ensure that given libraries have distinct names, i.e. traverses all of them and tries to generate
 * unique name for those with equal names.
 * 
 * @param libraries  libraries to process
 */
@SuppressWarnings("MethodMayBeStatic")
public void mixNames(@NotNull Collection<DataNode<LibraryData>> libraries) {
  if (libraries.isEmpty()) {
    return;
  }
  Map<String, Wrapped> names = ContainerUtilRt.newHashMap();
  List<Wrapped> data = ContainerUtilRt.newArrayList();
  for (DataNode<LibraryData> library : libraries) {
    Wrapped wrapped = new Wrapped(library.getData());
    data.add(wrapped);
  }
  boolean mixed = false;
  while (!mixed) {
    mixed = doMixNames(data, names);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GradleLibraryNamesMixer.java

示例4: createActions

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的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);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalSystemKeymapExtension.java

示例5: containsSourceFile

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
/**
 * Checks in the Android and Java models to see if the module contains the given file.
 * @param moduleNode represents the module that is not included yet in the IDE.
 * @param file the given file.
 * @param selected indicates whether the module is included in the project.
 * @return the result of the search, or {@code null} if this module does not contain the given file.
 */
@Nullable
private static ModuleSearchResult containsSourceFile(@NotNull DataNode<ModuleData> moduleNode, @NotNull File file, boolean selected) {
  DataNode<IdeaAndroidProject> androidProjectNode = find(moduleNode, IDE_ANDROID_PROJECT);
  if (androidProjectNode != null) {
    IdeaAndroidProject androidProject = androidProjectNode.getData();
    SourceFileContainerInfo result = androidProject.containsSourceFile(file);
    if (result != null) {
      return new ModuleSearchResult(moduleNode, result, selected);
    }
  }

  DataNode<IdeaJavaProject> javaProjectNode = find(moduleNode, IDE_JAVA_PROJECT);
  if (javaProjectNode != null) {
    IdeaJavaProject javaProject = javaProjectNode.getData();
    if (javaProject.containsSourceFile(file)) {
      return new ModuleSearchResult(moduleNode, null, selected);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ProjectSubset.java

示例6: getVariants

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GradleArgumentsCompletionProvider.java

示例7: applyExtraSettings

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@Override
protected void applyExtraSettings(@NotNull WizardContext context) {
  DataNode<ProjectData> node = getExternalProjectNode();
  if (node == null) {
    return;
  }

  DataNode<JavaProjectData> javaProjectNode = ExternalSystemApiUtil.find(node, JavaProjectData.KEY);
  if (javaProjectNode != null) {
    JavaProjectData data = javaProjectNode.getData();
    context.setCompilerOutputDirectory(data.getCompileOutputPath());
    JavaSdkVersion version = data.getJdkVersion();
    Sdk jdk = findJdk(version);
    if (jdk != null) {
      context.setProjectJdk(jdk);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GradleProjectImportBuilder.java

示例8: ModuleNode

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
public ModuleNode(ExternalProjectsView externalProjectsView,
                  DataNode<ModuleData> dataNode,
                  boolean isRoot) {
  super(externalProjectsView, null, dataNode);
  myIsRoot = isRoot;
  myData = dataNode.getData();
  myRunConfigurationsNode = new RunConfigurationsNode(externalProjectsView, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ModuleNode.java

示例9: TasksNode

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TasksNode.java

示例10: TaskNode

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TaskNode.java

示例11: computeOrphanData

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
@Override
public Computable<Collection<I>> computeOrphanData(@NotNull final Collection<DataNode<E>> toImport,
                                                   @NotNull final ProjectData projectData,
                                                   @NotNull final Project project,
                                                   @NotNull final IdeModifiableModelsProvider modelsProvider) {
  return new Computable<Collection<I>>() {
    @Override
    public Collection<I> compute() {
      MultiMap<String /*module name*/, String /*dep name*/> byModuleName = MultiMap.create();
      for (DataNode<E> node : toImport) {
        final AbstractDependencyData data = node.getData();
        byModuleName.putValue(data.getOwnerModule().getInternalName(), data.getInternalName());
      }

      List<I> orphanEntries = ContainerUtil.newSmartList();
      for (Module module : modelsProvider.getModules(projectData)) {
        for (OrderEntry entry : modelsProvider.getOrderEntries(module)) {
          //noinspection unchecked
          if (getOrderEntryType().isInstance(entry) &&
              !byModuleName.get(entry.getOwnerModule().getName()).contains(getOrderEntryName((I)entry))) {
            //noinspection unchecked
            orphanEntries.add((I)entry);
          }
        }
      }

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

示例12: buildDependency

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static ModuleDependencyData buildDependency(@NotNull DataNode<ModuleData> ownerModule,
                                                    @NotNull IdeaModuleDependency dependency,
                                                    @NotNull DataNode<ProjectData> ideProject)
  throws IllegalStateException {
  IdeaModule module = dependency.getDependencyModule();
  if (module == null) {
    throw new IllegalStateException(
      String.format("Can't parse gradle module dependency '%s'. Reason: referenced module is null", dependency)
    );
  }

  String moduleName = module.getName();
  if (moduleName == null) {
    throw new IllegalStateException(String.format(
      "Can't parse gradle module dependency '%s'. Reason: referenced module name is undefined (module: '%s') ", dependency, module
    ));
  }

  Set<String> registeredModuleNames = ContainerUtilRt.newHashSet();
  Collection<DataNode<ModuleData>> modulesDataNode = ExternalSystemApiUtil.getChildren(ideProject, ProjectKeys.MODULE);
  for (DataNode<ModuleData> moduleDataNode : modulesDataNode) {
    String name = moduleDataNode.getData().getExternalName();
    registeredModuleNames.add(name);
    if (name.equals(moduleName)) {
      return new ModuleDependencyData(ownerModule.getData(), moduleDataNode.getData());
    }
  }
  throw new IllegalStateException(String.format(
    "Can't parse gradle module dependency '%s'. Reason: no module with such name (%s) is found. Registered modules: %s",
    dependency, moduleName, registeredModuleNames
  ));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:BaseGradleProjectResolverExtension.java

示例13: getModuleIcon

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static Icon getModuleIcon(@NotNull DataNode<ModuleData> module) {
  Collection<DataNode<IdeaAndroidProject>> children = getChildren(module, IDE_ANDROID_PROJECT);
  if (!children.isEmpty()) {
    DataNode<IdeaAndroidProject> child = getFirstItem(children);
    if (child != null) {
      IdeaAndroidProject androidProject = child.getData();
      return androidProject.getDelegate().isLibrary() ? LibraryModule : AppModule;
    }
  }
  return PpJdk;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ModulesToImportDialog.java

示例14: indexByModuleName

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static Map<String, DataNode<ModuleData>> indexByModuleName(@NotNull Collection<DataNode<ModuleData>> moduleDataNodes) {
  Map<String, DataNode<ModuleData>> mapping = Maps.newHashMap();
  for (DataNode<ModuleData> moduleDataNode : moduleDataNodes) {
    ModuleData data = moduleDataNode.getData();
    mapping.put(data.getExternalName(), moduleDataNode);
  }
  return mapping;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GradleProjectImporter.java

示例15: indexByModuleName

import com.intellij.openapi.externalSystem.model.DataNode; //导入方法依赖的package包/类
@NotNull
private static Map<String, IdeaJavaProject> indexByModuleName(@NotNull Collection<DataNode<IdeaJavaProject>> dataNodes) {
  Map<String, IdeaJavaProject> javaProjectsByModuleName = Maps.newHashMap();
  for (DataNode<IdeaJavaProject> d : dataNodes) {
    IdeaJavaProject javaProject = d.getData();
    javaProjectsByModuleName.put(javaProject.getModuleName(), javaProject);
  }
  return javaProjectsByModuleName;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaProjectDataService.java


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