X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Ftypicals%2Frules%2FTransformRule.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Ftypicals%2Frules%2FTransformRule.java;h=96a4cae0df2a020423dd3b04d34c05b299835258;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=36c9316e202c7d80eeddab8cf98c4f73e1480a73;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/TransformRule.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/TransformRule.java index 36c9316e2..96a4cae0d 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/TransformRule.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/TransformRule.java @@ -1,46 +1,46 @@ -/******************************************************************************* - * Copyright (c) 2012 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.modeling.typicals.rules; - -import java.awt.geom.AffineTransform; - -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; -import org.simantics.modeling.typicals.ITypicalSynchronizationRule; -import org.simantics.modeling.typicals.TypicalInfo; - -/** - * @author Tuukka Lehtonen - */ -public enum TransformRule implements ITypicalSynchronizationRule { - - INSTANCE; - - public static TransformRule getInstance() { - return INSTANCE; - } - - @Override - public boolean synchronize(WriteGraph graph, Resource template, Resource instance, TypicalInfo info) throws DatabaseException { - AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, template); - AffineTransform copyAt = DiagramGraphUtil.getAffineTransform(graph, instance); - if (!at.equals(copyAt)) { - info.messageLog.add("\t\t\ttransform"); - DiagramGraphUtil.setTransform(graph, instance, at); - return true; - } - return false; - } - -} +/******************************************************************************* + * Copyright (c) 2012 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.modeling.typicals.rules; + +import java.awt.geom.AffineTransform; + +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; +import org.simantics.modeling.typicals.ITypicalSynchronizationRule; +import org.simantics.modeling.typicals.TypicalInfo; + +/** + * @author Tuukka Lehtonen + */ +public enum TransformRule implements ITypicalSynchronizationRule { + + INSTANCE; + + public static TransformRule getInstance() { + return INSTANCE; + } + + @Override + public boolean synchronize(WriteGraph graph, Resource template, Resource instance, TypicalInfo info) throws DatabaseException { + AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, template); + AffineTransform copyAt = DiagramGraphUtil.getAffineTransform(graph, instance); + if (!at.equals(copyAt)) { + info.messageLog.add("\t\t\ttransform"); + DiagramGraphUtil.setTransform(graph, instance, at); + return true; + } + return false; + } + +}