]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/ParentImpl.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / impl / ParentImpl.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.element.handler.impl;
13
14 import org.simantics.g2d.element.ElementHints;
15 import org.simantics.g2d.element.IElement;
16 import org.simantics.g2d.element.handler.Parent;
17
18 /**
19  * The most simple implementation of the {@link Parent} handler.
20  * 
21  * @author Tuukka Lehtonen
22  */
23 public class ParentImpl implements Parent {
24
25     public static final ParentImpl INSTANCE = new ParentImpl();
26
27     private static final long serialVersionUID = 1L;
28
29     private ParentImpl() {}
30
31     /* (non-Javadoc)
32      * @see org.simantics.g2d.element.handler.Parent#getParent(org.simantics.g2d.element.IElement)
33      */
34     @Override
35     public IElement getParent(IElement element) {
36         IElement e = element.getHint(ElementHints.KEY_PARENT_ELEMENT);
37         return e;
38
39 //        if (e == null)
40 //            return null;
41 //
42 //        Object obj = e.getHint(ElementHints.KEY_OBJECT);
43 //        if (obj == null)
44 //            return e;
45 //
46 //        IDiagram diagram = ElementUtils.peekDiagram(element);
47 //        DataElementMap dem = diagram.getDiagramClass().getAtMostOneItemOfClass(DataElementMap.class);
48 //        if (dem == null)
49 //            return e;
50 //
51 //        IElement mapped = dem.getElement(diagram, obj);
52 //        return mapped != null ? mapped : e;
53     }
54
55 }