blob: 4720dc2728ac2b3d5ac8cc18586a3ecc894a6482 [file] [log] [blame]
package org.eclipse.apogy.addons.sensors.range.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.range.SimpleSonar;
import org.eclipse.apogy.addons.sensors.range.ui.ApogyAddonsSensorsRangeUIFactory;
import org.eclipse.apogy.addons.sensors.range.ui.SimpleSonarPresentation;
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 SimpleSonarPresentationAdapter implements NodePresentationAdapter {
@Override
public Class<?> getAdaptedClass() {
return SimpleSonar.class;
}
@Override
public boolean isAdapterFor(Node node) {
return (node instanceof SimpleSonar);
}
@Override
public NodePresentation getAdapter(Node obj, Object context) {
if (!isAdapterFor(obj)) {
throw new IllegalArgumentException();
}
SimpleSonar simpleSonar = (SimpleSonar) obj;
SimpleSonarPresentation presentationNode = ApogyAddonsSensorsRangeUIFactory.eINSTANCE
.createSimpleSonarPresentation();
presentationNode.setNode(simpleSonar);
return presentationNode;
}
}