Bug 507323: [codegen] far end list generated incorrectly in certain
cases. 

The instance model was treating non-border ports (internal, SAPs and
SPPs) as border ports when creating the connections between port
instances, so it incorrectly determined that internal ports which are
not at the top-level capsule could be treated as relay ports that could
be deleted.

Change-Id: I8d609e16165a2253fae9b049d6f7cd2fa16324f5
Signed-off-by: Ernesto Posse <eposse@gmail.com>
diff --git a/.gitignore b/.gitignore
index 361a2ec..54eeb5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
 *.o
 *._trace
+*.xtendbin
+*.xtextbin
 bin/
 target/
 */.settings/*
diff --git a/models/samples/ComputerSystem/expected_src/CMakeLists.txt b/models/samples/ComputerSystem/expected_src/CMakeLists.txt
index c877ae2..1144f8d 100644
--- a/models/samples/ComputerSystem/expected_src/CMakeLists.txt
+++ b/models/samples/ComputerSystem/expected_src/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Generated 2016-11-17 16:17:38
+# Generated 2016-12-02 17:50:13
 
 cmake_minimum_required(VERSION 2.8.7)
 set(TARGET TopMain)
diff --git a/models/samples/ComputerSystem/expected_src/TopControllers.cc b/models/samples/ComputerSystem/expected_src/TopControllers.cc
index a79f075..c6d6c3a 100644
--- a/models/samples/ComputerSystem/expected_src/TopControllers.cc
+++ b/models/samples/ComputerSystem/expected_src/TopControllers.cc
@@ -287,7 +287,7 @@
         false,
         false,
         false,
-        true,
+        false,
         false,
         false,
         false,
diff --git a/models/tests/executable/PingPong/expected_src/CMakeLists.txt b/models/tests/executable/PingPong/expected_src/CMakeLists.txt
index b7a26d1..7146985 100644
--- a/models/tests/executable/PingPong/expected_src/CMakeLists.txt
+++ b/models/tests/executable/PingPong/expected_src/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Generated 2016-11-17 16:15:01
+# Generated 2016-12-02 17:48:40
 
 cmake_minimum_required(VERSION 2.8.7)
 set(TARGET TopMain)
diff --git a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/instance/model/CapsuleInstance.java b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/instance/model/CapsuleInstance.java
index 6b88bc6..a7d56a8 100644
--- a/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/instance/model/CapsuleInstance.java
+++ b/plugins/umlrt/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/instance/model/CapsuleInstance.java
@@ -272,10 +272,10 @@
 		boolean isRelay0 = false;
 		boolean isRelay1 = false;
 
-		if (cb.primary.part == part) {
+		if (cb.primary.part == part && XTUMLRTUtil.isBorderPort(cb.primary.port)) {
 			isRelay0 = ports.containsKey(cb.primary.port);
 		}
-		if (cb.secondary.part == part) {
+		if (cb.secondary.part == part && XTUMLRTUtil.isBorderPort(cb.secondary.port)) {
 			isRelay1 = ports.containsKey(cb.secondary.port);
 		}