Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java')
-rw-r--r--extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java
new file mode 100644
index 00000000000..ccddad6f9cc
--- /dev/null
+++ b/extraplugins/qompass/codegen/cpp/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java
@@ -0,0 +1,30 @@
+package org.eclipse.papyrus.cpp.codegen.transformation;
+
+import org.eclipse.papyrus.codegen.base.HierarchyLocationStrategy;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+
+
+public class CppLocationStrategy extends HierarchyLocationStrategy {
+
+ public static final String PKG_PREFIX = "Pkg_"; //$NON-NLS-1$
+
+ /**
+ * Return the filename for a given named element.
+ *
+ * @param element
+ * a named element
+ * @return filename for this element
+ */
+ public String getFileName(NamedElement element) {
+ if (element instanceof Package) {
+ // specific prefix for packages
+ String folder = super.getFileName(element);
+ if (folder.length() > 0) {
+ folder += HierarchyLocationStrategy.SEP_CHAR;
+ }
+ return folder + PKG_PREFIX + element.getName();
+ }
+ else return super.getFileName(element);
+ }
+}

Back to the top