Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/partialEditing/OperationHistoryListener.java')
-rw-r--r--deprecated/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/partialEditing/OperationHistoryListener.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/partialEditing/OperationHistoryListener.java b/deprecated/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/partialEditing/OperationHistoryListener.java
new file mode 100644
index 00000000000..9db63acc890
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.gmfdiag.xtext.glue/src/org/eclipse/papyrus/infra/gmfdiag/xtext/glue/partialEditing/OperationHistoryListener.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 itemis AG (http://www.itemis.eu) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.xtext.glue.partialEditing;
+
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ *
+ */
+public class OperationHistoryListener implements IOperationHistoryListener {
+ private final IUndoContext context;
+ private final IUpdate update;
+
+ /**
+ * @param context
+ * @param update
+ *
+ */
+ public OperationHistoryListener(IUndoContext context, IUpdate update) {
+ this.context = context;
+ this.update = update;
+ }
+
+ public void historyNotification(OperationHistoryEvent event) {
+ final int type= event.getEventType();
+ switch (type) {
+ case OperationHistoryEvent.UNDONE:
+ case OperationHistoryEvent.REDONE:
+ case OperationHistoryEvent.OPERATION_NOT_OK:
+ // if this is one of our operations
+ if (event.getOperation().hasContext(context)) {
+ update.update();
+ }
+ }
+ }
+} \ No newline at end of file

Back to the top