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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue May 8 08:54:03 EDT 2007


Author: KrisVerlaenen
Date: 2007-05-08 08:54:02 -0400 (Tue, 08 May 2007)
New Revision: 11745

Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java
Log:
 - Fixed failing test in IDE code completion

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java	2007-05-08 10:16:04 UTC (rev 11744)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java	2007-05-08 12:54:02 UTC (rev 11745)
@@ -235,9 +235,21 @@
 				if (lastDescr instanceof FieldConstraintDescr) {
 					FieldConstraintDescr lastFieldDescr = (FieldConstraintDescr) lastDescr;
 					List restrictions = lastFieldDescr.getRestrictions();
+					// if there are multiple restrictions, filter out all the rest so that
+					// only the last one remains
+					if (restrictions.size() > 2) {
+						Object last = restrictions.get(restrictions.size() - 2);
+						if (last instanceof RestrictionConnectiveDescr) {
+							RestrictionConnectiveDescr lastRestr = (RestrictionConnectiveDescr) last;
+							char connective = '&';
+							if (lastRestr.getConnective() == RestrictionConnectiveDescr.OR) {
+								connective = '|';
+							}
+							int connectiveLocation = patternContents.lastIndexOf(connective);
+							patternContents = "( " + lastFieldDescr.getFieldName() + " " + patternContents.substring(connectiveLocation + 1);
+						}
+					}
 					if (restrictions.size() > 1) {
-						// if there are multiple restrictions, filter out all the rest so that
-						// only the last one remains
 						Object last = restrictions.get(restrictions.size() - 1);
 						if (last instanceof RestrictionConnectiveDescr) {
 							RestrictionConnectiveDescr lastRestr = (RestrictionConnectiveDescr) last;
@@ -248,11 +260,6 @@
 							int connectiveLocation = patternContents.lastIndexOf(connective);
 							patternContents = "( " + lastFieldDescr.getFieldName() + " " + patternContents.substring(connectiveLocation + 1);
 						}
-//						else {
-//							Location location = new Location(LOCATION_LHS_INSIDE_CONDITION_END);
-//							location.setProperty(LOCATION_PROPERTY_CLASS_NAME, patternDescr.getObjectType());
-//							return location;
-//						}
 					}
 				}
 			}




More information about the jboss-svn-commits mailing list