summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetya Sabeva2013-03-19 07:10:40 (EDT)
committerPetya Sabeva2013-03-19 07:10:40 (EDT)
commit999cd40e021c23d8feea54fd5602cd7aa791119a (patch)
treea20857a1fc51df86c7071836a726b056feebf7a5
parent1c7b1df74b2d3ce8def7166e41b781ed4119f4d5 (diff)
downloadwebtools.dali-999cd40e021c23d8feea54fd5602cd7aa791119a.zip
webtools.dali-999cd40e021c23d8feea54fd5602cd7aa791119a.tar.gz
webtools.dali-999cd40e021c23d8feea54fd5602cd7aa791119a.tar.bz2
Replace the default Graphiti context menu, after bug 394315 is already
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java14
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPADiagramBehavior.java21
2 files changed, 28 insertions, 7 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
index 28eb326..1641284 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/JPADiagramEditor.java
@@ -37,6 +37,7 @@ import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.internal.parts.ConnectionEditPart;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -71,6 +72,7 @@ import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.ui.JPADiagramEditorInput;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.ModelIntegrationUtil;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPADiagramBehavior;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorDiagramTypeProvider;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.EntitiesCoordinatesXML;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.GraphicsUpdater;
@@ -138,6 +140,11 @@ public class JPADiagramEditor extends DiagramEditor implements JpaEditorManager{
return super.getAdapter(type);
}
+
+ @Override
+ protected DiagramBehavior createDiagramBehavior() {
+ return new JPADiagramBehavior(this);
+ }
public void saveWithoutEntities(IProgressMonitor monitor) {
final Diagram d = getDiagramTypeProvider().getDiagram();
@@ -238,13 +245,6 @@ public class JPADiagramEditor extends DiagramEditor implements JpaEditorManager{
}
}
-// @Override
-// protected ContextMenuProvider createContextMenuProvider() {
-// return new JPAEditorContextMenuProvider(getGraphicalViewer(),
-// getActionRegistry(),
-// ((JPADiagramBehavior)getDiagramTypeProvider().getDiagramBehavior()).getConfigurationProvider());
-// }
-
private void initWithFileEditorInput(final IEditorSite site,
final IFile entityFile) {
Diagram diagram = null;
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPADiagramBehavior.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPADiagramBehavior.java
new file mode 100644
index 0000000..7f2dbd1
--- /dev/null
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPADiagramBehavior.java
@@ -0,0 +1,21 @@
+package org.eclipse.jpt.jpadiagrameditor.ui.internal.provider;
+
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.graphiti.ui.editor.DiagramBehavior;
+import org.eclipse.graphiti.ui.editor.IDiagramContainerUI;
+
+public class JPADiagramBehavior extends DiagramBehavior{
+
+ public JPADiagramBehavior(IDiagramContainerUI diagramContainer) {
+ super(diagramContainer);
+ this.setParentPart(diagramContainer.getWorkbenchPart());
+ this.initDefaultBehaviors();
+ }
+
+ @Override
+ protected ContextMenuProvider createContextMenuProvider() {
+ return new JPAEditorContextMenuProvider(getDiagramContainer().getGraphicalViewer(),
+ getDiagramContainer().getActionRegistry(),
+ getConfigurationProvider());
+ }
+}