X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2FModificationAdapter.java;fp=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2FModificationAdapter.java;h=7ba43dcdd0deed683d4e886b8e81b0641410e300;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java new file mode 100644 index 000000000..7ba43dcdd --- /dev/null +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/ModificationAdapter.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.synchronization; + +import org.simantics.db.WriteGraph; + +/** + * @author Tuukka Lehtonen + */ +public class ModificationAdapter implements IModification { + + public static final Double HIGH_PRIORITY = 1d; + + public static final Double REMOVE_EDGE_PRIORITY = 2d; + public static final Double REMOVE_BRANCH_PRIORITY = 3d; + public static final Double REMOVE_CONNECTION_PRIORITY = 4d; + public static final Double REMOVE_NODE_PRIORITY = 5d; + + public static final Double ADD_NODE_PRIORITY = 6d; + public static final Double ADD_CONNECTION_PRIORITY = 7d; + public static final Double ADD_BRANCH_PRIORITY = 8d; + public static final Double ADD_EDGE_PRIORITY = 9d; + public static final Double SET_CONNECTION_TYPE_PRIORITY = 9.5d; + + public static final Double LOW_PRIORITY = 10d; + + final Double priority; + + Throwable exception; + boolean complete = false; + protected ModificationAdapter(Double priority) { + assert priority != null; + this.priority = priority; + } + @Override + public boolean isComplete() { + return complete; + } + @Override + public void markComplete() { + this.complete = true; + } + @Override + public void perform(WriteGraph g) throws Exception { + } + @Override + public void completed() { + } + @Override + public Throwable getException() { + return exception; + } + @Override + public void setException(Throwable t) { + this.exception = t; + } + //@Override + //public String toString() { + // return getClass().getSimpleName(); + //} + @Override + public Double getPriority() { + return priority; + } + @Override + public int compareTo(IModification arg0) { + return priority.compareTo(arg0.getPriority()); + } + @Override + public String toString() { + return getClass().getSimpleName() + "$" + System.identityHashCode(this); + } +} \ No newline at end of file