summaryrefslogtreecommitdiff
path: root/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java')
-rw-r--r--platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
index 4efac184c2ee..10fc11acbf5f 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
@@ -69,6 +69,18 @@ public class DataNode<T> implements Serializable {
}
@NotNull
+ public <T> DataNode<T> createOrReplaceChild(@NotNull Key<T> key, @NotNull T data) {
+ for (Iterator<DataNode<?>> iterator = myChildren.iterator(); iterator.hasNext(); ) {
+ DataNode<?> child = iterator.next();
+ if (child.getKey().equals(key)) {
+ iterator.remove();
+ break;
+ }
+ }
+ return createChild(key, data);
+ }
+
+ @NotNull
public Key<T> getKey() {
return myKey;
}