| // ***************************************************************************** |
| // 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 |
| // Regent L'Archeveque |
| // Olivier L. Larouche |
| // |
| // SPDX-License-Identifier: EPL-1.0 |
| // ***************************************************************************** |
| @GenModel(prefix="ApogyCoreInvocatorUI", |
| copyrightText="******************************************************************************* |
| 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 |
| Regent L'Archeveque |
| Olivier L. Larouche |
| |
| SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************", |
| childCreationExtenders="true", |
| modelName="ApogyCoreInvocatorUI") |
| @GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates") |
| @GenModel(modelDirectory="/org.eclipse.apogy.core.invocator.ui/src-gen") |
| @GenModel(editDirectory="/org.eclipse.apogy.core.invocator.ui/src-gen") |
| |
| package org.eclipse.apogy.core.invocator.ui |
| |
| import org.eclipse.apogy.common.emf.Exception |
| import org.eclipse.apogy.common.emf.ui.NamedDescribedWizardPagesProvider |
| |
| import org.eclipse.apogy.core.invocator.AbstractTypeImplementation |
| import org.eclipse.apogy.core.invocator.Type |
| import org.eclipse.apogy.core.invocator.Context |
| import org.eclipse.apogy.core.invocator.ProgramSettings |
| import org.eclipse.emf.ecore.EClass |
| import org.eclipse.emf.ecore.EObject |
| import java.util.List |
| import java.util.HashMap |
| import org.eclipse.apogy.core.invocator.Variable |
| import org.eclipse.apogy.core.invocator.VariablesList |
| import org.eclipse.apogy.core.invocator.Program |
| import org.eclipse.apogy.common.Apogy |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * DataTypes. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| type MPart wraps org.eclipse.e4.ui.model.application.ui.basic.MPart |
| type CompoundCommand wraps org.eclipse.emf.common.command.CompoundCommand |
| type ListVariables wraps List<Variable> |
| type ListTypes wraps List<Type> |
| type SortedSet<T> wraps java.util.SortedSet |
| type HashMap<key, value> wraps HashMap |
| |
| type Composite wraps org.eclipse.swt.widgets.Composite |
| type ISelectionListener wraps org.eclipse.ui.ISelectionListener |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Utilities |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(isSingleton="true", hasCustomClass="true") |
| class ApogyCoreInvocatorUIFacade{ |
| /* |
| * Copies the Initialization Data. |
| * @param source Reference to the source context. |
| * @param destination Reference to the destination context. |
| */ |
| op void copyInitializationData(Context source, Context destination) throws Exception |
| |
| /* |
| * Copies the Initialization Data. |
| * @param source Reference to the source implementation. |
| * @param destination Reference to the destination implementation. |
| * @param command Reference to the stack command. |
| */ |
| op void copyInitializationData(AbstractTypeImplementation source, AbstractTypeImplementation destination, CompoundCommand command) throws Exception |
| |
| /* |
| * Initializes the active session. |
| */ |
| op void initSession() |
| |
| /* |
| * Disposes the active session. |
| */ |
| op void disposeSession() |
| |
| /* |
| * Adds the variable to the specified list using a transaction. |
| * @param variablesList List of variables. |
| * @param variable Variable to add. |
| * @see ApogyCoreInvocatorFacade#addVariable(VariablesList variablesList, Variable variable) |
| */ |
| op void addVariable(VariablesList variablesList, Variable variable) |
| |
| /* |
| * Delete the variables from the specified list using a transaction. |
| * @param variablesList List of variables. |
| * @param variables Variables to remove. |
| * @see ApogyCoreInvocatorFacade#deleteVariable(VariablesList variablesList, Variable variable) |
| */ |
| op void deleteVariables(VariablesList variablesList, ListVariables variables) |
| |
| |
| /* |
| * Saves a specified EObject to a part's Persisted State. The Resource Set used is the one associated with the active session. |
| * @param mPart The part. |
| * @param persistedStateKey The persisted state key under which the eObject will be saved. |
| * @param eObject The EObject to save. |
| */ |
| op void saveToPersistedState(MPart mPart, String persistedStateKey, EObject eObject) |
| |
| /* |
| * Reads an EObject from a part's Persisted State. . The Resource Set used is the one associated with the active session. |
| * @param mPart The part. |
| * @param persistedStateKey The persisted state key under which the eObject is stored. |
| * @return The EObject read, null if none could be read. |
| */ |
| op EObject readFromPersistedState(MPart mPart, String persistedStateKey) |
| |
| /** |
| * Sorts a list of types based on their name. |
| * @param types List of Type to be sorted. |
| * @return The Type sorted by name. |
| */ |
| op SortedSet<Type> sortTypeByName(ListTypes types) |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Settings to be used in wizards |
| * |
| * ------------------------------------------------------------------------- */ |
| class NewProgramSettings |
| { |
| /* |
| * EClass of the program |
| */ |
| contains EClass eClass |
| |
| /* |
| * Settings of the program. |
| */ |
| contains ProgramSettings programSettings |
| } |
| |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Registry to get the factory for UI elements of a Program EClass |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(isSingleton="true", hasCustomClass="true") |
| class ProgramUIFactoriesRegistry |
| { |
| readonly transient String PROGRAM_FACTORY_PROVIDER_CONTRIBUTORS_POINT_ID = "org.eclipse.apogy.core.invocator.ui.programUIFactoryProvider" |
| readonly transient String PROGRAM_FACTORY_PROVIDER_CONTRIBUTORS_ECLASS_ID = "programUIFactoryEClass" |
| readonly transient String PROGRAM_FACTORY_PROVIDER_CONTRIBUTORS_FACTORY_ID = "factory" |
| HashMap<EClass,ProgramUIFactory> programUIFactoriesMap |
| |
| /* |
| * Gets the factory corresponding to the EClass |
| */ |
| op ProgramUIFactory getFactory(EClass eClass) |
| } |
| |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Factory used to create Program specific UI elements. |
| * |
| * ------------------------------------------------------------------------- */ |
| abstract class ProgramUIFactory |
| { |
| /** |
| * Creates a Program specific composite for the specified program. |
| * @param parent The parent composite. |
| * @param program The Program to display in the composite. |
| * @param selectionListener The selectionListener to call when a selection if made within the returned composite. |
| * @return The composite used to display the Program. |
| */ |
| op Composite createProgramComposite(Composite parent, Program program, ISelectionListener selectionListener) |
| } |
| |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Factory used to create OperationCallsList specific UI elements. |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(hasCustomClass="true") |
| class OperationCallsListProgramUIFactory extends ProgramUIFactory |
| { |
| } |
| |
| /** |
| * Wizard Provider used to create TypeMember. |
| */ |
| @Apogy(hasCustomClass="true") |
| class TypeMemberWizardPagesProvider extends NamedDescribedWizardPagesProvider |
| { |
| } |