blob: 5dbc21cd39a9e8c6692ca5395b12ed7f2285fa9b [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,
<<<<<<< HEAD
* Sebastien Gemme
*
=======
* Sebastien Gemme - initial API and implementation
*
>>>>>>> refs/heads/eclipse_pa
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.topology.ui.converters;
import org.eclipse.apogy.common.converters.IConverter;
import org.eclipse.apogy.common.topology.Node;
import org.eclipse.apogy.common.topology.ui.Activator;
import org.eclipse.apogy.common.topology.ui.NodePresentation;
public class NodeToNodePresentationConverter implements IConverter {
@Override
public boolean canConvert(Object arg0) {
if (arg0 instanceof Node) {
Node node = (Node) arg0;
return Activator.getTopologyPresentationRegistry().getPresentationNode(node) != null;
}
return false;
}
@Override
public Object convert(Object arg0) throws Exception {
Node node = (Node) arg0;
return Activator.getTopologyPresentationRegistry().getPresentationNode(node);
}
@Override
public Class<?> getInputType() {
return Node.class;
}
@Override
public Class<?> getOutputType() {
return NodePresentation.class;
}
}