blob: d7a5a3c7725e7615d9869eb0a72241c0210c15de [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* 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:
* Pierre Allard,
* Regent L'Archeveque,
* Sebastien Gemme - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.topology.impl;
import org.eclipse.apogy.common.topology.ApogyCommonTopologyFacade;
import org.eclipse.apogy.common.topology.Node;
import org.eclipse.apogy.common.topology.NodePath;
public class AttachedViewPointCustomImpl extends AttachedViewPointImpl {
private Node root = null;
private Node theNode;
@Override
public Node basicGetNode() {
if (this.theNode == null) {
if (getNodePath() != null && this.root != null) {
this.theNode = ApogyCommonTopologyFacade.INSTANCE.resolveNode(this.root, getNodePath());
}
}
return this.theNode;
}
@Override
public void setNodePath(NodePath newNodePath) {
super.setNodePath(newNodePath);
// Clear the node to force resolving later.
this.theNode = null;
}
@Override
public void initialize(Node root) {
this.root = root;
if (root != null) {
try {
// Attempt to resolve the node specified by the NodePath.
if (getNodePath() != null) {
this.theNode = ApogyCommonTopologyFacade.INSTANCE.resolveNode(root, getNodePath());
}
} catch (Throwable t) {
}
}
}
} // AttachedViewPointImpl