diff options
Diffstat (limited to 'extraplugins/qompass/designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/GatherConfigData.java')
-rw-r--r-- | extraplugins/qompass/designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/GatherConfigData.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/extraplugins/qompass/designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/GatherConfigData.java b/extraplugins/qompass/designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/GatherConfigData.java new file mode 100644 index 00000000000..62574661a24 --- /dev/null +++ b/extraplugins/qompass/designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/GatherConfigData.java @@ -0,0 +1,64 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * 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: + * Ansgar Radermacher ansgar.radermacher@cea.fr + * + *****************************************************************************/ + +package org.eclipse.papyrus.qompass.designer.core.deployment; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.codegen.extensionpoints.AbstractSettings; +import org.eclipse.papyrus.codegen.extensionpoints.ILangProjectSupport; +import org.eclipse.papyrus.qompass.designer.core.listeners.PreCopyListener; +import org.eclipse.papyrus.qompass.designer.core.transformations.LazyCopier; +import org.eclipse.uml2.uml.Class; + +/** + * Gather configuration data for a code generation project + * In particular, a class might be stereotyped to provide additional information + * about required compilation options (in case of C++ include paths, libraries, ...) + * + * @author ansgar + */ +public class GatherConfigData implements PreCopyListener { + + /** + * Gather configuration data for a code generation project + * Constructor. + * + * @param projectSupport + * A reference to a class providing the language support interface + */ + public GatherConfigData(ILangProjectSupport projectSupport) { + this.projectSupport = projectSupport; + settings = projectSupport.initialConfigurationData(); + } + + @Override + public EObject preCopyEObject(LazyCopier copy, EObject sourceEObj) { + if (sourceEObj instanceof Class) { + projectSupport.gatherConfigData((Class) sourceEObj, settings); + } + return sourceEObj; + } + + /** + * Return the settings that have been gathered + * @return + */ + public AbstractSettings getSettings() { + return settings; + } + + protected ILangProjectSupport projectSupport; + + protected AbstractSettings settings; +} |