| /******************************************************************************* |
| * 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.dynamics.ui.views; |
| |
| import org.eclipse.apogy.common.topology.addons.dynamics.CylindricalConstraint; |
| import org.eclipse.apogy.common.topology.addons.dynamics.ui.composites.CylindricalConstraintComposite; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.FillLayout; |
| import org.eclipse.swt.widgets.Composite; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class CylindricalConstraintView extends AbstractPinableView<CylindricalConstraint> { |
| private static final Logger Logger = LoggerFactory.getLogger(CylindricalConstraintView.class); |
| |
| private CylindricalConstraint cylindricalConstraint; |
| public static final String ID = "org.eclipse.apogy.common.topology.addons.dynamics.ui.views.CylindricalConstraintView"; //$NON-NLS-1$ |
| |
| private CylindricalConstraintComposite cylindricalConstraintComposite = null; |
| |
| public CylindricalConstraintView() { |
| } |
| |
| /** |
| * Create contents of the view part. |
| * |
| * @param parent |
| */ |
| @Override |
| public void createPartControl(Composite parent) { |
| super.createPartControl(parent); |
| Composite container = new Composite(parent, SWT.NONE); |
| container.setLayout(new FillLayout(SWT.HORIZONTAL)); |
| this.cylindricalConstraintComposite = new CylindricalConstraintComposite(container, SWT.None); |
| |
| createActions(); |
| getSite().getPage().addSelectionListener(this); |
| } |
| |
| public CylindricalConstraint getCylindricalConstraint() { |
| return this.cylindricalConstraint; |
| } |
| |
| public void setCylindricalConstraint(CylindricalConstraint cylindricalConstraint) { |
| this.cylindricalConstraint = cylindricalConstraint; |
| if (this.cylindricalConstraintComposite != null) |
| this.cylindricalConstraintComposite.setCylindricalConstraint(this.cylindricalConstraint); |
| } |
| |
| @Override |
| public void setFocus() { |
| } |
| |
| @Override |
| public Class<CylindricalConstraint> getObjectClass() { |
| return CylindricalConstraint.class; |
| } |
| |
| @Override |
| public void setObject(CylindricalConstraint object) { |
| |
| this.cylindricalConstraintComposite.setCylindricalConstraint(object); |
| |
| // Logs a message to says the SMA has been set. |
| Logger.info("Displayed CylindricalConstraint updated to <" + object + ">."); |
| |
| super.setObject(object); |
| } |
| } |