Java Code Examples for com.intellij.openapi.externalSystem.model.DataNode#getChildren()

The following examples show how to use com.intellij.openapi.externalSystem.model.DataNode#getChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectDataManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private <T> void ensureTheDataIsReadyToUse(@Nonnull Collection<DataNode<T>> nodes) {
  Map<Key<?>, List<ProjectDataService<?, ?>>> servicesByKey = myServices.getValue();
  Stack<DataNode<T>> toProcess = ContainerUtil.newStack(nodes);
  while (!toProcess.isEmpty()) {
    DataNode<T> node = toProcess.pop();
    List<ProjectDataService<?, ?>> services = servicesByKey.get(node.getKey());
    if (services != null) {
      for (ProjectDataService<?, ?> service : services) {
        node.prepareData(service.getClass().getClassLoader());
      }
    }

    for (DataNode<?> dataNode : node.getChildren()) {
      toProcess.push((DataNode<T>)dataNode);
    }
  }
}
 
Example 2
Source File: GradleMonitor.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
private boolean hasFormatPlugin(DataNode<?> node) {
	if (node == null) {
		return false;
	}
	Object data = node.getData();
	if (data instanceof TaskData && isFormatPlugin((TaskData) data)) {
		return true;
	}
	for (DataNode<?> child : node.getChildren()) {
		if (hasFormatPlugin(child)) {
			return true;
		}
	}
	return false;
}
 
Example 3
Source File: ExternalSystemApiUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Nonnull
public static <T> Collection<DataNode<T>> getChildren(@Nonnull DataNode<?> node, @Nonnull Key<T> key) {
  Collection<DataNode<T>> result = null;
  for (DataNode<?> child : node.getChildren()) {
    if (!key.equals(child.getKey())) {
      continue;
    }
    if (result == null) {
      result = ContainerUtilRt.newArrayList();
    }
    result.add((DataNode<T>)child);
  }
  return result == null ? Collections.<DataNode<T>>emptyList() : result;
}
 
Example 4
Source File: ExternalSystemApiUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@javax.annotation.Nullable
public static <T> DataNode<T> find(@Nonnull DataNode<?> node, @Nonnull Key<T> key) {
  for (DataNode<?> child : node.getChildren()) {
    if (key.equals(child.getKey())) {
      return (DataNode<T>)child;
    }
  }
  return null;
}
 
Example 5
Source File: ExternalSystemApiUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@javax.annotation.Nullable
public static <T> DataNode<T> find(@Nonnull DataNode<?> node, @Nonnull Key<T> key, BooleanFunction<DataNode<T>> predicate) {
  for (DataNode<?> child : node.getChildren()) {
    if (key.equals(child.getKey()) && predicate.fun((DataNode<T>)child)) {
      return (DataNode<T>)child;
    }
  }
  return null;
}
 
Example 6
Source File: ExternalSystemApiUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Nonnull
public static <T> Collection<DataNode<T>> findAll(@Nonnull DataNode<?> parent, @Nonnull Key<T> key) {
  Collection<DataNode<T>> result = null;
  for (DataNode<?> child : parent.getChildren()) {
    if (!key.equals(child.getKey())) {
      continue;
    }
    if (result == null) {
      result = ContainerUtilRt.newArrayList();
    }
    result.add((DataNode<T>)child);
  }
  return result == null ? Collections.<DataNode<T>>emptyList() : result;
}