X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fprofile%2FComponentTextStyle.java;h=29d07815fa97103d4c37653145f10374aec79292;hb=fe216008faa34a8db02d0c53fc97e71cb70f64c0;hp=315add3073e35e31720a12e7358ca55ebd2339ba;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ComponentTextStyle.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ComponentTextStyle.java index 315add307..29d07815f 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ComponentTextStyle.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ComponentTextStyle.java @@ -1,54 +1,54 @@ -/******************************************************************************* - * Copyright (c) 2011 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.profile; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.diagram.content.ConnectionUtil; -import org.simantics.diagram.flag.FlagUtil; -import org.simantics.diagram.stubs.DiagramResource; -import org.simantics.modeling.ModelingResources; - -/** - * @author Tuukka Lehtonen - */ -public abstract class ComponentTextStyle extends TextStyle { - - public ComponentTextStyle() { - super(); - } - - public ComponentTextStyle(double xOffset, double yOffset) { - super(xOffset, yOffset); - } - - @Override - protected Resource getConfigurationComponent(ReadGraph graph, Resource element) throws DatabaseException { - ModelingResources MOD = ModelingResources.getInstance(graph); - Resource component = graph.getPossibleObject(element, MOD.ElementToComponent); - if (component != null) - return component; - - DiagramResource DIA = DiagramResource.getInstance(graph); - if (graph.isInstanceOf(element, DIA.Flag) && FlagUtil.isExternal(graph, element)) { - for (Resource connector : graph.getObjects(element, DIA.Flag_ConnectionPoint)) { - Resource connection = ConnectionUtil.getConnection(graph, connector); - component = graph.getPossibleObject(connection, MOD.ElementToComponent); - if (component != null) - return component; - } - } - return null; - } - +/******************************************************************************* + * Copyright (c) 2011 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.profile; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.diagram.content.ConnectionUtil; +import org.simantics.diagram.flag.FlagUtil; +import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.modeling.ModelingResources; + +/** + * @author Tuukka Lehtonen + */ +public abstract class ComponentTextStyle extends TextStyle { + + public ComponentTextStyle() { + super(); + } + + public ComponentTextStyle(double xOffset, double yOffset) { + super(xOffset, yOffset); + } + + @Override + protected Resource getConfigurationComponent(ReadGraph graph, Resource element) throws DatabaseException { + ModelingResources MOD = ModelingResources.getInstance(graph); + Resource component = graph.getPossibleObject(element, MOD.ElementToComponent); + if (component != null) + return component; + + DiagramResource DIA = DiagramResource.getInstance(graph); + if (graph.isInstanceOf(element, DIA.Flag) && FlagUtil.isExternal(graph, element)) { + for (Resource connector : graph.getObjects(element, DIA.Flag_ConnectionPoint)) { + Resource connection = ConnectionUtil.getConnection(graph, connector); + component = graph.getPossibleObject(connection, MOD.ElementToComponent); + if (component != null) + return component; + } + } + return null; + } + } \ No newline at end of file