[jboss-svn-commits] JBL Code SVN: r13962 - in labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse: editors/completion and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 2 09:32:15 EDT 2007


Author: KrisVerlaenen
Date: 2007-08-02 09:32:14 -0400 (Thu, 02 Aug 2007)
New Revision: 13962

Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/completion/DSLRuleCompletionProcessor.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java
Log:
JBRULES-1048: Context assist is not working for DSLs in Eclipse
 - DSL code completion now only suggests complete sentences
 - no longer suggests default DRL code completions

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/completion/DSLRuleCompletionProcessor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/completion/DSLRuleCompletionProcessor.java	2007-08-02 13:32:10 UTC (rev 13961)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/completion/DSLRuleCompletionProcessor.java	2007-08-02 13:32:14 UTC (rev 13962)
@@ -35,7 +35,7 @@
     
 	protected void addRHSCompletionProposals(List list, int documentOffset, String prefix, String backText,
 			String conditions, String consequence) {
-		super.addRHSCompletionProposals(list, documentOffset, prefix, backText, conditions, consequence);
+		// super.addRHSCompletionProposals(list, documentOffset, prefix, backText, conditions, consequence);
 		DSLAdapter adapter = getDSLRuleEditor().getDSLAdapter();
 		if (adapter != null) {
 			List dslConsequences = adapter.getDSLTree().getConsequenceChildrenList(prefix, true);
@@ -45,7 +45,7 @@
 	
 	protected void addLHSCompletionProposals(List list, int documentOffset,
 			Location location, String prefix, String backText) {
-		super.addLHSCompletionProposals(list, documentOffset, location, prefix, backText);
+		// super.addLHSCompletionProposals(list, documentOffset, location, prefix, backText);
 		DSLAdapter adapter = getDSLRuleEditor().getDSLAdapter();
 		if (adapter != null) {
 			String lastobj = this.getLastNonDashLine(backText);

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java	2007-08-02 13:32:10 UTC (rev 13961)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java	2007-08-02 13:32:14 UTC (rev 13962)
@@ -332,7 +332,8 @@
             }
     	}
     	if (thenode == null) {
-    		thenode = this.rootCond;
+    		return null;
+    		// thenode = this.rootCond;
     	}
         Collection children = thenode.getChildren();
         Node[] nchild = new Node[children.size()];
@@ -371,9 +372,10 @@
     	Node[] c = getConsequenceChildren(text);
     	this.suggestions.clear();
     	for (int idx=0; idx < c.length; idx++) {
-    		this.suggestions.add(c[idx].getToken());
     		if (addChildren) {
         		this.addChildToList(c[idx], c[idx].getToken(), this.suggestions);
+    		} else {
+    			this.suggestions.add(c[idx].getToken());
     		}
     	}
     	return this.suggestions;
@@ -389,22 +391,26 @@
     public ArrayList getChildrenList(String obj, String text, boolean addChildren) {
     	Node[] c = getChildren(obj,text);
     	this.suggestions.clear();
-    	for (int idx=0; idx < c.length; idx++) {
-    		this.suggestions.add(c[idx].getToken());
-    		if (addChildren) {
-        		this.addChildToList(c[idx], c[idx].getToken(), this.suggestions);
-    		}
+    	if (c != null) {
+	    	for (int idx=0; idx < c.length; idx++) {
+	    		if (addChildren) {
+	        		this.addChildToList(c[idx], c[idx].getToken(), this.suggestions);
+	    		} else {
+	    			this.suggestions.add(c[idx].getToken());
+	    		}
+	    	}
     	}
-    	// in the event the line is zero length after it is trimmed, we also add
-    	// the top level nodes
-    	if (text.trim().length() == 0) {
+    	if (c == null || text.trim().length() == 0) {
+	    	// in the event the line is zero length after it is trimmed, we also add
+	    	// the top level nodes
     		Iterator top = this.rootCond.getChildren().iterator();
         	while (top.hasNext()) {
         		Node t = (Node)top.next();
         		if (!this.suggestions.contains(t.getToken())) {
-            		this.suggestions.add(t.getToken());
             		if (addChildren) {
                 		this.addChildToList(t, t.getToken(), this.suggestions);
+            		} else {
+                		this.suggestions.add(t.getToken());
             		}
         		}
         	}
@@ -425,9 +431,11 @@
     		while (itr.hasNext()) {
     			Node child = (Node)itr.next();
     			String text = prefix + " " + child.getToken();
-    			list.add(text);
+    			// list.add(text);
     			addChildToList(child,text,list);
     		}
+    	} else {
+    		list.add(prefix);
     	}
     }
     




More information about the jboss-svn-commits mailing list