blob: 958551b1aef798531ab17d65ae14cb4ab3b1e43c [file] [log] [blame]
package org.eclipse.apogy.addons.sensors.pose.ui.adapters;
/*******************************************************************************
* 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 - initial API and implementation
* Regent L'Archeveque
*
* SPDX-License-Identifier: EPL-1.0
*******************************************************************************/
import org.eclipse.apogy.addons.sensors.pose.OrientationSensor;
import org.eclipse.apogy.addons.sensors.pose.PoseSensor;
import org.eclipse.apogy.addons.sensors.pose.ui.ApogyAddonsSensorsPoseUIFactory;
import org.eclipse.apogy.addons.sensors.pose.ui.OrientationSensorPresentation;
import org.eclipse.apogy.common.topology.Node;
import org.eclipse.apogy.common.topology.ui.NodePresentation;
import org.eclipse.apogy.common.topology.ui.NodePresentationAdapter;
public class OrientationSensorPresentationAdapter implements NodePresentationAdapter {
public OrientationSensorPresentationAdapter() {
}
@Override
public Class<?> getAdaptedClass() {
return OrientationSensor.class;
}
@Override
public boolean isAdapterFor(Node obj) {
return (obj instanceof OrientationSensor) && !(obj instanceof PoseSensor);
}
@Override
public NodePresentation getAdapter(Node obj, Object context) {
if (!isAdapterFor(obj)) {
throw new IllegalArgumentException();
}
OrientationSensor orientationSensor = (OrientationSensor) obj;
OrientationSensorPresentation presentationNode = ApogyAddonsSensorsPoseUIFactory.eINSTANCE
.createOrientationSensorPresentation();
presentationNode.setNode(orientationSensor);
return presentationNode;
}
}