| /******************************************************************************* |
| * 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.addons.primitives.bindings.impl; |
| |
| import java.util.Map; |
| |
| import org.eclipse.apogy.common.topology.Node; |
| import org.eclipse.apogy.common.topology.addons.primitives.Light; |
| import org.eclipse.apogy.common.topology.addons.primitives.bindings.LightEnablementBinding; |
| import org.eclipse.apogy.common.topology.bindings.AbstractTopologyBinding; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| public class LightEnablementBindingCustomImpl extends LightEnablementBindingImpl { |
| |
| @Override |
| public AbstractTopologyBinding clone(Map<Node, Node> originalToCopyNodeMap) { |
| LightEnablementBinding lightEnablementBindingCopy = EcoreUtil.copy(this); |
| lightEnablementBindingCopy.setLight((Light) originalToCopyNodeMap.get(this.getLight())); |
| return lightEnablementBindingCopy; |
| } |
| |
| @Override |
| public Class<?> getSupportedFeatureType() { |
| return Light.class; |
| } |
| |
| protected void valueChanged(Object newValue) { |
| boolean value = false; |
| if (newValue instanceof Boolean) { |
| value = (Boolean) newValue; |
| setCurrentValue(value); |
| |
| if (getLight() != null) |
| getLight().setEnabled(value); |
| } |
| } |
| |
| } // LightEnablementBindingImpl |