Index: src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java =================================================================== --- src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java (revision 27346) +++ src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java (working copy) @@ -199,12 +199,18 @@ int commandType = EXECUTE_COMMAND; Command undoCommand = ((org.eclipse.emf.common.command.CommandStack) fe.getSource()) .getUndoCommand(); + while (undoCommand != null && undoCommand instanceof CommandWrapper) { + undoCommand = ((CommandWrapper) undoCommand).getCommand(); + } Command redoCommand = ((org.eclipse.emf.common.command.CommandStack) fe.getSource()) .getRedoCommand(); - if (undoCommand != null || rawCommand.equals(undoCommand)) { + while (redoCommand != null && redoCommand instanceof CommandWrapper) { + redoCommand = ((CommandWrapper) redoCommand).getCommand(); + } + if (undoCommand != null && rawCommand.equals(undoCommand)) { commandType = EXECUTE_COMMAND; } - if (redoCommand != null || rawCommand.equals(redoCommand)) { + if (redoCommand != null && rawCommand.equals(redoCommand)) { commandType = UNDO_COMMAND; } if (rawCommand instanceof CompoundCommand) { @@ -435,7 +441,8 @@ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next(); AbstractSmooksGraphicalModel target = treeNodeConnection.getTargetNode(); Object refValue = command.getValue(); - if(refValue == null) continue; + if (refValue == null) + continue; String refID = refValue.toString(); Object targetModel = AdapterFactoryEditingDomain.unwrap(target.getData()); if (targetModel instanceof EObject) { @@ -619,7 +626,6 @@ AbstractSmooksGraphicalModel gmodel = findGraphicalModel(object2); if (gmodel != null) { root.removeTreeNode(gmodel); - break; } } } else { @@ -719,8 +725,8 @@ (TransferDropTargetListener) new TemplateTransferDropTargetListener(getGraphicalViewer())); GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler(getGraphicalViewer()); - keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0), this.getActionRegistry().getAction( - ActionFactory.DELETE.getId())); + keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0), + this.getActionRegistry().getAction(ActionFactory.DELETE.getId())); ContextMenuProvider provider = getContextMenuProvider(); getGraphicalViewer().setContextMenu(provider); @@ -871,18 +877,19 @@ if (connectionModelFactory != null) { if (connectionModelFactory.hasConnection(model)) { - Collection cList = connectionModelFactory.createConnection(inputDataList, getSmooksResourceList(), root, model); - + Collection cList = connectionModelFactory.createConnection(inputDataList, + getSmooksResourceList(), root, model); + if (cList != null) { cs.addAll(cList); } } } - + if (cs.isEmpty()) { return null; } - + return cs; } @@ -947,9 +954,10 @@ public void createConnection(List children, List connections) { Object parentTask = taskType.getParent(); - - if(parentTask instanceof TaskType) { - if(((TaskType) parentTask).getId().equals(TaskTypeManager.TASK_ID_INPUT) && !taskType.getId().equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) { + + if (parentTask instanceof TaskType) { + if (((TaskType) parentTask).getId().equals(TaskTypeManager.TASK_ID_INPUT) + && !taskType.getId().equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) { for (AbstractSmooksGraphicalModel abstractSmooksGraphicalModel : children) { if (abstractSmooksGraphicalModel instanceof InputDataContianerModel) { Collection c = createConnection(abstractSmooksGraphicalModel); @@ -958,7 +966,7 @@ } break; } - } + } } else { for (AbstractSmooksGraphicalModel abstractSmooksGraphicalModel : children) { if (!(abstractSmooksGraphicalModel instanceof InputDataContianerModel)) { @@ -973,7 +981,7 @@ } } } - } + } } private boolean canCreateConnection(AbstractSmooksGraphicalModel model) { @@ -1037,10 +1045,11 @@ List childrenEditPart = rootEditPart.getChildren(); for (Iterator iterator = childrenEditPart.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); -// Object model = ((EditPart) object).getModel(); -// if (object instanceof InputDataContainerEditPart || model instanceof XSLTemplateGraphicalModel) { - SmooksUIUtils.expandGraphTree(expanedTreeNodeList, (TreeNodeEditPart) object); -// } + // Object model = ((EditPart) object).getModel(); + // if (object instanceof InputDataContainerEditPart || model + // instanceof XSLTemplateGraphicalModel) { + SmooksUIUtils.expandGraphTree(expanedTreeNodeList, (TreeNodeEditPart) object); + // } // if(model instanceof XSLTemplateGraphicalModel){ // ((TreeNodeEditPart) object).expandNode(); // if(!((TreeNodeEditPart) object).getChildren().isEmpty()){ @@ -1309,8 +1318,9 @@ public void selectionChanged(SelectionChangedEvent event) { updateActions(getSelectionActions()); - ISelectionProvider provider = ((SmooksTaskDetailsEditorSite)getSite()).getMultiPageEditor().getSite().getSelectionProvider(); - if(provider != null){ + ISelectionProvider provider = ((SmooksTaskDetailsEditorSite) getSite()).getMultiPageEditor().getSite() + .getSelectionProvider(); + if (provider != null) { provider.setSelection(event.getSelection()); } }