blob: b993a3f0805ebc244e02a1d3fcef278de520cc22 [file] [log] [blame]
/*******************************************************************************
* 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.ConstraintState;
import org.eclipse.apogy.common.topology.addons.dynamics.ui.composites.ConstraintStateComposite;
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 ConstraintStateView extends AbstractPinableView<ConstraintState> {
private static final Logger Logger = LoggerFactory.getLogger(ConstraintStateView.class);
private ConstraintState constraintState;
public static final String ID = "org.eclipse.apogy.common.topology.addons.dynamics.ui.views.ConstraintStateView"; //$NON-NLS-1$
private ConstraintStateComposite constraintStateComposite = null;
public ConstraintStateView() {
}
/**
* 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.constraintStateComposite = new ConstraintStateComposite(container, SWT.None);
createActions();
getSite().getPage().addSelectionListener(this);
}
public ConstraintState getConstraintState() {
return this.constraintState;
}
public void setConstraintState(ConstraintState constraintState) {
this.constraintState = constraintState;
if (constraintState != null)
this.constraintStateComposite.setConstraintState(this.constraintState);
}
@Override
public Class<ConstraintState> getObjectClass() {
return ConstraintState.class;
}
@Override
public void setFocus() {
}
@Override
public void setObject(ConstraintState object) {
this.constraintStateComposite.setConstraintState(object);
Logger.info("Displayed ConstraintState updated to <" + object + ">.");
super.setObject(object);
}
}