| /******************************************************************************* |
| * 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.wizards; |
| |
| import org.eclipse.apogy.common.topology.bindings.EnumerationCase; |
| import org.eclipse.apogy.common.topology.bindings.EnumerationSwitchBinding; |
| import org.eclipse.apogy.common.topology.bindings.ui.composites.EnumerationSwitchBindingCasesComposite; |
| import org.eclipse.apogy.common.topology.ui.composites.TopologyTreeEditingComposite; |
| import org.eclipse.jface.wizard.WizardPage; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.layout.GridLayout; |
| import org.eclipse.swt.widgets.Composite; |
| |
| public class EnumerationSwitchBindingWizardPage extends WizardPage { |
| private final static String WIZARD_PAGE_ID = "org.eclipse.apogy.common.topology.bindings.ui.wizards.EnumerationSwitchBindingWizardPage"; |
| |
| private final EnumerationSwitchBinding enumerationSwitchBinding; |
| |
| private EnumerationSwitchBindingCasesComposite enumerationSwitchBindingCasesComposite; |
| private TopologyTreeEditingComposite topologyTreeComposite; |
| |
| public EnumerationSwitchBindingWizardPage(EnumerationSwitchBinding enumerationSwitchBinding) { |
| super(WIZARD_PAGE_ID); |
| setTitle("Enum Cases Topologies."); |
| setDescription("Define the enum cases topologies."); |
| |
| this.enumerationSwitchBinding = enumerationSwitchBinding; |
| } |
| |
| @Override |
| public void createControl(Composite parent) { |
| Composite container = new Composite(parent, SWT.BORDER); |
| container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
| container.setLayout(new GridLayout(2, true)); |
| setControl(container); |
| |
| this.enumerationSwitchBindingCasesComposite = new EnumerationSwitchBindingCasesComposite(container, |
| SWT.BORDER) { |
| @Override |
| protected void enumerationCaseSelected(EnumerationCase selectedEnumerationCase) { |
| EnumerationSwitchBindingWizardPage.this.topologyTreeComposite |
| .setRoot(selectedEnumerationCase.getTopologyRoot()); |
| } |
| }; |
| this.enumerationSwitchBindingCasesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| |
| this.enumerationSwitchBindingCasesComposite.setEnumerationSwitchBinding(this.enumerationSwitchBinding); |
| |
| this.topologyTreeComposite = new TopologyTreeEditingComposite(container, SWT.BORDER, true); |
| this.topologyTreeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| } |
| } |