| /******************************************************************************* |
| * 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, |
| * Olivier L. Larouche - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.core.invocator.ui.parts; |
| |
| import org.eclipse.apogy.common.emf.transaction.ApogyCommonTransactionFacade; |
| import org.eclipse.apogy.core.invocator.ApogyCoreInvocatorFactory; |
| import org.eclipse.apogy.core.invocator.ApogyCoreInvocatorPackage; |
| import org.eclipse.apogy.core.invocator.InitialConditionsList; |
| import org.eclipse.apogy.core.invocator.InvocatorSession; |
| import org.eclipse.apogy.core.invocator.ui.composites.InitialConditionsComposite; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.widgets.Composite; |
| |
| public class InitialConditionPart extends AbstractSessionBasedPart { |
| private InitialConditionsComposite initialConditionsComposite; |
| |
| @Override |
| protected void newInvocatorSession(InvocatorSession invocatorSession) { |
| InitialConditionsList initialConditionsList = null; |
| |
| if (invocatorSession != null) { |
| initialConditionsList = invocatorSession.getInitialConditionsList(); |
| |
| // If there is no Initial Condition List defined, creates one. |
| if (initialConditionsList == null) { |
| initialConditionsList = ApogyCoreInvocatorFactory.eINSTANCE.createInitialConditionsList(); |
| |
| ApogyCommonTransactionFacade.INSTANCE.basicSet(invocatorSession, |
| ApogyCoreInvocatorPackage.Literals.INVOCATOR_SESSION__INITIAL_CONDITIONS_LIST, |
| initialConditionsList); |
| } |
| } |
| |
| this.initialConditionsComposite.setInitialConditionsList(initialConditionsList); |
| } |
| |
| @Override |
| protected void createContentComposite(Composite parent, int style) { |
| this.initialConditionsComposite = new InitialConditionsComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); |
| } |
| } |