Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbblajer2007-08-22 14:18:08 +0000
committerbblajer2007-08-22 14:18:08 +0000
commitca522413ba3a87ef8db6c98f94f7b19dd24c13d8 (patch)
treeca53b77d934ae33ecbd98c5ddde47c431777dd26 /plugins/org.eclipse.gmf.runtime.lite/src/org
parentcd0f054be623f574868f12a73d4331700491dbf4 (diff)
downloadorg.eclipse.gmf-tooling-ca522413ba3a87ef8db6c98f94f7b19dd24c13d8.tar.gz
org.eclipse.gmf-tooling-ca522413ba3a87ef8db6c98f94f7b19dd24c13d8.tar.xz
org.eclipse.gmf-tooling-ca522413ba3a87ef8db6c98f94f7b19dd24c13d8.zip
It should not be possible to delete a link from diagram via UI (links are always canonical).
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite/src/org')
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/ComponentEditPolicyEx.java14
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/requests/RequestConstants.java8
2 files changed, 22 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/ComponentEditPolicyEx.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/ComponentEditPolicyEx.java
index 29dd5a60f..28f985aae 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/ComponentEditPolicyEx.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/policies/ComponentEditPolicyEx.java
@@ -28,6 +28,17 @@ public class ComponentEditPolicyEx extends ComponentEditPolicy {
* @return Command <code>null</code> or a contribution to the delete
*/
protected Command getDeleteViewCommand(GroupRequest deleteRequest) {
+ return getDeleteViewCommand(deleteRequest, false);
+ }
+
+ /**
+ * Override to contribute to the command that deletes the notational view.
+ * @param deleteRequest the DeleteRequest
+ * @param isForced <code>true</code> if the command is requested as a part of view deletion of
+ * the edit part this edit part depends on (container or a link end).
+ * @return Command <code>null</code> or a contribution to the delete
+ */
+ protected Command getDeleteViewCommand(GroupRequest deleteRequest, boolean isForced) {
return null;
}
@@ -36,6 +47,9 @@ public class ComponentEditPolicyEx extends ComponentEditPolicy {
if (RequestConstants.REQ_DELETE_VIEW.equals(request.getType())) {
return getDeleteViewCommand((GroupRequest) request);
}
+ if (RequestConstants.REQ_FORCED_DELETE_VIEW.equals(request.getType())) {
+ return getDeleteViewCommand((GroupRequest) request, true);
+ }
return super.getCommand(request);
}
}
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/requests/RequestConstants.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/requests/RequestConstants.java
index 009b18287..022eae1c1 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/requests/RequestConstants.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/requests/RequestConstants.java
@@ -26,4 +26,12 @@ public interface RequestConstants extends org.eclipse.gef.RequestConstants {
* <p/>Requests with this type may be safely cast to {@link org.eclipse.gef.requests.GroupRequest}.
*/
public static final String REQ_DELETE_VIEW = "delete_view"; //$NON-NLS-1$
+ /**
+ * Constant used to indicate that the notational view of the receiver of the Request should be unconditionally deleted,
+ * while the underlying model element should be preserved.
+ * <p/>Requests with this type may be safely cast to {@link org.eclipse.gef.requests.GroupRequest}.
+ * <p/>Note that this is an internal request that is used by edit parts whose view
+ * is being deleted to unconditionally delete the view of the associated links. Clients are expected to use {@link #REQ_DELETE_VIEW} instead.
+ */
+ public static final String REQ_FORCED_DELETE_VIEW = "forced_delete_view"; //$NON-NLS-1$
}

Back to the top