X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fsynchronization%2Fgraph%2FTextSynchronizer.java;h=950eee80bacde0a6bba9fe9ac29691b3eede970e;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=662e15a1cb0aa4ec5264620717df4ea817dbcb54;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/TextSynchronizer.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/TextSynchronizer.java index 662e15a1c..950eee80b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/TextSynchronizer.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/synchronization/graph/TextSynchronizer.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * 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.graph; - -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.diagram.synchronization.IModificationQueue; -import org.simantics.diagram.synchronization.ISynchronizationContext; -import org.simantics.g2d.element.ElementHints; -import org.simantics.utils.datastructures.hints.IHintContext.Key; -import org.simantics.utils.datastructures.hints.IHintObservable; - -/** - * @author Marko Luukkainen - */ -public class TextSynchronizer extends ResourceSynchronizer { - - public static final TextSynchronizer INSTANCE = new TextSynchronizer(); - - private static final Key[] SYNCHRONIZED_HINTS = { - ElementHints.KEY_TEXT - }; - - @Override - public Key[] getSynchronizedHints() { - return SYNCHRONIZED_HINTS; - } - - @Override - public boolean hintChanged(ISynchronizationContext context, IModificationQueue queue, Resource object, IHintObservable sender, Key key, Object oldValue, Object newValue) { - if (ElementHints.KEY_TEXT.equals(key)) { - BasicResources br = context.get(GraphSynchronizationHints.BASIC_RESOURCES); - return queue.offer(new PropertyModification(object, br.DIA.HasText, br.L0.String, newValue, Bindings.STRING), null); - } - return false; - } - -} +/******************************************************************************* + * 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.graph; + +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.diagram.synchronization.IModificationQueue; +import org.simantics.diagram.synchronization.ISynchronizationContext; +import org.simantics.g2d.element.ElementHints; +import org.simantics.utils.datastructures.hints.IHintContext.Key; +import org.simantics.utils.datastructures.hints.IHintObservable; + +/** + * @author Marko Luukkainen + */ +public class TextSynchronizer extends ResourceSynchronizer { + + public static final TextSynchronizer INSTANCE = new TextSynchronizer(); + + private static final Key[] SYNCHRONIZED_HINTS = { + ElementHints.KEY_TEXT + }; + + @Override + public Key[] getSynchronizedHints() { + return SYNCHRONIZED_HINTS; + } + + @Override + public boolean hintChanged(ISynchronizationContext context, IModificationQueue queue, Resource object, IHintObservable sender, Key key, Object oldValue, Object newValue) { + if (ElementHints.KEY_TEXT.equals(key)) { + BasicResources br = context.get(GraphSynchronizationHints.BASIC_RESOURCES); + return queue.offer(new PropertyModification(object, br.DIA.HasText, br.L0.String, newValue, Bindings.STRING), null); + } + return false; + } + +}