示例#1
0
 /** Updates the state of the property {@link #RESOLVED_COMPLETELY_PROP} */
 protected void updateResolvedCompletely() {
   boolean oldValueResolvedCompletely = resolvedCompletely;
   if (my instanceof Node) {
     // resolve the version conflict if this is a node and all tag
     // conflicts have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely();
   } else if (my instanceof Way) {
     // resolve the version conflict if this is a way, all tag
     // conflicts have been resolved, and conflicts in the node list
     // have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely()
             && nodeListMerger.getModel().isFrozen();
   } else if (my instanceof Relation) {
     // resolve the version conflict if this is a relation, all tag
     // conflicts and all conflicts in the member list
     // have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely()
             && relationMemberMerger.getModel().isFrozen();
   }
   if (this.resolvedCompletely != oldValueResolvedCompletely) {
     firePropertyChange(
         RESOLVED_COMPLETELY_PROP, oldValueResolvedCompletely, this.resolvedCompletely);
   }
 }
示例#2
0
  /** builds the UI */
  protected final void build() {
    tabbedPane = new JTabbedPane();

    propertiesMerger = new PropertiesMerger();
    propertiesMerger.setName("panel.propertiesmerger");
    propertiesMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Properties"), propertiesMerger);

    tagMerger = new TagMerger();
    tagMerger.setName("panel.tagmerger");
    tagMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Tags"), tagMerger);

    nodeListMerger = new NodeListMerger();
    nodeListMerger.setName("panel.nodelistmerger");
    nodeListMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Nodes"), nodeListMerger);

    relationMemberMerger = new RelationMemberMerger();
    relationMemberMerger.setName("panel.relationmembermerger");
    relationMemberMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Members"), relationMemberMerger);

    setLayout(new BorderLayout());
    add(tabbedPane, BorderLayout.CENTER);

    conflictResolvers.add(propertiesMerger);
    conflictResolvers.add(tagMerger);
    conflictResolvers.add(nodeListMerger);
    conflictResolvers.add(relationMemberMerger);
  }
示例#3
0
  /**
   * Builds the resolution command(s) for the resolved conflicts in this ConflictResolver
   *
   * @return the resolution command
   */
  public Command buildResolveCommand() {
    List<Command> commands = new ArrayList<>();

    if (tagMerger.getModel().getNumResolvedConflicts() > 0) {
      commands.add(tagMerger.getModel().buildResolveCommand(conflict));
    }
    commands.addAll(propertiesMerger.getModel().buildResolveCommand(conflict));
    if (my instanceof Way && nodeListMerger.getModel().isFrozen()) {
      NodeListMergeModel model = (NodeListMergeModel) nodeListMerger.getModel();
      commands.add(model.buildResolveCommand(conflict));
    } else if (my instanceof Relation && relationMemberMerger.getModel().isFrozen()) {
      RelationMemberListMergeModel model =
          (RelationMemberListMergeModel) relationMemberMerger.getModel();
      commands.add(model.buildResolveCommand((Relation) my, (Relation) their));
    }
    if (isResolvedCompletely()) {
      commands.add(new VersionConflictResolveCommand(conflict));
      commands.add(new ModifiedConflictResolveCommand(conflict));
    }
    return new SequenceCommand(tr("Conflict Resolution"), commands);
  }