[jboss-svn-commits] JBL Code SVN: r26538 - labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/outline.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu May 14 10:46:12 EDT 2009


Author: KrisVerlaenen
Date: 2009-05-14 10:46:12 -0400 (Thu, 14 May 2009)
New Revision: 26538

Modified:
   labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java
Log:
JBRULES-552: Outline problems in DRL editor
 - resolved issue where commented out rules were still visible in the outline

Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java	2009-05-14 14:23:47 UTC (rev 26537)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java	2009-05-14 14:46:12 UTC (rev 26538)
@@ -44,6 +44,8 @@
 
     ///////////////////////////////////
     // Patterns that the parser uses
+    // TODO: this should just reuse the existing parser to avoid inconsistencies
+    //       with for example comments
     ///////////////////////////////////
     private static final Pattern RULE_PATTERN1 = Pattern.compile(
 			"\\n\\s*rule\\s+\"([^\"]+)\"", Pattern.DOTALL);
@@ -152,16 +154,22 @@
         matcher = RULE_PATTERN1.matcher(ruleFileContents);
         while (matcher.find()) {
             String ruleName = matcher.group(1);
-            DroolsModelBuilder.addRule(pkg, ruleName, null,
-        		matcher.start(1), matcher.end(1) - matcher.start(1),
-        		extractAttributes((RuleDescr) rules.get(ruleName)));
+            RuleDescr descr = (RuleDescr) rules.get(ruleName);
+            if (descr != null) {
+	            DroolsModelBuilder.addRule(pkg, ruleName, null,
+	        		matcher.start(1), matcher.end(1) - matcher.start(1),
+	        		extractAttributes(descr));
+            }
         }
         matcher = RULE_PATTERN2.matcher(ruleFileContents);
         while (matcher.find()) {
             String ruleName = matcher.group(1);
-            DroolsModelBuilder.addRule(pkg, ruleName, null,
-        		matcher.start(1), matcher.end(1) - matcher.start(1),
-        		extractAttributes((RuleDescr) rules.get(ruleName)));
+            RuleDescr descr = (RuleDescr) rules.get(ruleName);
+            if (descr != null) {
+    	        DroolsModelBuilder.addRule(pkg, ruleName, null,
+	        		matcher.start(1), matcher.end(1) - matcher.start(1),
+	        		extractAttributes(descr));
+            }
          } 
         matcher = FUNCTION_PATTERN.matcher(ruleFileContents);
 		while (matcher.find()) {




More information about the jboss-svn-commits mailing list