Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Salinas2012-05-02 20:46:00 +0000
committerVivian Kong2012-05-02 20:46:00 +0000
commitbc0f7232a4cf6cacbef90f5f0679094c57d5d81b (patch)
tree17bf21b12f5f98ab79eb897cf677116a9b8cbf69
parenta75f297fb2425a59454cab992f0cb4e32174f54a (diff)
downloadorg.eclipse.ptp-bc0f7232a4cf6cacbef90f5f0679094c57d5d81b.tar.gz
org.eclipse.ptp-bc0f7232a4cf6cacbef90f5f0679094c57d5d81b.tar.xz
org.eclipse.ptp-bc0f7232a4cf6cacbef90f5f0679094c57d5d81b.zip
Bug 378196 - switch statement folding not working in remote c editor
-rw-r--r--rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteFoldingRegionsHandler.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteFoldingRegionsHandler.java b/rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteFoldingRegionsHandler.java
index 2adfecf11..21c12f2bf 100644
--- a/rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteFoldingRegionsHandler.java
+++ b/rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteFoldingRegionsHandler.java
@@ -13,6 +13,7 @@ package org.eclipse.ptp.internal.rdt.core.miners;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
@@ -197,9 +198,21 @@ public class RemoteFoldingRegionsHandler {
IASTStatement switchstmt = ((IASTSwitchStatement)statement).getBody();
if (switchstmt instanceof IASTCompoundStatement) {
IASTStatement[] stmts = ((IASTCompoundStatement)switchstmt).getStatements();
+
+ List<IASTStatement> list = new ArrayList<IASTStatement>();
+ for (IASTStatement s : stmts) {
+ if (s instanceof IASTCompoundStatement) {
+ IASTStatement[] ss = ((IASTCompoundStatement)s).getStatements();
+ for (IASTStatement t : ss)
+ list.add(t);
+ } else
+ list.add(s);
+ }
+
boolean pushedMR = false;
- for (IASTStatement tmpstmt : stmts) {
+ for (IASTStatement tmpstmt : list) {
StatementRegion tmpmr;
+
if (!(tmpstmt instanceof IASTCaseStatement || tmpstmt instanceof IASTDefaultStatement)) {
if (!pushedMR) return PROCESS_SKIP;
IASTFileLocation tmpfl = tmpstmt.getFileLocation();
@@ -212,6 +225,9 @@ public class RemoteFoldingRegionsHandler {
tmpmr = createRegion();
tmpmr.level= fLevel+1;
tmpmr.inclusive = true;
+
+
+
if (tmpstmt instanceof IASTCaseStatement) {
IASTCaseStatement casestmt = (IASTCaseStatement) tmpstmt;
tmpfl = casestmt.getExpression().getFileLocation();

Back to the top