| /******************************************************************************* |
| * 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 |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.common.topology.bindings.ui.impl; |
| |
| import org.eclipse.apogy.common.emf.ui.EClassSettings; |
| import org.eclipse.apogy.common.emf.ui.MapBasedEClassSettings; |
| import org.eclipse.apogy.common.topology.AggregateGroupNode; |
| import org.eclipse.apogy.common.topology.ApogyCommonTopologyFactory; |
| import org.eclipse.apogy.common.topology.bindings.ApogyCommonTopologyBindingsFactory; |
| import org.eclipse.apogy.common.topology.bindings.EnumerationCase; |
| import org.eclipse.apogy.common.topology.bindings.EnumerationSwitchBinding; |
| import org.eclipse.apogy.common.topology.bindings.ui.TopologyUIBindingsConstants; |
| import org.eclipse.apogy.common.topology.bindings.ui.wizards.EnumerationCaseWizardPage; |
| 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 EnumerationCaseWizardPagesProviderCustomImpl extends EnumerationCaseWizardPagesProviderImpl { |
| |
| @Override |
| public EObject createEObject(EClass eClass, EClassSettings settings) { |
| EnumerationCase enumerationCase = ApogyCommonTopologyBindingsFactory.eINSTANCE.createEnumerationCase(); |
| AggregateGroupNode node = ApogyCommonTopologyFactory.eINSTANCE.createAggregateGroupNode(); |
| node.setNodeId("GIVE_ME_A_UNIQUE_ID!"); |
| enumerationCase.setTopologyRoot(node); |
| return enumerationCase; |
| } |
| |
| @Override |
| public EList<WizardPage> instantiateWizardPages(EObject eObject, EClassSettings settings) { |
| EList<WizardPage> list = new BasicEList<>(); |
| list.addAll(super.instantiateWizardPages(eObject, settings)); |
| |
| EnumerationSwitchBinding enumerationSwitchBinding = null; |
| if (settings instanceof MapBasedEClassSettings) { |
| MapBasedEClassSettings mapBasedEClassSettings = (MapBasedEClassSettings) settings; |
| enumerationSwitchBinding = (EnumerationSwitchBinding) mapBasedEClassSettings.getUserDataMap() |
| .get(TopologyUIBindingsConstants.ENUMERATION_SWITCH_BINDING_USER_ID); |
| } |
| |
| EnumerationCase enumerationCase = (EnumerationCase) eObject; |
| |
| list.add(new EnumerationCaseWizardPage(enumerationSwitchBinding, enumerationCase)); |
| |
| return list; |
| } |
| } // EnumerationCaseWizardPagesProviderImpl |