summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Salinas2012-05-02 16:45:40 (EDT)
committerVivian Kong2012-05-02 16:45:40 (EDT)
commit829ca20bb253b4ad0cbcd22bb0526d701718223f (patch)
tree2d28d142ce0b805a3d4da98fc283d406903f0afa
parentae3a68024f6a1b4f6c52a8bc05d7c8081b9878a4 (diff)
downloadorg.eclipse.ptp-829ca20bb253b4ad0cbcd22bb0526d701718223f.zip
org.eclipse.ptp-829ca20bb253b4ad0cbcd22bb0526d701718223f.tar.gz
org.eclipse.ptp-829ca20bb253b4ad0cbcd22bb0526d701718223f.tar.bz2
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 2adfecf..21c12f2 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();