[jboss-svn-commits] JBL Code SVN: r14036 - labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Aug 4 18:00:13 EDT 2007


Author: arhan
Date: 2007-08-04 18:00:13 -0400 (Sat, 04 Aug 2007)
New Revision: 14036

Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/AddNewInsertedFactFieldDialog.java
Log:
fixed action field type selection problem

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/AddNewInsertedFactFieldDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/AddNewInsertedFactFieldDialog.java	2007-08-04 21:59:44 UTC (rev 14035)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/AddNewInsertedFactFieldDialog.java	2007-08-04 22:00:13 UTC (rev 14036)
@@ -19,61 +19,56 @@
  */
 public class AddNewInsertedFactFieldDialog extends RuleDialog {
 
-    private RuleModeller           modeller;
+	private RuleModeller modeller;
 
-    private final ActionInsertFact fact;
+	private final ActionInsertFact fact;
 
-    public AddNewInsertedFactFieldDialog(Shell parent,
-                                         RuleModeller modeller,
-                                         ActionInsertFact fact) {
-        super( parent,
-               "Add new condition to the rule",
-               "Pick the values from combos and confirm the selection." );
-        this.modeller = modeller;
-        this.fact = fact;
-    }
+	public AddNewInsertedFactFieldDialog(Shell parent, RuleModeller modeller,
+			ActionInsertFact fact) {
+		super(parent, "Add new condition to the rule",
+				"Pick the values from combos and confirm the selection.");
+		this.modeller = modeller;
+		this.fact = fact;
+	}
 
-    protected Control createDialogArea(final Composite parent) {
+	protected Control createDialogArea(final Composite parent) {
 
-        Composite composite = (Composite) super.createDialogArea( parent );
+		Composite composite = (Composite) super.createDialogArea(parent);
 
-        createLabel( composite,
-                     "Field:" );
+		createLabel(composite, "Field:");
 
-        final Combo factsCombo = new Combo( composite,
-                                            SWT.READ_ONLY );
+		final Combo factsCombo = new Combo(composite, SWT.READ_ONLY);
 
-        String[] fields = getCompletion().getFieldCompletions( fact.factType );
-        factsCombo.add( "..." );
-        for ( int i = 0; i < fields.length; i++ ) {
-            factsCombo.add( fields[i] );
-        }
-        factsCombo.select( 0 );
+		String[] fields = getCompletion().getFieldCompletions(fact.factType);
+		factsCombo.add("...");
+		for (int i = 0; i < fields.length; i++) {
+			factsCombo.add(fields[i]);
+		}
+		factsCombo.select(0);
 
-        factsCombo.addListener( SWT.Selection,
-                                new Listener() {
-                                    public void handleEvent(Event event) {
+		factsCombo.addListener(SWT.Selection, new Listener() {
+			public void handleEvent(Event event) {
 
-                                        if ( factsCombo.getSelectionIndex() == 0 ) {
-                                            return;
-                                        }
+				if (factsCombo.getSelectionIndex() == 0) {
+					return;
+				}
 
-                                        // TODO Is NUMBERIC ok?
-                                        fact.addFieldValue( new ActionFieldValue( factsCombo.getText(),
-                                                                                  "",
-                                                                                  SuggestionCompletionEngine.TYPE_NUMERIC ) );
+				String fieldType = modeller.getSuggestionCompletionEngine()
+						.getFieldType(fact.factType, factsCombo.getText());
+				fact.addFieldValue(new ActionFieldValue(factsCombo.getText(),
+						"", fieldType));
 
-                                        modeller.setDirty( true );
-                                        modeller.reloadRhs();
-                                        close();
-                                    }
-                                } );
+				modeller.setDirty(true);
+				modeller.reloadRhs();
+				close();
+			}
+		});
 
-        return composite;
-    }
+		return composite;
+	}
 
-    public SuggestionCompletionEngine getCompletion() {
-        return modeller.getSuggestionCompletionEngine();
-    }
+	public SuggestionCompletionEngine getCompletion() {
+		return modeller.getSuggestionCompletionEngine();
+	}
 
 }




More information about the jboss-svn-commits mailing list