X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Fdiagram%2Fhandler%2FTransactionContext.java;h=187fe4a9bca9bda82dae4494a38bee062d578ae4;hb=48135dcd03588783f9c1b688aaa53cdaacba6ef2;hp=d56273f4acdf702364e335d460fe5d1144ab0ddd;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/TransactionContext.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/TransactionContext.java index d56273f4a..187fe4a9b 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/TransactionContext.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/TransactionContext.java @@ -1,89 +1,89 @@ -/******************************************************************************* - * 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 added, removed; -// public Map modifications; -// } - -} +/******************************************************************************* + * 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 added, removed; +// public Map modifications; +// } + +}