X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FParentImpl.java;h=eb12f1c2010d393edfdd422b29627799a9bfbe7d;hb=refs%2Fchanges%2F38%2F238%2F2;hp=8400434e2b1e12a7b6b31f83a050017e3059d1df;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ParentImpl.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ParentImpl.java index 8400434e2..eb12f1c20 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ParentImpl.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ParentImpl.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * 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.element.handler.impl; - -import org.simantics.g2d.element.ElementHints; -import org.simantics.g2d.element.IElement; -import org.simantics.g2d.element.handler.Parent; - -/** - * The most simple implementation of the {@link Parent} handler. - * - * @author Tuukka Lehtonen - */ -public class ParentImpl implements Parent { - - public static final ParentImpl INSTANCE = new ParentImpl(); - - private static final long serialVersionUID = 1L; - - private ParentImpl() {} - - /* (non-Javadoc) - * @see org.simantics.g2d.element.handler.Parent#getParent(org.simantics.g2d.element.IElement) - */ - @Override - public IElement getParent(IElement element) { - IElement e = element.getHint(ElementHints.KEY_PARENT_ELEMENT); - return e; - -// if (e == null) -// return null; -// -// Object obj = e.getHint(ElementHints.KEY_OBJECT); -// if (obj == null) -// return e; -// -// IDiagram diagram = ElementUtils.peekDiagram(element); -// DataElementMap dem = diagram.getDiagramClass().getAtMostOneItemOfClass(DataElementMap.class); -// if (dem == null) -// return e; -// -// IElement mapped = dem.getElement(diagram, obj); -// return mapped != null ? mapped : e; - } - -} +/******************************************************************************* + * 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.element.handler.impl; + +import org.simantics.g2d.element.ElementHints; +import org.simantics.g2d.element.IElement; +import org.simantics.g2d.element.handler.Parent; + +/** + * The most simple implementation of the {@link Parent} handler. + * + * @author Tuukka Lehtonen + */ +public class ParentImpl implements Parent { + + public static final ParentImpl INSTANCE = new ParentImpl(); + + private static final long serialVersionUID = 1L; + + private ParentImpl() {} + + /* (non-Javadoc) + * @see org.simantics.g2d.element.handler.Parent#getParent(org.simantics.g2d.element.IElement) + */ + @Override + public IElement getParent(IElement element) { + IElement e = element.getHint(ElementHints.KEY_PARENT_ELEMENT); + return e; + +// if (e == null) +// return null; +// +// Object obj = e.getHint(ElementHints.KEY_OBJECT); +// if (obj == null) +// return e; +// +// IDiagram diagram = ElementUtils.peekDiagram(element); +// DataElementMap dem = diagram.getDiagramClass().getAtMostOneItemOfClass(DataElementMap.class); +// if (dem == null) +// return e; +// +// IElement mapped = dem.getElement(diagram, obj); +// return mapped != null ? mapped : e; + } + +}