[jbosstools-commits] JBoss Tools SVN: r9421 - in trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor: core and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 30 06:08:06 EDT 2008


Author: koen.aers at jboss.com
Date: 2008-07-30 06:08:06 -0400 (Wed, 30 Jul 2008)
New Revision: 9421

Removed:
   trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/ConnectionFactory.java
Modified:
   trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/PaletteFactory.java
   trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java
   trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java
Log:
refactor PaletteFactory, ditch ConnectionFactory

Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/PaletteFactory.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/PaletteFactory.java	2008-07-30 10:07:26 UTC (rev 9420)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/PaletteFactory.java	2008-07-30 10:08:06 UTC (rev 9421)
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.gef.palette.ConnectionCreationToolEntry;
 import org.eclipse.gef.palette.MarqueeToolEntry;
 import org.eclipse.gef.palette.PaletteContainer;
 import org.eclipse.gef.palette.PaletteDrawer;
@@ -28,11 +27,6 @@
 import org.eclipse.gef.palette.PaletteRoot;
 import org.eclipse.gef.palette.SelectionToolEntry;
 import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.gef.requests.CreationFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.jboss.tools.flow.JBossToolsProcessPlugin;
-import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
-import org.jboss.tools.flow.editor.core.ConnectionFactory;
 
 /**
  * Factory for creating a RuleFlow palette.
@@ -41,12 +35,6 @@
  */
 public abstract class PaletteFactory {
     
-    protected ConnectionFactory connectionFactory;
-    
-    public PaletteFactory(ConnectionFactory connectionFactory) {
-        this.connectionFactory = connectionFactory;
-    }
-
     public PaletteRoot createPalette() {
         PaletteRoot palette = new PaletteRoot();
         palette.addAll(createCategories(palette));
@@ -72,22 +60,6 @@
         tool = new MarqueeToolEntry();
         entries.add(tool);
         
-//        tool = new ConnectionCreationToolEntry(
-//            "Connection Creation",
-//            "Creating connections",
-//            new CreationFactory() {
-//                public Object getNewObject() {
-//                	return connectionFactory.createElementConnection();
-//                }
-//                public Object getObjectType() {
-//                	return AbstractConnectionWrapper.class;
-//                }
-//            },
-//            ImageDescriptor.createFromURL(JBossToolsProcessPlugin.getDefault().getBundle().getEntry("icons/connection.gif")), 
-//            ImageDescriptor.createFromURL(JBossToolsProcessPlugin.getDefault().getBundle().getEntry("icons/connection.gif"))
-//        );
-//        entries.add(tool);
-        
         controlGroup.addAll(entries);
         return controlGroup;
     }

Deleted: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/ConnectionFactory.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/ConnectionFactory.java	2008-07-30 10:07:26 UTC (rev 9420)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/ConnectionFactory.java	2008-07-30 10:08:06 UTC (rev 9421)
@@ -1,28 +0,0 @@
-package org.jboss.tools.flow.editor.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.
- */
-
-/**
- * Factory for creating element connections.
- * 
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public interface ConnectionFactory {
-	
-	AbstractConnectionWrapper createElementConnection();
-	
-}

Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java	2008-07-30 10:07:26 UTC (rev 9420)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java	2008-07-30 10:08:06 UTC (rev 9421)
@@ -29,8 +29,9 @@
 import org.eclipse.gef.EditPolicy;
 import org.eclipse.gef.editparts.AbstractConnectionEditPart;
 import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
 import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
-import org.jboss.tools.flow.editor.core.ConnectionFactory;
 import org.jboss.tools.flow.editor.core.ModelEvent;
 import org.jboss.tools.flow.editor.core.ModelListener;
 import org.jboss.tools.flow.editor.policy.ConnectionBendpointEditPolicy;
@@ -55,7 +56,14 @@
         installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new ConnectionBendpointEditPolicy());
     }
     
-    protected abstract ConnectionFactory getElementConnectionFactory();
+    protected CreationFactory getElementConnectionFactory() {
+    	return new SimpleFactory(getElementConnectionType());
+    }
+    
+    
+    protected abstract Class<?> getElementConnectionType();
+    
+//    protected abstract ConnectionFactory getElementConnectionFactory();
 
     protected IFigure createFigure() {
         PolylineConnection result = new PolylineConnection();

Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java	2008-07-30 10:07:26 UTC (rev 9420)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java	2008-07-30 10:08:06 UTC (rev 9421)
@@ -21,12 +21,12 @@
 import org.eclipse.gef.Request;
 import org.eclipse.gef.commands.Command;
 import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.CreationFactory;
 import org.eclipse.gef.requests.GroupRequest;
 import org.jboss.tools.flow.editor.command.DeleteConnectionCommand;
 import org.jboss.tools.flow.editor.command.SplitConnectionCommand;
 import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
 import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
-import org.jboss.tools.flow.editor.core.ConnectionFactory;
 import org.jboss.tools.flow.editor.core.NodeWrapper;
 import org.jboss.tools.flow.editor.editpart.ConnectionEditPart;
 
@@ -37,9 +37,11 @@
  */
 public class ConnectionEditPolicy extends org.eclipse.gef.editpolicies.ConnectionEditPolicy {
 
-	private ConnectionFactory elementConnectionFactory;
+//	private ConnectionFactory elementConnectionFactory;
 	
-	public void setElementConnectionFactory(ConnectionFactory elementConnectionFactory) {
+	private CreationFactory elementConnectionFactory;
+	
+	public void setElementConnectionFactory(CreationFactory elementConnectionFactory) {
 		this.elementConnectionFactory = elementConnectionFactory;
 	}
 	
@@ -69,7 +71,7 @@
     	}
         SplitConnectionCommand cmd = new SplitConnectionCommand();
         cmd.setElementConnection(((AbstractConnectionWrapper) getHost().getModel()));
-        cmd.setNewSecondConnection(elementConnectionFactory.createElementConnection());
+        cmd.setNewSecondConnection((AbstractConnectionWrapper)elementConnectionFactory.getNewObject());
         cmd.setParent(((AbstractFlowWrapper) ((ConnectionEditPart) getHost())
             .getSource().getParent().getModel()));
         cmd.setNewElement(((NodeWrapper) ((CreateRequest) request).getNewObject()));




More information about the jbosstools-commits mailing list