-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.diagram.handler;\r
-\r
-import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.g2d.element.ElementClass.Required;\r
-import org.simantics.g2d.element.ElementClass.Single;\r
-\r
-/**\r
- * @author Toni Kalajainen\r
- */\r
-@Single\r
-@Required\r
-public interface TransactionContext extends DiagramHandler {\r
-\r
- public static enum TransactionType {\r
- READ, WRITE\r
- }\r
-\r
- public static interface Transaction {\r
- TransactionType getType();\r
-\r
- public static class Impl implements Transaction {\r
- TransactionType type;\r
- public Impl(TransactionType type) {\r
- this.type = type;\r
- }\r
- @Override\r
- public TransactionType getType() {\r
- return type;\r
- }\r
- @Override\r
- public String toString() {\r
- return "Transaction.Impl[" + type + "]";\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * A listener for diagram transaction context events.\r
- */\r
- public static interface TransactionListener {\r
- /**\r
- * Invoked when the transaction has been started and locked properly\r
- * using\r
- * {@link TransactionContext#startTransaction(IDiagram, TransactionType)}\r
- * .\r
- * \r
- * @param d the diagram where the transaction has started\r
- * @param t the transaction handle\r
- */\r
- void transactionStarted(IDiagram d, Transaction t);\r
-\r
- /**\r
- * Invoked if a transaction is committed using\r
- * {@link TransactionContext#finishTransaction(IDiagram, Transaction)}\r
- * while transaction t still holds on to its lock, either read or write.\r
- * \r
- * @param d the diagram where the transaction took place\r
- * @param t the transaction handle\r
- */\r
- void transactionFinished(IDiagram d, Transaction t);\r
- }\r
-\r
- void addTransactionListener(IDiagram d, TransactionListener l);\r
- void removeTransactionListener(IDiagram d, TransactionListener l);\r
-\r
- Transaction startTransaction(IDiagram d, TransactionType type);\r
- void finishTransaction(IDiagram d, Transaction t);\r
-\r
-// /**\r
-// * @deprecated will be removed\r
-// */\r
-// @Deprecated\r
-// public static class ChangeSet {\r
-// public List<IElement> added, removed;\r
-// public Map<IElement, HintContext> modifications;\r
-// }\r
-\r
-}\r
+/*******************************************************************************
+ * 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.g2d.diagram.handler;
+
+import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.g2d.element.ElementClass.Required;
+import org.simantics.g2d.element.ElementClass.Single;
+
+/**
+ * @author Toni Kalajainen
+ */
+@Single
+@Required
+public interface TransactionContext extends DiagramHandler {
+
+ public static enum TransactionType {
+ READ, WRITE
+ }
+
+ public static interface Transaction {
+ TransactionType getType();
+
+ public static class Impl implements Transaction {
+ TransactionType type;
+ public Impl(TransactionType type) {
+ this.type = type;
+ }
+ @Override
+ public TransactionType getType() {
+ return type;
+ }
+ @Override
+ public String toString() {
+ return "Transaction.Impl[" + type + "]";
+ }
+ }
+ }
+
+ /**
+ * A listener for diagram transaction context events.
+ */
+ public static interface TransactionListener {
+ /**
+ * Invoked when the transaction has been started and locked properly
+ * using
+ * {@link TransactionContext#startTransaction(IDiagram, TransactionType)}
+ * .
+ *
+ * @param d the diagram where the transaction has started
+ * @param t the transaction handle
+ */
+ void transactionStarted(IDiagram d, Transaction t);
+
+ /**
+ * Invoked if a transaction is committed using
+ * {@link TransactionContext#finishTransaction(IDiagram, Transaction)}
+ * while transaction t still holds on to its lock, either read or write.
+ *
+ * @param d the diagram where the transaction took place
+ * @param t the transaction handle
+ */
+ void transactionFinished(IDiagram d, Transaction t);
+ }
+
+ void addTransactionListener(IDiagram d, TransactionListener l);
+ void removeTransactionListener(IDiagram d, TransactionListener l);
+
+ Transaction startTransaction(IDiagram d, TransactionType type);
+ void finishTransaction(IDiagram d, Transaction t);
+
+// /**
+// * @deprecated will be removed
+// */
+// @Deprecated
+// public static class ChangeSet {
+// public List<IElement> added, removed;
+// public Map<IElement, HintContext> modifications;
+// }
+
+}