Author: DartPeng
Date: 2010-12-13 05:38:59 -0500 (Mon, 13 Dec 2010)
New Revision: 27401
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/command/DeleteConnectionCommand.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/CreateConnectionCommand.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeModel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerTemplateConnectionEditPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerXMLNodeEditPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateConnection.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateNodeGraphicalModel.java
Log:
JBIDE-7833
Fixed
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -3229,7 +3229,9 @@
if (Collection.class.isAssignableFrom(clazz)) {
return true;
}
+ if(clazz.isArray()) return true;
} catch (Throwable t) {
+ t.printStackTrace();
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/command/DeleteConnectionCommand.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/command/DeleteConnectionCommand.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/command/DeleteConnectionCommand.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -20,7 +20,7 @@
*/
public class DeleteConnectionCommand extends Command {
- private TreeNodeConnection connection;
+ protected TreeNodeConnection connection;
public DeleteConnectionCommand(TreeNodeConnection connection) {
Assert.isNotNull(connection);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/CreateConnectionCommand.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/CreateConnectionCommand.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/CreateConnectionCommand.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -90,4 +90,14 @@
public void setTarget(AbstractSmooksGraphicalModel target) {
this.target = target;
}
+
+ public TreeNodeConnection getTempConnectionHandle() {
+ return tempConnectionHandle;
+ }
+
+ public void setTempConnectionHandle(TreeNodeConnection tempConnectionHandle) {
+ this.tempConnectionHandle = tempConnectionHandle;
+ }
+
+
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeConnection.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -29,11 +29,11 @@
protected int severity = IFieldMarker.TYPE_NONE;
- private Object data;
+ protected Object data;
- private AbstractSmooksGraphicalModel sourceNode;
+ protected AbstractSmooksGraphicalModel sourceNode;
- private AbstractSmooksGraphicalModel targetNode;
+ protected AbstractSmooksGraphicalModel targetNode;
protected List<String> markerMessages = null;
@@ -81,7 +81,11 @@
}
public void connectTarget() {
+// if(data instanceof RemoveResult) {
+// ((TreeNodeModel)targetNode.getModelRootNode()).reAddMappingConnections(((RemoveResult)data).getRemoveMappings());
+// }
targetNode.addTargetConnection(this, sourceNode);
+
}
public void disconnectSource() {
@@ -90,9 +94,9 @@
public void disconnectTarget() {
targetNode.removeTargetConnection(this);
- if(data instanceof RemoveResult) {
- ((TreeNodeModel)targetNode.getModelRootNode()).removeMappingConnections(((RemoveResult)data).getRemoveMappings());
- }
+// if(data instanceof RemoveResult) {
+// ((TreeNodeModel)targetNode.getModelRootNode()).removeMappingConnections(((RemoveResult)data).getRemoveMappings());
+// }
}
public AbstractSmooksGraphicalModel getSourceNode() {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeModel.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/model/TreeNodeModel.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -12,7 +12,6 @@
import org.jboss.tools.smooks.configuration.editors.xml.TagObject;
import org.jboss.tools.smooks.configuration.editors.xml.TagPropertyObject;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
-import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerTemplateNodeGraphicalModel;
import org.jboss.tools.smooks.templating.template.CollectionMapping;
import org.jboss.tools.smooks.templating.template.Mapping;
@@ -201,35 +200,69 @@
return parentNode.getParentCollectionConnection();
}
+
+// public void reAddMappingConnections(List<Mapping> removeMappings){
+// if(removeMappings == null || removeMappings.isEmpty()) {
+// return;
+// }
+//
+// // Remove from all the children first...
+// for(AbstractSmooksGraphicalModel child : children) {
+// if(child instanceof TreeNodeModel) {
+// ((TreeNodeModel)child).reAddMappingConnections(removeMappings);
+// }
+// }
+// for (Mapping mapping : removeMappings) {
+// Object mappingObj = mapping.getMappingNode();
+// if(this.data == mappingObj){
+//
+// }
+// }
+// // Now remove from this node...
+// if(targetConnections != null && !targetConnections.isEmpty()) {
+// List<TreeNodeConnection> connectionsToAdd = new
ArrayList<TreeNodeConnection>();
+// for(TreeNodeConnection connection : targetConnections) {
+// Object connectionData = connection.getData();
+// if(connectionData instanceof Mapping) {
+// if(removeMappings.contains(connectionData)) {
+// connectionsToAdd.add(connection);
+// }
+// }
+// }
+// for(TreeNodeConnection connection : connectionsToAdd) {
+// connection.connect();
+// }
+// }
+// }
- public void removeMappingConnections(List<Mapping> removeMappings) {
- if(removeMappings == null || removeMappings.isEmpty()) {
- return;
- }
-
- // Remove from all the children first...
- for(AbstractSmooksGraphicalModel child : children) {
- if(child instanceof TreeNodeModel) {
- ((TreeNodeModel)child).removeMappingConnections(removeMappings);
- }
- }
-
- // Now remove from this node...
- if(targetConnections != null && !targetConnections.isEmpty()) {
- List<TreeNodeConnection> connectionsToRemove = new
ArrayList<TreeNodeConnection>();
- for(TreeNodeConnection connection : targetConnections) {
- Object connectionData = connection.getData();
- if(connectionData instanceof Mapping) {
- if(removeMappings.contains(connectionData)) {
- connectionsToRemove.add(connection);
- }
- }
- }
- for(TreeNodeConnection connection : connectionsToRemove) {
- connection.disconnect();
- }
- }
- }
+// public void removeMappingConnections(List<Mapping> removeMappings) {
+// if(removeMappings == null || removeMappings.isEmpty()) {
+// return;
+// }
+//
+// // Remove from all the children first...
+// for(AbstractSmooksGraphicalModel child : children) {
+// if(child instanceof TreeNodeModel) {
+// ((TreeNodeModel)child).removeMappingConnections(removeMappings);
+// }
+// }
+//
+// // Now remove from this node...
+// if(targetConnections != null && !targetConnections.isEmpty()) {
+// List<TreeNodeConnection> connectionsToRemove = new
ArrayList<TreeNodeConnection>();
+// for(TreeNodeConnection connection : targetConnections) {
+// Object connectionData = connection.getData();
+// if(connectionData instanceof Mapping) {
+// if(removeMappings.contains(connectionData)) {
+// connectionsToRemove.add(connection);
+// }
+// }
+// }
+// for(TreeNodeConnection connection : connectionsToRemove) {
+// connection.disconnect();
+// }
+// }
+// }
public void setText(String text) {
// if (text != null && !text.equals(this.text)) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerTemplateConnectionEditPart.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerTemplateConnectionEditPart.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerTemplateConnectionEditPart.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -10,24 +10,50 @@
******************************************************************************/
package org.jboss.tools.smooks.graphical.editors.editparts.freemarker;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.ConnectionEditPolicy;
+import org.eclipse.gef.requests.GroupRequest;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.xml.TagObject;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
+import org.jboss.tools.smooks.gef.tree.command.DeleteConnectionCommand;
import org.jboss.tools.smooks.gef.tree.editparts.TreeNodeConnectionEditPart;
+import org.jboss.tools.smooks.gef.tree.editpolicy.TreeNodeConnectionEditPolicy;
+import org.jboss.tools.smooks.gef.tree.editpolicy.TreeNodeEndpointEditPolicy;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
+import org.jboss.tools.smooks.gef.tree.model.TreeNodeModel;
import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerModelAnalyzer;
+import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerTemplateNodeGraphicalModel;
+import org.jboss.tools.smooks.templating.template.Mapping;
+import org.jboss.tools.smooks.templating.template.TemplateBuilder;
+import org.jboss.tools.smooks.templating.template.result.RemoveResult;
/**
* @author Dart
*
*/
-public class FreemarkerTemplateConnectionEditPart extends TreeNodeConnectionEditPart {
+public class FreemarkerTemplateConnectionEditPart extends
+ TreeNodeConnectionEditPart {
public FreemarkerTemplateConnectionEditPart() {
super();
}
+ @Override
+ protected void createEditPolicies() {
+ this.installEditPolicy(EditPolicy.CONNECTION_ROLE,
+ new FreemarkerTemplateConnectionEditPolicy());
+ this.installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
+ new TreeNodeEndpointEditPolicy());
+ }
+
/*
* (non-Javadoc)
*
@@ -39,11 +65,120 @@
AbstractSmooksGraphicalModel target = connection.getTargetNode();
Object data = target.getData();
if (data instanceof TagObject) {
- if (FreemarkerModelAnalyzer.isChoiceElement(((TagObject) data).getReferenceElement()))
{
- this.setMarkerImage(SmooksConfigurationActivator.getDefault().getImageRegistry().get(
- GraphicsConstants.IMAGE_XSL_CHOICE));
+ if (FreemarkerModelAnalyzer.isChoiceElement(((TagObject) data)
+ .getReferenceElement())) {
+ this.setMarkerImage(SmooksConfigurationActivator.getDefault()
+ .getImageRegistry()
+ .get(GraphicsConstants.IMAGE_XSL_CHOICE));
}
}
super.refreshVisuals();
}
+
+ public class FreemarkerTemplateConnectionEditPolicy extends
+ ConnectionEditPolicy {
+
+ @Override
+ protected Command getDeleteCommand(GroupRequest request) {
+ Object connection = getHost().getModel();
+ EditPart host = getHost();
+ if (connection != null && connection instanceof TreeNodeConnection) {
+ if (host instanceof TreeNodeConnectionEditPart) {
+ if (!((TreeNodeConnectionEditPart) host).isCanDelete()) {
+ return null;
+ }
+ }
+ DeleteFreeMarkerConnectionCommand command = new DeleteFreeMarkerConnectionCommand(
+ (TreeNodeConnection) connection);
+ return command;
+ }
+ return null;
+ }
+
+ }
+
+ public class DeleteFreeMarkerConnectionCommand extends
+ DeleteConnectionCommand {
+
+ private List<TreeNodeConnection> relatedConnections = new
ArrayList<TreeNodeConnection>();
+
+ public DeleteFreeMarkerConnectionCommand(TreeNodeConnection connection) {
+ super(connection);
+ }
+
+ @Override
+ public void execute() {
+ Object target = connection.getTargetNode();
+ if (target instanceof FreemarkerTemplateNodeGraphicalModel) {
+ RemoveResult removeResult;
+ try {
+ TemplateBuilder builder = ((FreemarkerTemplateNodeGraphicalModel) target)
+ .getTemplateBuilder();
+ Object mapping = connection.getData();
+ if (builder == null || mapping == null)
+ return;
+ if (mapping instanceof Mapping) {
+ relatedConnections.clear();
+ removeResult = builder.removeMapping((Mapping) mapping);
+ relatedConnections.addAll(removeMappingConnections(
+ removeResult.getRemoveMappings(),
+ (FreemarkerTemplateNodeGraphicalModel) target));
+ }
+ for (TreeNodeConnection con : relatedConnections) {
+ con.disconnect();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ super.execute();
+ }
+
+ @Override
+ public void redo() {
+ super.redo();
+ }
+
+ @Override
+ public void undo() {
+ super.undo();
+ for (TreeNodeConnection c : relatedConnections) {
+ c.connect();
+ }
+ }
+
+ public List<TreeNodeConnection> removeMappingConnections(
+ List<Mapping> removeMappings, AbstractSmooksGraphicalModel node) {
+ if (removeMappings == null || removeMappings.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ // Remove from all the children first...
+ for (AbstractSmooksGraphicalModel child : node.getChildren()) {
+ if (child instanceof TreeNodeModel) {
+ relatedConnections.addAll(removeMappingConnections(
+ removeMappings, (TreeNodeModel) child));
+ }
+ }
+
+ // Now remove from this node...
+ if (node.getTargetConnections() != null &&
!node.getTargetConnections().isEmpty()) {
+ List<TreeNodeConnection> connectionsToRemove = new
ArrayList<TreeNodeConnection>();
+ for (TreeNodeConnection connection : node
+ .getTargetConnections()) {
+ Object connectionData = connection.getData();
+ if (connectionData instanceof Mapping) {
+ for (Mapping mapping : removeMappings) {
+ if(mapping.getMappingNode() == ((Mapping)connectionData).getMappingNode()
&&
+ mapping.getSrcPath().equals(((Mapping)connectionData).getSrcPath())){
+ connectionsToRemove.add(connection);
+ }
+ }
+ }
+ }
+ return connectionsToRemove;
+ }
+ return Collections.emptyList();
+ }
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerXMLNodeEditPart.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerXMLNodeEditPart.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/freemarker/FreemarkerXMLNodeEditPart.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -11,6 +11,8 @@
package org.jboss.tools.smooks.graphical.editors.editparts.freemarker;
import java.beans.PropertyChangeEvent;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -21,11 +23,16 @@
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
+import org.jboss.tools.smooks.gef.tree.editparts.CreateConnectionCommand;
import org.jboss.tools.smooks.gef.tree.editparts.TreeNodeEditPart;
import org.jboss.tools.smooks.gef.tree.figures.TreeNodeFigure;
+import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeModel;
+import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerTemplateConnection;
import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerTemplateGraphicalModel;
+import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerTemplateNodeGraphicalModel;
import
org.jboss.tools.smooks.graphical.editors.model.freemarker.IFreemarkerTemplateModel;
+import org.jboss.tools.smooks.templating.template.Mapping;
import org.jboss.tools.smooks.templating.template.TemplateBuilder;
/**
@@ -165,4 +172,72 @@
refreshAllChildren(abstractSmooksGraphicalModel.getChildrenWithoutDynamic());
}
}
+
+ public class CreateFreemarkerXMLConnectionCommand extends CreateConnectionCommand{
+ private List<TreeNodeConnection> relatedConnections = new
ArrayList<TreeNodeConnection>();
+
+ public List<TreeNodeConnection> removeMappingConnections(
+ List<Mapping> removeMappings, AbstractSmooksGraphicalModel node) {
+ if (removeMappings == null || removeMappings.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ // Remove from all the children first...
+ for (AbstractSmooksGraphicalModel child : node.getChildren()) {
+ if (child instanceof TreeNodeModel) {
+ relatedConnections.addAll(removeMappingConnections(
+ removeMappings, (TreeNodeModel) child));
+ }
+ }
+
+ // Now remove from this node...
+ if (node.getTargetConnections() != null &&
!node.getTargetConnections().isEmpty()) {
+ List<TreeNodeConnection> connectionsToRemove = new
ArrayList<TreeNodeConnection>();
+ for (TreeNodeConnection connection : node
+ .getTargetConnections()) {
+ Object connectionData = connection.getData();
+ if (connectionData instanceof Mapping) {
+ for (Mapping mapping : removeMappings) {
+ if(mapping.getMappingNode() == ((Mapping)connectionData).getMappingNode()
&&
+ mapping.getSrcPath().equals(((Mapping)connectionData).getSrcPath())){
+ connectionsToRemove.add(connection);
+ }
+ }
+ }
+ }
+ return connectionsToRemove;
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void execute() {
+ super.execute();
+ Object target = getTempConnectionHandle().getTargetNode();
+ if (target instanceof FreemarkerTemplateNodeGraphicalModel) {
+ FreemarkerTemplateConnection connection =
(FreemarkerTemplateConnection)this.getTempConnectionHandle();
+ List<Mapping> removeMappings = connection.getRemoveMappings();
+ if(removeMappings!=null){
+ relatedConnections.clear();
+ relatedConnections.addAll(removeMappingConnections(removeMappings,
(FreemarkerTemplateNodeGraphicalModel)target));
+ for (TreeNodeConnection con : relatedConnections) {
+ con.disconnect();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void undo() {
+ super.undo();
+ for (TreeNodeConnection c : relatedConnections) {
+ c.connect();
+ }
+ }
+
+ }
+
+ public CreateConnectionCommand createCreateConnectionCommand() {
+ return new CreateFreemarkerXMLConnectionCommand();
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateConnection.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateConnection.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateConnection.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -10,12 +10,23 @@
******************************************************************************/
package org.jboss.tools.smooks.graphical.editors.model.freemarker;
+import java.util.List;
+
import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
+import org.jboss.tools.smooks.templating.template.Mapping;
/**
* @author Dart
*
*/
public class FreemarkerTemplateConnection extends TreeNodeConnection {
+ protected List<Mapping> removeMappings;
+ public void setRemoveMappingConnections(List<Mapping> removeMappings) {
+ this.removeMappings = removeMappings;
+ }
+
+ public List<Mapping> getRemoveMappings() {
+ return removeMappings;
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateNodeGraphicalModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateNodeGraphicalModel.java 2010-12-13
10:36:29 UTC (rev 27400)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerTemplateNodeGraphicalModel.java 2010-12-13
10:38:59 UTC (rev 27401)
@@ -58,7 +58,7 @@
this.domainProvider = domainProvider;
}
- protected TemplateBuilder getTemplateBuilder() {
+ public TemplateBuilder getTemplateBuilder() {
AbstractSmooksGraphicalModel parent = this;
while (parent != null
&& !(parent instanceof FreemarkerTemplateGraphicalModel)) {
@@ -181,7 +181,10 @@
}
connection.setData(mappingResult.getMapping());
- ((TreeNodeModel)getModelRootNode()).removeMappingConnections(mappingResult.getRemoveMappings());
+ if(connection instanceof FreemarkerTemplateConnection){
+ ((FreemarkerTemplateConnection)connection).setRemoveMappingConnections(mappingResult.getRemoveMappings());
+ }
+// ((TreeNodeModel)getModelRootNode()).removeMappingConnections(mappingResult.getRemoveMappings());
} else if (isMappingValueConnection(connection)) {
String mappingString = null;
@@ -349,7 +352,8 @@
public void removeTargetConnection(TreeNodeConnection connection) {
((TreeNodeModel)connection.getSourceNode()).getConnections().remove(connection);
getConnections().remove(connection);
-
+// changeFreemarkerContents();
+// super.removeTargetConnection(connection);
RemoveResult removeResult;
try {
TemplateBuilder builder = getTemplateBuilder();
@@ -358,9 +362,10 @@
return;
if (mapping instanceof Mapping) {
removeResult = builder.removeMapping((Mapping) mapping);
- changeFreemarkerContents();
+
connection.setData(removeResult);
}
+ changeFreemarkerContents();
super.removeTargetConnection(connection);
} catch (Exception e) {
e.printStackTrace();