blob: de4de5dd71a70dbfcb8aea3bd9ee1cecbe6c8cde [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 - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.core.environment.surface.ui.composites;
import org.eclipse.apogy.common.converters.ApogyCommonConvertersFacade;
import org.eclipse.apogy.common.emf.ui.emfforms.ApogyCommonEMFUiEMFFormsFacade;
import org.eclipse.apogy.common.topology.ui.NodePresentation;
import org.eclipse.apogy.core.FeatureOfInterest;
import org.eclipse.apogy.core.FeatureOfInterestNode;
import org.eclipse.apogy.core.ui.ApogyCoreUIFacade;
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 FeatureOfInterestPresentationComposite extends Composite {
private FeatureOfInterest featureOfInterest;
private final Composite compositeDetails;
public FeatureOfInterestPresentationComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(1, false));
this.compositeDetails = new Composite(this, SWT.NONE);
GridData gd_compositeDetails = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1);
gd_compositeDetails.widthHint = 402;
gd_compositeDetails.minimumWidth = 402;
this.compositeDetails.setLayoutData(gd_compositeDetails);
this.compositeDetails.setLayout(new GridLayout(1, false));
}
public FeatureOfInterest getFeatureOfInterest() {
return this.featureOfInterest;
}
public void setFeatureOfInterest(FeatureOfInterest newFeatureOfInterest) {
this.featureOfInterest = newFeatureOfInterest;
// Update Details EMFForm.
NodePresentation presentation = null;
if (newFeatureOfInterest != null) {
FeatureOfInterestNode node = ApogyCoreUIFacade.INSTANCE.getFeatureOfInterestNode(this.featureOfInterest);
if (node != null) {
presentation = (NodePresentation) ApogyCommonConvertersFacade.INSTANCE.convert(node,
NodePresentation.class);
}
}
ApogyCommonEMFUiEMFFormsFacade.INSTANCE.createEMFForms(this.compositeDetails, presentation,
"No presentation information available.");
}
}