Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern
deprecated in Graphiti 0.12.0
Change-Id: Ibbdbc73bbc150ed8b9f3ce24c3fdabc5f41d5e7d
diff --git a/plugins/org.eclipse.graphiti.pattern/.settings/.api_filters b/plugins/org.eclipse.graphiti.pattern/.settings/.api_filters
index 7898096..d06812e 100644
--- a/plugins/org.eclipse.graphiti.pattern/.settings/.api_filters
+++ b/plugins/org.eclipse.graphiti.pattern/.settings/.api_filters
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.graphiti.pattern" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="923795461">
+ <message_arguments>
+ <message_argument value="0.16.0"/>
+ <message_argument value="0.15.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.graphiti.pattern.ICustomUndoablePattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.ICustomUndoablePattern"/>
+ <message_argument value="org.eclipse.graphiti.pattern_0.16.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/pattern/AbstractBasePattern.java" type="org.eclipse.graphiti.pattern.AbstractBasePattern">
<filter id="574619656">
<message_arguments>
@@ -26,6 +42,76 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/graphiti/pattern/AddFeatureForPattern.java" type="org.eclipse.graphiti.pattern.AddFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.AddFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.AddFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/CreateConnectionFeatureForPattern.java" type="org.eclipse.graphiti.pattern.CreateConnectionFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.CreateConnectionFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.CreateConnectionFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/CreateFeatureForPattern.java" type="org.eclipse.graphiti.pattern.CreateFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.CreateFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.CreateFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/DeleteFeatureForPattern.java" type="org.eclipse.graphiti.pattern.DeleteFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.DeleteFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.DeleteFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/DirectEditingFeatureForPattern.java" type="org.eclipse.graphiti.pattern.DirectEditingFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.DirectEditingFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.DirectEditingFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/pattern/IConnectionPattern.java" type="org.eclipse.graphiti.pattern.IConnectionPattern">
<filter id="571473929">
<message_arguments>
@@ -96,7 +182,47 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/graphiti/pattern/LayoutFeatureForPattern.java" type="org.eclipse.graphiti.pattern.LayoutFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.LayoutFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.LayoutFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java" type="org.eclipse.graphiti.pattern.MoveShapeFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.MoveShapeFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.MoveShapeFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java" type="org.eclipse.graphiti.pattern.ReconnectionFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.ReconnectionFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.ReconnectionFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
<filter id="574619656">
<message_arguments>
<message_argument value="IReconnectionFeature"/>
@@ -104,4 +230,46 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/graphiti/pattern/RemoveFeatureForPattern.java" type="org.eclipse.graphiti.pattern.RemoveFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.RemoveFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.RemoveFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/ResizeShapeFeatureForPattern.java" type="org.eclipse.graphiti.pattern.ResizeShapeFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.ResizeShapeFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.ResizeShapeFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java" type="org.eclipse.graphiti.pattern.UpdateFeatureForPattern">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.UpdateFeatureForPattern"/>
+ <message_argument value="redo(IContext)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.pattern.UpdateFeatureForPattern"/>
+ <message_argument value="undo(IContext)"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
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 72c8919..d0e4c1c 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -20,7 +21,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IAddContext;
import org.eclipse.graphiti.features.context.IContext;
@@ -36,8 +36,7 @@
* @noinstantiate This class is not intended to be instantiated by clients.
* @since 0.12
*/
-public class AddFeatureForPattern extends AbstractAddFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class AddFeatureForPattern extends AbstractAddFeature implements ICustomAbortableUndoRedoFeature {
private IAdd pattern;
/**
@@ -74,9 +73,7 @@
@Override
public boolean canUndo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -104,21 +101,9 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -143,14 +128,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.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 8265d0b..22006d9 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
* mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
* mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -21,7 +22,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.ICreateConnectionContext;
@@ -36,7 +36,7 @@
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CreateConnectionFeatureForPattern extends AbstractCreateConnectionFeature implements
- ICustomUndoableFeature, ICustomAbortableUndoRedoFeature {
+ ICustomAbortableUndoRedoFeature {
private IConnectionPattern pattern;
/**
@@ -88,9 +88,7 @@
@Override
public boolean canUndo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -118,21 +116,9 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -158,16 +144,6 @@
}
}
- /**
- * @since 0.8
- * @deprecated use {@link #postRedo(IContext)} instead
- */
- public void redo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).redo(this, context);
- }
- }
-
@Override
public void startConnecting() {
pattern.startConnecting();
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 4e15daa..1559cc7 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -20,7 +21,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.ICreateContext;
@@ -33,8 +33,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class CreateFeatureForPattern extends AbstractCreateFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class CreateFeatureForPattern extends AbstractCreateFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
/**
@@ -94,9 +93,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -126,23 +123,10 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -169,15 +153,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.8
- * @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 0133f7a..e551943 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, 2015 Volker Wegert and others.
+ * Copyright (c) 2012, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -24,7 +25,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.IDeleteContext;
@@ -40,8 +40,7 @@
*
* @since 0.8.0
*/
-public class DeleteFeatureForPattern extends DefaultDeleteFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class DeleteFeatureForPattern extends DefaultDeleteFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
@@ -102,9 +101,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -132,21 +129,9 @@
}
}
- /**
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -174,16 +159,6 @@
}
}
- /**
- * @deprecated use {@link #postRedo(IContext)} instead
- */
- public void redo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).redo(this, context);
- }
- }
-
@Override
public boolean hasDoneChanges() {
IPattern pattern = delegate.getPattern();
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 ec56042..f1a8ea0 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
* mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
* mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -21,7 +22,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.IDirectEditingContext;
@@ -36,8 +36,8 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class DirectEditingFeatureForPattern extends AbstractDirectEditingFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class DirectEditingFeatureForPattern extends AbstractDirectEditingFeature
+ implements ICustomAbortableUndoRedoFeature {
private IDirectEditing pattern;
/**
@@ -123,9 +123,7 @@
@Override
public boolean canUndo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -153,21 +151,9 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -192,14 +178,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.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/ICustomUndoablePattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ICustomUndoablePattern.java
deleted file mode 100644
index 313f61a..0000000
--- a/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ICustomUndoablePattern.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * <copyright>
- *
- * Copyright (c) 2005, 2011 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * mwenz - Bug 324859 - initial API, implementation and documentation
- *
- * </copyright>
- *
- *******************************************************************************/
-package org.eclipse.graphiti.pattern;
-
-import org.eclipse.graphiti.features.IFeature;
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-
-/**
- * This interface can by used by customers and implemented within any pattern to
- * signal the need for additional undo or redo work. When a pattern implements
- * this interface, and the framework performs an undo or a redo, the framework
- * will call the contained methods.
- * <p>
- * Implementing this interface is especially helpful if customers want to
- * implement undo/redo functionality for non-EMF changes, e.g. for non-EMF
- * domain models. Note that any EMF-model changes (including the changes done to
- * the graphical representation (Graphiti {@link PictogramElement}s and
- * {@link GraphicsAlgorithm}s will by handled automatically by the Graphiti
- * framework no matter if this interface is implemented by a pattern or not.
- *
- * @since 0.8.0
- */
-public interface ICustomUndoablePattern {
-
- /**
- * Decides if the processed pattern functionality can be undone.
- *
- * @param feature
- * this is the instance of the {@link IFeature} object that was
- * in use when executing the pattern functionality
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- *
- * @return true if the feature can be undone, false if not
- */
- boolean canUndo(IFeature feature, IContext context);
-
- /**
- * This method will be called to actually do the work needed for undo.
- * Customers may revert their non-EMF changes done by the pattern
- * functionality here.
- *
- * @param feature
- * this is the instance of the {@link IFeature} object that was
- * in use when executing the pattern functionality
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- */
- void undo(IFeature feature, IContext context);
-
- /**
- * Decides if the processed pattern functionality can be re-done.
- *
- * @param feature
- * this is the instance of the {@link IFeature} object that was
- * in use when executing the pattern functionality
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- *
- * @return true if the feature can be re-done, false if not
- */
- boolean canRedo(IFeature feature, IContext context);
-
- /**
- * This method will be called to actually do the work needed for redo.
- * Customers may re-apply their non-EMF changes done by the pattern
- * functionality here. (Usually it might be sufficient to delegate to the
- * execution method of the pattern functionality.)
- *
- * @param feature
- * this is the instance of the {@link IFeature} object that was
- * in use when executing the pattern functionality
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- */
- void redo(IFeature feature, IContext 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 74fe687..1cb5fc2 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -20,7 +21,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.ILayoutContext;
@@ -33,8 +33,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class LayoutFeatureForPattern extends AbstractLayoutFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class LayoutFeatureForPattern extends AbstractLayoutFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
/**
@@ -74,9 +73,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -106,23 +103,10 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -149,15 +133,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.8
- * @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/MoveShapeFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/MoveShapeFeatureForPattern.java
index 01663e2..bc5193d 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -20,7 +21,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.IMoveShapeContext;
@@ -33,8 +33,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class MoveShapeFeatureForPattern extends AbstractMoveShapeFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class MoveShapeFeatureForPattern extends AbstractMoveShapeFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
/**
@@ -74,9 +73,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -106,23 +103,10 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -149,15 +133,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.8
- * @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/ReconnectionFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/ReconnectionFeatureForPattern.java
index 2a7c627..908a7a6 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
@@ -15,6 +15,7 @@
* 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -22,7 +23,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.IReconnectionFeature;
import org.eclipse.graphiti.features.context.IContext;
@@ -39,7 +39,7 @@
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ReconnectionFeatureForPattern extends AbstractFeature implements IReconnectionFeature,
- ICustomUndoableFeature, ICustomAbortableUndoRedoFeature {
+ ICustomAbortableUndoRedoFeature {
private static final String NAME = Messages.ReconnectionFeatureForPattern_0_xfld;
private IReconnection pattern;
@@ -112,9 +112,7 @@
@Override
public boolean canUndo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -142,21 +140,9 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -183,16 +169,6 @@
}
/**
- * @since 0.8
- * @deprecated use {@link #postRedo(IContext)} instead
- */
- public void redo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).redo(this, context);
- }
- }
-
- /**
* @since 0.11
*/
@Override
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 ade7408..8ef1297 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, 2015 Volker Wegert and others.
+ * Copyright (c) 2013, 2018 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
@@ -18,6 +18,7 @@
* 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -25,7 +26,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.IRemoveContext;
@@ -41,8 +41,7 @@
*
* @since 0.8.0
*/
-public class RemoveFeatureForPattern extends DefaultRemoveFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class RemoveFeatureForPattern extends DefaultRemoveFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
@@ -103,9 +102,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -133,21 +130,9 @@
}
}
- /**
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -175,16 +160,6 @@
}
}
- /**
- * @deprecated use {@link #postRedo(IContext)} instead
- */
- public void redo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).redo(this, context);
- }
- }
-
@Override
public boolean hasDoneChanges() {
IPattern pattern = delegate.getPattern();
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 68ab3bb..f7c9211 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
* mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
* mwenz - Bug 481994 - Some XxxFeatureForPattern classes call ICustomUndoablePattern#redo instead of ICustomUndoRedoPattern#postRedo
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -21,7 +22,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.IResizeConfiguration;
import org.eclipse.graphiti.features.context.IContext;
@@ -35,8 +35,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class ResizeShapeFeatureForPattern extends DefaultResizeShapeFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class ResizeShapeFeatureForPattern extends DefaultResizeShapeFeature implements ICustomAbortableUndoRedoFeature {
private IFeatureForPattern delegate;
@@ -89,9 +88,7 @@
@Override
public boolean canUndo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -121,23 +118,10 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
IPattern pattern = delegate.getPattern();
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -164,15 +148,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.8
- * @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/UpdateFeatureForPattern.java b/plugins/org.eclipse.graphiti.pattern/src/org/eclipse/graphiti/pattern/UpdateFeatureForPattern.java
index 4bfaefc..916eeb4 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, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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 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
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -20,7 +21,6 @@
package org.eclipse.graphiti.pattern;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.IReason;
import org.eclipse.graphiti.features.context.IContext;
@@ -36,8 +36,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
-public class UpdateFeatureForPattern extends AbstractUpdateFeature implements ICustomUndoableFeature,
- ICustomAbortableUndoRedoFeature {
+public class UpdateFeatureForPattern extends AbstractUpdateFeature implements ICustomAbortableUndoRedoFeature {
private IUpdate pattern;
@@ -87,9 +86,7 @@
@Override
public boolean canUndo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canUndo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canUndo(this, context);
}
return super.canUndo(context);
@@ -117,21 +114,9 @@
/**
* @since 0.8
- * @deprecated use {@link #postUndo(IContext)} instead
- */
- public void undo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- ((ICustomUndoablePattern) pattern).undo(this, context);
- }
- }
-
- /**
- * @since 0.8
*/
public boolean canRedo(IContext context) {
- if (pattern instanceof ICustomUndoablePattern) {
- return ((ICustomUndoablePattern) pattern).canRedo(this, context);
- } else if (pattern instanceof ICustomUndoRedoPattern) {
+ if (pattern instanceof ICustomUndoRedoPattern) {
return ((ICustomUndoRedoPattern) pattern).canRedo(this, context);
}
return true;
@@ -156,14 +141,4 @@
((ICustomUndoRedoPattern) pattern).postRedo(this, context);
}
}
-
- /**
- * @since 0.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.ui/src/org/eclipse/graphiti/ui/internal/editor/GFWorkspaceCommandStackImpl.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GFWorkspaceCommandStackImpl.java
index b3022b0..978f3d4 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GFWorkspaceCommandStackImpl.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GFWorkspaceCommandStackImpl.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
@@ -20,6 +20,7 @@
* Laurent Le Moux - mwenz - Bug 475240 - Malfunctioning redo GFWorkspaceCommandStackImpl
* mwenz - Bug 477083 - Read-write transaction not created if another thread is using runExclusive()
* mwenz - Bug 481994 - canUndo/canRedo called twice
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -38,7 +39,6 @@
import org.eclipse.graphiti.IExecutionInfo;
import org.eclipse.graphiti.features.ICustomAbortableUndoRedoFeature;
import org.eclipse.graphiti.features.ICustomUndoRedoFeature;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
import org.eclipse.graphiti.features.IFeature;
import org.eclipse.graphiti.features.IFeatureAndContext;
import org.eclipse.graphiti.features.context.IContext;
@@ -160,9 +160,7 @@
for (int i = 0; i < executionList.length; i++) {
IFeature feature = executionList[i].getFeature();
IContext context = executionList[i].getContext();
- if (feature instanceof ICustomUndoableFeature) {
- canRedo[i] = ((ICustomUndoableFeature) feature).canRedo(context);
- } else if (feature instanceof ICustomUndoRedoFeature) {
+ if (feature instanceof ICustomUndoRedoFeature) {
canRedo[i] = ((ICustomUndoRedoFeature) feature).canRedo(context);
} else {
canRedo[i] = true;
@@ -201,16 +199,6 @@
for (int i = 0; i < executionList.length; i++) {
IFeature feature = executionList[i].getFeature();
IContext context = executionList[i].getContext();
- if (feature instanceof ICustomUndoableFeature) {
- ICustomUndoableFeature undoableFeature = (ICustomUndoableFeature) feature;
- if (canRedo[i]) {
- undoableFeature.redo(context);
- }
- }
- }
- for (int i = 0; i < executionList.length; i++) {
- IFeature feature = executionList[i].getFeature();
- IContext context = executionList[i].getContext();
if (feature instanceof ICustomUndoRedoFeature) {
ICustomUndoRedoFeature undoableFeature = (ICustomUndoRedoFeature) feature;
if (canRedo[i]) {
@@ -269,16 +257,6 @@
for (int i = executionList.length - 1; i >= 0; i--) {
IFeature feature = executionList[i].getFeature();
IContext context = executionList[i].getContext();
- if (feature instanceof ICustomUndoableFeature) {
- ICustomUndoableFeature undoableFeature = (ICustomUndoableFeature) feature;
- if (canUndo[i]) {
- undoableFeature.undo(context);
- }
- }
- }
- for (int i = executionList.length - 1; i >= 0; i--) {
- IFeature feature = executionList[i].getFeature();
- IContext context = executionList[i].getContext();
if (feature instanceof ICustomUndoRedoFeature) {
ICustomUndoRedoFeature undoableFeature = (ICustomUndoRedoFeature) feature;
if (canUndo[i]) {
diff --git a/plugins/org.eclipse.graphiti/.settings/.api_filters b/plugins/org.eclipse.graphiti/.settings/.api_filters
index 1989b34..a11f614 100644
--- a/plugins/org.eclipse.graphiti/.settings/.api_filters
+++ b/plugins/org.eclipse.graphiti/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.graphiti" version="2">
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.graphiti.features.ICustomUndoableFeature">
+ <filter comment="Removal of deprecated ICustomUndoableFeature" id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.graphiti.features.ICustomUndoableFeature"/>
+ <message_argument value="org.eclipse.graphiti_0.16.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/graphiti/features/context/impl/DeleteContext.java" type="org.eclipse.graphiti.features.context.impl.DeleteContext">
<filter id="576720909">
<message_arguments>
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/features/ICustomUndoableFeature.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/features/ICustomUndoableFeature.java
deleted file mode 100644
index 5ad74df..0000000
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/features/ICustomUndoableFeature.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * <copyright>
- *
- * Copyright (c) 2005, 2014 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * mwenz - Bug 324859 - initial API, implementation and documentation
- * mwenz - Bug 443304 - Improve undo/redo handling in Graphiti features
- *
- * </copyright>
- *
- *******************************************************************************/
-package org.eclipse.graphiti.features;
-
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-
-/**
- * This interface can by used and implemented by customers within any feature to
- * signal the need for additional undo or redo work. When a feature implements
- * this interface, and the framework performs an undo or a redo, the framework
- * will call the contained methods.
- * <p>
- * Implementing this interface is especially helpful if customers want to
- * implement undo/redo functionality for non-EMF changes, e.g. for non-EMF
- * domain models. Note that any EMF-model change (including the changes done to
- * the graphical representation (Graphiti {@link PictogramElement}s and
- * {@link GraphicsAlgorithm}s will by handled automatically by the Graphiti
- * framework no matter if this interface is implemented by a feature or not. The
- * feature may use the context object (e.g. the contained properties set) passed
- * to the contained methods while executing the feature in order to collect any
- * information needed for undo.
- *
- * @since 0.8.0
- * @deprecated Use {@link ICustomUndoRedoFeature} instead
- */
-public interface ICustomUndoableFeature {
-
- /**
- * Decides if the changes done by a processed feature can be undone.
- * <p>
- * Note that as soon as any feature reports <code>false</code> here, also
- * all previous entries in the command stack are no longer reachable for
- * undo.
- * <p>
- * Note: this method with exactly the same signature is also already part of
- * the {@link IFeature} contract. It is repeated here for transparency
- * purposes only.
- *
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature.
- *
- * @return true if the feature can be undone, false if not
- */
- boolean canUndo(IContext context);
-
- /**
- * This method will be called to actually do the work needed for undo.
- * Customers may revert their non-EMF changes done by the feature here.
- *
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- */
- void undo(IContext context);
-
- /**
- * Decides if the processed feature can be re-done.
- * <p>
- * Note that as soon as any feature reports <code>false</code> here, also
- * all consecutive entries in the command stack are no longer reachable for
- * redo.
- *
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- *
- * @return true if the feature can be re-done, false if not
- */
- boolean canRedo(IContext context);
-
- /**
- * This method will be called to actually do the work needed for redo.
- * Customers may re-apply their non-EMF changes done by the feature here.
- * (Usually it might be sufficient to delegate to the execution method of
- * the feature.)
- *
- * @param context
- * this is the instance of the {@link IContext} object that was
- * in use when executing the feature
- */
- void redo(IContext context);
-}
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/AllTests.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/AllTests.java
index fc62549..b8ef0b4 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/AllTests.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/AllTests.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2015 SAP AG.
+ * Copyright (c) 2005, 2018 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
@@ -17,6 +17,7 @@
* mwenz - Bug 453553 - Provide an abort possibility for delete and remove features in case 'pre' methods fail
* mwenz - Bug 467476 - NullPointerException in GFPaletteRoot.createModelIndependentTools
* mwenz - Bug 470455 - Difficulty in creating associations
+ * mwenz - Bug 472955 - Remove ICustomUndoableFeature and ICustomUndoablePattern deprecated in Graphiti 0.12.0
*
* </copyright>
*
@@ -33,10 +34,9 @@
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({ PackageTest.class, CommandStackTest.class, MigrationServiceTest.class,
- CustomUndoableFeatureTest.class, RollbackTest.class, LayoutServiceTest.class, CommandTest.class,
- CompatibilityTests.class, GFFigureUtilTest.class, CustomUndoRedoFeatureTest.class,
- DefaultDeleteFeatureTest.class, DefaultRemoveFeatureTest.class, GFPaletteRootTest.class,
- CreateConnectionCommandTest.class, ResourceManagerTest.class })
+@Suite.SuiteClasses({ PackageTest.class, CommandStackTest.class, MigrationServiceTest.class, RollbackTest.class,
+ LayoutServiceTest.class, CommandTest.class, CompatibilityTests.class, GFFigureUtilTest.class,
+ CustomUndoRedoFeatureTest.class, DefaultDeleteFeatureTest.class, DefaultRemoveFeatureTest.class,
+ GFPaletteRootTest.class, CreateConnectionCommandTest.class, ResourceManagerTest.class })
public class AllTests {
}
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java
deleted file mode 100644
index e635e0f..0000000
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * <copyright>
- *
- * Copyright (c) 2005, 2012 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * mwenz - Bug 324859 - initial API, implementation and documentation
- * cbrand - Bug 377475 - Fix AbstractCustomFeature.execute and canExecute
- *
- * </copyright>
- *
- *******************************************************************************/
-package org.eclipse.graphiti.ui.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.easymock.EasyMock;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.graphiti.dt.IDiagramTypeProvider;
-import org.eclipse.graphiti.features.ICustomUndoableFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.context.IReconnectionContext;
-import org.eclipse.graphiti.features.context.impl.ReconnectionContext;
-import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
-import org.eclipse.graphiti.features.impl.DefaultReconnectionFeature;
-import org.eclipse.graphiti.internal.command.CommandContainer;
-import org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-import org.eclipse.graphiti.mm.pictograms.Connection;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.tb.IToolBehaviorProvider;
-import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramBehavior;
-import org.eclipse.graphiti.ui.editor.IDiagramContainerUI;
-import org.eclipse.graphiti.ui.internal.command.GefCommandWrapper;
-import org.eclipse.graphiti.ui.internal.command.ReconnectCommand;
-import org.eclipse.graphiti.ui.internal.config.IConfigurationProviderInternal;
-import org.eclipse.graphiti.ui.internal.editor.GFCommandStack;
-import org.eclipse.graphiti.ui.platform.IConfigurationProvider;
-import org.eclipse.graphiti.ui.services.GraphitiUi;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-@SuppressWarnings("restriction")
-public class CustomUndoableFeatureTest extends GFAbstractTestCase {
-
- @BeforeClass
- public static void prepareClass() {
- }
-
- @Before
- public void initializeTest() {
- }
-
- @Test
- public void testPositive() {
- TransactionalEditingDomain editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
- IToolBehaviorProvider toolBehaviorProvider = EasyMock.createNiceMock(IToolBehaviorProvider.class);
- EasyMock.replay(toolBehaviorProvider);
-
- IDiagramTypeProvider diagramTypeProvider = EasyMock.createNiceMock(IDiagramTypeProvider.class);
- IFeatureProvider featureProvider = EasyMock.createNiceMock(IFeatureProvider.class);
- EasyMock.replay(featureProvider);
-
- EasyMock.expect(diagramTypeProvider.getCurrentToolBehaviorProvider()).andReturn(toolBehaviorProvider).anyTimes();
- EasyMock.replay(diagramTypeProvider);
-
- IConfigurationProvider configurationProvider = EasyMock.createNiceMock(IConfigurationProviderInternal.class);
- EasyMock.expect(configurationProvider.getDiagramTypeProvider()).andReturn(diagramTypeProvider).anyTimes();
- EasyMock.replay(configurationProvider);
- GFCommandStack commandStack = new GFCommandStack(configurationProvider, editingDomain);
-
- ICustomContext context = EasyMock.createNiceMock(ICustomContext.class);
- EasyMock.replay(context);
-
- TestCustomFeature feature = new TestCustomFeature(featureProvider);
- GenericFeatureCommandWithContext featureCommand = new GenericFeatureCommandWithContext(feature, context);
-
- CommandContainer commandContainer = new CommandContainer(featureProvider);
- commandContainer.add(featureCommand);
-
- GefCommandWrapper commandWrapper = new GefCommandWrapper(commandContainer, editingDomain);
- commandStack.execute(commandWrapper);
-
- // Check that feature can be undone
- assertTrue("Executed command must be undoable", commandStack.canUndo());
-
- // Check that undo is called
- commandStack.undo();
- assertTrue("Undo() must have been called", feature.undoCalled);
-
- // Check that feature can be redone
- assertTrue("Executed command must be redoable", commandStack.canRedo());
-
- // Check that redo is called
- commandStack.redo();
- assertTrue("Redo() must have been called", feature.redoCalled);
- }
-
- @Test
- public void testReconnect() {
- TransactionalEditingDomain editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
- IToolBehaviorProvider toolBehaviorProvider = EasyMock.createNiceMock(IToolBehaviorProvider.class);
- EasyMock.replay(toolBehaviorProvider);
-
- IDiagramTypeProvider diagramTypeProvider = EasyMock.createNiceMock(IDiagramTypeProvider.class);
- IFeatureProvider featureProvider = EasyMock.createNiceMock(IFeatureProvider.class);
- TestReconnectionFeature feature = new TestReconnectionFeature(featureProvider);
- EasyMock.expect(featureProvider.getReconnectionFeature(EasyMock.<IReconnectionContext> anyObject()))
- .andReturn(feature).anyTimes();
- EasyMock.replay(featureProvider);
-
- EasyMock.expect(diagramTypeProvider.getCurrentToolBehaviorProvider()).andReturn(toolBehaviorProvider).anyTimes();
- EasyMock.expect(diagramTypeProvider.getFeatureProvider()).andReturn(featureProvider).anyTimes();
- EasyMock.replay(diagramTypeProvider);
-
- IDiagramContainerUI diagramContainer = EasyMock.createNiceMock(IDiagramContainerUI.class);
-
- DiagramBehavior diagramBehavior = new MockDiagramBehavior(diagramContainer, editingDomain);
-
- IConfigurationProvider configurationProvider = EasyMock.createNiceMock(IConfigurationProviderInternal.class);
- EasyMock.expect(configurationProvider.getDiagramTypeProvider()).andReturn(diagramTypeProvider).anyTimes();
- EasyMock.expect(configurationProvider.getDiagramBehavior()).andReturn(diagramBehavior).anyTimes();
- EasyMock.replay(configurationProvider);
- GFCommandStack commandStack = new GFCommandStack(configurationProvider, editingDomain);
-
- ICustomContext context = EasyMock.createNiceMock(ICustomContext.class);
- EasyMock.replay(context);
-
- Connection connection = EasyMock.createNiceMock(Connection.class);
- Anchor oldAnchor = EasyMock.createNiceMock(Anchor.class);
- Anchor newAnchor = EasyMock.createNiceMock(Anchor.class);
- PictogramElement newTargetPictogramElement = EasyMock.createNiceMock(PictogramElement.class);
-
- ReconnectCommand reconnectCommand = new ReconnectCommand(configurationProvider, connection, oldAnchor,
- newAnchor, newTargetPictogramElement, ReconnectionContext.RECONNECT_SOURCE, null);
- commandStack.execute(reconnectCommand);
-
- // Check that feature can be undone
- assertTrue("Executed command must be undoable", commandStack.canUndo());
-
- // Check that undo is called
- commandStack.undo();
- assertTrue("Undo() must have been called", feature.undoCalled);
-
- // Check that feature can be redone
- assertTrue("Executed command must be redoable", commandStack.canRedo());
-
- // Check that redo is called
- commandStack.redo();
- assertTrue("Redo() must have been called", feature.redoCalled);
- }
-
- private class TestCustomFeature extends AbstractCustomFeature implements ICustomUndoableFeature {
-
- public boolean undoCalled = false;
- public boolean redoCalled = false;
- private ICustomContext context = null;
-
- public TestCustomFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- return true;
- }
-
- public void execute(ICustomContext context) {
- // Do nothing
- this.context = context;
- }
-
- @Override
- public boolean canUndo(IContext context) {
- return true;
- }
-
- public void undo(IContext context) {
- undoCalled = true;
- assertEquals("Context object must be the same as in execute", this.context, context);
- }
-
- public boolean canRedo(IContext context) {
- return true;
- }
-
- public void redo(IContext context) {
- redoCalled = true;
- assertEquals("Context object must be the same as in execute", this.context, context);
- }
- }
-
- private class TestReconnectionFeature extends DefaultReconnectionFeature implements ICustomUndoableFeature {
-
- public boolean undoCalled = false;
- public boolean redoCalled = false;
- private IReconnectionContext context = null;
-
- public TestReconnectionFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public boolean canReconnect(IReconnectionContext context) {
- return true;
- }
-
- @Override
- public boolean canUndo(IContext context) {
- return true;
- }
-
- public void undo(IContext context) {
- undoCalled = true;
- assertEquals("Context object must be the same as in execute", this.context, context);
- }
-
- public boolean canRedo(IContext context) {
- return true;
- }
-
- public void redo(IContext context) {
- redoCalled = true;
- assertEquals("Context object must be the same as in execute", this.context, context);
- }
-
- public void preReconnect(IReconnectionContext context) {
- // Do nothing
- this.context = context;
- }
-
- public void postReconnect(IReconnectionContext context) {
- }
-
- public void canceledReconnect(IReconnectionContext context) {
- }
-
- }
-
- public class MockDiagramBehavior extends DiagramBehavior {
-
- private TransactionalEditingDomain editingDomain;
-
- public MockDiagramBehavior(IDiagramContainerUI diagramContainer, TransactionalEditingDomain editingDomain) {
- super(diagramContainer);
- this.editingDomain = editingDomain;
- }
-
- @Override
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
- }
-
-}