[jboss-svn-commits] JBL Code SVN: r14338 - in labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin: src/main/java/org/drools/eclipse/action and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 17 20:10:05 EDT 2007


Author: KrisVerlaenen
Date: 2007-08-17 20:10:05 -0400 (Fri, 17 Aug 2007)
New Revision: 14338

Added:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/icons/action.gif
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ActionWrapper.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/ActionEditPart.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionCellEditor.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionDialog.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionPropertyDescriptor.java
Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/ValueEditorTypeSelectionDialog.java
Log:
JBRULES-1098: Add action support in ruleflow
 - initial implementation of an action node, supporting MVEL consequence code

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/icons/action.gif
===================================================================
(Binary files differ)


Property changes on: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/icons/action.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java	2007-08-17 22:44:15 UTC (rev 14337)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -78,7 +78,6 @@
     public static void addDroolsLibraries(IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
     	IClasspathEntry[] classpathEntries = project.getRawClasspath();
     	for (int i = 0; i < classpathEntries.length; i++) {
-    		System.out.println(classpathEntries[i].getPath().toString());
     		if (NewDroolsProjectWizard.DROOLS_CLASSPATH_CONTAINER_PATH.equals(classpathEntries[i].getPath().toString())) {
     			return;
     		}

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java	2007-08-17 22:44:15 UTC (rev 14337)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -316,7 +316,6 @@
         while ((len = reader.read(buf)) >= 0) {
             text.append(buf, 0, len);
         }
-        System.out.println(text.toString());
         return text.toString();
     }
 

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ActionWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ActionWrapper.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ActionWrapper.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -0,0 +1,92 @@
+package org.drools.eclipse.flow.ruleflow.core;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor;
+import org.drools.ruleflow.core.ActionNode;
+import org.drools.ruleflow.core.impl.ActionNodeImpl;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * Wrapper for an action node.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ActionWrapper extends NodeWrapper {
+
+	private static final long serialVersionUID = -3618183280436588589L;
+
+	private IPropertyDescriptor[] descriptors;
+
+    public static final String ACTION = "Action";
+
+    public ActionWrapper() {
+        setNode(new ActionNodeImpl());
+        getActionNode().setName("Action");
+    }
+    
+    private void setDescriptors() {
+        descriptors = new IPropertyDescriptor[DefaultElementWrapper.descriptors.length + 1];
+        System.arraycopy(DefaultElementWrapper.descriptors, 0, descriptors, 0, DefaultElementWrapper.descriptors.length);
+        descriptors[descriptors.length - 1] = 
+            new ActionPropertyDescriptor(ACTION, "Action", getActionNode(), ((RuleFlowProcessWrapper) getParent()).getRuleFlowProcess());
+    }
+    
+    public ActionNode getActionNode() {
+        return (ActionNode) getNode();
+    }
+    
+    public IPropertyDescriptor[] getPropertyDescriptors() {
+    	if (descriptors == null) {
+    		setDescriptors();
+    	}
+        return descriptors;
+    }
+
+    public boolean acceptsIncomingConnection(ElementConnection connection) {
+        return getIncomingConnections().isEmpty();
+    }
+
+    public boolean acceptsOutgoingConnection(ElementConnection connection) {
+        return getOutgoingConnections().isEmpty();
+    }
+    
+    public Object getPropertyValue(Object id) {
+        if (ACTION.equals(id)) {
+        	Object action = getActionNode().getAction();
+            return action == null ? "" : action.toString();
+        }
+        return super.getPropertyValue(id);
+    }
+
+    public void resetPropertyValue(Object id) {
+        if (ACTION.equals(id)) {
+        	getActionNode().setAction(null);
+        } else {
+            super.resetPropertyValue(id);
+        }
+    }
+
+    public void setPropertyValue(Object id, Object value) {
+        if (ACTION.equals(id)) {
+        	getActionNode().setAction(value);
+        } else {
+            super.setPropertyValue(id, value);
+        }
+    }
+}

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java	2007-08-17 22:44:15 UTC (rev 14337)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -20,6 +20,7 @@
 
 import org.drools.eclipse.DroolsEclipsePlugin;
 import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.ruleflow.core.ActionWrapper;
 import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper;
 import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapperFactory;
 import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
@@ -139,6 +140,16 @@
         );
         entries.add(combined);
                                 
+        combined = new CombinedTemplateCreationEntry(
+                "Action",
+                "Create a new Action",
+                ActionWrapper.class,
+                new SimpleFactory(ActionWrapper.class),
+                ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/action.gif")), 
+                ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/action.gif"))
+            );
+            entries.add(combined);
+                                    
         drawer.addAll(entries);
         return drawer;
     }

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/ActionEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/ActionEditPart.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/ActionEditPart.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -0,0 +1,71 @@
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.eclipse.DroolsEclipsePlugin;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * EditPart for an action node.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ActionEditPart extends ElementEditPart {
+
+    private static final Color color = new Color(Display.getCurrent(), 255, 250, 205);
+    
+    protected IFigure createFigure() {
+        return new RuleSetNodeFigure();
+    }
+    
+    public static class RuleSetNodeFigure extends ElementFigure {
+        
+        private static final Image ICON = ImageDescriptor.createFromURL(
+    		DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/action.gif")).createImage();
+            
+        private RoundedRectangle rectangle;
+        
+        protected void customizeFigure() {
+            rectangle = new RoundedRectangle();
+            rectangle.setCornerDimensions(new Dimension(25, 25));
+            add(rectangle, 0);
+            rectangle.setBackgroundColor(color);
+            rectangle.setBounds(getBounds());
+            setSelected(false);
+            setIcon(ICON);
+        }
+        
+        public void setBounds(Rectangle rectangle) {
+            super.setBounds(rectangle);
+            this.rectangle.setBounds(rectangle);
+        }
+        
+        public void setSelected(boolean b) {
+            super.setSelected(b);
+            rectangle.setLineWidth(b ? 3 : 1);
+            repaint();
+        }
+    }
+}

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java	2007-08-17 22:44:15 UTC (rev 14337)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -17,6 +17,7 @@
 
 import org.drools.eclipse.flow.common.editor.core.ElementConnection;
 import org.drools.eclipse.flow.common.editor.editpart.ProcessEditPart;
+import org.drools.eclipse.flow.ruleflow.core.ActionWrapper;
 import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
 import org.drools.eclipse.flow.ruleflow.core.JoinWrapper;
 import org.drools.eclipse.flow.ruleflow.core.MilestoneWrapper;
@@ -55,6 +56,8 @@
             result = new MilestoneEditPart();
         } else if (model instanceof SubFlowWrapper) {
             result = new SubFlowEditPart();
+        } else if (model instanceof ActionWrapper) {
+            result = new ActionEditPart();
         } else {
             throw new IllegalArgumentException(
                 "Unknown model object " + model);

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionCellEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionCellEditor.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionCellEditor.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -0,0 +1,51 @@
+package org.drools.eclipse.flow.ruleflow.view.property.action;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.eclipse.flow.common.view.property.BeanDialogCellEditor;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
+import org.drools.ruleflow.core.ActionNode;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Cell editor for an action.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ActionCellEditor extends BeanDialogCellEditor {
+
+    private RuleFlowProcess process;
+    private ActionNode actionNode;
+    
+    public ActionCellEditor(Composite parent, RuleFlowProcess process, ActionNode actionNode) {
+        super(parent);
+        this.process = process;
+        this.actionNode = actionNode;
+    }
+
+    protected EditBeanDialog createDialog(Shell shell) {
+        return new ActionDialog(shell, process, actionNode);
+    }
+    
+    protected String getLabelText(Object value) {
+    	if (actionNode == null || actionNode.getAction() == null) {
+    		return "";
+    	}
+        return actionNode.getAction().toString();
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionDialog.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionDialog.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -0,0 +1,187 @@
+package org.drools.eclipse.flow.ruleflow.view.property.action;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.drools.eclipse.editors.scanners.DRLPartionScanner;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
+import org.drools.eclipse.flow.ruleflow.view.property.constraint.RuleFlowImportsDialog;
+import org.drools.ruleflow.core.ActionNode;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.ruleflow.core.impl.DroolsConsequenceAction;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+/**
+ * Dialog for editing an action.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ActionDialog extends EditBeanDialog {
+
+	private RuleFlowProcess process;
+	private TabFolder tabFolder;
+	private SourceViewer actionViewer;
+	//private ActionCompletionProcessor completionProcessor;
+
+	public ActionDialog(Shell parentShell, RuleFlowProcess process, ActionNode actionNode) {
+		super(parentShell, "Action editor");
+		this.process = process;
+		super.setValue(actionNode.getAction());
+	}
+	
+    public void setValue(Object value) {
+        // the value is automatically retrieved from the actionNode
+    	// and cannot be set manually
+    }
+
+	protected Object updateValue(Object value) {
+		if (tabFolder.getSelectionIndex() == 0) {
+			return getAction();
+		}
+		return null;
+	}
+
+	protected Point getInitialSize() {
+		return new Point(600, 450);
+	}
+
+	private Control createTextualEditor(Composite parent) {
+		actionViewer = new SourceViewer(parent, null, SWT.BORDER);
+//		actionViewer.configure(new DRLSourceViewerConfig(null) {
+//			public IReconciler getReconciler(ISourceViewer sourceViewer) {
+//				return null;
+//			}
+//			public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+//				ContentAssistant assistant = new ContentAssistant();
+//				completionProcessor = new ActionCompletionProcessor(process);
+//				assistant.setContentAssistProcessor(
+//					completionProcessor, IDocument.DEFAULT_CONTENT_TYPE);
+//				assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+//				return assistant;
+//			}
+//		});
+		Object action = getValue();
+		String value = null;
+		if (action instanceof DroolsConsequenceAction) {
+			value = ((DroolsConsequenceAction) action).getConsequence();
+		}
+		if (value == null) {
+			value = "";
+		}
+		IDocument document = new Document(value);
+		actionViewer.setDocument(document);
+		IDocumentPartitioner partitioner =
+            new FastPartitioner(
+                new DRLPartionScanner(),
+                DRLPartionScanner.LEGAL_CONTENT_TYPES);
+        partitioner.connect(document);
+        document.setDocumentPartitioner(partitioner);
+        actionViewer.getControl().addKeyListener(new KeyListener() {
+			public void keyPressed(KeyEvent e) {
+				if (e.character == ' ' && e.stateMask == SWT.CTRL) {
+					actionViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
+				}
+			}
+			public void keyReleased(KeyEvent e) {
+			}
+        });
+		return actionViewer.getControl();
+	}
+	
+	private Object getAction() {
+		return new DroolsConsequenceAction(actionViewer.getDocument().get());
+	}
+	
+	public Control createDialogArea(Composite parent) {
+		GridLayout layout = new GridLayout();
+		parent.setLayout(layout);
+		layout.numColumns = 2;
+
+		Composite top = new Composite(parent, SWT.NONE);
+		GridData gd = new GridData();
+		gd.horizontalSpan = 2;
+		gd.grabExcessHorizontalSpace = true;
+		top.setLayoutData(gd);
+
+		layout = new GridLayout();
+		layout.numColumns = 3;
+		top.setLayout(layout);
+
+		Button importButton = new Button(top, SWT.PUSH);
+		importButton.setText("Imports ...");
+		importButton.setFont(JFaceResources.getDialogFont());
+		importButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent event) {
+				importButtonPressed();
+			}
+		});
+		gd = new GridData();
+		gd.horizontalAlignment = GridData.END;
+		importButton.setLayoutData(gd);
+
+		tabFolder = new TabFolder(parent, SWT.NONE);
+		gd = new GridData();
+		gd.horizontalSpan = 3;
+		gd.grabExcessHorizontalSpace = true;
+		gd.grabExcessVerticalSpace = true;
+		gd.verticalAlignment = GridData.FILL;
+		gd.horizontalAlignment = GridData.FILL;
+		tabFolder.setLayoutData(gd);
+		TabItem textEditorTab = new TabItem(tabFolder, SWT.NONE);
+		textEditorTab.setText("Textual Editor");
+
+		textEditorTab.setControl(createTextualEditor(tabFolder));
+		return tabFolder;
+	}
+	
+	private void importButtonPressed() {
+		final Runnable r = new Runnable() {
+			public void run() {
+				RuleFlowImportsDialog dialog =
+					new RuleFlowImportsDialog(getShell(), process);
+				dialog.create();
+				int code = dialog.open();
+				if (code != CANCEL) {
+					List imports = dialog.getImports();
+					process.setImports(imports);
+//					completionProcessor.reset();
+				}
+			}
+		};
+		r.run();
+	}
+}

Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionPropertyDescriptor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionPropertyDescriptor.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/action/ActionPropertyDescriptor.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -0,0 +1,51 @@
+package org.drools.eclipse.flow.ruleflow.view.property.action;
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.ruleflow.core.ActionNode;
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+/**
+ * Property descriptor for an action.
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ActionPropertyDescriptor extends PropertyDescriptor {
+    
+    private RuleFlowProcess process;
+    private ActionNode actionNode;
+    
+    public ActionPropertyDescriptor(Object id, String displayName, ActionNode actionNode, RuleFlowProcess process) {
+        super(id, displayName);
+        this.actionNode = actionNode;
+        this.process = process;
+    }
+    
+    public RuleFlowProcess getProcess() {
+        return process;
+    }
+    
+    public CellEditor createPropertyEditor(Composite parent) {
+    	ActionCellEditor editor = new ActionCellEditor(parent, process, actionNode);
+        if (getValidator() != null) {
+            editor.setValidator(getValidator());
+        }
+        return editor;
+    }
+}

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/ValueEditorTypeSelectionDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/ValueEditorTypeSelectionDialog.java	2007-08-17 22:44:15 UTC (rev 14337)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/ValueEditorTypeSelectionDialog.java	2007-08-18 00:10:05 UTC (rev 14338)
@@ -47,9 +47,6 @@
         valueTypeCombo.addModifyListener( new ModifyListener() {
             public void modifyText(ModifyEvent e) {
 
-                System.out.println( "Modify event " + valueTypeCombo.getSelectionIndex() );
-                System.out.println( "setting constraint for " + constraint );
-
                 switch ( valueTypeCombo.getSelectionIndex() ) {
                     case 0 :
                         constraint.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;




More information about the jboss-svn-commits mailing list