private void addPossibleConflict(ModelChange a, ModelChange b) { if (a.isNonConflicting() || b.isNonConflicting()) { addSymmetric(a, b); } else { addConflict(a, b); } }
private void addAffectedRoot(@NotNull ModelChange change) { if (change.getRootId() != null) { ListSequence.fromList(myAffectedRoots) .addElement( new SNodePointer( change.getChangeSet().getNewModel().getReference(), change.getRootId())); } }
@Nullable private static SNodeId getNodeIdForChange(@NotNull ModelChange change) { if (change instanceof NodeChange) { return ((NodeChange) change).getAffectedNodeId(); } else if (change instanceof AddRootChange || change instanceof DeleteRootChange) { return change.getRootId(); } else if (change instanceof NodeGroupChange) { return ((NodeGroupChange) change).getParentNodeId(); } return null; }
@Override protected void updateRootCustomPresentation(@NotNull DiffModelTree.RootTreeNode rootTreeNode) { ChangeType compositeChangeType = ChangeType.CHANGE; if (rootTreeNode.getRootId() != null) { ModelChange firstChange = Sequence.fromIterable(myChangeSet.getChangesForRoot(rootTreeNode.getRootId())).first(); if (firstChange instanceof AddRootChange || firstChange instanceof DeleteRootChange) { compositeChangeType = firstChange.getType(); } else if (firstChange == null) { compositeChangeType = null; } } else { if (myMetadataChangeSet == null || ListSequence.fromList(myMetadataChangeSet.getModelChanges()).isEmpty()) { compositeChangeType = null; } } rootTreeNode.setColor( (compositeChangeType == null ? null : ChangeColors.getForTree(compositeChangeType))); }
private void updateCacheForChange(@NotNull ModelChange change) { SNodeId id = getNodeIdForChange(change); if (id != null) { myNodesToChanges.put(id, change); } else { SetSequence.fromSet(myMetadataChanges).addElement((MetadataChange) change); } if (change instanceof AddRootChange) { MapSequence.fromMap(myAddedNodesToChanges).put(change.getRootId(), change); } else if (change instanceof NodeGroupChange) { for (SNodeId i : Sequence.fromIterable( getNodeIdsForNodeGroupChange( (NodeGroupChange) change, myLastParentAndNewChildrenIds))) { MapSequence.fromMap(myAddedNodesToChanges).put(i, change); } } }
@NotNull private TreeMessage getMessage( @NotNull ModelChange modelChange, @NotNull EditableSModel modelDescriptor) { switch (modelChange.getType()) { case ADD: if (modelChange instanceof AddRootChange) { Project project = myRegistry.getProject(); FileStatus modelStatus = getModelFileStatus(modelDescriptor, project); if (BaseVersionUtil.isAddedFileStatus(modelStatus)) { return getMessage(modelStatus); } else if (ConflictsUtil.isModelOrModuleConflicting(modelDescriptor, project)) { return getMessage(FileStatus.MERGED_WITH_CONFLICTS); } } return getMessage(FileStatus.ADDED); case CHANGE: return getMessage(FileStatus.MODIFIED); default: assert false; return getMessage(FileStatus.MERGED_WITH_CONFLICTS); } }
private static void addChangeLink( Map<ModelChange, List<ModelChange>> map, ModelChange a, ModelChange b) { assert a.getChangeSet() != b.getChangeSet(); addOneWayChangeLink(map, a, b); addOneWayChangeLink(map, b, a); }