blob: f2e7e16d36a3e8188a1bf7ffc74d5fb1124b260f [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.PoseSensor;
import org.eclipse.apogy.addons.sensors.pose.ui.ApogyAddonsSensorsPoseUIFactory;
import org.eclipse.apogy.addons.sensors.pose.ui.PoseSensorPresentation;
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 PoseSensorPresentationAdapter implements NodePresentationAdapter {
public PoseSensorPresentationAdapter() {
}
@Override
public Class<?> getAdaptedClass() {
return PoseSensor.class;
}
@Override
public boolean isAdapterFor(Node obj) {
return obj instanceof PoseSensor;
}
@Override
public NodePresentation getAdapter(Node obj, Object context) {
if (!isAdapterFor(obj)) {
throw new IllegalArgumentException();
}
PoseSensor poseSensor = (PoseSensor) obj;
PoseSensorPresentation presentationNode = ApogyAddonsSensorsPoseUIFactory.eINSTANCE
.createPoseSensorPresentation();
presentationNode.setNode(poseSensor);
return presentationNode;
}
}