Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormgolubev2012-02-27 20:05:37 -0500
committermgolubev2012-02-27 20:05:37 -0500
commit055e74fcf7a56d3902b9884bcf3aab0ed7104729 (patch)
treeca507ba1cd6d7fd30cc4e1d017746c7b0937b088
parentad0f10e25915eea741962eb43286190c379ef85a (diff)
downloadorg.eclipse.gmf-tooling-372479-diagram-updater-API.tar.gz
org.eclipse.gmf-tooling-372479-diagram-updater-API.tar.xz
org.eclipse.gmf-tooling-372479-diagram-updater-API.zip
[372479] - gmf.runtime.diagram.ui imported372479-diagram-updater-API
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java5
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt27
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/DiagramUpdater.java11
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/UpdateDiagramCommand.java81
5 files changed, 115 insertions, 12 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
index 311356ae7..9a505a456 100644
--- a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
+++ b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
@@ -498,7 +498,10 @@ public class DiagramGenModelTransformer extends MappingTransformer {
@Override
protected void complete() {
- getGenEssence().getPlugin().getRequiredPlugins().addAll(Arrays.asList(myViewmaps.dependencies()));
+ List<String> requiredPlugins = getGenEssence().getPlugin().getRequiredPlugins();
+ final String GMF_TOOLING_RUNTIME = "org.eclipse.gmf.tooling.runtime"; //$NON-NLS-1$
+ requiredPlugins.add(GMF_TOOLING_RUNTIME);
+ requiredPlugins.addAll(Arrays.asList(myViewmaps.dependencies()));
}
// private void process(AppearanceSteward appSteward) {
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt
index 3157c9262..73087fba3 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt
@@ -17,6 +17,7 @@
«EXTENSION xpt::diagram::updater::Utils»
«EXTENSION xpt::GenModelUtils»
«EXTENSION gmf::GenModelUtils»
+«EXTENSION xpt::GenEditorGenerator»
«DEFINE DiagramUpdater FOR gmfgen::GenDiagramUpdater-»
«EXPAND xpt::Common::copyright FOR editorGen-»
@@ -484,33 +485,39 @@ private static «EXPAND CodeStyle::G('java.util.Collection', getDiagram().editor
«ENDDEFINE»
«DEFINE runtimeTypedInstance FOR gmfgen::GenDiagramUpdater-»
+ «IF self.editorGen.jdkComplianceLevel() > 4-»
+ «LET self.getNodeDescriptorQualifiedClassName() AS nodeDescriptorFQN-»
+ «LET self.getLinkDescriptorQualifiedClassName() AS linkDescriptorFQN-»
«EXPAND xpt::Common::generatedClassComment»
public static final org.eclipse.gmf.tooling.runtime.update.DiagramUpdater TYPED_INSTANCE = new org.eclipse.gmf.tooling.runtime.update.DiagramUpdater() {
- «REM»Doesn't make sense to use CodeStyle::G -- interface requires generics anyway«ENDREM»«-»
+ «REM»Doesn't make sense to use CodeStyle::G -- interface requires generics anyway, so we checked above for the whole field«ENDREM»«-»
«EXPAND xpt::Common::generatedMemberComment»
«EXPAND CodeStyle::override FOR editorGen.diagram»
- public java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor> getSemanticChildren(View view) {
- return (java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor>)«diagramUpdaterClassName».getSemanticChildren(view);
+ public java.util.List<«nodeDescriptorFQN»> getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
+ return «diagramUpdaterClassName».getSemanticChildren(view);
}
«EXPAND xpt::Common::generatedMemberComment»
«EXPAND CodeStyle::override FOR editorGen.diagram»
- public java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor> getContainedLinks(View view) {
- return (java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor>)«diagramUpdaterClassName».getContainedLinks(view);
+ public java.util.List<«linkDescriptorFQN»> getContainedLinks(org.eclipse.gmf.runtime.notation.View view) {
+ return «diagramUpdaterClassName».getContainedLinks(view);
}
«EXPAND xpt::Common::generatedMemberComment»
«EXPAND CodeStyle::override FOR editorGen.diagram»
- public java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor> getIncomingLinks(View view) {
- return (java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor>)«diagramUpdaterClassName».getIncomingLinks(view);
+ public java.util.List<«linkDescriptorFQN»> getIncomingLinks(org.eclipse.gmf.runtime.notation.View view) {
+ return «diagramUpdaterClassName».getIncomingLinks(view);
}
«EXPAND xpt::Common::generatedMemberComment»
«EXPAND CodeStyle::override FOR editorGen.diagram»
- public java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor> getOutgoingLinks(View view) {
- return (java.util.List<org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor>)«diagramUpdaterClassName».getOutgoingLinks(view);
+ public java.util.List<«linkDescriptorFQN»> getOutgoingLinks(org.eclipse.gmf.runtime.notation.View view) {
+ return «diagramUpdaterClassName».getOutgoingLinks(view);
}
- }
+ };
+ «ENDLET-»
+ «ENDLET-»
+ «ENDIF-»
«ENDDEFINE»
«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
index 986182c12..bcbbbe97d 100644
--- a/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.gmf.runtime.emf.commands.core,
org.eclipse.gmf.runtime.common.ui.services,
org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.gmf.runtime.notation
+ org.eclipse.gmf.runtime.notation,
+ org.eclipse.gmf.runtime.diagram.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Activator: org.eclipse.gmf.tooling.runtime.GMFToolingRuntimePlugin
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/DiagramUpdater.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/DiagramUpdater.java
index 949caa26a..229b2c24d 100644
--- a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/DiagramUpdater.java
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/DiagramUpdater.java
@@ -1,3 +1,14 @@
+/*
+ * Copyright (c) 2012, Montages 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:
+ * Michael Golubev (Montages) - initial API (#372479)
+ */
package org.eclipse.gmf.tooling.runtime.update;
import java.util.List;
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/UpdateDiagramCommand.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/UpdateDiagramCommand.java
new file mode 100644
index 000000000..0f1e99c21
--- /dev/null
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/update/UpdateDiagramCommand.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2007, 2012 Borland Software Corporation 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
+ *
+ * Contributors:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime (#372479)
+ */
+package org.eclipse.gmf.tooling.runtime.update;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @since 3.0
+ */
+public class UpdateDiagramCommand implements IHandler {
+
+ @Override
+ public void addHandlerListener(IHandlerListener handlerListener) {
+ //
+ }
+
+ @Override
+ public void removeHandlerListener(IHandlerListener handlerListener) {
+ //
+ }
+
+ @Override
+ public void dispose() {
+ //
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() != 1) {
+ return null;
+ }
+ if (structuredSelection.getFirstElement() instanceof EditPart && ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
+ EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
+ List<?> editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (Iterator<?> it = editPolicies.iterator(); it.hasNext();) {
+ CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
+ nextEditPolicy.refresh();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isHandled() {
+ return true;
+ }
+
+}

Back to the top