| /******************************************************************************* |
| * 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 - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.addons.sensors.fov.bindings.ui.impl; |
| |
| import java.util.List; |
| |
| import org.eclipse.apogy.addons.sensors.fov.ApogyAddonsSensorsFOVPackage; |
| import org.eclipse.apogy.addons.sensors.fov.RectangularFrustrumFieldOfView; |
| import org.eclipse.apogy.addons.sensors.fov.bindings.ApogyAddonsSensorsFOVBindingsFactory; |
| import org.eclipse.apogy.addons.sensors.fov.bindings.ApogyAddonsSensorsFOVBindingsPackage; |
| import org.eclipse.apogy.addons.sensors.fov.bindings.RectangularFrustrumFieldOfViewBinding; |
| import org.eclipse.apogy.common.emf.transaction.ApogyCommonTransactionFacade; |
| import org.eclipse.apogy.common.emf.ui.EClassSettings; |
| import org.eclipse.apogy.common.emf.ui.MapBasedEClassSettings; |
| import org.eclipse.apogy.common.topology.Node; |
| import org.eclipse.apogy.common.topology.bindings.ui.TopologyUIBindingsConstants; |
| import org.eclipse.apogy.common.topology.bindings.ui.wizards.TopologyNodeSelectionWizardPage; |
| import org.eclipse.emf.common.util.BasicEList; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.jface.wizard.WizardPage; |
| |
| public class RectangularFrustrumFieldOfViewBindingWizardPagesProviderCustomImpl |
| extends RectangularFrustrumFieldOfViewBindingWizardPagesProviderImpl { |
| |
| @Override |
| public EObject createEObject(EClass eClass, EClassSettings settings) { |
| RectangularFrustrumFieldOfViewBinding rectangularFrustrumFieldOfViewBinding = ApogyAddonsSensorsFOVBindingsFactory.eINSTANCE |
| .createRectangularFrustrumFieldOfViewBinding(); |
| return rectangularFrustrumFieldOfViewBinding; |
| } |
| |
| @SuppressWarnings("unchecked") |
| @Override |
| public EList<WizardPage> instantiateWizardPages(EObject eObject, EClassSettings settings) { |
| EList<WizardPage> list = new BasicEList<>(); |
| list.addAll(super.instantiateWizardPages(eObject, settings)); |
| |
| // Add topology node selection page. |
| List<Node> nodes = null; |
| if (settings instanceof MapBasedEClassSettings) { |
| MapBasedEClassSettings mapBasedEClassSettings = (MapBasedEClassSettings) settings; |
| nodes = (List<Node>) mapBasedEClassSettings.getUserDataMap() |
| .get(TopologyUIBindingsConstants.NODES_LIST_USER_ID); |
| } |
| |
| RectangularFrustrumFieldOfViewBinding binding = (RectangularFrustrumFieldOfViewBinding) eObject; |
| |
| TopologyNodeSelectionWizardPage topologyNodeSelectionWizardPage = new TopologyNodeSelectionWizardPage( |
| "Select Rectangular Frustrum Field Of View", |
| "Select the Rectangular Frustrum Field Of View that this binding is controlling.", binding, |
| ApogyAddonsSensorsFOVPackage.Literals.RECTANGULAR_FRUSTRUM_FIELD_OF_VIEW, nodes) { |
| @Override |
| protected void nodeSelected(Node nodeSelected) { |
| if (binding != null && nodeSelected instanceof RectangularFrustrumFieldOfView) { |
| ApogyCommonTransactionFacade.INSTANCE.basicSet(binding, |
| ApogyAddonsSensorsFOVBindingsPackage.Literals.RECTANGULAR_FRUSTRUM_FIELD_OF_VIEW_BINDING__FOV, |
| nodeSelected, true); |
| |
| setMessage("Node selected : " + nodeSelected.getNodeId()); |
| setErrorMessage(null); |
| } else { |
| setErrorMessage("The selected Node is not a Rectangular Frustrum Field Of View !"); |
| } |
| } |
| }; |
| |
| list.add(topologyNodeSelectionWizardPage); |
| |
| return list; |
| } |
| } // RectangularFrustrumFieldOfViewBindingWizardPagesProviderImpl |