Bug 481994 - Some XxxFeatureForPattern classes call
ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo

Cleaned-up, so that all methods (canUndo/Redo, preUndo/Redo, undo/redo,
postUndo/Redo) try to delegate to the pattern methods in case the
pattern implement ICustonUndoablePattern or ICustomUndoRedoPattern for
all methods implemented by the interfaces. In case a method is part of
both interfaces first ICustomUndoablePattern is checked for, because
that is the older interface (to keep compatibility).
This change might modify the behavior for certain tools that rely on the
old, not really consistent behavior.

Change-Id: Ic3ffed5ea6549ca272f043e7eaf65b0db388721f
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/AddFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/AddFeatureForPattern.java
index 4f7af00..72c8919 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/AddFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/AddFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -75,6 +76,8 @@
 	public boolean canUndo(IContext context) {
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -84,6 +87,9 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -112,6 +118,8 @@
 	public boolean canRedo(IContext context) {
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -121,6 +129,9 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
@@ -128,8 +139,8 @@
 	 */
 	@Override
 	public void postRedo(IContext context) {
-		if (pattern instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) pattern).redo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postRedo(this, context);
 		}
 	}
 
@@ -138,5 +149,8 @@
 	 * @deprecated use {@link #postRedo(IContext)} instead
 	 */
 	public void redo(IContext context) {
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).redo(this, context);
+		}
 	}
 }
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateConnectionFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateConnectionFeatureForPattern.java
index 0f41afb..8265d0b 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateConnectionFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateConnectionFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
  *    mgorning - Bug 329517 - state call backs during creation of a connection
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -36,7 +37,7 @@
  */
 public class CreateConnectionFeatureForPattern extends AbstractCreateConnectionFeature implements
 		ICustomUndoableFeature, ICustomAbortableUndoRedoFeature {
-	private IConnectionPattern delegate;
+	private IConnectionPattern pattern;
 
 	/**
 	 * Creates a new {@link CreateConnectionFeatureForPattern}.
@@ -48,30 +49,30 @@
 	 */
 	public CreateConnectionFeatureForPattern(IFeatureProvider featureProvider, IConnectionPattern pattern) {
 		super(featureProvider, pattern.getCreateName(), pattern.getCreateDescription());
-		delegate = pattern;
+		this.pattern = pattern;
 	}
 
 	public boolean canCreate(ICreateConnectionContext context) {
-		boolean ret = delegate.canCreate(context);
+		boolean ret = pattern.canCreate(context);
 		return ret;
 	}
 
 	public boolean canStartConnection(ICreateConnectionContext context) {
-		return delegate.canStartConnection(context);
+		return pattern.canStartConnection(context);
 	}
 
 	public Connection create(ICreateConnectionContext context) {
-		return delegate.create(context);
+		return pattern.create(context);
 	}
 
 	@Override
 	public String getCreateImageId() {
-		return delegate.getCreateImageId();
+		return pattern.getCreateImageId();
 	}
 
 	@Override
 	public String getCreateLargeImageId() {
-		return delegate.getCreateLargeImageId();
+		return pattern.getCreateLargeImageId();
 	}
 
 	/**
@@ -79,16 +80,18 @@
 	 */
 	@Override
 	public boolean isAbort() {
-		if (delegate instanceof ICustomAbortableUndoRedoPattern) {
-			return ((ICustomAbortableUndoRedoPattern) delegate).isAbort();
+		if (pattern instanceof ICustomAbortableUndoRedoPattern) {
+			return ((ICustomAbortableUndoRedoPattern) pattern).isAbort();
 		}
 		return false;
 	}
 
 	@Override
 	public boolean canUndo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canUndo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -98,6 +101,9 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -105,8 +111,8 @@
 	 */
 	@Override
 	public void postUndo(IContext context) {
-		if (delegate instanceof ICustomAbortableUndoRedoPattern) {
-			((ICustomAbortableUndoRedoPattern) delegate).postUndo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postUndo(this, context);
 		}
 	}
 
@@ -115,8 +121,8 @@
 	 * @deprecated use {@link #postUndo(IContext)} instead
 	 */
 	public void undo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).undo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).undo(this, context);
 		}
 	}
 
@@ -124,8 +130,10 @@
 	 * @since 0.8
 	 */
 	public boolean canRedo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canRedo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -135,6 +143,9 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
@@ -142,8 +153,8 @@
 	 */
 	@Override
 	public void postRedo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).redo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postRedo(this, context);
 		}
 	}
 
@@ -152,26 +163,29 @@
 	 * @deprecated use {@link #postRedo(IContext)} instead
 	 */
 	public void redo(IContext context) {
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).redo(this, context);
+		}
 	}
 
 	@Override
 	public void startConnecting() {
-		delegate.startConnecting();
+		pattern.startConnecting();
 	}
 
 	@Override
 	public void endConnecting() {
-		delegate.endConnecting();
+		pattern.endConnecting();
 	}
 
 	@Override
 	public void attachedToSource(ICreateConnectionContext context) {
-		delegate.attachedToSource(context);
+		pattern.attachedToSource(context);
 	}
 
 	@Override
 	public void canceledAttaching(ICreateConnectionContext context) {
-		delegate.canceledAttaching(context);
+		pattern.canceledAttaching(context);
 	}
 
 	/**
@@ -181,6 +195,6 @@
 	 * @since 0.10
 	 */
 	public IConnectionPattern getPattern() {
-		return delegate;
+		return pattern;
 	}
 }
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateFeatureForPattern.java
index 9baaf8d..4e15daa 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/CreateFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -95,6 +96,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -104,6 +107,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -135,6 +142,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -144,6 +153,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
@@ -152,8 +165,8 @@
 	@Override
 	public void postRedo(IContext context) {
 		IPattern pattern = delegate.getPattern();
-		if (pattern instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) pattern).redo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postRedo(this, context);
 		}
 	}
 
@@ -162,5 +175,9 @@
 	 * @deprecated use {@link #postRedo(IContext)} instead
 	 */
 	public void redo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).redo(this, context);
+		}
 	}
 }
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DeleteFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DeleteFeatureForPattern.java
index 8048eb8..0133f7a 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DeleteFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DeleteFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2012, 2014 Volker Wegert and others.
+ * Copyright (c) 2012, 2015 Volker Wegert and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
  *    mwenz - Bug 453553 - Provide an abort possibility for delete and remove features in case 'pre' methods fail
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -103,6 +104,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -112,6 +115,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -139,6 +146,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -148,6 +157,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DirectEditingFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DirectEditingFeatureForPattern.java
index 2be778a..ec56042 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DirectEditingFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/DirectEditingFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -37,7 +38,7 @@
  */
 public class DirectEditingFeatureForPattern extends AbstractDirectEditingFeature implements ICustomUndoableFeature,
 		ICustomAbortableUndoRedoFeature {
-	private IDirectEditing delegate;
+	private IDirectEditing pattern;
 
 	/**
 	 * Creates a new {@link DirectEditingFeatureForPattern}.
@@ -49,64 +50,64 @@
 	 */
 	public DirectEditingFeatureForPattern(IFeatureProvider featureProvider, IDirectEditing pattern) {
 		super(featureProvider);
-		delegate = pattern;
+		this.pattern = pattern;
 	}
 
 	@Override
 	public boolean canDirectEdit(IDirectEditingContext context) {
-		return delegate.canDirectEdit(context);
+		return pattern.canDirectEdit(context);
 	}
 
 	@Override
 	public String checkValueValid(String value, IDirectEditingContext context) {
-		return delegate.checkValueValid(value, context);
+		return pattern.checkValueValid(value, context);
 	}
 
 	@Override
 	public String completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context) {
-		return delegate.completeValue(value, caretPos, choosenValue, context);
+		return pattern.completeValue(value, caretPos, choosenValue, context);
 	}
 
 	@Override
 	public String[] getPossibleValues(IDirectEditingContext context) {
-		return delegate.getPossibleValues(context);
+		return pattern.getPossibleValues(context);
 	}
 
 	@Override
 	public String[] getValueProposals(String value, int caretPos, IDirectEditingContext context) {
-		return delegate.getValueProposals(value, caretPos, context);
+		return pattern.getValueProposals(value, caretPos, context);
 	}
 
 	@Override
 	public boolean isAutoCompletionEnabled() {
-		return delegate.isAutoCompletionEnabled();
+		return pattern.isAutoCompletionEnabled();
 	}
 
 	@Override
 	public boolean isCompletionAvailable() {
-		return delegate.isCompletionAvailable();
+		return pattern.isCompletionAvailable();
 	}
 
 	@Override
 	public boolean stretchFieldToFitText() {
-		return delegate.stretchFieldToFitText();
+		return pattern.stretchFieldToFitText();
 	}
 
 	public int getEditingType() {
-		return delegate.getEditingType();
+		return pattern.getEditingType();
 	}
 
 	public String getInitialValue(IDirectEditingContext context) {
-		return delegate.getInitialValue(context);
+		return pattern.getInitialValue(context);
 	}
 
 	public void setValue(String value, IDirectEditingContext context) {
-		delegate.setValue(value, context);
+		pattern.setValue(value, context);
 	}
 
 	@Override
 	public IProposalSupport getProposalSupport() {
-		return delegate.getProposalSupport();
+		return pattern.getProposalSupport();
 	}
 
 	/**
@@ -114,16 +115,18 @@
 	 */
 	@Override
 	public boolean isAbort() {
-		if (delegate instanceof ICustomAbortableUndoRedoPattern) {
-			return ((ICustomAbortableUndoRedoPattern) delegate).isAbort();
+		if (pattern instanceof ICustomAbortableUndoRedoPattern) {
+			return ((ICustomAbortableUndoRedoPattern) pattern).isAbort();
 		}
 		return false;
 	}
 
 	@Override
 	public boolean canUndo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canUndo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -133,6 +136,9 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -140,8 +146,8 @@
 	 */
 	@Override
 	public void postUndo(IContext context) {
-		if (delegate instanceof ICustomUndoRedoPattern) {
-			((ICustomUndoRedoPattern) delegate).postUndo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postUndo(this, context);
 		}
 	}
 
@@ -150,8 +156,8 @@
 	 * @deprecated use {@link #postUndo(IContext)} instead
 	 */
 	public void undo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).undo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).undo(this, context);
 		}
 	}
 
@@ -159,8 +165,10 @@
 	 * @since 0.8
 	 */
 	public boolean canRedo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canRedo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -170,6 +178,9 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
@@ -177,8 +188,8 @@
 	 */
 	@Override
 	public void postRedo(IContext context) {
-		if (delegate instanceof ICustomUndoRedoPattern) {
-			((ICustomUndoRedoPattern) delegate).postRedo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postRedo(this, context);
 		}
 	}
 
@@ -187,8 +198,8 @@
 	 * @deprecated use {@link #postRedo(IContext)} instead
 	 */
 	public void redo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).redo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).redo(this, context);
 		}
 	}
 }
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/LayoutFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/LayoutFeatureForPattern.java
index 9452982..74fe687 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/LayoutFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/LayoutFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -75,6 +76,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -84,6 +87,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -115,6 +122,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -124,6 +133,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java
index 77f3eab..01663e2 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -75,6 +76,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -84,6 +87,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -115,6 +122,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -124,6 +133,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java
index 3a14d66..2a7c627 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mlypik - Bug 401792 - Disable starting reconnection
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -41,7 +42,7 @@
 		ICustomUndoableFeature, ICustomAbortableUndoRedoFeature {
 
 	private static final String NAME = Messages.ReconnectionFeatureForPattern_0_xfld;
-	private IReconnection delegate;
+	private IReconnection pattern;
 
 	/**
 	 * Creates a new {@link ReconnectionFeatureForPattern}.
@@ -53,30 +54,30 @@
 	 */
 	public ReconnectionFeatureForPattern(IFeatureProvider fp, IReconnection pattern) {
 		super(fp);
-		this.delegate = pattern;
+		this.pattern = pattern;
 	}
 
 	public boolean canReconnect(IReconnectionContext context) {
-		return delegate.canReconnect(context);
+		return pattern.canReconnect(context);
 	}
 
 	public void postReconnect(IReconnectionContext context) {
-		delegate.postReconnect(context);
+		pattern.postReconnect(context);
 	}
 
 	public void preReconnect(IReconnectionContext context) {
-		delegate.preReconnect(context);
+		pattern.preReconnect(context);
 	}
 
 	public void reconnect(IReconnectionContext context) {
-		delegate.reconnect(context);
+		pattern.reconnect(context);
 	}
 
 	/**
 	 * @since 0.9
 	 */
 	public void canceledReconnect(IReconnectionContext context) {
-		delegate.canceledReconnect(context);
+		pattern.canceledReconnect(context);
 	}
 
 	public boolean canExecute(IContext context) {
@@ -103,16 +104,18 @@
 	 */
 	@Override
 	public boolean isAbort() {
-		if (delegate instanceof ICustomAbortableUndoRedoPattern) {
-			return ((ICustomAbortableUndoRedoPattern) delegate).isAbort();
+		if (pattern instanceof ICustomAbortableUndoRedoPattern) {
+			return ((ICustomAbortableUndoRedoPattern) pattern).isAbort();
 		}
 		return false;
 	}
 
 	@Override
 	public boolean canUndo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canUndo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -122,6 +125,9 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -129,8 +135,8 @@
 	 */
 	@Override
 	public void postUndo(IContext context) {
-		if (delegate instanceof ICustomUndoRedoPattern) {
-			((ICustomUndoRedoPattern) delegate).postUndo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postUndo(this, context);
 		}
 	}
 
@@ -139,8 +145,8 @@
 	 * @deprecated use {@link #postUndo(IContext)} instead
 	 */
 	public void undo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).undo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).undo(this, context);
 		}
 	}
 
@@ -148,8 +154,10 @@
 	 * @since 0.8
 	 */
 	public boolean canRedo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			return ((ICustomUndoablePattern) delegate).canRedo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -159,6 +167,9 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
@@ -166,8 +177,8 @@
 	 */
 	@Override
 	public void postRedo(IContext context) {
-		if (delegate instanceof ICustomUndoRedoPattern) {
-			((ICustomUndoRedoPattern) delegate).postRedo(this, context);
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).postRedo(this, context);
 		}
 	}
 
@@ -176,8 +187,8 @@
 	 * @deprecated use {@link #postRedo(IContext)} instead
 	 */
 	public void redo(IContext context) {
-		if (delegate instanceof ICustomUndoablePattern) {
-			((ICustomUndoablePattern) delegate).redo(this, context);
+		if (pattern instanceof ICustomUndoablePattern) {
+			((ICustomUndoablePattern) pattern).redo(this, context);
 		}
 	}
 
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/RemoveFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/RemoveFeatureForPattern.java
index a118eca..ade7408 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/RemoveFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/RemoveFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2013, 2014 Volker Wegert and others.
+ * Copyright (c) 2013, 2015 Volker Wegert and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@
  *    mwenz - Bug 390331 - preDelete and postDelete not called for Patterns 
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
  *    mwenz - Bug 453553 - Provide an abort possibility for delete and remove features in case 'pre' methods fail
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -104,6 +105,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -113,6 +116,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -140,6 +147,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -149,6 +158,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ResizeShapeFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ResizeShapeFeatureForPattern.java
index f8b3d0f..68ab3bb 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ResizeShapeFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ResizeShapeFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -90,6 +91,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -99,6 +102,10 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -130,6 +137,8 @@
 		IPattern pattern = delegate.getPattern();
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -139,6 +148,10 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		IPattern pattern = delegate.getPattern();
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**
diff --git a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java
index 3846ead..4bfaefc 100644
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java
+++ b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * <copyright>
  *
- * Copyright (c) 2005, 2014 SAP AG.
+ * Copyright (c) 2005, 2015 SAP AG.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
  *    mwenz - Bug 324859 - Need Undo/Redo support for Non-EMF based domain objects
  *    mwenz - Bug 325084 - Provide documentation for Patterns
  *    mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
+ *    mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
  *
  * </copyright>
  *
@@ -88,6 +89,8 @@
 	public boolean canUndo(IContext context) {
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canUndo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
 		}
 		return super.canUndo(context);
 	}
@@ -97,6 +100,9 @@
 	 */
 	@Override
 	public void preUndo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preUndo(this, context);
+		}
 	}
 
 	/**
@@ -125,6 +131,8 @@
 	public boolean canRedo(IContext context) {
 		if (pattern instanceof ICustomUndoablePattern) {
 			return ((ICustomUndoablePattern) pattern).canRedo(this, context);
+		} else if (pattern instanceof ICustomUndoRedoPattern) {
+			return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
 		}
 		return true;
 	}
@@ -134,6 +142,9 @@
 	 */
 	@Override
 	public void preRedo(IContext context) {
+		if (pattern instanceof ICustomUndoRedoPattern) {
+			((ICustomUndoRedoPattern) pattern).preRedo(this, context);
+		}
 	}
 
 	/**