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


Java DataNode类代码示例

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


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

示例1: collectComponentsToScan

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@Override
protected Components collectComponentsToScan(@Nullable DataNode<ProjectData> externalProject) {
    Components components = ComponentsFactory.create();
    // This set is used to make sure the artifacts added are unique
    Set<String> added = Sets.newHashSet();
    for (MavenProject mavenProject : MavenProjectsManager.getInstance(project).getProjects()) {
        for (MavenArtifactNode mavenArtifactNode : mavenProject.getDependencyTree()) {
            if (added.add(mavenArtifactNode.getArtifact().getDisplayStringForLibraryName())) {
                addArtifact(components, mavenArtifactNode.getArtifact());
                for (MavenArtifactNode artifactNode : mavenArtifactNode.getDependencies()) {
                    addArtifact(components, artifactNode.getArtifact());
                }
            }
        }
    }
    return components;
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:18,代码来源:MavenScanManager.java

示例2: refreshDependencies

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@Override
protected void refreshDependencies(ExternalProjectRefreshCallback cbk, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    if (libraryDependencies != null) {
        // Change the dependencies only if there are new dependencies
        this.libraryDependencies = libraryDependencies;
        cbk.onSuccess(null);
        return;
    }
    if (this.libraryDependencies != null) {
        cbk.onSuccess(null);
        return;
    }
    ExternalSystemProcessingManager processingManager = ServiceManager.getService(ExternalSystemProcessingManager.class);
    if (processingManager != null && processingManager.findTask(ExternalSystemTaskType.RESOLVE_PROJECT, GradleConstants.SYSTEM_ID, getProjectBasePath(project)) != null) {
        // Another scan in progress
        return;
    }
    ExternalSystemUtil.refreshProject(project, GradleConstants.SYSTEM_ID, getProjectBasePath(project), cbk, false, ProgressExecutionMode.IN_BACKGROUND_ASYNC);
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:20,代码来源:GradleScanManager.java

示例3: populateDependenciesTree

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
private void populateDependenciesTree(ScanTreeNode scanTreeNode, DataNode<? extends AbstractDependencyData> dataNode) {
    String componentId = dataNode.getData().getExternalName();

    int colonCount = StringUtils.countMatches(componentId, ":");
    if (colonCount == 3) {
        // <Group ID>:<Artifact ID>:<Classifier>:<Version>. The classifier should be ignored.
        int secondColonIdx = componentId.indexOf(":", componentId.indexOf(":") + 1);
        int thirdColonIdx = componentId.indexOf(":", secondColonIdx + 1);
        componentId = componentId.substring(0, secondColonIdx) + componentId.substring(thirdColonIdx);
        colonCount--;
    }
    if (colonCount != 2) {
        if (StringUtils.isNotBlank(componentId)) {
            logger.warn("Bad component ID structure. Should be <GroupID>:<ArtifactID>:<Version>, got '" + componentId + "'");
        }
        return;
    }

    ComponentDetailImpl scanComponent = new ComponentDetailImpl(componentId, getArtifactChecksum(dataNode));
    ScanTreeNode treeNode = new ScanTreeNode(scanComponent);
    for (DataNode child : dataNode.getChildren()) {
        populateDependenciesTree(treeNode, child);
    }
    scanTreeNode.add(treeNode);
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:26,代码来源:GradleScanManager.java

示例4: scanAndUpdate

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
/**
 * Scan and update dependency components.
 */
private void scanAndUpdate(boolean quickScan, ProgressIndicator indicator, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    // Don't scan if Xray is not configured
    if (!GlobalSettings.getInstance().isCredentialsSet()) {
        Utils.notify(logger, "JFrog Xray scan failed", "Xray server is not configured.", NotificationType.ERROR);
        return;
    }
    // Prevent multiple simultaneous scans
    if (!scanInProgress.compareAndSet(false, true)) {
        if (!quickScan) {
            Utils.notify(logger, "JFrog Xray", "Scan already in progress.", NotificationType.INFORMATION);
        }
        return;
    }
    try {
        // Refresh dependencies -> Collect -> Scan and store to cache -> Update view
        refreshDependencies(getRefreshDependenciesCbk(quickScan, indicator), libraryDependencies);
    } finally {
        scanInProgress.set(false);
    }
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:24,代码来源:ScanManager.java

示例5: asyncScanAndUpdateResults

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
/**
 * Launch async dependency scan.
 */
public void asyncScanAndUpdateResults(boolean quickScan, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
    Task.Backgroundable scanAndUpdateTask = new Task.Backgroundable(project, "Xray: Scanning for Vulnerabilities...") {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            scanAndUpdate(quickScan, indicator, libraryDependencies);
            indicator.finishNonCancelableSection();
        }
    };
    // The progress manager is only good for foreground threads.
    if (SwingUtilities.isEventDispatchThread()) {
        ProgressManager.getInstance().run(scanAndUpdateTask);
    } else {
        // Run the scan task when the thread is in the foreground.
        SwingUtilities.invokeLater(() -> ProgressManager.getInstance().run(scanAndUpdateTask));
    }
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:20,代码来源:ScanManager.java

示例6: importData

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
/**
 * This function is called after change in the build.gradle file or refresh gradle dependencies call.
 * @param toImport the project dependencies
 * @param projectData the project data
 * @param project the current project
 * @param modelsProvider contains the project modules
 */
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
    if (projectData == null || !projectData.getOwner().equals(GradleConstants.SYSTEM_ID)) {
        return;
    }

    ScanManager scanManager = ScanManagerFactory.getScanManager(project);
    if (scanManager == null) {
        ScanManagerFactory scanManagerFactory = ServiceManager.getService(project, ScanManagerFactory.class);
        scanManagerFactory.initScanManager(project);
        scanManager = ScanManagerFactory.getScanManager(project);
        if (scanManager == null) {
            return;
        }
        MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
        messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
    }
    if (GlobalSettings.getInstance().isCredentialsSet()) {
        scanManager.asyncScanAndUpdateResults(true, toImport);
    }
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:32,代码来源:XrayDependencyDataService.java

示例7: createNodes

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@Override
@NotNull
public List<ExternalSystemNode<?>> createNodes(final ExternalProjectsView externalProjectsView,
                                               final MultiMap<Key<?>, DataNode<?>> dataNodes) {
  final List<ExternalSystemNode<?>> result = new SmartList<ExternalSystemNode<?>>();

  addModuleNodes(externalProjectsView, dataNodes, result);
  // add tasks
  TasksNode tasksNode = new TasksNode(externalProjectsView, dataNodes.get(ProjectKeys.TASK));
  if(externalProjectsView.useTasksNode()) {
    result.add(tasksNode);
  } else {
    ContainerUtil.addAll(result, tasksNode.getChildren());
  }

  addDependenciesNode(externalProjectsView, dataNodes, result);

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

示例8: 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

示例9: importData

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleDependencyData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
  MultiMap<DataNode<ModuleData>, DataNode<ModuleDependencyData>> byModule = ExternalSystemApiUtil.groupBy(toImport, MODULE);
  for (Map.Entry<DataNode<ModuleData>, Collection<DataNode<ModuleDependencyData>>> entry : byModule.entrySet()) {
    Module ideModule = modelsProvider.findIdeModule(entry.getKey().getData());
    if (ideModule == null) {
      LOG.warn(String.format(
        "Can't import module dependencies %s. Reason: target module (%s) is not found at the ide and can't be imported",
        entry.getValue(), entry.getKey()
      ));
      continue;
    }
    importData(entry.getValue(), ideModule, modelsProvider);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ModuleDependencyDataService.java

示例10: updateExternalProjectData

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

示例11: isCacheMissingModels

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@VisibleForTesting
static boolean isCacheMissingModels(@NotNull DataNode<ProjectData> cache, @NotNull Project project) {
  Collection<DataNode<ModuleData>> moduleDataNodes = findAll(cache, MODULE);
  if (!moduleDataNodes.isEmpty()) {
    Map<String, DataNode<ModuleData>> moduleDataNodesByName = indexByModuleName(moduleDataNodes);

    ModuleManager moduleManager = ModuleManager.getInstance(project);
    for (Module module : moduleManager.getModules()) {
      DataNode<ModuleData> moduleDataNode = moduleDataNodesByName.get(module.getName());
      if (moduleDataNode == null) {
        // When a Gradle facet is present, there should be a cache node for the module.
        AndroidGradleFacet gradleFacet = AndroidGradleFacet.getInstance(module);
        if (gradleFacet != null) {
          return true;
        }
      }
      else if (isCacheMissingModels(moduleDataNode, module)) {
        return true;
      }
    }
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GradleProjectImporter.java

示例12: importData

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
@Override
public void importData(@NotNull Collection<DataNode<ModuleData>> toImport,
                       @Nullable ProjectData projectData,
                       @NotNull Project project,
                       @NotNull IdeModifiableModelsProvider modelsProvider) {
  if (toImport.isEmpty()) {
    return;
  }

  final Collection<DataNode<ModuleData>> toCreate = filterExistingModules(toImport, modelsProvider);
  if (!toCreate.isEmpty()) {
    createModules(toCreate, modelsProvider);
  }
  for (DataNode<ModuleData> node : toImport) {
    Module module = modelsProvider.findIdeModule(node.getData());
    if (module != null) {
      syncPaths(module, modelsProvider, node.getData());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleDataService.java

示例13: 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

示例14: setModuleOptions

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
private static void setModuleOptions(Module module, DataNode<ModuleData> moduleDataNode) {
  ModuleData moduleData = moduleDataNode.getData();
  module.putUserData(MODULE_DATA_KEY, moduleData);

  module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
  module.setOption(ExternalSystemConstants.LINKED_PROJECT_ID_KEY, moduleData.getId());
  module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
  ProjectData projectData = moduleDataNode.getData(ProjectKeys.PROJECT);
  module.setOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY, projectData != null ? projectData.getLinkedExternalProjectPath() : "");

  if (moduleData.getGroup() != null) {
    module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY, moduleData.getGroup());
  }
  if (moduleData.getVersion() != null) {
    module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY, moduleData.getVersion());
  }

  // clear maven option
  module.clearOption("org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleDataService.java

示例15: testPopulateModuleContentRootsWithJavaProject

import com.intellij.openapi.externalSystem.model.DataNode; //导入依赖的package包/类
public void testPopulateModuleContentRootsWithJavaProject() {
  ProjectData project = myProjectResolver.createProject();
  DataNode<ProjectData> projectNode = new DataNode<ProjectData>(ProjectKeys.PROJECT, project, null);
  ModuleData module = myProjectResolver.createModule(myUtilModule, project);
  DataNode<ModuleData> moduleDataNode = projectNode.createChild(ProjectKeys.MODULE, module);

  myProjectResolver.populateModuleContentRoots(myUtilModule, moduleDataNode);

  // Verify module does not have IdeaAndroidProject.
  Collection<DataNode<IdeaAndroidProject>> androidProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_ANDROID_PROJECT);
  assertEquals(0, androidProjects.size());

  // Verify module has IdeaGradleProject.
  Collection<DataNode<IdeaGradleProject>> gradleProjects =
    ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_GRADLE_PROJECT);
  assertEquals(1, gradleProjects.size());
  DataNode<IdeaGradleProject> gradleProjectNode = ContainerUtil.getFirstItem(gradleProjects);
  assertNotNull(gradleProjectNode);
  assertEquals(myUtilModule.getGradleProject().getPath(), gradleProjectNode.getData().getGradlePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidGradleProjectResolverIdeaTest.java


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