Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 213179 Details for
Bug 334142
Support Visual Definition and Editing of MappedSuperclass
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Mapped_superclasses_visulization_v2
Mapped_superclasses_visulization_v2.txt (text/plain), 186.48 KB, created by
Petya Sabeva
on 2012-03-26 09:48:07 EDT
(
hide
)
Description:
Mapped_superclasses_visulization_v2
Filename:
MIME Type:
Creator:
Petya Sabeva
Created:
2012-03-26 09:48:07 EDT
Size:
186.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.jpadiagrameditor.ui >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java,v >retrieving revision 1.5 >diff -u -r1.5 AddAllEntitiesFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java 2 Aug 2011 10:25:06 -0000 1.5 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java 26 Mar 2012 13:43:16 -0000 >@@ -35,13 +35,14 @@ > import org.eclipse.graphiti.mm.pictograms.PictogramElement; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.jpt.jpa.core.JpaProject; >-import org.eclipse.jpt.jpa.core.MappingKeys; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; > import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; > import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; > 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.util.JPAEditorConstants; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > > public class AddAllEntitiesFeature extends AbstractCustomFeature implements IAddFeature { >@@ -90,11 +91,12 @@ > numInARow = (numInARow > 0) ? numInARow : 1; > > lowerEdges[0] = lowestRightestPointOfExistingDiagram.y + ((lowestRightestPointOfExistingDiagram.y == 0) ? DIST_FROM_EDGE_V : DIST_V); >+ TransactionalEditingDomain ted = ModelIntegrationUtil.getTransactionalEditingDomain(d); > > for (ClassRef classRef : unit.getClassRefs()) { > if (classRef.getJavaPersistentType() != null) { // null if > JavaPersistentType jpt = classRef.getJavaPersistentType(); >- if (jpt.getMappingKey() == MappingKeys.ENTITY_TYPE_MAPPING_KEY) { >+ if (JpaArtifactFactory.instance().hasEntityOrMappedSuperclassAnnotation(jpt)) { > PictogramElement pe = getFeatureProvider().getPictogramElementForBusinessObject(jpt); > if (pe != null) > continue; >@@ -107,10 +109,8 @@ > > int x = DIST_FROM_EDGE_H + ie.index * (JPAEditorConstants.ENTITY_WIDTH + DIST_H); > ctx.setLocation(x, ie.lowerEdge); >- final AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider()); >+ final AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider(), false); > >- final Diagram targetDiagram = (Diagram) ctx.getTargetContainer(); >- TransactionalEditingDomain ted = ModelIntegrationUtil.getTransactionalEditingDomain(targetDiagram); > ted.getCommandStack().execute(new RecordingCommand(ted) { > @Override > protected void doExecute() { >@@ -122,6 +122,13 @@ > } > } > } >+ ted.getCommandStack().execute(new RecordingCommand(ted) { >+ @Override >+ protected void doExecute() { >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); >+ } >+ }); >+ > } > > private IndexAndLowerEdge getMinLowerEdge() { >@@ -177,4 +184,9 @@ > return JPAEditorMessages.JPAEditorToolBehaviorProvider_showAllTheEntities; > } > >+ public IJPAEditorFeatureProvider getFeatureProvider() { >+ return (IJPAEditorFeatureProvider) super.getFeatureProvider(); >+ } >+ >+ > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddInheritedEntityFeature.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddInheritedEntityFeature.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddInheritedEntityFeature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddInheritedEntityFeature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,86 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; >+ >+import org.eclipse.graphiti.features.IFeatureProvider; >+import org.eclipse.graphiti.features.context.IAddConnectionContext; >+import org.eclipse.graphiti.features.context.IAddContext; >+import org.eclipse.graphiti.features.impl.AbstractAddFeature; >+import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator; >+import org.eclipse.graphiti.mm.pictograms.Diagram; >+import org.eclipse.graphiti.mm.pictograms.FreeFormConnection; >+import org.eclipse.graphiti.mm.pictograms.PictogramElement; >+import org.eclipse.graphiti.services.Graphiti; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorImageCreator; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageCreator; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtilImpl; >+ >+public class AddInheritedEntityFeature extends AbstractAddFeature { >+ >+ private IJPAEditorImageCreator imageCreator; >+ >+ public AddInheritedEntityFeature(IFeatureProvider fp) { >+ this(fp, new JPAEditorImageCreator(), new JPAEditorUtilImpl()); >+ } >+ >+ >+ public AddInheritedEntityFeature(IFeatureProvider fp, >+ IJPAEditorImageCreator imageCreator, >+ IJPAEditorUtil jpaEditorUtil) { >+ super(fp); >+ this.imageCreator = imageCreator; >+ } >+ >+ >+ public boolean canAdd(IAddContext context) { >+ return true; >+ } >+ >+ public PictogramElement add(IAddContext context) { >+ final IAddConnectionContext addConContext = (IAddConnectionContext) context; >+ final IsARelation relation = (IsARelation)context.getNewObject(); >+ final Diagram diagram = getDiagram(); >+ FreeFormConnection connection = createIsAConnection(addConContext, relation, diagram); >+ imageCreator.createIsAConnectionLine(diagram, connection); >+ layoutPictogramElement(connection); >+ return connection; >+ } >+ >+ private FreeFormConnection createIsAConnection(IAddConnectionContext addConContext, IsARelation relation, >+ final Diagram diagram) { >+ FreeFormConnection connection = getFeatureProvider().getPeService().createFreeFormConnection(diagram); >+ connection.setStart(addConContext.getSourceAnchor()); >+ connection.setEnd(addConContext.getTargetAnchor()); >+ connection.setVisible(true); >+ connection.setActive(true); >+ getFeatureProvider().getPeServiceUtil().setPropertyValue(connection, IsARelation.IS_A_CONNECTION_PROP_KEY, Boolean.TRUE.toString()); >+ addDecorators(connection); >+ return connection; >+ } >+ >+ public IJPAEditorFeatureProvider getFeatureProvider() { >+ return (IJPAEditorFeatureProvider)super.getFeatureProvider(); >+ } >+ >+ private void addDecorators(FreeFormConnection c) { >+ ConnectionDecorator d = imageCreator.createArrowConnectionDecorator(c, 0.9999, true); >+ Graphiti.getGaService().setLocation(d.getGraphicsAlgorithm(), 0, 0); >+ } >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java,v >retrieving revision 1.8 >diff -u -r1.8 AddJPAEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java 12 Sep 2011 09:37:13 -0000 1.8 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddJPAEntityFeature.java 26 Mar 2012 13:43:18 -0000 >@@ -18,10 +18,9 @@ > import java.util.ArrayList; > import java.util.HashSet; > import java.util.List; >+ > import org.eclipse.graphiti.features.IFeatureProvider; > import org.eclipse.graphiti.features.context.IAddContext; >-import org.eclipse.graphiti.features.context.ICreateContext; >-import org.eclipse.graphiti.features.context.impl.CreateContext; > import org.eclipse.graphiti.features.impl.AbstractAddShapeFeature; > import org.eclipse.graphiti.mm.algorithms.Image; > import org.eclipse.graphiti.mm.algorithms.Polyline; >@@ -35,15 +34,11 @@ > import org.eclipse.graphiti.mm.pictograms.PictogramElement; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.graphiti.services.Graphiti; >-import org.eclipse.graphiti.util.IPredefinedRenderingStyle; >-import org.eclipse.graphiti.util.PredefinedColoredAreas; >+import org.eclipse.graphiti.util.IColorConstant; > import org.eclipse.jdt.core.ICompilationUnit; >-import org.eclipse.jdt.core.IPackageDeclaration; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.internal.core.SourceType; > import org.eclipse.jpt.jpa.core.JpaProject; >-import org.eclipse.jpt.jpa.core.context.AttributeMapping; >-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; >@@ -54,22 +49,25 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.GraphicsUpdater; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants.ShapeType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorPredefinedColoredAreas; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants.ShapeType; > > > @SuppressWarnings({ "restriction" }) > public class AddJPAEntityFeature extends AbstractAddShapeFeature { > > private IPeUtilFacade facade; >+ private boolean shouldRearrangeIsARelations = true; > private static ContainerShape primaryShape; > private static ContainerShape relationShape; > private static ContainerShape basicShape; > > >- public AddJPAEntityFeature(IFeatureProvider fp) { >+ public AddJPAEntityFeature(IFeatureProvider fp, boolean shouldRearrangeIsARelations) { > super(fp); >+ this.shouldRearrangeIsARelations = shouldRearrangeIsARelations; > facade = new PeUtilFacade(); > } > >@@ -126,15 +124,9 @@ > JavaPersistentType jpt = null; > if (newObj instanceof JavaPersistentType) { > jpt = (JavaPersistentType) newObj; >- if (jpt.getMapping() instanceof JavaMappedSuperclass) { >- jpt = createEntityFromExistingMappedSuperclass(fp, jpt); >- } > } else if (newObj instanceof ICompilationUnit) { > ICompilationUnit cu = (ICompilationUnit) newObj; > jpt = JPAEditorUtil.getJPType(cu); >- if (jpt.getMapping() instanceof JavaMappedSuperclass) { >- jpt = createEntityFromExistingMappedSuperclass(fp, jpt); >- } > > } else if (newObj instanceof SourceType) { > ICompilationUnit cu = ((SourceType)newObj).getCompilationUnit(); >@@ -144,8 +136,9 @@ > > ContainerShape entityShape = facade.createContainerShape(targetDiagram, true); > >- createEntityRectangle(context, entityShape, >- this.getFeatureProvider().getDiagramTypeProvider().getDiagram()); >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot = JpaArtifactFactory.instance().determineDiagramObjectType(jpt); >+ createEntityRectangle(context, entityShape, dot, >+ this.getFeatureProvider().getDiagramTypeProvider().getDiagram()); > link(entityShape, jpt); > Shape shape = Graphiti.getPeService().createShape(entityShape, false); > Polyline headerBottomLine = Graphiti.getGaService().createPolyline(shape, new int[] { 0, >@@ -154,7 +147,7 @@ > .setForeground(manageColor(JPAEditorConstants.ENTITY_BORDER_COLOR)); > headerBottomLine.setLineWidth(JPAEditorConstants.ENTITY_BORDER_WIDTH); > >- addHeader(jpt, entityShape, JPAEditorConstants.ENTITY_WIDTH); >+ addHeader(jpt, entityShape, JPAEditorConstants.ENTITY_WIDTH, dot); > > createCompartments(context, jpt, entityShape); > fillCompartments(jpt,entityShape); >@@ -169,64 +162,26 @@ > > UpdateAttributeFeature updateFeature = new UpdateAttributeFeature(fp); > updateFeature.reconnect(jpt); >- >+ if (shouldRearrangeIsARelations) >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); > return entityShape; > } >- >- private JavaPersistentType createEntityFromExistingMappedSuperclass( >- IJPAEditorFeatureProvider fp, JavaPersistentType jpt) { >- ICreateContext cont = new CreateContext(); >- String packageName = null; >- try { >- packageName = getMappedSuperclassPackageDeclaration(fp, jpt, >- packageName); >- } catch (JavaModelException e) { >- JPADiagramEditorPlugin.logError(e); >- } >- >- boolean hasPrimaryKey = hasMappedSuperclassPrimaryKeyAttribute(jpt); >- >- CreateJPAEntityFeature createFeature = new CreateJPAEntityFeature(fp, >- true, jpt.getName(), packageName, hasPrimaryKey); >- Object[] objects = createFeature.create(cont); >- if (objects.length != 0) { >- Object obj = objects[0]; >- if (obj instanceof JavaPersistentType) { >- jpt = (JavaPersistentType) obj; >- } >- } >- return jpt; >- } >- >- private boolean hasMappedSuperclassPrimaryKeyAttribute( >- JavaPersistentType jpt) { >- >- for (AttributeMapping map : ((JavaMappedSuperclass) jpt.getMapping()).getAllAttributeMappings()) { >- if (map.getPrimaryKeyColumnName() != null) { >- return true; >- } >- } >- return false; >- } >- >- private String getMappedSuperclassPackageDeclaration( >- IJPAEditorFeatureProvider fp, JavaPersistentType jpt, >- String packageName) throws JavaModelException { >- IPackageDeclaration[] packages = fp.getCompilationUnit(jpt) >- .getPackageDeclarations(); >- if (packages.length > 0) { >- IPackageDeclaration packageDecl = packages[0]; >- packageName = packageDecl.getElementName(); >- } >- return packageName; >- } > > private void createCompartments(IAddContext context, JavaPersistentType jpt, > ContainerShape entityShape) { >- primaryShape = createCompartmentRectangle(entityShape, JPAEditorConstants.ENTITY_MIN_HEIGHT, JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape); >- relationShape = createCompartmentRectangle(entityShape, GraphicsUpdater.getNextCompartmentY(primaryShape) + JPAEditorConstants.SEPARATOR_HEIGHT, >- JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes); >- basicShape = createCompartmentRectangle(entityShape, GraphicsUpdater.getNextCompartmentY(relationShape) + JPAEditorConstants.SEPARATOR_HEIGHT, JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes); >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot = JpaArtifactFactory.instance().determineDiagramObjectType(jpt); >+ primaryShape = createCompartmentRectangle(entityShape, >+ JPAEditorConstants.ENTITY_MIN_HEIGHT, >+ JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape, >+ dot); >+ relationShape = createCompartmentRectangle(entityShape, >+ GraphicsUpdater.getNextCompartmentY(primaryShape) + JPAEditorConstants.SEPARATOR_HEIGHT, >+ JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes, >+ dot); >+ basicShape = createCompartmentRectangle(entityShape, >+ GraphicsUpdater.getNextCompartmentY(relationShape) + JPAEditorConstants.SEPARATOR_HEIGHT, >+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, >+ dot); > if (IAddEntityContext.class.isInstance(context)) { > IAddEntityContext entityContext = (IAddEntityContext) context; > GraphicsUpdater.setCollapsed(primaryShape, entityContext.isPrimaryCollapsed()); >@@ -255,7 +210,8 @@ > } > > private ContainerShape createCompartmentRectangle( >- ContainerShape entityShape, int y, String attribTxt) { >+ ContainerShape entityShape, int y, String attribTxt, >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { > int width = entityShape.getGraphicsAlgorithm().getWidth(); > ContainerShape containerShape = Graphiti.getPeService().createContainerShape( > entityShape, false); >@@ -268,7 +224,7 @@ > > UpdateAttributeFeature updateFeature = new UpdateAttributeFeature(getFeatureProvider()); > >- updateFeature.addSeparatorsToShape(containerShape); >+ updateFeature.addSeparatorsToShape(containerShape, dot); > > return containerShape; > } >@@ -341,17 +297,23 @@ > } > > public static RoundedRectangle createEntityRectangle(IAddContext context, >- ContainerShape entityShape, Diagram diagram) { >- >+ ContainerShape entityShape, >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot, >+ Diagram diagram) { >+ >+ IColorConstant foreground = JpaArtifactFactory.instance().getForeground(dot); >+ IColorConstant background = JpaArtifactFactory.instance().getBackground(dot); >+ String renderingStyle = JpaArtifactFactory.instance().getRenderingStyle(dot); >+ > RoundedRectangle entityRectangle = Graphiti.getGaService().createRoundedRectangle( > entityShape, JPAEditorConstants.ENTITY_CORNER_WIDTH, > JPAEditorConstants.ENTITY_CORNER_HEIGHT); > entityRectangle >- .setForeground(Graphiti.getGaService().manageColor(diagram, JPAEditorConstants.ENTITY_BORDER_COLOR)); >+ .setForeground(Graphiti.getGaService().manageColor(diagram, foreground)); > entityRectangle >- .setBackground(Graphiti.getGaService().manageColor(diagram, JPAEditorConstants.ENTITY_BACKGROUND)); >+ .setBackground(Graphiti.getGaService().manageColor(diagram, background)); > Graphiti.getGaService().setRenderingStyle(entityRectangle.getPictogramElement().getGraphicsAlgorithm(), >- PredefinedColoredAreas.getAdaptedGradientColoredAreas(IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID)); >+ JPAEditorPredefinedColoredAreas.getAdaptedGradientColoredAreas(renderingStyle)); > entityRectangle.setLineWidth(JPAEditorConstants.ENTITY_BORDER_WIDTH); > entityRectangle.setLineStyle(LineStyle.SOLID); > Graphiti.getGaService().setLocationAndSize(entityRectangle, context >@@ -370,8 +332,13 @@ > } > > private ContainerShape addHeader(JavaPersistentType addedWrapper, >- ContainerShape entityShape, int width) { >- >+ ContainerShape entityShape, >+ int width, >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { >+ String entityIconId = dot.equals(JPAEditorConstants.DIAGRAM_OBJECT_TYPE.Entity) ? >+ JPAEditorImageProvider.JPA_ENTITY : >+ JPAEditorImageProvider.MAPPED_SUPERCLASS; >+ > ContainerShape headerIconShape = Graphiti.getPeService().createContainerShape( > entityShape, false); > Rectangle iconRect = Graphiti.getGaService().createRectangle(headerIconShape); >@@ -383,7 +350,7 @@ > iconRect.setHeight(JPAEditorConstants.HEADER_ICON_RECT_HEIGHT); > iconRect.setY(0); > Image headerIcon = Graphiti.getGaService().createImage(iconRect, >- JPAEditorImageProvider.JPA_ENTITY); >+ entityIconId); > Graphiti.getGaService().setLocationAndSize(headerIcon, > JPAEditorConstants.ICON_HEADER_X, > JPAEditorConstants.ICON_HEADER_Y, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddRelationFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 AddRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddRelationFeature.java 27 Apr 2011 22:45:26 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddRelationFeature.java 26 Mar 2012 13:43:18 -0000 >@@ -103,7 +103,7 @@ > > private FreeFormConnection createConnection(IAddConnectionContext addConContext, IRelation relation, > final Diagram diagram) { >- FreeFormConnection connection = getFeatureProvider().getPeUtil().createFreeFormConnection(diagram); >+ FreeFormConnection connection = getFeatureProvider().getPeServiceUtil().createFreeFormConnection(diagram); > connection.setStart(addConContext.getSourceAnchor()); > connection.setEnd(addConContext.getTargetAnchor()); > connection.setVisible(true); >@@ -154,7 +154,7 @@ > double endCoefficient = 1.0 - startCoefficient; > int len = JPAEditorUtil.calcConnectionLength(c); > if (UNI.equals(direction)) { >- ConnectionDecorator d = imageCreator.createArrowConnectionDecorator(c, endCoefficient); >+ ConnectionDecorator d = imageCreator.createArrowConnectionDecorator(c, endCoefficient, false); > Graphiti.getGaService().setLocation(d.getGraphicsAlgorithm(),Math.round(-len/10), 0); > } > } >@@ -175,7 +175,7 @@ > ConnectionDecorator d1 = imageCreator.createManyStartDecorator(c, startCoefficient); > Graphiti.getGaService().setLocation(d1.getGraphicsAlgorithm(),Math.round(len/10), 0); > if (UNI.equals(direction)) { >- ConnectionDecorator d2 = imageCreator.createArrowConnectionDecorator(c, endCoefficient); >+ ConnectionDecorator d2 = imageCreator.createArrowConnectionDecorator(c, endCoefficient, false); > Graphiti.getGaService().setLocation(d2.getGraphicsAlgorithm(),Math.round(-len/10), 0); > } > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateInheritedEntityFeature.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateInheritedEntityFeature.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateInheritedEntityFeature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateInheritedEntityFeature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; >+ >+import org.eclipse.graphiti.features.IFeatureProvider; >+import org.eclipse.graphiti.features.context.ICreateConnectionContext; >+import org.eclipse.graphiti.features.context.ICreateContext; >+import org.eclipse.graphiti.features.context.impl.AddContext; >+import org.eclipse.graphiti.features.context.impl.CreateContext; >+import org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature; >+import org.eclipse.graphiti.mm.pictograms.Anchor; >+import org.eclipse.graphiti.mm.pictograms.Connection; >+import org.eclipse.graphiti.mm.pictograms.Diagram; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jpt.jpa.core.context.PersistentType; >+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageProvider; >+ >+public class CreateInheritedEntityFeature extends AbstractCreateConnectionFeature { >+ >+ public CreateInheritedEntityFeature(IFeatureProvider fp) { >+ this(fp, JPAEditorMessages.CreateIsARelationFeature_name, JPAEditorMessages.CreateIsARelationFeature_description); >+ } >+ >+ public CreateInheritedEntityFeature(IFeatureProvider fp, String name, >+ String description) { >+ super(fp, name, description); >+ } >+ >+ public boolean canCreate(ICreateConnectionContext context) { >+ JavaPersistentType superclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >+ if (superclass == null) >+ return false; >+ if (context.getTargetAnchor() == null) >+ return true; >+ if (context.getTargetAnchor().getParent() instanceof Diagram) >+ return true; >+ return false; >+ } >+ >+ public Connection create(ICreateConnectionContext context) { >+ JavaPersistentType mappedSuperclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >+ CreateJPAEntityFeature createEntityFeature = null; >+ try { >+ createEntityFeature = new CreateJPAEntityFeature( >+ getFeatureProvider(), mappedSuperclass); >+ } catch (JavaModelException e) { >+ JPADiagramEditorPlugin.logError("Cannot create a new JPA entity class", e); //$NON-NLS-1$ >+ return null; >+ } >+ ICreateContext ctx = new CreateContext(); >+ Object[] res = createEntityFeature.create(ctx); >+ JavaPersistentType newEntity = (JavaPersistentType)res[0]; >+ AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider(), true); >+ AddContext cont = new AddContext(); >+ cont.setTargetContainer(getFeatureProvider().getDiagram()); >+ cont.setNewObject(newEntity); >+ cont.setLocation(context.getTargetLocation().getX(), context.getTargetLocation().getY()); >+ ft.add(cont); >+ return null; >+ } >+ >+ public boolean canStartConnection(ICreateConnectionContext context) { >+ JavaPersistentType superclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >+ if (superclass == null) >+ return false; >+ return true; >+ } >+ >+ public String getCreateImageId() { >+ return JPAEditorImageProvider.ADD_INHERITED_ENTITY; >+ } >+ >+ protected PersistentType getPersistentType(Anchor anchor) { >+ if (anchor != null) { >+ Object refObject = >+ getBusinessObjectForPictogramElement(anchor.getParent()); >+ if (refObject instanceof PersistentType) { >+ return (PersistentType) refObject; >+ } >+ } >+ return null; >+ } >+ >+ public IJPAEditorFeatureProvider getFeatureProvider() { >+ return (IJPAEditorFeatureProvider)super.getFeatureProvider(); >+ } >+ >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java,v >retrieving revision 1.6 >diff -u -r1.6 CreateJPAEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java 20 Feb 2012 21:56:32 -0000 1.6 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java 26 Mar 2012 13:43:19 -0000 >@@ -30,6 +30,7 @@ > import org.eclipse.graphiti.mm.pictograms.Diagram; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jface.dialogs.ErrorDialog; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jpt.jpa.core.JpaProject; >@@ -43,6 +44,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IWorkbenchSite; >@@ -52,9 +54,10 @@ > > private IPreferenceStore jpaPreferenceStore = JPADiagramEditorPlugin.getDefault().getPreferenceStore(); > private boolean isMappedSuperclassChild; >+ private JavaPersistentType mappedSuperclass; > private String mappedSuperclassName; > private String mappedSuperclassPackage; >- private boolean hasPrimarykey; >+ private boolean superHasPrimarykey; > > > public CreateJPAEntityFeature(IFeatureProvider fp) { >@@ -75,14 +78,24 @@ > > public CreateJPAEntityFeature(IFeatureProvider fp, > boolean isMappedSuperclassChild, String mappedSuperclassName, >- String mappedSuperClassPackage, boolean hasPrimaryKey) { >+ String mappedSuperClassPackage, boolean superHasPrimaryKey) { > this(fp); > this.isMappedSuperclassChild = isMappedSuperclassChild; > this.mappedSuperclassName = mappedSuperclassName; > this.mappedSuperclassPackage = mappedSuperClassPackage; >- this.hasPrimarykey = hasPrimaryKey; >+ this.superHasPrimarykey = superHasPrimaryKey; > } > >+ public CreateJPAEntityFeature(IJPAEditorFeatureProvider fp, >+ JavaPersistentType mappedSuperclass) throws JavaModelException { >+ this(fp); >+ this.isMappedSuperclassChild = true; >+ this.mappedSuperclass = mappedSuperclass; >+ this.mappedSuperclassName = mappedSuperclass.getName(); >+ this.mappedSuperclassPackage = JpaArtifactFactory.instance().getMappedSuperclassPackageDeclaration(mappedSuperclass); >+ this.superHasPrimarykey = JpaArtifactFactory.instance().hasOrInheritsPrimaryKey(mappedSuperclass); >+ } >+ > > public boolean canCreate(ICreateContext context) { > return context.getTargetContainer() instanceof Diagram; >@@ -122,7 +135,17 @@ > } > > try { >- this.getFeatureProvider().getJPAEditorUtil().createEntityInProject(targetProject, entityName, jpaPreferenceStore, isMappedSuperclassChild, mappedSuperclassName, mappedSuperclassPackage, hasPrimarykey); >+ if (mappedSuperclass != null) { >+ this.getFeatureProvider(). >+ getJPAEditorUtil(). >+ createEntityInProject(targetProject, entityName, mappedSuperclass); //$NON-NLS-1$ >+ } else { >+ this.getFeatureProvider(). >+ getJPAEditorUtil(). >+ createEntityInProject(targetProject, entityName, jpaPreferenceStore, >+ isMappedSuperclassChild, mappedSuperclassName, >+ mappedSuperclassPackage, "id", superHasPrimarykey); //$NON-NLS-1$ >+ } > } catch (Exception e1) { > JPADiagramEditorPlugin.logError("Cannot create an entity in the project " + targetProject.getName(), e1); //$NON-NLS-1$ > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyBiDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyBiDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateManyToManyBiDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyBiDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyBiDirRelationFeature.java 26 Mar 2012 13:43:19 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateManyToManyBiDirRelationFeature extends >- CreateManyToManyRelationFeature { >+public class CreateManyToManyBiDirRelationFeature extends CreateManyToManyRelationFeature >+ implements ICreateBiDirRelationFeature { > > public CreateManyToManyBiDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyUniDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyUniDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateManyToManyUniDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyUniDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToManyUniDirRelationFeature.java 26 Mar 2012 13:43:19 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateManyToManyUniDirRelationFeature extends >- CreateManyToManyRelationFeature { >+public class CreateManyToManyUniDirRelationFeature extends CreateManyToManyRelationFeature >+ implements ICreateUniDirRelationFeature { > > public CreateManyToManyUniDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneBiDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneBiDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateManyToOneBiDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneBiDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneBiDirRelationFeature.java 26 Mar 2012 13:43:19 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateManyToOneBiDirRelationFeature extends >- CreateManyToOneRelationFeature { >+public class CreateManyToOneBiDirRelationFeature extends CreateManyToOneRelationFeature >+ implements ICreateBiDirRelationFeature { > > public CreateManyToOneBiDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneUniDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneUniDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateManyToOneUniDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneUniDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateManyToOneUniDirRelationFeature.java 26 Mar 2012 13:43:19 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateManyToOneUniDirRelationFeature extends >- CreateManyToOneRelationFeature { >+public class CreateManyToOneUniDirRelationFeature extends CreateManyToOneRelationFeature >+ implements ICreateUniDirRelationFeature { > > public CreateManyToOneUniDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,123 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; >+ >+import java.util.List; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.graphiti.features.IFeatureProvider; >+import org.eclipse.graphiti.features.context.ICreateContext; >+import org.eclipse.graphiti.features.impl.AbstractCreateFeature; >+import org.eclipse.graphiti.mm.pictograms.Diagram; >+import org.eclipse.graphiti.mm.pictograms.Shape; >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jpt.jpa.core.JpaProject; >+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; >+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; >+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IWorkbenchSite; >+ >+ >+ >+public class CreateMappedSuperclassFeature extends >+ AbstractCreateFeature { >+ >+ public CreateMappedSuperclassFeature(IFeatureProvider fp) { >+ super( >+ fp, >+ JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName, >+ JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureDescription); >+ } >+ >+ public boolean canCreate(ICreateContext context) { >+ return context.getTargetContainer() instanceof Diagram; >+ } >+ >+ public Object[] create(ICreateContext context) { >+ List<Shape> shapes = this.getFeatureProvider().getDiagramTypeProvider() >+ .getDiagram().getChildren(); >+ IProject targetProject = null; >+ JpaProject jpaProject = null; >+ if ((shapes == null) || (shapes.size() == 0)) { >+ jpaProject = getTargetJPAProject(); >+ targetProject = jpaProject.getProject(); >+ } else { >+ Shape sh = shapes.get(0); >+ JavaPersistentType jpt = (JavaPersistentType) getFeatureProvider() >+ .getBusinessObjectForPictogramElement(sh); >+ if (jpt == null) >+ return new Object[] {}; >+ jpaProject = jpt.getJpaProject(); >+ targetProject = jpaProject.getProject(); >+ } >+ >+ String mappedSuperclassName = getFeatureProvider() >+ .getJPAEditorUtil() >+ .generateUniqueMappedSuperclassName( >+ jpaProject, >+ JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()), >+ getFeatureProvider()); >+ >+ if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(jpaProject.getProject())) { >+ JPAEditorUtil.createRegisterEntityInXMLJob(jpaProject, mappedSuperclassName); >+ } >+ >+ try { >+ getFeatureProvider().getJPAEditorUtil().createMappedSuperclassInProject(targetProject, mappedSuperclassName); >+ } catch (Exception e1) { >+ JPADiagramEditorPlugin.logError("Cannot create a mapped superclass in the project " + targetProject.getName(), e1); //$NON-NLS-1$ >+ } >+// jpaProject.updateAndWait(); >+ PersistenceUnit pu = JpaArtifactFactory.instance().getPersistenceUnit(jpaProject); >+ JavaPersistentType jpt = JpaArtifactFactory.instance().getJPT(mappedSuperclassName, pu); >+ >+ if (jpt != null) { >+ addGraphicalRepresentation(context, jpt); >+ IWorkbenchSite ws = ((IEditorPart)getDiagramEditor()).getSite(); >+ ICompilationUnit cu = getFeatureProvider().getCompilationUnit(jpt); >+ getFeatureProvider().getJPAEditorUtil().formatCode(cu, ws); >+ return new Object[] { jpt }; >+ } else { >+ JPADiagramEditorPlugin.logError("The mapped superclass " + //$NON-NLS-1$ >+ mappedSuperclassName + " could not be created", new Exception()); //$NON-NLS-1$ >+ } >+ >+ return new Object[] {}; >+ } >+ >+ public String getCreateImageId() { >+ return JPAEditorImageProvider.ADD_MAPPED_SUPERCLASS; >+ } >+ >+ >+ public IJPAEditorFeatureProvider getFeatureProvider() { >+ return (IJPAEditorFeatureProvider) super.getFeatureProvider(); >+ } >+ >+ private JpaProject getTargetJPAProject() { >+ return getFeatureProvider().getMoinIntegrationUtil() >+ .getProjectByDiagram(getDiagram()); >+ } >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToManyUniDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToManyUniDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateOneToManyUniDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToManyUniDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToManyUniDirRelationFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateOneToManyUniDirRelationFeature extends >- CreateOneToManyRelationFeature { >+public class CreateOneToManyUniDirRelationFeature extends CreateOneToManyRelationFeature >+ implements ICreateUniDirRelationFeature { > > public CreateOneToManyUniDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneBiDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneBiDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateOneToOneBiDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneBiDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneBiDirRelationFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -25,7 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class CreateOneToOneBiDirRelationFeature extends CreateOneToOneRelationFeature { >+public class CreateOneToOneBiDirRelationFeature extends CreateOneToOneRelationFeature >+ implements ICreateBiDirRelationFeature { > > public CreateOneToOneBiDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneUniDirRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneUniDirRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateOneToOneUniDirRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneUniDirRelationFeature.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateOneToOneUniDirRelationFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -25,8 +25,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >- >-public class CreateOneToOneUniDirRelationFeature extends CreateOneToOneRelationFeature { >+public class CreateOneToOneUniDirRelationFeature extends CreateOneToOneRelationFeature >+ implements ICreateUniDirRelationFeature { > > public CreateOneToOneUniDirRelationFeature(IJPAEditorFeatureProvider fp) { > super(fp, JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateRelationFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 CreateRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateRelationFeature.java 2 Mar 2011 17:18:13 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateRelationFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.AbstractRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > > abstract public class CreateRelationFeature extends AbstractCreateConnectionFeature { >@@ -34,25 +35,33 @@ > } > > public boolean canCreate(ICreateConnectionContext context) { >- JavaPersistentType source = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >- JavaPersistentType target = (JavaPersistentType)getPersistentType(context.getTargetAnchor()); >- if (source != null && target != null) { >- return true; >- } >- return false; >+ JavaPersistentType owner = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >+ JavaPersistentType inverse = (JavaPersistentType)getPersistentType(context.getTargetAnchor()); >+ if ((owner == null) || (inverse == null)) >+ return false; >+ if (JpaArtifactFactory.instance().hasMappedSuperclassAnnotation(inverse)) >+ return false; >+ if ((this instanceof ICreateBiDirRelationFeature) && >+ (JpaArtifactFactory.instance().hasMappedSuperclassAnnotation(owner))) >+ return false; >+ return true; > } > > public boolean canStartConnection(ICreateConnectionContext context) { >- if (getPersistentType(context.getSourceAnchor()) != null) >- return true; >- return false; >+ JavaPersistentType owner = (JavaPersistentType)getPersistentType(context.getSourceAnchor()); >+ if (owner == null) >+ return false; >+ if ((this instanceof ICreateBiDirRelationFeature) && >+ JpaArtifactFactory.instance().hasMappedSuperclassAnnotation(owner)) >+ return false; >+ return true; > } > > public Connection create(ICreateConnectionContext context) { > Connection newConnection = null; >- PersistentType source = getPersistentType(context.getSourceAnchor()); >- PersistentType target = getPersistentType(context.getTargetAnchor()); >- if (source != null && target != null) { >+ PersistentType owner = getPersistentType(context.getSourceAnchor()); >+ PersistentType inverse = getPersistentType(context.getTargetAnchor()); >+ if (owner != null && inverse != null) { > AbstractRelation rel = createRelation(getFeatureProvider(), context.getSourceAnchor().getParent(), > context.getTargetAnchor().getParent()); > AddConnectionContext addContext = >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 DeleteRelationFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java 19 May 2011 19:29:05 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -26,7 +26,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.AbstractRelation; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.BidirectionalRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.UnidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; >@@ -81,8 +81,8 @@ > feat.delete(delCtx, false); > } > >- if (rel instanceof BidirectionalRelation) { >- BidirectionalRelation relation = (BidirectionalRelation)(rel); >+ if (rel instanceof IBidirectionalRelation) { >+ IBidirectionalRelation relation = (IBidirectionalRelation)(rel); > ClickRemoveAttributeButtonFeature feat = new ClickRemoveAttributeButtonFeature(getFeatureProvider()); > > JavaPersistentAttribute ownerAttribute = relation.getOwnerAnnotatedAttribute(); >@@ -97,17 +97,6 @@ > } > > postDelete(context); >- >- /* >- IRemoveContext rc = new RemoveContext(pe); >- IFeatureProvider featureProvider = getFeatureProvider(); >- IRemoveFeature removeFeature = featureProvider.getRemoveFeature(rc); >- if (removeFeature != null) { >- removeFeature.remove(rc); >- } >- */ >- >- > } > > public void postDelete(IDeleteContext context) { >@@ -117,7 +106,7 @@ > IWorkbenchSite ws = ((IEditorPart)getDiagramEditor()).getSite(); > ICompilationUnit cu = getFeatureProvider().getCompilationUnit(rel.getOwner()); > ut.organizeImports(cu, ws); >- if (rel instanceof BidirectionalRelation) { >+ if (rel instanceof IBidirectionalRelation) { > cu = getFeatureProvider().getCompilationUnit(rel.getInverse()); > ut.organizeImports(cu, ws); > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 DirectEditAttributeFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java 27 Jun 2011 14:14:40 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DirectEditAttributeFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -35,7 +35,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.BidirectionalRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; >@@ -106,7 +106,7 @@ > > IRelation rel = getFeatureProvider().getRelationRelatedToAttribute(oldAt); > String inverseJPTName = null; >- if (BidirectionalRelation.class.isInstance(rel)) >+ if (IBidirectionalRelation.class.isInstance(rel)) > inverseJPTName = rel.getInverse().getName(); > if (oldAt.getName().equals(value)) > return; >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/GraphicalRemoveAttributeFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/GraphicalRemoveAttributeFeature.java,v >retrieving revision 1.3 >diff -u -r1.3 GraphicalRemoveAttributeFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/GraphicalRemoveAttributeFeature.java 1 Aug 2011 15:10:11 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/GraphicalRemoveAttributeFeature.java 26 Mar 2012 13:43:21 -0000 >@@ -92,18 +92,19 @@ > .getAnchors().iterator().next()); > ctx.setNewObject(rel); > relF.add(ctx); >-// JpaArtifactFactory.instance().refreshEntityModel(fp, jpt); > } >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); >+ > } > > @SuppressWarnings("deprecation") > private void readdCompartmentsChildren(JavaPersistentType javaPersistentType, ContainerShape entityShape, > ContainerShape primaryShape, ContainerShape relationShape, ContainerShape basicShape) { >- >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot = JpaArtifactFactory.instance().determineDiagramObjectType(javaPersistentType); > UpdateAttributeFeature updateFeature = new UpdateAttributeFeature(getFeatureProvider()); >- updateFeature.addSeparatorsToShape(primaryShape); >- updateFeature.addSeparatorsToShape(relationShape); >- updateFeature.addSeparatorsToShape(basicShape); >+ updateFeature.addSeparatorsToShape(primaryShape, dot); >+ updateFeature.addSeparatorsToShape(relationShape, dot); >+ updateFeature.addSeparatorsToShape(basicShape, dot); > > for (JavaPersistentAttribute attribute : javaPersistentType.getAttributes()) { > updateFeature.addAttributes(entityShape, attribute); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateBiDirRelationFeature.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateBiDirRelationFeature.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateBiDirRelationFeature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateBiDirRelationFeature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; >+ >+public interface ICreateBiDirRelationFeature { >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateUniDirRelationFeature.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateUniDirRelationFeature.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateUniDirRelationFeature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/ICreateUniDirRelationFeature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature; >+ >+public interface ICreateUniDirRelationFeature { >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/LayoutJPAEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/LayoutJPAEntityFeature.java,v >retrieving revision 1.1 >diff -u -r1.1 LayoutJPAEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/LayoutJPAEntityFeature.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/LayoutJPAEntityFeature.java 26 Mar 2012 13:43:22 -0000 >@@ -45,7 +45,7 @@ > > public LayoutJPAEntityFeature(IJPAEditorFeatureProvider fp) { > super(fp); >- peUtil = fp.getPeUtil(); >+ peUtil = fp.getPeServiceUtil(); > } > > public boolean canLayout(ILayoutContext context) { >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java,v >retrieving revision 1.7 >diff -u -r1.7 RefactorEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java 20 Feb 2012 21:56:32 -0000 1.7 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java 26 Mar 2012 13:43:22 -0000 >@@ -114,6 +114,7 @@ > final Shape pict = (Shape)getFeatureProvider().getPictogramElementForBusinessObject(jpt); > JavaPersistentType jpt = (JavaPersistentType)getFeatureProvider(). > getBusinessObjectForPictogramElement(pict); >+ final JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot = JpaArtifactFactory.instance().determineDiagramObjectType(jpt); > final PersistenceUnit pu = JpaArtifactFactory.instance().getPersistenceUnit(jpt); > final Semaphore s = new Semaphore(0); > final JPAProjectListener lsnr = new JPAProjectListener(s); >@@ -137,12 +138,13 @@ > ted.getCommandStack().execute(new RecordingCommand(ted) { > @Override > protected void doExecute() { >- remapEntity(oldName, pict, pu, rename, lsnr, getFeatureProvider()); >+ remapEntity(oldName, pict, pu, rename, lsnr, dot, getFeatureProvider()); > } > }); > } > > public void execute(ICustomContext context, String newName, ICompilationUnit cu, JavaPersistentType jpt) { >+ final JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot = JpaArtifactFactory.instance().determineDiagramObjectType(jpt); > final String oldName = jpt.getName(); > final Shape pict = (Shape)getFeatureProvider().getPictogramElementForBusinessObject(jpt); > jpt = (JavaPersistentType)getFeatureProvider(). >@@ -161,7 +163,7 @@ > ted.getCommandStack().execute(new RecordingCommand(ted) { > @Override > protected void doExecute() { >- remapEntity(oldName, pict, pu, true, lsnr, getFeatureProvider()); >+ remapEntity(oldName, pict, pu, true, lsnr, dot, getFeatureProvider()); > } > }); > } >@@ -171,6 +173,7 @@ > final PersistenceUnit pu, > final boolean rename, > final JPAProjectListener lsnr, >+ final JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot, > final IJPAEditorFeatureProvider fp) { > BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { > public void run() { >@@ -190,11 +193,11 @@ > cont.setY(y); > cont.setWidth(width); > cont.setHeight(height); >- RoundedRectangle rect = AddJPAEntityFeature.createEntityRectangle(cont, cs, fp.getDiagramTypeProvider().getDiagram()); >+ RoundedRectangle rect = AddJPAEntityFeature.createEntityRectangle(cont, cs, dot, fp.getDiagramTypeProvider().getDiagram()); > rect.setFilled(true); > > IRemoveContext ctx = new RemoveContext(pict); >- RemoveJPAEntityFeature ft = new RemoveJPAEntityFeature(fp); >+ RemoveJPAEntityFeature ft = new RemoveJPAEntityFeature(fp, true); > > boolean primaryCollapsed = JPAEditorConstants.TRUE_STRING.equals(Graphiti.getPeService().getPropertyValue(pict, JPAEditorConstants.PRIMARY_COLLAPSED)); > boolean relationCollapsed = JPAEditorConstants.TRUE_STRING.equals(Graphiti.getPeService().getPropertyValue(pict, JPAEditorConstants.RELATION_COLLAPSED)); >@@ -217,7 +220,7 @@ > addCtx.setY(y); > addCtx.setWidth(width); > addCtx.setHeight(height); >- AddJPAEntityFeature ft1 = new AddJPAEntityFeature(fp); >+ AddJPAEntityFeature ft1 = new AddJPAEntityFeature(fp, true); > ft.remove(ctx); > ft1.add(addCtx); > PictogramElement pe = fp.getPictogramElementForBusinessObject(newJPT); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAllEntitiesFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAllEntitiesFeature.java,v >retrieving revision 1.1 >diff -u -r1.1 RemoveAllEntitiesFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAllEntitiesFeature.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAllEntitiesFeature.java 26 Mar 2012 13:43:22 -0000 >@@ -27,8 +27,8 @@ > import org.eclipse.graphiti.features.context.IRemoveContext; > import org.eclipse.graphiti.features.context.impl.RemoveContext; > import org.eclipse.graphiti.features.custom.AbstractCustomFeature; >-import org.eclipse.graphiti.mm.pictograms.PictogramElement; > import org.eclipse.graphiti.mm.pictograms.Shape; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; > > public abstract class RemoveAllEntitiesFeature extends AbstractCustomFeature { > >@@ -45,14 +45,12 @@ > } > > public void execute(ICustomContext context) { >+ TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(getFeatureProvider().getDiagram()); > Iterator<Shape> it = allShapes.iterator(); > while (it.hasNext()) { > Shape sh = it.next(); >- final RemoveJPAEntityFeature ft = new RemoveJPAEntityFeature(this.getFeatureProvider()); >+ final RemoveJPAEntityFeature ft = new RemoveJPAEntityFeature(this.getFeatureProvider(), false); > final IRemoveContext ctx = new RemoveContext(sh); >- PictogramElement pe = ctx.getPictogramElement(); >- >- TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(pe); > ted.getCommandStack().execute(new RecordingCommand(ted) { > @Override > protected void doExecute() { >@@ -62,4 +60,8 @@ > } > } > >+ public IJPAEditorFeatureProvider getFeatureProvider() { >+ return (IJPAEditorFeatureProvider) super.getFeatureProvider(); >+ } >+ > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAndSaveEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAndSaveEntityFeature.java,v >retrieving revision 1.1 >diff -u -r1.1 RemoveAndSaveEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAndSaveEntityFeature.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAndSaveEntityFeature.java 26 Mar 2012 13:43:22 -0000 >@@ -30,6 +30,7 @@ > import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > > >@@ -67,4 +68,9 @@ > return (IJPAEditorFeatureProvider)super.getFeatureProvider(); > } > >+ public void postRemove(IRemoveContext context) { >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); >+ } >+ >+ > } >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 RemoveAttributeFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java 12 May 2011 15:15:12 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveAttributeFeature.java 26 Mar 2012 13:43:23 -0000 >@@ -154,8 +154,8 @@ > cntx.setNewObject(rel); > AddRelationFeature ft = new AddRelationFeature(getFeatureProvider()); > ft.add(cntx); >-// JpaArtifactFactory.instance().refreshEntityModel(getFeatureProvider(), jpt); > } >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); > } > > } >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveJPAEntityFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveJPAEntityFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 RemoveJPAEntityFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveJPAEntityFeature.java 14 Apr 2011 14:39:00 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveJPAEntityFeature.java 26 Mar 2012 13:43:23 -0000 >@@ -43,18 +43,15 @@ > > public class RemoveJPAEntityFeature extends DefaultRemoveFeature { > >+ private boolean shouldRearrangeIsARelations = true; > >- public RemoveJPAEntityFeature(IFeatureProvider fp) { >+ public RemoveJPAEntityFeature(IFeatureProvider fp, boolean shouldRearrangeIsARelations) { > super(fp); >+ this.shouldRearrangeIsARelations = shouldRearrangeIsARelations; > } > > public void preRemove(IRemoveContext context) { > PictogramElement pe = context.getPictogramElement(); >- >-// RestoreEntityFeature ft = new RestoreEntityFeature(getFeatureProvider()); >-// ICustomContext customContext = new CustomContext(new PictogramElement[] { pe }); >-// ft.execute(customContext); >- > final Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe); > Set<Shape> shapesForDeletion = new HashSet<Shape>(); > if (bo instanceof JavaPersistentType) { >@@ -75,20 +72,8 @@ > IRemoveContext ctx = new RemoveContext(it.next()); > f.remove(ctx); > } >- //--------------------------------------------------------------------- >- //--Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=281345 >- //Job job = new Job("Remove JPA entity") { //$NON-NLS-1$ >- // protected IStatus run(IProgressMonitor monitor) { >- String name = ((PersistentType)bo).getName(); >- getFeatureProvider().remove(name, true); >- //return new Status(IStatus.OK, >- // JPADiagramEditorPlugin.PLUGIN_ID, >- // name + " is removed"); //$NON-NLS-1$ >- >- // } >- //}; >- //job.schedule(); >- //--------------------------------------------------------------------- >+ String name = ((PersistentType)bo).getName(); >+ getFeatureProvider().remove(name, true); > } > } > >@@ -123,9 +108,9 @@ > super.execute(context); > } > >- >- >- >- >+ public void postRemove(IRemoveContext context) { >+ if (shouldRearrangeIsARelations) >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); >+ } > > } >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/UpdateAttributeFeature.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/UpdateAttributeFeature.java,v >retrieving revision 1.2 >diff -u -r1.2 UpdateAttributeFeature.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/UpdateAttributeFeature.java 27 Apr 2011 22:45:26 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/UpdateAttributeFeature.java 26 Mar 2012 13:43:23 -0000 >@@ -31,6 +31,7 @@ > import org.eclipse.graphiti.mm.pictograms.ContainerShape; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.graphiti.services.Graphiti; >+import org.eclipse.graphiti.util.IColorConstant; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >@@ -128,17 +129,21 @@ > return rect; > } > >- public void addSeparatorsToShape(ContainerShape compartmentShape) { >- addSeparatorToCollection(compartmentShape, 0); >- addSeparatorToCollection(compartmentShape, JPAEditorConstants.COMPARTMENT_MIN_HEIGHT); >+ public void addSeparatorsToShape(ContainerShape compartmentShape, >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { >+ addSeparatorToCollection(compartmentShape, 0, dot); >+ addSeparatorToCollection(compartmentShape, JPAEditorConstants.COMPARTMENT_MIN_HEIGHT, dot); > } > >- private Shape addSeparatorToCollection(ContainerShape containerShape, int y) { >+ private Shape addSeparatorToCollection(ContainerShape containerShape, int y, >+ JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { > final int width = containerShape.getGraphicsAlgorithm().getWidth(); > Shape shape = Graphiti.getPeService().createShape(containerShape, false); > Rectangle rectangle = Graphiti.getGaService().createRectangle(shape); >- rectangle.setForeground(manageColor(JPAEditorConstants.ENTITY_BACKGROUND)); >- rectangle.setBackground(manageColor(JPAEditorConstants.ENTITY_BORDER_COLOR)); >+ IColorConstant foreground = JpaArtifactFactory.instance().getForeground(dot); >+ IColorConstant background = JpaArtifactFactory.instance().getBackground(dot); >+ rectangle.setForeground(manageColor(background)); >+ rectangle.setBackground(manageColor(foreground)); > rectangle.setLineVisible(false); > Graphiti.getGaService().setSize(rectangle, width, JPAEditorConstants.SEPARATOR_HEIGHT); > Graphiti.getGaService().setLocationAndSize(rectangle, 0, y, width, JPAEditorConstants.SEPARATOR_HEIGHT); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java,v >retrieving revision 1.5 >diff -u -r1.5 JPAEditorMessages.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java 20 May 2011 02:51:26 -0000 1.5 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java 26 Mar 2012 13:43:23 -0000 >@@ -36,18 +36,20 @@ > public static String CreateDiagramJob_createDiagramJobName; > public static String CreateDiagramJob_getJPADiagramMonitorTaskName; > >+ public static String CreateIsARelationFeature_description; >+ public static String CreateIsARelationFeature_name; >+ > public static String CreateJPAEntityFeature_createEntityErrorMsg; >- > public static String CreateJPAEntityFeature_createEntityErrorMsgTitle; >- > public static String CreateJPAEntityFeature_createEntityErrorStatusMsg; >- > public static String CreateJPAEntityFeature_jpaEntityFeatureDescription; > public static String CreateJPAEntityFeature_jpaEntityFeatureName; > public static String CreateJPAEntityFeature_jpaProjectSelectionDialogDescription; > public static String CreateJPAEntityFeature_jpaProjectSelectionDialogTitle; > public static String CreateJPAEntityFromMappedSuperclassFeature_createInheritedEntityFeatureDescription; > public static String CreateJPAEntityFromMappedSuperclassFeature_createInheritedEntityFeatureName; >+ public static String CreateMappedSuperclassFeature_createMappedSuperclassFeatureDescription; >+ public static String CreateMappedSuperclassFeature_createMappedSuperclassFeatureName; > > public static String CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName; > public static String CreateManyToManyBiDirRelationFeature_manyToManyUniDirFeatureDescription; >@@ -181,7 +183,9 @@ > public static String JPAEditorToolBehaviorProvider_expandEntitymenuItemDescr; > > public static String JPAEditorToolBehaviorProvider_expandAllEntitiesMenuItem; >- public static String JPAEditorToolBehaviorProvider_expandAllEntitiesMenuItemDescr; >+ public static String JPAEditorToolBehaviorProvider_expandAllEntitiesMenuItemDescr; >+ >+ public static String JPAEditorToolBehaviorProvider_InheritanceCompartmentTitle; > > public static String JPAEditorToolBehaviorProvider_refactorAttributeType; > public static String JPAEditorToolBehaviorProvider_refactorAttributeTypeDesc; >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties,v >retrieving revision 1.7 >diff -u -r1.7 messages.properties >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties 20 May 2011 02:51:26 -0000 1.7 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties 26 Mar 2012 13:43:23 -0000 >@@ -25,6 +25,10 @@ > > CreateDiagramJob_createDiagramJobName=Creating diagram for: {0}... > CreateDiagramJob_getJPADiagramMonitorTaskName=Get JPA Diagram >+ >+CreateIsARelationFeature_description=Click on an entity or mapped superclass and then click somewhere in the diagram to create new inherited entity >+CreateIsARelationFeature_name=Inherited Entity >+ > CreateJPAEntityFeature_createEntityErrorMsg=Entity could not be created. > CreateJPAEntityFeature_createEntityErrorMsgTitle=Cannot Create Entity > CreateJPAEntityFeature_createEntityErrorStatusMsg=Persistence API library is not into the project's classpath. >@@ -34,6 +38,8 @@ > CreateJPAEntityFeature_jpaProjectSelectionDialogTitle=Select JPA Project > CreateJPAEntityFromMappedSuperclassFeature_createInheritedEntityFeatureDescription=Create a new JPA entity that will inherit a new Mapped Superclass. > CreateJPAEntityFromMappedSuperclassFeature_createInheritedEntityFeatureName=Inherited Entity >+CreateMappedSuperclassFeature_createMappedSuperclassFeatureDescription=Create a new Mapped Superclass. >+CreateMappedSuperclassFeature_createMappedSuperclassFeatureName=Mapped Superclass > > CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName=Many-to-Many > CreateManyToManyBiDirRelationFeature_manyToManyUniDirFeatureDescription=Create new bidirectional many-to-many relation. >@@ -152,6 +158,7 @@ > JPAEditorToolBehaviorProvider_expandEntitymenuItemDescr=Expand entity. > JPAEditorToolBehaviorProvider_expandAllEntitiesMenuItem=Expand All > JPAEditorToolBehaviorProvider_expandAllEntitiesMenuItemDescr=Expand all entities. >+JPAEditorToolBehaviorProvider_InheritanceCompartmentTitle=Inheritance > JPAEditorToolBehaviorProvider_refactorAttributeType=Refactor Attribute Type... > JPAEditorToolBehaviorProvider_refactorAttributeTypeDesc=Change the type of the selected attribute. > JPAEditorToolBehaviorProvider_removeAllEntitiesMenu=Remove All Entities From Diagram >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java,v >retrieving revision 1.3 >diff -u -r1.3 OpenJpaDiagramActionDelegate.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java 15 Jul 2011 12:33:06 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java 26 Mar 2012 13:43:23 -0000 >@@ -178,7 +178,18 @@ > if (firstElement instanceof JpaNode) { > jpaProject = ((JpaNode)firstElement).getJpaProject(); > } else if (firstElement instanceof IProject) { >- jpaProject = JpaArtifactFactory.instance().getJpaProject((IProject)firstElement); >+ int cnt = 0; >+ while ((jpaProject == null) && (cnt < 25)) { >+ jpaProject = JpaArtifactFactory.instance().getJpaProject((IProject)firstElement); >+ if (jpaProject == null) { >+ try { >+ Thread.sleep(200); >+ } catch (InterruptedException e) { >+ JPADiagramEditorPlugin.logError("Thread sleep interrupted", e); //$NON-NLS-1$ >+ } >+ } >+ cnt++; >+ } > } > return JpaArtifactFactory.instance().getPersistenceUnit(jpaProject); > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java,v >retrieving revision 1.10 >diff -u -r1.10 ModelIntegrationUtil.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java 10 Feb 2012 20:49:05 -0000 1.10 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/modelintegration/util/ModelIntegrationUtil.java 26 Mar 2012 13:43:23 -0000 >@@ -294,6 +294,8 @@ > > public static JPAEditorDiagramTypeProvider getProviderByDiagram(String diagramName) { > IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if (workbenchWindow == null) >+ return null; > IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); > IEditorReference[] editorRefs = workbenchPage.getEditorReferences(); > for (IEditorReference editorRef : editorRefs) { >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorFeatureProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorFeatureProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 IJPAEditorFeatureProvider.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorFeatureProvider.java 2 Mar 2011 17:18:13 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorFeatureProvider.java 26 Mar 2012 13:43:23 -0000 >@@ -15,6 +15,8 @@ > *******************************************************************************/ > package org.eclipse.jpt.jpadiagrameditor.ui.internal.provider; > >+import java.util.Collection; >+import java.util.HashSet; > import java.util.Properties; > > import org.eclipse.core.resources.IProject; >@@ -23,7 +25,9 @@ > import org.eclipse.graphiti.features.IFeatureProvider; > import org.eclipse.graphiti.features.context.IDeleteContext; > import org.eclipse.graphiti.features.custom.ICustomFeature; >+import org.eclipse.graphiti.mm.pictograms.Diagram; > import org.eclipse.graphiti.mm.pictograms.Shape; >+import org.eclipse.graphiti.services.IPeService; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; >@@ -32,6 +36,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelDir; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IGraphicsUpdater; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IPeServiceUtil; >@@ -39,6 +44,12 @@ > > public interface IJPAEditorFeatureProvider extends IFeatureProvider{ > >+ public Diagram getDiagram(); >+ >+ public HashSet<IsARelation> getAllRedundantIsARelations(); >+ >+ public HashSet<IsARelation> getAllExistingIsARelations(); >+ > public ICompilationUnit getCompilationUnit(JavaPersistentType jpt); > > public boolean hasObjectWithName(String name); >@@ -80,8 +91,10 @@ > public void replaceAttribute(JavaPersistentAttribute oldAt, JavaPersistentAttribute newAt); > > public void renewAttributeJoiningStrategyPropertyListener(JavaPersistentAttribute jpa); >+ >+ public IPeService getPeService(); > >- public IPeServiceUtil getPeUtil(); >+ public IPeServiceUtil getPeServiceUtil(); > > public IJPAEditorUtil getJPAEditorUtil(); > >@@ -99,4 +112,12 @@ > > public Properties loadProperties(IProject project); > >+ public Collection<JavaPersistentType> getPersistentTypes(); >+ >+ public JavaPersistentType getFirstSuperclassBelongingToTheDiagram(JavaPersistentType subclass); >+ >+ public void removeAllRedundantIsARelations(); >+ >+ public boolean existRedundantIsARelations(); >+ > } >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorImageCreator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorImageCreator.java,v >retrieving revision 1.2 >diff -u -r1.2 IJPAEditorImageCreator.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorImageCreator.java 27 Apr 2011 22:45:26 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/IJPAEditorImageCreator.java 26 Mar 2012 13:43:23 -0000 >@@ -31,9 +31,11 @@ > > public Polyline createConnectionLine(Diagram d, Connection connection); > >+ public Polyline createIsAConnectionLine(Diagram d, Connection connection); >+ > //public ConnectionDecorator createTextConnectionDecorator(Connection connection, String text, double location); > >- public ConnectionDecorator createArrowConnectionDecorator(Connection connection, double location); >+ public ConnectionDecorator createArrowConnectionDecorator(Connection connection, double location, boolean isA); > > public ConnectionDecorator createManyEndWithArrowDecorator(Connection connection, double location); > >@@ -45,5 +47,7 @@ > > public ConnectionDecorator createCardinalityConnectionDecorator(Diagram d, Connection c, String text, double location); > >+ public ConnectionDecorator createIsATextConnectionDecorator(Diagram d, Connection c); >+ > > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java,v >retrieving revision 1.6 >diff -u -r1.6 JPAEditorDiagramTypeProvider.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java 29 Aug 2011 15:17:03 -0000 1.6 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java 26 Mar 2012 13:43:23 -0000 >@@ -266,10 +266,11 @@ > ctx.setHeight(sp.getHeight()); > ctx.setX(sp.getX()); > ctx.setY(sp.getY()); >- AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider()); >+ AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider(), false); > ft.add(ctx); > } > } >+ JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); > } > }); > getDiagramEditor().saveWithoutEntities(new NullProgressMonitor()); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 JPAEditorFeatureProvider.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java 12 May 2011 15:15:13 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java 26 Mar 2012 13:43:23 -0000 >@@ -19,10 +19,12 @@ > import java.util.Collection; > import java.util.HashSet; > import java.util.Iterator; >+import java.util.LinkedList; > import java.util.List; > import java.util.Properties; > > import org.eclipse.core.resources.IProject; >+import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.transaction.RecordingCommand; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.emf.transaction.util.TransactionUtil; >@@ -61,12 +63,14 @@ > import org.eclipse.graphiti.mm.pictograms.PictogramElement; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.graphiti.services.Graphiti; >+import org.eclipse.graphiti.services.IPeService; > import org.eclipse.graphiti.ui.features.DefaultFeatureProvider; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.internal.core.CompilationUnit; > import org.eclipse.jdt.internal.core.SourceType; > import org.eclipse.jpt.jpa.core.JpaNode; > import org.eclipse.jpt.jpa.core.context.PersistentAttribute; >+import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.java.JavaEntity; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; >@@ -82,11 +86,11 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseCompartmentShapeFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseEntityFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateJPAEntityFeature; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateJPAEntityFromMappedSuperclassFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateManyToManyBiDirRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateManyToManyUniDirRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateManyToOneBiDirRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateManyToOneUniDirRelationFeature; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateMappedSuperclassFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateOneToManyUniDirRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateOneToOneBiDirRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateOneToOneUniDirRelationFeature; >@@ -113,6 +117,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelDir; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.GraphicsUpdaterImpl; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IGraphicsUpdater; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; >@@ -132,7 +137,8 @@ > > private ClickAddAttributeButtonFeature clickAddAttBtnFeat = null; > private ClickRemoveAttributeButtonFeature clickRemoveAttBtnFeat = null; >- private IPeServiceUtil peUtil = new PeServiceUtilImpl(); >+ private IPeServiceUtil peServiceUtil = new PeServiceUtilImpl(); >+ private IPeService peService = Graphiti.getPeService(); > private IJPAEditorUtil jpaEditorUtil = new JPAEditorUtilImpl(); > private IModelIntegrationUtil moinIntegrationUtil = new ModelIntegrationUtilImpl(); > private IGraphicsUpdater graphicsUpdater = new GraphicsUpdaterImpl(); >@@ -148,6 +154,100 @@ > ((JPASolver)getIndependenceSolver()).stopThread(); > } > >+ public Diagram getDiagram() { >+ return getDiagramTypeProvider().getDiagram(); >+ } >+ >+ public HashSet<IsARelation> getAllExistingIsARelations() { >+ EList<Connection> allCons = getDiagram().getConnections(); >+ HashSet<IsARelation> res = new HashSet<IsARelation>(); >+ HashSet<Connection> tbd = new HashSet<Connection>(); >+ for (Connection conn : allCons) { >+ if (IsARelation.isIsAConnection(conn)) >+ try { >+ res.add(new IsARelation(this, conn)); >+ } catch (NullPointerException e) { >+ tbd.add(conn); >+ } >+ } >+ Iterator<Connection> it = tbd.iterator(); >+ while (it.hasNext()) { >+ Graphiti.getPeService().deletePictogramElement(it.next()); >+ } >+ return res; >+ } >+ >+ public HashSet<IsARelation> getAllRedundantIsARelations() { >+ EList<Connection> allCons = getDiagram().getConnections(); >+ HashSet<IsARelation> res = new HashSet<IsARelation>(); >+ for (Connection conn : allCons) { >+ if (IsARelation.isIsAConnection(conn)) >+ res.add(new IsARelation(this, conn)); >+ } >+ return res; >+ } >+ >+ public void removeAllRedundantIsARelations() { >+ EList<Connection> allCons = getDiagram().getConnections(); >+ Collection<Connection> redundantConnections = new LinkedList<Connection>(); >+ for (Connection conn : allCons) { >+ if (IsARelation.isIsAConnection(conn)) { >+ IsARelation rel = null; >+ try { >+ rel = new IsARelation(this, conn); >+ } catch (NullPointerException e) { >+ redundantConnections.add(conn); >+ continue; >+ } >+ if (!rel.getSuperclass().getName().equals(getFirstSuperclassBelongingToTheDiagram(rel.getSubclass()).getName())) { >+ redundantConnections.add(conn); >+ } >+ } >+ } >+ Iterator<Connection> it = redundantConnections.iterator(); >+ while (it.hasNext()) { >+ Connection conn = it.next(); >+ peService.deletePictogramElement(conn); >+ } >+ } >+ >+ public boolean existRedundantIsARelations() { >+ EList<Connection> allCons = getDiagram().getConnections(); >+ for (Connection conn : allCons) { >+ if (IsARelation.isIsAConnection(conn)) { >+ IsARelation rel = null; >+ try { >+ rel = new IsARelation(this, conn); >+ } catch (NullPointerException e) { >+ return true; >+ } >+ if (!rel.getSuperclass().equals(getFirstSuperclassBelongingToTheDiagram(rel.getSubclass()))) { >+ return true; >+ } >+ } >+ } >+ return false; >+ } >+ >+ public JavaPersistentType getFirstSuperclassBelongingToTheDiagram(JavaPersistentType subclass) { >+ Iterable<PersistentType> h = subclass.getInheritanceHierarchy(); >+ Iterator<PersistentType> iter = h.iterator(); >+ if (!iter.hasNext()) >+ return null; >+ HashSet<PersistentType> cycleChecker = new HashSet<PersistentType>(); >+ cycleChecker.add(iter.next()); >+ while (iter.hasNext()) { >+ PersistentType superclass = iter.next(); >+ if (hasObjectWithName(getKeyForBusinessObject(superclass))) { >+ return (JavaPersistentType) superclass; >+ } >+ if (!cycleChecker.add(superclass)) >+ return null; >+ } >+ return null; >+ } >+ >+ > public void addJPTForUpdate(String jptName) { > ((JPASolver)getIndependenceSolver()).addJPTForUpdate(jptName); > } >@@ -178,7 +278,7 @@ > public IAddFeature getAddFeature(IAddContext context) { > Object newObj = context.getNewObject(); > if (newObj instanceof JavaPersistentType) { >- return new AddJPAEntityFeature(this); >+ return new AddJPAEntityFeature(this, true); > } else if (newObj instanceof AbstractRelation) { > return new AddRelationFeature(this); > } else if (newObj instanceof PersistentAttribute) { >@@ -190,11 +290,11 @@ > } else if (newObj instanceof CompilationUnit) { > CompilationUnit cu = (CompilationUnit)newObj; > JavaPersistentType jpt = JPAEditorUtil.getJPType(cu); >- if (jpt != null) return new AddJPAEntityFeature(this); >+ if (jpt != null) return new AddJPAEntityFeature(this, true); > } else if ((newObj instanceof JpaNode)) { > return new AddAllEntitiesFeature(this); > } else if (newObj instanceof SourceType) { >- return new AddJPAEntityFeature(this); >+ return new AddJPAEntityFeature(this, true); > } > return super.getAddFeature(context); > } >@@ -202,7 +302,8 @@ > > @Override > public ICreateFeature[] getCreateFeatures() { >- return new ICreateFeature[] { new CreateJPAEntityFeature(this), new CreateJPAEntityFromMappedSuperclassFeature(this) }; >+ return new ICreateFeature[] {new CreateJPAEntityFeature(this), >+ new CreateMappedSuperclassFeature(this)}; > } > > @Override >@@ -278,7 +379,7 @@ > if (bo == null) > super.getRemoveFeature(context); > if (bo instanceof JavaPersistentType) { >- return new RemoveJPAEntityFeature(this); >+ return new RemoveJPAEntityFeature(this, true); > } else if (bo instanceof AbstractRelation) { > return new RemoveRelationFeature(this); > } >@@ -456,6 +557,9 @@ > return ((JPASolver)getIndependenceSolver()).remove(key); > } > >+ public Collection<JavaPersistentType> getPersistentTypes() { >+ return ((JPASolver)getIndependenceSolver()).getPersistentTypes(); >+ } > > protected void removeAllConnections(Shape shape) { > for (Iterator<Anchor> iter = shape.getAnchors().iterator(); iter.hasNext();) { >@@ -590,10 +694,13 @@ > ((JPASolver)getIndependenceSolver()).dispose(); > setIndependenceSolver(null); > } >+ >+ public IPeService getPeService() { >+ return peService; >+ } > >- >- public IPeServiceUtil getPeUtil() { >- return peUtil; >+ public IPeServiceUtil getPeServiceUtil() { >+ return peServiceUtil; > } > > public IJPAEditorUtil getJPAEditorUtil() { >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageCreator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageCreator.java,v >retrieving revision 1.2 >diff -u -r1.2 JPAEditorImageCreator.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageCreator.java 27 Apr 2011 22:45:26 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageCreator.java 26 Mar 2012 13:43:23 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.graphiti.mm.algorithms.Image; > import org.eclipse.graphiti.mm.algorithms.Polyline; > import org.eclipse.graphiti.mm.algorithms.Text; >+import org.eclipse.graphiti.mm.algorithms.styles.LineStyle; > import org.eclipse.graphiti.mm.pictograms.Connection; > import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator; > import org.eclipse.graphiti.mm.pictograms.Diagram; >@@ -37,18 +38,14 @@ > return polyline; > } > >- /* >- public ConnectionDecorator createTextConnectionDecorator(Connection connection, String text, double location) { >- ConnectionDecorator textDecorator = Graphiti.getPeService().createConnectionDecorator(connection, true, 0.5, true); >- Text txt = Graphiti.getGaService().createDefaultText(textDecorator); >- txt.setLineWidth(JPAEditorConstants.CONNECTION_LINE_WIDTH); >- txt.setValue(text); >- Graphiti.getGaService().manageColor(connection.getParent(), IColorConstant.BLACK); >- Graphiti.getGaService().setLocation(txt, 5, -20); >- return textDecorator; >+ public Polyline createIsAConnectionLine(Diagram d, Connection connection) { >+ Polyline polyline = Graphiti.getGaService().createPolyline(connection); >+ polyline.setForeground(Graphiti.getGaService().manageColor(d, JPAEditorConstants.IS_A_CONNECTION_LINE_COLOR)); >+ polyline.setLineWidth(JPAEditorConstants.IS_A_CONNECTION_LINE_WIDTH); >+ polyline.setLineStyle(LineStyle.DASH); >+ return polyline; > } >- */ >- >+ > public ConnectionDecorator createCardinalityConnectionDecorator(Diagram d, Connection c, String text, double location) { > ConnectionDecorator textDecorator = Graphiti.getPeService().createConnectionDecorator(c, true, location, true); > Text txt = Graphiti.getGaService().createDefaultText(d, textDecorator); >@@ -60,11 +57,14 @@ > return textDecorator; > } > >- public ConnectionDecorator createArrowConnectionDecorator(Connection connection, double location) { >+ public ConnectionDecorator createArrowConnectionDecorator(Connection connection, >+ double location, >+ boolean isA) { > ConnectionDecorator cd = Graphiti.getPeService().createConnectionDecorator(connection, false, location, true); >- Polyline arrow = null; >- arrow = Graphiti.getGaService().createPolyline(cd, new int[] { 11, 3, 0, 0, 11, -3, 11, 3}); >- arrow.setForeground(Graphiti.getGaService().manageColor(connection.getParent(), JPAEditorConstants.CONNECTION_LINE_COLOR)); >+ Polyline arrow = Graphiti.getGaService().createPolyline(cd, new int[] { 11, 3, 0, 0, 11, -3, 11, 3 }); >+ arrow.setForeground(Graphiti.getGaService().manageColor(connection.getParent(), isA ? >+ JPAEditorConstants.IS_A_CONNECTION_LINE_COLOR : >+ JPAEditorConstants.CONNECTION_LINE_COLOR)); > arrow.setLineWidth(JPAEditorConstants.CONNECTION_LINE_WIDTH); > return cd; > } >@@ -107,4 +107,15 @@ > return iconDecorator; > } > >+ public ConnectionDecorator createIsATextConnectionDecorator(Diagram d, Connection c) { >+ ConnectionDecorator textDecorator = Graphiti.getPeService().createConnectionDecorator(c, true, 0.5, true); >+ Text txt = Graphiti.getGaService().createDefaultText(d, textDecorator); >+ txt.setLineWidth(JPAEditorConstants.CONNECTION_LINE_WIDTH); >+ txt.setValue(JPAEditorConstants.IS_A); >+ Graphiti.getGaService().manageColor(c.getParent(), IColorConstant.BLACK); >+ //Point pt = JPAEditorUtil.recalcTextDecoratorPosition((FreeFormConnection)c, textDecorator); >+ Graphiti.getGaService().setLocation(txt, 5, 5, false); >+ return textDecorator; >+ } >+ > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 JPAEditorImageProvider.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java 26 Mar 2012 13:43:23 -0000 >@@ -18,42 +18,45 @@ > import org.eclipse.graphiti.ui.platform.AbstractImageProvider; > > public class JPAEditorImageProvider extends AbstractImageProvider { >- >- public final static String ID = "org.eclipse.jpt.jpadiagrameditor.ui.JPAEditorImageProvider"; //$NON-NLS-1$ >- static final String PRE = "org.eclipse.jpt.jpadiagrameditor.ui."; //$NON-NLS-1$ >- public static final String JPA_ENTITY = PRE + "entity"; //$NON-NLS-1$ >- public static final String ADD_JPA_ENTITY = PRE + "add_entity"; //$NON-NLS-1$ >- public static final String ADD_INHERITED_ENTITY = PRE + "mapped_superclass"; //$NON-NLS-1$ >- public static final String PRIMARY_KEY = PRE + "pk"; //$NON-NLS-1$ >- public static final String ICON_BASIC = PRE + "field"; //$NON-NLS-1$ >- public static final String ADD_ATTRIBUTE = PRE + "add_attribute"; //$NON-NLS-1$ >- public static final String REMOVE_ATTRIBUTE = PRE + "remove_attribute"; //$NON-NLS-1$ >- public static final String ICON_ONE_TO_ONE = PRE + "one_to_one_relation"; //$NON-NLS-1$ >- public static final String ICON_ONE_TO_MANY = PRE + "one_to_many_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_ONE = PRE + "many_to_one_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_MANY = PRE + "many_to_many_relation"; //$NON-NLS-1$ >- public static final String ICON_EMBEDDED_ID = PRE + "embedded_id"; //$NON-NLS-1$ >- public static final String ICON_VERSION = PRE + "version"; //$NON-NLS-1$ >- public static final String ICON_TRANSIENT = PRE + "transient"; //$NON-NLS-1$ >- public static final String ICON_EMBEDDED = PRE + "embedded"; //$NON-NLS-1$ >- public static final String ICON_UNMAPPED = PRE + "unmapped"; //$NON-NLS-1$ >- >- >- public static final String ICON_ONE_TO_ONE_1_DIR = PRE + "one_to_one_1_dir_relation"; //$NON-NLS-1$ >- public static final String ICON_ONE_TO_MANY_1_DIR = PRE + "one_to_many_1_dir_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_ONE_1_DIR = PRE + "many_to_one_1_dir_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_MANY_1_DIR = PRE + "many_to_many_1_dir_relation"; //$NON-NLS-1$ >- >- public static final String ICON_ONE_TO_ONE_2_DIR = PRE + "one_to_one_2_dir_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_ONE_2_DIR = PRE + "many_to_one_2_dir_relation"; //$NON-NLS-1$ >- public static final String ICON_MANY_TO_MANY_2_DIR = PRE + "many_to_many_2_dir_relation"; //$NON-NLS-1$ >+ >+ private final static String PREFIX = "org.eclipse.jpt.jpadiagrameditor.ui."; //$NON-NLS-1$ >+ public final static String ID = "org.eclipse.jpt.jpadiagrameditor.ui.JPAEditorImageProvider"; //$NON-NLS-1$ >+ >+ public static final String JPA_ENTITY = PREFIX + "entity"; //$NON-NLS-1$ >+ public static final String MAPPED_SUPERCLASS = PREFIX + "mapped_superclass"; //$NON-NLS-1$ >+ public static final String ADD_JPA_ENTITY = PREFIX + "add_entity"; //$NON-NLS-1$ >+ public static final String ADD_INHERITED_ENTITY = PREFIX + "add_inherited_entity"; //$NON-NLS-1$ >+ public static final String ADD_MAPPED_SUPERCLASS = PREFIX + "add_mapped_superclass"; //$NON-NLS-1$ >+ public static final String PRIMARY_KEY = PREFIX + "pk"; //$NON-NLS-1$ >+ public static final String ICON_BASIC = PREFIX + "field"; //$NON-NLS-1$ >+ public static final String ADD_ATTRIBUTE = PREFIX + "add_attribute"; //$NON-NLS-1$ >+ public static final String REMOVE_ATTRIBUTE = PREFIX + "remove_attribute"; //$NON-NLS-1$ >+ public static final String ICON_ONE_TO_ONE = PREFIX + "one_to_one_relation"; //$NON-NLS-1$ >+ public static final String ICON_ONE_TO_MANY = PREFIX + "one_to_many_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_ONE = PREFIX + "many_to_one_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_MANY = PREFIX + "many_to_many_relation"; //$NON-NLS-1$ >+ public static final String ICON_EMBEDDED_ID = PREFIX + "embedded_id"; //$NON-NLS-1$ >+ public static final String ICON_VERSION = PREFIX + "version"; //$NON-NLS-1$ >+ public static final String ICON_TRANSIENT = PREFIX + "transient"; //$NON-NLS-1$ >+ public static final String ICON_EMBEDDED = PREFIX + "embedded"; //$NON-NLS-1$ >+ public static final String ICON_UNMAPPED = PREFIX + "unmapped"; //$NON-NLS-1$ >+ >+ >+ public static final String ICON_ONE_TO_ONE_1_DIR = PREFIX + "one_to_one_1_dir_relation"; //$NON-NLS-1$ >+ public static final String ICON_ONE_TO_MANY_1_DIR = PREFIX + "one_to_many_1_dir_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_ONE_1_DIR = PREFIX + "many_to_one_1_dir_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_MANY_1_DIR = PREFIX + "many_to_many_1_dir_relation"; //$NON-NLS-1$ >+ >+ public static final String ICON_ONE_TO_ONE_2_DIR = PREFIX + "one_to_one_2_dir_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_ONE_2_DIR = PREFIX + "many_to_one_2_dir_relation"; //$NON-NLS-1$ >+ public static final String ICON_MANY_TO_MANY_2_DIR = PREFIX + "many_to_many_2_dir_relation"; //$NON-NLS-1$ > > >- public static final String ICON_SAVE = PRE + "save"; //$NON-NLS-1$ >- public static final String ICON_RESTORE = PRE + "restore"; //$NON-NLS-1$ >- public static final String ICON_SAVE_AND_REMOVE = PRE + "save_and_remove"; //$NON-NLS-1$ >+ public static final String ICON_SAVE = PREFIX + "save"; //$NON-NLS-1$ >+ public static final String ICON_RESTORE = PREFIX + "restore"; //$NON-NLS-1$ >+ public static final String ICON_SAVE_AND_REMOVE = PREFIX + "save_and_remove"; //$NON-NLS-1$ > >- private static final String ROOT_FOLDER_FOR_IMG = "icons/"; //$NON-NLS-1$ >+ private static final String ROOT_FOLDER_FOR_IMG = "icons/"; //$NON-NLS-1$ > > public JPAEditorImageProvider() { > super(); >@@ -62,34 +65,36 @@ > @Override > protected void addAvailableImages() { > addImageFilePath(ICON_BASIC, ROOT_FOLDER_FOR_IMG + "ent/basic.gif"); //$NON-NLS-1$ >- addImageFilePath(JPA_ENTITY, ROOT_FOLDER_FOR_IMG + "ent/entity.gif"); //$NON-NLS-1$ >+ addImageFilePath(JPA_ENTITY, ROOT_FOLDER_FOR_IMG + "ent/entity.gif"); //$NON-NLS-1$ >+ addImageFilePath(MAPPED_SUPERCLASS, ROOT_FOLDER_FOR_IMG + "ent/mapped-superclass.gif"); //$NON-NLS-1$ > addImageFilePath(ADD_JPA_ENTITY, ROOT_FOLDER_FOR_IMG + "ent/add_entity.gif"); //$NON-NLS-1$ >- addImageFilePath(ADD_INHERITED_ENTITY, ROOT_FOLDER_FOR_IMG + "ent/mapped-superclass.gif"); //$NON-NLS-1$ >- addImageFilePath(PRIMARY_KEY, ROOT_FOLDER_FOR_IMG + "ent/id.gif"); //$NON-NLS-1$ >- addImageFilePath(ADD_ATTRIBUTE, ROOT_FOLDER_FOR_IMG + "ent/add_attribute.gif"); //$NON-NLS-1$ >- addImageFilePath(REMOVE_ATTRIBUTE, ROOT_FOLDER_FOR_IMG + "ent/remove_attribute.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_ONE_TO_ONE, ROOT_FOLDER_FOR_IMG + "ent/one-to-one.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_ONE_TO_MANY, ROOT_FOLDER_FOR_IMG + "ent/one-to-many.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_ONE, ROOT_FOLDER_FOR_IMG + "ent/many-to-one.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_MANY, ROOT_FOLDER_FOR_IMG + "ent/many-to-many.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_EMBEDDED_ID, ROOT_FOLDER_FOR_IMG + "ent/embedded-id.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_VERSION, ROOT_FOLDER_FOR_IMG + "ent/version.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_TRANSIENT, ROOT_FOLDER_FOR_IMG + "ent/transient.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_EMBEDDED, ROOT_FOLDER_FOR_IMG + "ent/embedded.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_UNMAPPED, ROOT_FOLDER_FOR_IMG + "ent/null-attribute-mapping.gif"); //$NON-NLS-1$ >+ addImageFilePath(ADD_INHERITED_ENTITY, ROOT_FOLDER_FOR_IMG + "ent/add_entity.gif"); //$NON-NLS-1$ >+ addImageFilePath(ADD_MAPPED_SUPERCLASS, ROOT_FOLDER_FOR_IMG + "ent/add_mapped-superclass.gif"); //$NON-NLS-1$ >+ addImageFilePath(PRIMARY_KEY, ROOT_FOLDER_FOR_IMG + "ent/id.gif"); //$NON-NLS-1$ >+ addImageFilePath(ADD_ATTRIBUTE, ROOT_FOLDER_FOR_IMG + "ent/add_attribute.gif"); //$NON-NLS-1$ >+ addImageFilePath(REMOVE_ATTRIBUTE, ROOT_FOLDER_FOR_IMG + "ent/remove_attribute.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_ONE_TO_ONE, ROOT_FOLDER_FOR_IMG + "ent/one-to-one.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_ONE_TO_MANY, ROOT_FOLDER_FOR_IMG + "ent/one-to-many.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_ONE, ROOT_FOLDER_FOR_IMG + "ent/many-to-one.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_MANY, ROOT_FOLDER_FOR_IMG + "ent/many-to-many.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_EMBEDDED_ID, ROOT_FOLDER_FOR_IMG + "ent/embedded-id.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_VERSION, ROOT_FOLDER_FOR_IMG + "ent/version.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_TRANSIENT, ROOT_FOLDER_FOR_IMG + "ent/transient.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_EMBEDDED, ROOT_FOLDER_FOR_IMG + "ent/embedded.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_UNMAPPED, ROOT_FOLDER_FOR_IMG + "ent/null-attribute-mapping.gif"); //$NON-NLS-1$ > > addImageFilePath(ICON_ONE_TO_ONE_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-one-1-dir.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_ONE_TO_MANY_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-many-1-dir.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_ONE_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-one-1-dir.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_MANY_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-many-1-dir.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_ONE_TO_MANY_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-many-1-dir.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_ONE_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-one-1-dir.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_MANY_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-many-1-dir.gif"); //$NON-NLS-1$ > > addImageFilePath(ICON_ONE_TO_ONE_2_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-one-2-dir.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_ONE_2_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-one-2-dir.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_MANY_TO_MANY_2_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-many-2-dir.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_ONE_2_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-one-2-dir.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_MANY_TO_MANY_2_DIR, ROOT_FOLDER_FOR_IMG + "ent/many-to-many-2-dir.gif"); //$NON-NLS-1$ > >- addImageFilePath(ICON_SAVE, ROOT_FOLDER_FOR_IMG + "save.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_RESTORE, ROOT_FOLDER_FOR_IMG + "restore.gif"); //$NON-NLS-1$ >- addImageFilePath(ICON_SAVE_AND_REMOVE, ROOT_FOLDER_FOR_IMG + "save_and_remove.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_SAVE, ROOT_FOLDER_FOR_IMG + "save.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_RESTORE, ROOT_FOLDER_FOR_IMG + "restore.gif"); //$NON-NLS-1$ >+ addImageFilePath(ICON_SAVE_AND_REMOVE, ROOT_FOLDER_FOR_IMG + "save_and_remove.gif"); //$NON-NLS-1$ > } > > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 JPAEditorToolBehaviorProvider.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java 5 Aug 2011 11:04:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java 26 Mar 2012 13:43:23 -0000 >@@ -46,6 +46,7 @@ > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.graphiti.palette.IPaletteCompartmentEntry; > import org.eclipse.graphiti.palette.IToolEntry; >+import org.eclipse.graphiti.palette.impl.ConnectionCreationToolEntry; > import org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry; > import org.eclipse.graphiti.platform.IPlatformImageConstants; > import org.eclipse.graphiti.services.Graphiti; >@@ -68,6 +69,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseAllEntitiesFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseCompartmentShapeFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseEntityFeature; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateInheritedEntityFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.DeleteJPAEntityFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.DiscardAndRemoveAllEntitiesFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.ExpandAllEntitiesFeature; >@@ -88,8 +90,8 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.GraphicsUpdater; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IEclipseFacade; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants.ShapeType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; > import org.eclipse.ui.PartInitException; > > @SuppressWarnings("restriction") >@@ -236,6 +238,18 @@ > IPaletteCompartmentEntry en = ret.get(0); > ret.set(0, ret.get(1)); > ret.set(1, en); >+ >+ PaletteCompartmentEntry ent = new PaletteCompartmentEntry(JPAEditorMessages.JPAEditorToolBehaviorProvider_InheritanceCompartmentTitle, superCompartments[1].getIconId()); >+ CreateInheritedEntityFeature ft = new CreateInheritedEntityFeature(this.getFeatureProvider()); >+ ConnectionCreationToolEntry isARelToolEntry = new ConnectionCreationToolEntry(ft.getCreateName(), >+ ft.getCreateDescription(), ft.getCreateImageId(), ft.getCreateLargeImageId()); >+ isARelToolEntry.addCreateConnectionFeature(ft); >+ >+ ent.addToolEntry(isARelToolEntry); >+ >+ >+ ret.add(1, ent); >+ > return ret.toArray(new IPaletteCompartmentEntry[ret.size()]); > } > >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/******************************************************************************* >- * <copyright> >- * >- * Copyright (c) 2005, 2010 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: >- * Stefan Dimov - initial API, implementation and documentation >- * >- * </copyright> >- * >- *******************************************************************************/ >-package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; >- >-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; >- >-public interface BidirectionalRelation extends IRelation { >- >- public abstract JavaPersistentAttribute getOwnerAnnotatedAttribute(); >- >- public abstract JavaPersistentAttribute getInverseAnnotatedAttribute(); >- >- public abstract void setOwnerAnnotatedAttribute(JavaPersistentAttribute ownerAnnotatedAttribute); >- >- public abstract void setInverseAnnotatedAttribute(JavaPersistentAttribute inverseAnnotatedAttribute); >- >-} >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IBidirectionalRelation.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IBidirectionalRelation.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IBidirectionalRelation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IBidirectionalRelation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; >+ >+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; >+ >+public interface IBidirectionalRelation extends IRelation { >+ >+ public abstract JavaPersistentAttribute getOwnerAnnotatedAttribute(); >+ >+ public abstract JavaPersistentAttribute getInverseAnnotatedAttribute(); >+ >+ public abstract void setOwnerAnnotatedAttribute(JavaPersistentAttribute ownerAnnotatedAttribute); >+ >+ public abstract void setInverseAnnotatedAttribute(JavaPersistentAttribute inverseAnnotatedAttribute); >+ >+} >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IsARelation.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IsARelation.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IsARelation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IsARelation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; >+ >+import org.eclipse.graphiti.mm.pictograms.Anchor; >+import org.eclipse.graphiti.mm.pictograms.Connection; >+import org.eclipse.graphiti.mm.pictograms.ContainerShape; >+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorConstants; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; >+ >+public class IsARelation { >+ >+ protected final static String SEPARATOR = ";isA;"; //$NON-NLS-1$ >+ public final static String IS_A_CONNECTION_PROP_KEY = "is_is_a_connection"; //$NON-NLS-1$ >+ >+ >+ protected JavaPersistentType subclass; >+ protected JavaPersistentType superclass; >+ >+ public IsARelation(JavaPersistentType subclass, >+ JavaPersistentType superclass) { >+ this.subclass = subclass; >+ this.superclass = superclass; >+ } >+ >+ public IsARelation(IJPAEditorFeatureProvider fp, Connection conn) { >+ Anchor start = conn.getStart(); >+ Anchor end = conn.getEnd(); >+ Object startObj = fp.getBusinessObjectForPictogramElement((ContainerShape)start.eContainer()); >+ Object endObj = fp.getBusinessObjectForPictogramElement((ContainerShape)end.eContainer()); >+ if ((startObj == null) || (endObj == null)) >+ throw new NullPointerException("Some of the connection ends is null"); //$NON-NLS-1$ >+ if (!(startObj instanceof JavaPersistentType) || !(endObj instanceof JavaPersistentType)) >+ throw new IllegalArgumentException(); >+ this.subclass = (JavaPersistentType)startObj; >+ this.superclass = (JavaPersistentType)endObj; >+ } >+ >+ >+ public JavaPersistentType getSubclass() { >+ return subclass; >+ } >+ >+ public JavaPersistentType getSuperclass() { >+ return superclass; >+ } >+ >+ public static boolean isIsAConnection(Connection conn) { >+ String val = JPAEditorUtil.getPeUtil().getPropertyValue(conn, IS_A_CONNECTION_PROP_KEY); >+ return (Boolean.TRUE.toString().equals(val)); >+ } >+ >+ >+ public String getId() { >+ return generateId(subclass, superclass); >+ } >+ >+ public static String generateId(IJPAEditorFeatureProvider fp, Connection conn) { >+ Anchor start = conn.getStart(); >+ Anchor end = conn.getEnd(); >+ Object startObj = fp.getBusinessObjectForPictogramElement((ContainerShape)start.eContainer()); >+ Object endObj = fp.getBusinessObjectForPictogramElement((ContainerShape)end.eContainer()); >+ if ((startObj == null) || (endObj == null)) >+ return null; >+ if (!(startObj instanceof JavaPersistentType) || !(endObj instanceof JavaPersistentType)) >+ return null; >+ JavaPersistentType startJpt = (JavaPersistentType)startObj; >+ JavaPersistentType endJpt = (JavaPersistentType)endObj; >+ return generateId(startJpt, endJpt); >+ } >+ >+ private static String generateId(JavaPersistentType startJpt, JavaPersistentType endJpt) { >+ return JPAEditorConstants.IS_A_RELATION_ID_PREFIX + >+ startJpt.getName() + SEPARATOR + endJpt.getName(); >+ } >+ >+ public boolean equals(Object obj) { >+ if (obj == null) >+ return false; >+ if (this.hashCode() != obj.hashCode()) >+ return false; >+ if (!(obj instanceof IsARelation)) >+ return false; >+ IsARelation rel = (IsARelation)obj; >+ return this.getId().equals(rel.getId()); >+ } >+ >+ public int hashCode() { >+ return getId().hashCode(); >+ } >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java,v >retrieving revision 1.4 >diff -u -r1.4 ManyToManyBiDirRelation.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java 14 Apr 2011 16:46:20 -0000 1.4 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java 26 Mar 2012 13:43:25 -0000 >@@ -24,7 +24,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class ManyToManyBiDirRelation extends ManyToManyRelation implements BidirectionalRelation { >+public class ManyToManyBiDirRelation extends ManyToManyRelation implements IBidirectionalRelation { > > public ManyToManyBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, > JavaPersistentType inverse, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java,v >retrieving revision 1.4 >diff -u -r1.4 ManyToOneBiDirRelation.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java 14 Apr 2011 16:46:20 -0000 1.4 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java 26 Mar 2012 13:43:25 -0000 >@@ -24,7 +24,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class ManyToOneBiDirRelation extends ManyToOneRelation implements BidirectionalRelation{ >+public class ManyToOneBiDirRelation extends ManyToOneRelation implements IBidirectionalRelation{ > > public ManyToOneBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, > JavaPersistentType inverse, >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java,v >retrieving revision 1.3 >diff -u -r1.3 OneToOneBiDirRelation.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java 14 Apr 2011 14:39:00 -0000 1.3 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java 26 Mar 2012 13:43:25 -0000 >@@ -23,7 +23,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; > > >-public class OneToOneBiDirRelation extends OneToOneRelation implements BidirectionalRelation{ >+public class OneToOneBiDirRelation extends OneToOneRelation implements IBidirectionalRelation{ > public OneToOneBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, > JavaPersistentType inverse, > String ownerAttributeName, >@@ -59,7 +59,6 @@ > private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { > String name = JPAEditorUtil.returnSimpleName(inverse.getName()); > String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); >- > String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); > String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); > >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java,v >retrieving revision 1.5 >diff -u -r1.5 EntityChangeListener.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java 20 Feb 2012 21:56:32 -0000 1.5 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java 26 Mar 2012 13:43:25 -0000 >@@ -20,10 +20,9 @@ > import java.util.Hashtable; > import java.util.Iterator; > import java.util.Set; >+ > import org.eclipse.graphiti.features.context.impl.RemoveContext; > import org.eclipse.graphiti.mm.pictograms.ContainerShape; >-import org.eclipse.jdt.core.ICompilationUnit; >-import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jpt.common.core.resource.java.Annotation; > import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; > import org.eclipse.jpt.jpa.core.context.MappedByRelationship; >@@ -122,7 +121,7 @@ > PersistenceUnit pu = JpaArtifactFactory.instance().getPersistenceUnit(jpt); > PersistentType pt = pu.getPersistentType(jpt.getName()); > >- if ((pt == null) || !JpaArtifactFactory.instance().hasEntityAnnotation(jpt)) { >+ if ((pt == null) || !JpaArtifactFactory.instance().hasEntityOrMappedSuperclassAnnotation(jpt)) { > > JpaArtifactFactory.instance().forceSaveEntityClass(jpt, featureProvider); > >@@ -136,21 +135,6 @@ > RemoveAndSaveEntityFeature ft = new RemoveAndSaveEntityFeature(featureProvider); > ft.remove(ctx); > break; >- } else { >- >- ICompilationUnit cu = featureProvider.getCompilationUnit(jpt); >- String entName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(jpt)); >- try { >- final String newHeader = (cu.hasUnsavedChanges() ? "* " : "") + entName; //$NON-NLS-1$ //$NON-NLS-2$ >- Display.getDefault().asyncExec(new Runnable() { >- public void run() { >- GraphicsUpdater.updateHeader(entShape, newHeader); >- } >- }); >- >- } catch (JavaModelException e) { >- JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ >- } > } > } > } >@@ -192,7 +176,7 @@ > } > } > } catch(Exception e) { >- //$NON-NLS-1$ >+ //ignore > } > } > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/GraphicsUpdater.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/GraphicsUpdater.java,v >retrieving revision 1.2 >diff -u -r1.2 GraphicsUpdater.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/GraphicsUpdater.java 12 Sep 2011 09:37:13 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/GraphicsUpdater.java 26 Mar 2012 13:43:25 -0000 >@@ -166,9 +166,25 @@ > } > > public static void updateHeader(ContainerShape entityShape, final String newHeader) { >- if(entityShape == null) >+ final Text txt = getHeaderText(entityShape); >+ if (txt == null) > return; >- >+ //if (!JPAEditorUtil.areHeadersEqual(txt.getValue(), newHeader)) { >+ >+ if (!txt.getValue().equals(newHeader)) { >+ TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(txt); >+ RecordingCommand rc = new RecordingCommand(ted) { >+ protected void doExecute() { >+ txt.setValue(newHeader); >+ } >+ }; >+ ted.getCommandStack().execute(rc); >+ } >+ } >+ >+ private static Text getHeaderText(ContainerShape entityShape) { >+ if(entityShape == null) >+ return null; > List<Shape> shapes = entityShape.getChildren(); > Iterator<Shape> shIt = shapes.iterator(); > Shape headerShape = null;; >@@ -180,19 +196,13 @@ > headerShape = null; > } > if (headerShape == null) >- return; >+ return null; > GraphicsAlgorithm ga = headerShape.getGraphicsAlgorithm(); > if (ga == null) >- return; >- final Text txt = (Text)ga.getGraphicsAlgorithmChildren().get(0); >- if (!JPAEditorUtil.areHeadersEqual(txt.getValue(), newHeader)) { >- TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(txt); >- RecordingCommand rc = new RecordingCommand(ted) { >- protected void doExecute() { >- txt.setValue(newHeader); >- } >- }; >- ted.getCommandStack().execute(rc); >- } >+ return null; >+ if (ga.getGraphicsAlgorithmChildren().size() == 0) >+ return null; >+ Text txt = (Text)ga.getGraphicsAlgorithmChildren().get(0); >+ return txt; > } > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorPredefinedRenderingStyle.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorPredefinedRenderingStyle.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorPredefinedRenderingStyle.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorPredefinedRenderingStyle.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.util; >+ >+import org.eclipse.graphiti.util.IPredefinedRenderingStyle; >+ >+public interface IJPAEditorPredefinedRenderingStyle extends IPredefinedRenderingStyle { >+ >+ /** >+ * The ID for a green-to-white gradient with a gloss-effect. >+ */ >+ public static final String GREEN_WHITE_GLOSS_ID = "green-white-gloss"; //$NON-NLS-1$ >+ >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorUtil.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorUtil.java,v >retrieving revision 1.1 >diff -u -r1.1 IJPAEditorUtil.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorUtil.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/IJPAEditorUtil.java 26 Mar 2012 13:43:26 -0000 >@@ -18,6 +18,7 @@ > import java.util.List; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; > import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator; > import org.eclipse.graphiti.mm.pictograms.FreeFormConnection; >@@ -64,11 +65,23 @@ > boolean isMappedSuperClassChild, > String mappedSuperclassName, > String mappedSuperclassPackage, >+ String idName, > boolean hasPrimaryKey) throws Exception; >+ >+ public IFile createEntityInProject(IProject project, >+ String entityName, >+ JavaPersistentType mappedSuperclass) throws Exception; >+ > > public IFile createEntityFromMappedSuperclassInProject(IProject project, > String mappedSuperclassName, IPreferenceStore jpaPreferenceStore) throws Exception; > >+ public IFile createMappedSuperclassInProject(IProject project, >+ IFolder folder, String mappedSuperclassName) throws Exception; >+ >+ public IFile createMappedSuperclassInProject(IProject project, >+ String mappedSuperclassName) throws Exception; >+ > public boolean isCardinalityDecorator(ConnectionDecorator cd); > > public void discardWorkingCopyOnce(ICompilationUnit cu); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorConstants.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorConstants.java,v >retrieving revision 1.4 >diff -u -r1.4 JPAEditorConstants.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorConstants.java 12 Sep 2011 09:37:13 -0000 1.4 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorConstants.java 26 Mar 2012 13:43:26 -0000 >@@ -25,6 +25,15 @@ > > public class JPAEditorConstants { > >+ public static enum DIAGRAM_OBJECT_TYPE { >+ Entity, >+ MappedSupeclass >+ }; >+ >+ public static final String IS_A_RELATION_ID_PREFIX = "is_a_relation:"; //$NON-NLS-1$ >+ >+ public static final String IS_A = "is-a"; //$NON-NLS-1$ >+ > public static final String HEADER_PREFIX_DIRTY = "* "; //$NON-NLS-1$ > > public static Hashtable<String, String> PRIMITIVE_TO_WRAPPER = new Hashtable<String,String>(); >@@ -41,16 +50,27 @@ > > public static final IColorConstant ENTITY_BACKGROUND = > new ColorConstant(212, 231, 248); >+ >+ public static final IColorConstant MAPPED_SUPERCLASS_BACKGROUND = >+ new ColorConstant(212, 248, 231); > > public static final IColorConstant CONNECTION_LINE_COLOR = > new ColorConstant(98, 131,167); > >+ public static final IColorConstant IS_A_CONNECTION_LINE_COLOR = >+ new ColorConstant(98, 167, 131); >+ > public static final IColorConstant ENTITY_BORDER_COLOR = > new ColorConstant(98, 131,167); > >+ public static final IColorConstant MAPPED_SUPERCLASS_BORDER_COLOR = >+ new ColorConstant(98, 167, 131); >+ > public final static String TRUE_STRING = Boolean.toString(true); > > public final static int CONNECTION_LINE_WIDTH = 2; >+ public final static int IS_A_CONNECTION_LINE_WIDTH = 2; >+ > public final static int ENTITY_BORDER_WIDTH = 2; > > public final static int ENTITY_CORNER_WIDTH = 6; >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorPredefinedColoredAreas.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorPredefinedColoredAreas.java >diff -N src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorPredefinedColoredAreas.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorPredefinedColoredAreas.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,150 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ >+package org.eclipse.jpt.jpadiagrameditor.ui.internal.util; >+ >+import org.eclipse.emf.common.util.EList; >+import org.eclipse.graphiti.mm.algorithms.styles.AdaptedGradientColoredAreas; >+import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredArea; >+import org.eclipse.graphiti.mm.algorithms.styles.GradientColoredAreas; >+import org.eclipse.graphiti.mm.algorithms.styles.LocationType; >+import org.eclipse.graphiti.mm.algorithms.styles.StylesFactory; >+import org.eclipse.graphiti.util.IGradientType; >+import org.eclipse.graphiti.util.IPredefinedRenderingStyle; >+import org.eclipse.graphiti.util.PredefinedColoredAreas; >+ >+public class JPAEditorPredefinedColoredAreas extends PredefinedColoredAreas >+ implements IJPAEditorPredefinedRenderingStyle { >+ >+ /** >+ * The color-areas, which are used for default elements with the ID >+ * {@link #GREEN_WHITE_GLOSS_ID}. >+ */ >+ private static GradientColoredAreas getGreenWhiteGlossDefaultAreas() { >+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE.createGradientColoredAreas(); >+ final EList<GradientColoredArea> gcas = gradientColoredAreas.getGradientColor(); >+ >+ addGradientColoredArea(gcas, "F8FEFB", 0, LocationType.LOCATION_TYPE_ABSOLUTE_START, "F8FEFB", 1, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "EDFCF5", 1, LocationType.LOCATION_TYPE_ABSOLUTE_START, "EDFCF5", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "DEFAED", 2, LocationType.LOCATION_TYPE_ABSOLUTE_START, "DEFAED", 3, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "D4F8E7", 3, LocationType.LOCATION_TYPE_ABSOLUTE_START, "FAFCFB", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ addGradientColoredArea(gcas, "E2E9E5", 2, LocationType.LOCATION_TYPE_ABSOLUTE_END, "E2E9E5", 0, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ gradientColoredAreas.setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT); >+ return gradientColoredAreas; >+ } >+ >+ /** >+ * The color-areas, which are used for primary selected elements with the ID >+ * {@link #GREEN_WHITE_GLOSS_ID}. >+ */ >+ private static GradientColoredAreas getGreenWhiteGlossPrimarySelectedAreas() { >+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE.createGradientColoredAreas(); >+ gradientColoredAreas.setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED); >+ final EList<GradientColoredArea> gcas = gradientColoredAreas.getGradientColor(); >+ >+ addGradientColoredArea(gcas, "EEFDF6", 0, LocationType.LOCATION_TYPE_ABSOLUTE_START, "EEFDF6", 1, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "D0F9E6", 1, LocationType.LOCATION_TYPE_ABSOLUTE_START, "D0F9E6", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "ACF4D2", 2, LocationType.LOCATION_TYPE_ABSOLUTE_START, "ACF4D2", 3, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "81EAB9", 3, LocationType.LOCATION_TYPE_ABSOLUTE_START, "AAF2D0", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ addGradientColoredArea(gcas, "9AE0BF", 2, LocationType.LOCATION_TYPE_ABSOLUTE_END, "9AE0BF", 0, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ return gradientColoredAreas; >+ } >+ >+ /** >+ * The color-areas, which are used for secondary selected elements with the >+ * ID {@link #GREEN_WHITE_GLOSS_ID}. >+ */ >+ private static GradientColoredAreas getGreenWhiteGlossSecondarySelectedAreas() { >+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE.createGradientColoredAreas(); >+ gradientColoredAreas.setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED); >+ final EList<GradientColoredArea> gcas = gradientColoredAreas.getGradientColor(); >+ >+ addGradientColoredArea(gcas, "F5FEF9", 0, LocationType.LOCATION_TYPE_ABSOLUTE_START, "F5FEF9", 1, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "E2FCEF", 1, LocationType.LOCATION_TYPE_ABSOLUTE_START, "E2FCEF", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "CBF9E3", 2, LocationType.LOCATION_TYPE_ABSOLUTE_START, "CBF9E3", 3, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_START); >+ addGradientColoredArea(gcas, "BBF7DA", 3, LocationType.LOCATION_TYPE_ABSOLUTE_START, "C5F7E0", 2, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ addGradientColoredArea(gcas, "B2E5CD", 2, LocationType.LOCATION_TYPE_ABSOLUTE_END, "B2E5CD", 0, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ return gradientColoredAreas; >+ } >+ >+ /** >+ * The color-areas, which are used for elements where an action is allowed >+ * with the ID {@link #GREEN_WHITE_GLOSS_ID}. >+ */ >+ private static GradientColoredAreas getGreeenWhiteGlossActionAllowedAreas() { >+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE.createGradientColoredAreas(); >+ gradientColoredAreas.setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_ALLOWED); >+ final EList<GradientColoredArea> gcas = gradientColoredAreas.getGradientColor(); >+ >+ addGradientColoredArea(gcas, "9900CC", 0, LocationType.LOCATION_TYPE_ABSOLUTE_START, "336699", 0, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ return gradientColoredAreas; >+ } >+ >+ /** >+ * The color-areas, which are used for elements where an action is forbidden >+ * with the ID {@link #GREEN_WHITE_GLOSS_ID}. >+ */ >+ private static GradientColoredAreas getGreenWhiteGlossActionForbiddenAreas() { >+ final GradientColoredAreas gradientColoredAreas = StylesFactory.eINSTANCE.createGradientColoredAreas(); >+ gradientColoredAreas.setStyleAdaption(IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_FORBIDDEN); >+ final EList<GradientColoredArea> gcas = gradientColoredAreas.getGradientColor(); >+ >+ addGradientColoredArea(gcas, "FF00CC", 0, LocationType.LOCATION_TYPE_ABSOLUTE_START, "FF0066", 0, //$NON-NLS-1$ //$NON-NLS-2$ >+ LocationType.LOCATION_TYPE_ABSOLUTE_END); >+ return gradientColoredAreas; >+ } >+ >+ >+ public static AdaptedGradientColoredAreas getGreenWhiteGlossAdaptions() { >+ final AdaptedGradientColoredAreas agca = StylesFactory.eINSTANCE.createAdaptedGradientColoredAreas(); >+ agca.setDefinedStyleId(GREEN_WHITE_GLOSS_ID); >+ agca.setGradientType(IGradientType.VERTICAL); >+ agca.getAdaptedGradientColoredAreas().add(IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT, getGreenWhiteGlossDefaultAreas()); >+ agca.getAdaptedGradientColoredAreas().add(IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED, >+ getGreenWhiteGlossPrimarySelectedAreas()); >+ agca.getAdaptedGradientColoredAreas().add(IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED, >+ getGreenWhiteGlossSecondarySelectedAreas()); >+ agca.getAdaptedGradientColoredAreas().add(IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_ALLOWED, >+ getGreeenWhiteGlossActionAllowedAreas()); >+ agca.getAdaptedGradientColoredAreas().add(IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_FORBIDDEN, >+ getGreenWhiteGlossActionForbiddenAreas()); >+ return agca; >+ } >+ >+ public static AdaptedGradientColoredAreas getAdaptedGradientColoredAreas(String id) { >+ AdaptedGradientColoredAreas res = PredefinedColoredAreas.getAdaptedGradientColoredAreas(id); >+ if (res != null) >+ return res; >+ if (GREEN_WHITE_GLOSS_ID.equals(id)) >+ return getGreenWhiteGlossAdaptions(); >+ return null; >+ } >+} >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java,v >retrieving revision 1.9 >diff -u -r1.9 JPAEditorUtil.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java 10 Feb 2012 20:49:05 -0000 1.9 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java 26 Mar 2012 13:43:29 -0000 >@@ -159,7 +159,9 @@ > > public static Anchor getAnchor(ContainerShape cs) { > Collection<Anchor> anchors = cs.getAnchors(); >- return anchors.iterator().next(); >+ if (anchors.iterator().hasNext()) >+ return anchors.iterator().next(); >+ return null; > } > > public static Anchor getAnchor(JavaPersistentType jpt, IFeatureProvider fp) { >@@ -536,7 +538,12 @@ > Iterator<Connection> consIt = cons.iterator(); > while (consIt.hasNext()) { > Connection con = consIt.next(); >- ContainerShape cs1 = (ContainerShape)con.getStart().getParent(); >+ ContainerShape cs1 = null; >+ try { >+ cs1 = (ContainerShape)con.getStart().getParent(); >+ } catch (NullPointerException e) { >+ continue; >+ } > if (cs1 != cs) > res.add(cs1); > cs1 = (ContainerShape)con.getEnd().getParent(); >@@ -847,7 +854,10 @@ > Iterator<Connection> cIter = set.iterator(); > while (cIter.hasNext()) { > Connection c = cIter.next(); >- IRelation rel = (IRelation)fp.getBusinessObjectForPictogramElement(c); >+ Object o = fp.getBusinessObjectForPictogramElement(c); >+ if (!(o instanceof IRelation)) >+ continue; >+ IRelation rel = (IRelation)o; > rearrangeConnection(c, cnt, setSize, rel.getOwner() == rel.getInverse()); > cnt++; > } >@@ -1067,7 +1077,7 @@ > > static public String generateUniqueMappedSuperclassName( > JpaProject jpaProject, String pack, IJPAEditorFeatureProvider fp) { >- String NAME = pack + ".MappedSuperclass"; //$NON-NLS-1$ >+ String NAME = pack + ".MpdSuprcls"; //$NON-NLS-1$ > String name = null; > > HashSet<String> JPAProjectEntityNames = getEntityNames(jpaProject); >@@ -1084,17 +1094,26 @@ > return name; > } > >- >+ static public IFile createEntityInProject(IProject project, >+ String entityName, >+ JavaPersistentType mappedSuperclass) throws Exception { >+ IFolder folder = getPackageFolder(project); >+ return createEntity(project, folder, entityName, >+ true, mappedSuperclass.getName(), >+ JpaArtifactFactory.instance().getMappedSuperclassPackageDeclaration(mappedSuperclass), >+ JpaArtifactFactory.instance().generateIdName(mappedSuperclass), >+ JpaArtifactFactory.instance().hasOrInheritsPrimaryKey(mappedSuperclass)); >+ } > > static public IFile createEntityInProject(IProject project, > String entityName, IPreferenceStore jpaPreferenceStore, > boolean isMappedSuperclassChild, String mappedSuperclassName, >- String mappedSuperclassPackage, boolean hasPrimaryKey) >+ String mappedSuperclassPackage, String idName, boolean hasPrimaryKey) > throws Exception { > IFolder folder = getPackageFolder(project); > return createEntity(project, folder, entityName, > isMappedSuperclassChild, mappedSuperclassName, >- mappedSuperclassPackage, hasPrimaryKey); >+ mappedSuperclassPackage, idName, hasPrimaryKey); > } > > >@@ -1102,8 +1121,7 @@ > IProject project, String mappedSuperclassName, > IPreferenceStore jpaPreferenceStore) throws Exception { > IFolder folder = getPackageFolder(project); >- createMappedSuperclass(project, folder, mappedSuperclassName); >- return createMappedSuperclass(project, folder, mappedSuperclassName); >+ return createMappedSuperclassInProject(project, folder, mappedSuperclassName); > } > > @SuppressWarnings("deprecation") >@@ -1130,7 +1148,13 @@ > > } > >- static private IFile createMappedSuperclass(IProject project, >+ static public IFile createMappedSuperclassInProject(IProject project, >+ String mappedSuperclassName) throws Exception { >+ IFolder folder = getPackageFolder(project); >+ return createMappedSuperclassInProject(project, folder, mappedSuperclassName); >+ } >+ >+ static public IFile createMappedSuperclassInProject(IProject project, > IFolder folder, String mappedSuperclassName) throws Exception { > > String mappedSuperclassShortName = mappedSuperclassName >@@ -1275,10 +1299,14 @@ > } > } > >- static private IFile createEntity(IProject project, IFolder folder, String entityName, boolean isMappedSuperclassChild, >- String mappedSuperclassName, String mappedSuperclassPackage, boolean hasPrimaryKey) throws Exception { >- >- >+ static private IFile createEntity(IProject project, >+ IFolder folder, >+ String entityName, >+ boolean isMappedSuperclassChild, >+ String mappedSuperclassName, >+ String mappedSuperclassPackage, >+ String idName, >+ boolean hasPrimaryKey) throws Exception { > > String entityShortName = entityName.substring(entityName.lastIndexOf('.') + 1); > if (!folder.exists()) { >@@ -1306,28 +1334,20 @@ > } > > String primaryKeyDeclaration = ""; //$NON-NLS-1$ >- if (!hasPrimaryKey) { >- primaryKeyDeclaration = (fieldBasedAccess ? " @Id \n" : "") //$NON-NLS-1$ //$NON-NLS-2$ >- + " private long id;\n\n" //$NON-NLS-1$ >- + (fieldBasedAccess ? "" : " @Id \n") //$NON-NLS-1$ //$NON-NLS-2$ >- + " public long getId() {\n" //$NON-NLS-1$ >- + " return id;\n" //$NON-NLS-1$ >- + " }\n\n" //$NON-NLS-1$ >- + " public void setId(long id) {\n" //$NON-NLS-1$ >- + " this.id = id;\n" //$NON-NLS-1$ >- + " }\n\n"; //$NON-NLS-1$ >- } >- >+ if (!hasPrimaryKey) >+ primaryKeyDeclaration = generatePrimaryKeyDeclaration(fieldBasedAccess, idName); > > if (!file.exists()) { >- String content = "package " + JPADiagramPropertyPage.getDefaultPackage(project, props) + ";\n\n" //$NON-NLS-1$ //$NON-NLS-2$ >- + "import javax.persistence.*;\n" //$NON-NLS-1$ >- + packageImport+"\n\n" //$NON-NLS-1$ >- + "@Entity \n" //$NON-NLS-1$ >- + ((tableName.length() > 0) ? ("@Table(name=\"" + tableName + "\")\n") : "") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- + classDeclarationStringContent >- + primaryKeyDeclaration >- +"}"; //$NON-NLS-1$ >+ String content = "package " + JPADiagramPropertyPage.getDefaultPackage(project, props) //$NON-NLS-1$ >+ + ";\n\n" //$NON-NLS-1$ >+ + "import javax.persistence.*;\n" //$NON-NLS-1$ >+ + packageImport+"\n\n" //$NON-NLS-1$ >+ + "@Entity \n" //$NON-NLS-1$ >+ + ((tableName.length() > 0) ? ("@Table(name=\"" //$NON-NLS-1$ >+ + tableName + "\")\n") : "") //$NON-NLS-1$ //$NON-NLS-2$ >+ + classDeclarationStringContent >+ + primaryKeyDeclaration >+ +"}"; //$NON-NLS-1$ > ByteArrayOutputStream stream = new ByteArrayOutputStream(); > try { > stream.write(content.getBytes()); >@@ -1338,7 +1358,21 @@ > } > } > return file; >- } >+ } >+ >+ static private String generatePrimaryKeyDeclaration(boolean fieldBasedAccess, String primaryKeyName) { >+ String primaryKeyDeclaration = (fieldBasedAccess ? " @Id \n" : "") //$NON-NLS-1$ //$NON-NLS-2$ >+ + " private long " + primaryKeyName + ";\n\n" //$NON-NLS-1$ //$NON-NLS-2$ >+ + (fieldBasedAccess ? "" : " @Id \n") //$NON-NLS-1$ //$NON-NLS-2$ >+ + " public long get" + capitalizeFirstLetter(primaryKeyName) + "() {\n" //$NON-NLS-1$ //$NON-NLS-2$ >+ + " return " + primaryKeyName + ";\n" //$NON-NLS-1$ //$NON-NLS-2$ >+ + " }\n\n" //$NON-NLS-1$ >+ + " public void set" + capitalizeFirstLetter(primaryKeyName) //$NON-NLS-1$ >+ + "(long " + primaryKeyName + ") {\n" //$NON-NLS-1$ //$NON-NLS-2$ >+ + " this." + primaryKeyName + " = " + primaryKeyName + ";\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ + " }\n\n"; //$NON-NLS-1$ >+ return primaryKeyDeclaration; >+ } > > static private HashSet<String> getEntityNames(JpaProject jpaProject) { > HashSet<String> names = new HashSet<String>(); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtilImpl.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtilImpl.java,v >retrieving revision 1.1 >diff -u -r1.1 JPAEditorUtilImpl.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtilImpl.java 28 Feb 2011 10:34:30 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtilImpl.java 26 Mar 2012 13:43:29 -0000 >@@ -18,6 +18,7 @@ > import java.util.List; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; > import org.eclipse.core.resources.IProject; > import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator; > import org.eclipse.graphiti.mm.pictograms.FreeFormConnection; >@@ -78,11 +79,18 @@ > > > public IFile createEntityInProject(IProject project, String entityName, IPreferenceStore jpaPreferenceStore, >- boolean isMappedSuperclassChild, String mappedSuperclassName, String mappedSuperclassPackage, boolean hasPrimaryKey) throws Exception { >+ boolean isMappedSuperclassChild, String mappedSuperclassName, >+ String mappedSuperclassPackage, String idName, >+ boolean hasPrimaryKey) throws Exception { > return JPAEditorUtil.createEntityInProject(project, entityName, jpaPreferenceStore, isMappedSuperclassChild, >- mappedSuperclassName, mappedSuperclassPackage, hasPrimaryKey); >+ mappedSuperclassName, mappedSuperclassPackage, idName, hasPrimaryKey); > } > >+ public IFile createEntityInProject(IProject project, >+ String entityName, >+ JavaPersistentType mappedSuperclass) throws Exception { >+ return JPAEditorUtil.createEntityInProject(project, entityName, mappedSuperclass); >+ } > > public ICompilationUnit getCompilationUnit(JavaPersistentType jpt) { > return JPAEditorUtil.getCompilationUnit(jpt); >@@ -100,5 +108,15 @@ > String mappedSuperclassName, IPreferenceStore jpaPreferenceStore) throws Exception { > return JPAEditorUtil.createEntityFromMappedSuperclassInProject(project, mappedSuperclassName, jpaPreferenceStore); > } >+ >+ public IFile createMappedSuperclassInProject(IProject project, >+ IFolder folder, String mappedSuperclassName) throws Exception { >+ return JPAEditorUtil.createMappedSuperclassInProject(project, folder, mappedSuperclassName); >+ } >+ >+ public IFile createMappedSuperclassInProject(IProject project, >+ String mappedSuperclassName) throws Exception { >+ return JPAEditorUtil.createMappedSuperclassInProject(project, mappedSuperclassName); >+ } > > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java,v >retrieving revision 1.7 >diff -u -r1.7 JPASolver.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java 1 Aug 2011 15:10:11 -0000 1.7 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java 26 Mar 2012 13:43:29 -0000 >@@ -25,6 +25,7 @@ > import java.util.List; > import java.util.Set; > import java.util.WeakHashMap; >+ > import org.eclipse.core.internal.resources.File; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IMarkerDelta; >@@ -115,7 +116,7 @@ > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorDiagramTypeProvider; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.AbstractRelation; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.BidirectionalRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.widgets.Display; >@@ -143,6 +144,7 @@ > private IJPAEditorFeatureProvider featureProvider; > private HashSet<String> removeIgnore = new HashSet<String>(); > private HashSet<String> removeRelIgnore = new HashSet<String>(); >+ private Collection<JavaPersistentType> persistentTypes = new HashSet<JavaPersistentType>(); > > private HashSet<String> addIgnore = new HashSet<String>(); > private Hashtable<String, IRelation> attribToRel = new Hashtable<String, IRelation>(); >@@ -221,7 +223,11 @@ > eclipseFacade.getDisplay().asyncExec(new Runnable() { > public void run() { > if(featureProvider != null) >- featureProvider.getDiagramTypeProvider().getDiagramEditor().refresh(); >+ try { >+ featureProvider.getDiagramTypeProvider().getDiagramEditor().refresh(); >+ } catch (Exception e) { >+ // ignore >+ } > } > }); > >@@ -323,10 +329,11 @@ > addListenersToEntity(jpt); > PictogramElement pe = featureProvider.getPictogramElementForBusinessObject(jpt); > Graphiti.getPeService().setPropertyValue(pe, JPAEditorConstants.PROP_ENTITY_CLASS_NAME, jpt.getName()); >+ persistentTypes.add(jpt); > } else if (bo instanceof AbstractRelation) { > AbstractRelation rel = (AbstractRelation) bo; > attribToRel.put(produceOwnerKeyForRel(rel), rel); >- if (rel instanceof BidirectionalRelation) { >+ if (rel instanceof IBidirectionalRelation) { > attribToRel.put(produceInverseKeyForRel(rel), rel); > } > } else if (bo instanceof JavaPersistentAttribute) { >@@ -344,7 +351,7 @@ > String k = getKeyForBusinessObject(at); > remove(k); > } >- >+ persistentTypes.remove(jpt); > removeListenersFromEntity(jpt); > Diagram d = featureProvider.getDiagramTypeProvider().getDiagram(); > if (d.getChildren().size() == 1) { >@@ -361,7 +368,7 @@ > } else if (o instanceof AbstractRelation) { > AbstractRelation rel = (AbstractRelation) o; > attribToRel.remove(produceOwnerKeyForRel(rel)); >- if (rel instanceof BidirectionalRelation) >+ if (rel instanceof IBidirectionalRelation) > attribToRel.remove(produceInverseKeyForRel(rel)); > } else if (o instanceof JavaPersistentAttribute) { > removeListenersFromAttribute((JavaPersistentAttribute)o); >@@ -939,8 +946,10 @@ > util = null; > keyToBO.clear(); > attribToRel.clear(); >+ persistentTypes.clear(); > keyToBO = null; >- attribToRel = null; >+ attribToRel = null; >+ persistentTypes = null; > removeAllListeners(); > featureProvider = null; > synchronized (JPASolver.class) { >@@ -977,25 +986,20 @@ > > for (ICompilationUnit cu : affectedCompilationUnits) { > JavaPersistentType jpt = JPAEditorUtil.getJPType(cu); >- for (JPASolver solver : solversSet) { >+ for (final JPASolver solver : solversSet) { > final ContainerShape cs = (ContainerShape)solver.featureProvider.getPictogramElementForBusinessObject(jpt); > if (cs == null) > return; > String entName = JPAEditorUtil.getText(jpt); > try { > final String newHeader = (cu.hasUnsavedChanges() ? "* " : "") + entName; //$NON-NLS-1$ //$NON-NLS-2$ >- Display.getDefault().asyncExec(new Runnable() { >- public void run() { >- GraphicsUpdater.updateHeader(cs, newHeader); >- } >- }); >- >+ GraphicsUpdater.updateHeader(cs, newHeader); >+ JpaArtifactFactory.instance().rearrangeIsARelationsInTransaction(solver.featureProvider); > } catch (JavaModelException e) { > JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ >- } >+ } > } >- >- } >+ } > } > > private Set<ICompilationUnit> getAffectedCompilationUnits(IJavaElementDelta delta) { >@@ -1470,4 +1474,8 @@ > return resources; > } > >+ public Collection<JavaPersistentType> getPersistentTypes() { >+ return persistentTypes; >+ } >+ > } >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java,v >retrieving revision 1.18 >diff -u -r1.18 JpaArtifactFactory.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java 10 Feb 2012 20:49:05 -0000 1.18 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java 26 Mar 2012 13:43:30 -0000 >@@ -27,10 +27,13 @@ > import java.util.Locale; > import java.util.Properties; > import java.util.Set; >+ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.emf.transaction.RecordingCommand; >+import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.graphiti.features.IFeatureProvider; > import org.eclipse.graphiti.features.context.IRemoveContext; > import org.eclipse.graphiti.features.context.impl.AddConnectionContext; >@@ -39,10 +42,12 @@ > import org.eclipse.graphiti.mm.pictograms.ContainerShape; > import org.eclipse.graphiti.mm.pictograms.Shape; > import org.eclipse.graphiti.services.Graphiti; >+import org.eclipse.graphiti.util.IColorConstant; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IField; > import org.eclipse.jdt.core.IImportDeclaration; > import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.IPackageDeclaration; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.dom.CompilationUnit; >@@ -68,6 +73,7 @@ > import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaEntity; > import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping; >+import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; > import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; >@@ -77,8 +83,6 @@ > import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; > import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; >-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation; >-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation; >@@ -89,16 +93,18 @@ > import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; > import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddInheritedEntityFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.AddRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.RemoveRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.UpdateAttributeFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.BidirectionalRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelDir; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelType; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.ManyToManyBiDirRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.ManyToManyUniDirRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.ManyToOneBiDirRelation; >@@ -129,6 +135,44 @@ > return INSTANCE; > } > >+ public void rearrangeIsARelations(IJPAEditorFeatureProvider fp) { >+ Collection<IsARelation> isARels = produceAllMissingIsARelations(fp); >+ addIsARelations(fp, isARels); >+ fp.removeAllRedundantIsARelations(); >+ } >+ >+ public void rearrangeIsARelationsInTransaction(final IJPAEditorFeatureProvider fp) { >+ final Collection<IsARelation> isARels = produceAllMissingIsARelations(fp); >+ if (!fp.existRedundantIsARelations() && (isARels.size() == 0)) >+ return; >+ TransactionalEditingDomain ted = fp.getTransactionalEditingDomain(); >+ RecordingCommand rc = new RecordingCommand(ted) { >+ protected void doExecute() { >+ addIsARelations(fp, isARels); >+ fp.removeAllRedundantIsARelations(); >+ } >+ }; >+ ted.getCommandStack().execute(rc); >+ } >+ >+ >+ public Collection<IsARelation> produceAllMissingIsARelations(IJPAEditorFeatureProvider fp) { >+ Collection<JavaPersistentType> persistentTypes = fp.getPersistentTypes(); >+ Collection<IsARelation> res = new HashSet<IsARelation>(); >+ Iterator<JavaPersistentType> it = persistentTypes.iterator(); >+ HashSet<IsARelation> allExistingIsARelations = fp.getAllExistingIsARelations(); >+ while (it.hasNext()) { >+ JavaPersistentType jpt = it.next(); >+ JavaPersistentType superclass = fp.getFirstSuperclassBelongingToTheDiagram(jpt); >+ if (superclass == null) >+ continue; >+ IsARelation newRel = new IsARelation(jpt, superclass); >+ if (!allExistingIsARelations.contains(newRel)) >+ res.add(newRel); >+ } >+ return res; >+ } >+ > public void addOneToOneUnidirectionalRelation(IFeatureProvider fp, JavaPersistentType jpt, > JavaPersistentAttribute attribute) { > addOneToOneRelation(fp, jpt, attribute, null, null, >@@ -445,7 +489,6 @@ > IJPAEditorFeatureProvider fp) { > ICompilationUnit cu = fp.getCompilationUnit(jpt); > try { >- JpaProject jpaProject = jpt.getJpaProject(); > JPAEditorUtil.discardWorkingCopy(cu); > cu.delete(true, new NullProgressMonitor()); > return true; >@@ -514,9 +557,13 @@ > JavaResourceType jrpt = convertJPTToJRT(jpt); > if (jrpt == null) > return false; >- JavaEntity mapping = (JavaEntity) jpt.getMapping(); >- if (mapping != null) >+ JavaTypeMapping jtm = jpt.getMapping(); >+ if (jtm == null) >+ return false; >+ if (jtm instanceof JavaEntity) { >+ JavaEntity mapping = (JavaEntity)jtm; > return (mapping.getSpecifiedName() != null); >+ } > return false; > } > >@@ -551,19 +598,35 @@ > } > */ > >+ public boolean hasEntityOrMappedSuperclassAnnotation(JavaPersistentType jpt) { >+ return hasEntityAnnotation(jpt) || hasMappedSuperclassAnnotation(jpt); >+ } >+ > public boolean hasEntityAnnotation(JavaPersistentType jpt) { >- return (jpt.getMapping() instanceof JavaEntity); >+ return (jpt.getMappingKey() == MappingKeys.ENTITY_TYPE_MAPPING_KEY); > } > >+ public boolean hasMappedSuperclassAnnotation(JavaPersistentType jpt) { >+ return (jpt.getMappingKey() == MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); >+ } >+ > public String getSpecifiedEntityName(JavaPersistentType jpt){ >- JavaEntity gje = (JavaEntity) jpt.getMapping(); >+ JavaTypeMapping jtm = jpt.getMapping(); >+ if (jtm instanceof JavaEntity) { >+ JavaEntity gje = (JavaEntity)jtm; > return gje.getSpecifiedName(); > } >+ JavaMappedSuperclass jms = (JavaMappedSuperclass)jtm; >+ return jms.getName(); >+ } > > public void renameEntity(JavaPersistentType jpt, String newName) { >- JavaEntity gje = (JavaEntity)jpt.getMapping(); >+ JavaTypeMapping jtm = jpt.getMapping(); >+ if (jtm instanceof JavaEntity) { >+ JavaEntity gje = (JavaEntity)jtm; > gje.setSpecifiedName(newName); > } >+ } > > public JavaPersistentAttribute addAttribute(IJPAEditorFeatureProvider fp, JavaPersistentType jpt, > JavaPersistentType attributeType, String attributeName, >@@ -1478,7 +1541,7 @@ > IRelation rel = fp.getRelationRelatedToAttribute(oldAt); > String inverseJPAName = null; > JavaPersistentType inverseJPT = null; >- if (BidirectionalRelation.class.isInstance(rel)) { >+ if (IBidirectionalRelation.class.isInstance(rel)) { > inverseJPT = rel.getInverse(); > if (inverseJPT != oldAt.getParent()) { > pu = JpaArtifactFactory.INSTANCE.getPersistenceUnit(jpt); >@@ -1832,7 +1895,7 @@ > return res; > } > >- private BidirectionalRelation produceBiDirRelation(JavaPersistentType jpt, >+ private IBidirectionalRelation produceBiDirRelation(JavaPersistentType jpt, > JavaPersistentAttribute at, Annotation an, > JavaPersistentType relJPT, JavaPersistentAttribute relAt, > Annotation relAn, IJPAEditorFeatureProvider fp) { >@@ -1876,7 +1939,7 @@ > } > } > >- BidirectionalRelation res = null; >+ IBidirectionalRelation res = null; > if (annotationName.equals(JPAEditorConstants.ANNOTATION_ONE_TO_ONE)) { > if (!fp.doesRelationExist(jpt, relJPT, ownerAttrName, RelType.ONE_TO_ONE, > RelDir.BI)) >@@ -2167,6 +2230,9 @@ > Iterator<Connection> iter = Graphiti.getPeService().getAllConnections(cs).iterator(); > while (iter.hasNext()) { > Connection conn = iter.next(); >+ String v = Graphiti.getPeService().getPropertyValue(conn, IsARelation.IS_A_CONNECTION_PROP_KEY); >+ if (Boolean.TRUE.toString().equals(v)) >+ continue; > IRemoveContext ctx = new RemoveContext(conn); > ctxs.add(ctx); > } >@@ -2200,6 +2266,15 @@ > } > } > >+ public void addIsARelations(IJPAEditorFeatureProvider fp, >+ Collection<IsARelation> rels) { >+ Iterator<IsARelation> it = rels.iterator(); >+ while (it.hasNext()) { >+ IsARelation rel = it.next(); >+ addNewIsARelation(fp, rel); >+ } >+ } >+ > private void addNewRelation(IJPAEditorFeatureProvider fp, IRelation rel) { > AddConnectionContext ctx = new AddConnectionContext(JPAEditorUtil > .getAnchor(rel.getOwner(), fp), JPAEditorUtil.getAnchor(rel >@@ -2212,6 +2287,17 @@ > ft.add(ctx); > } > >+ private void addNewIsARelation(IJPAEditorFeatureProvider fp, IsARelation rel) { >+ AddConnectionContext ctx = new AddConnectionContext(JPAEditorUtil >+ .getAnchor(rel.getSubclass(), fp), JPAEditorUtil.getAnchor(rel.getSuperclass(), fp)); >+ ctx.setNewObject(rel); >+ ctx.setTargetContainer(fp.getDiagramTypeProvider().getDiagram()); >+ refreshEntityModel(fp, rel.getSubclass()); >+ refreshEntityModel(fp, rel.getSuperclass()); >+ AddInheritedEntityFeature ft = new AddInheritedEntityFeature(fp); >+ ft.add(ctx); >+ } >+ > private String getRelTypeName(RelationshipMappingAnnotation an, > JavaResourceAttribute jra) { > String relTypeName = null; >@@ -2252,18 +2338,35 @@ > return res.toArray(ret); > } > >- public boolean isId(JavaPersistentAttribute jpa) { >+ // returns true even if the primary key is inherited >+ public boolean hasOrInheritsPrimaryKey(JavaPersistentType jpt) { >+ Iterable<ReadOnlyPersistentAttribute> attributes = jpt.getAllAttributes(); >+ Iterator<ReadOnlyPersistentAttribute> it = attributes.iterator(); >+ while (it.hasNext()) { >+ ReadOnlyPersistentAttribute at = it.next(); >+ if (isId(at)) >+ return true; >+ } >+ return false; >+ } >+ >+ public boolean hasPrimaryKey(JavaPersistentType jpt) { >+ for (JavaPersistentAttribute at : jpt.getAttributes()) >+ if (isId(at)) return true; >+ return false; >+ } >+ >+ >+ public boolean isId(ReadOnlyPersistentAttribute jpa) { > return isSimpleId(jpa) || isEmbeddedId(jpa); > } > >- public boolean isSimpleId(JavaPersistentAttribute jpa) { >- IdAnnotation an = (IdAnnotation)jpa.getResourceAttribute().getAnnotation(IdAnnotation.ANNOTATION_NAME); >- return (an != null); >+ public boolean isSimpleId(ReadOnlyPersistentAttribute jpa) { >+ return (jpa.getMappingKey() == MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); > } > >- public boolean isEmbeddedId(JavaPersistentAttribute jpa) { >- EmbeddedIdAnnotation an = (EmbeddedIdAnnotation)jpa.getResourceAttribute().getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME); >- return (an != null); >+ public boolean isEmbeddedId(ReadOnlyPersistentAttribute jpa) { >+ return (jpa.getMappingKey() == MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); > } > > public String getColumnName(JavaPersistentAttribute jpa) { >@@ -2278,5 +2381,69 @@ > return columnName; > } > >+ public IColorConstant getForeground(JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { >+ IColorConstant foreground = dot.equals(JPAEditorConstants.DIAGRAM_OBJECT_TYPE.MappedSupeclass) ? >+ JPAEditorConstants.MAPPED_SUPERCLASS_BORDER_COLOR: >+ JPAEditorConstants.ENTITY_BORDER_COLOR; >+ return foreground; >+ } > >+ public IColorConstant getBackground(JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { >+ IColorConstant background = dot.equals(JPAEditorConstants.DIAGRAM_OBJECT_TYPE.MappedSupeclass) ? >+ JPAEditorConstants.MAPPED_SUPERCLASS_BACKGROUND: >+ JPAEditorConstants.ENTITY_BACKGROUND; >+ return background; >+ } >+ >+ public String getRenderingStyle(JPAEditorConstants.DIAGRAM_OBJECT_TYPE dot) { >+ String renderingStyle = dot.equals(JPAEditorConstants.DIAGRAM_OBJECT_TYPE.MappedSupeclass) ? >+ IJPAEditorPredefinedRenderingStyle.GREEN_WHITE_GLOSS_ID : >+ IJPAEditorPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID; >+ return renderingStyle; >+ } >+ >+ public JPAEditorConstants.DIAGRAM_OBJECT_TYPE determineDiagramObjectType(JavaPersistentType jpt) { >+ if (this.hasEntityAnnotation(jpt)) { >+ return JPAEditorConstants.DIAGRAM_OBJECT_TYPE.Entity; >+ } else if (this.hasMappedSuperclassAnnotation(jpt)) { >+ return JPAEditorConstants.DIAGRAM_OBJECT_TYPE.MappedSupeclass; >+ } >+ throw new IllegalArgumentException(); >+ } >+ >+ public String generateIdName(JavaPersistentType jpt) { >+ String name = "id"; //$NON-NLS-1$ >+ String genName = name; >+ for (int i = 0; i < 10000000; i++) { >+ if (!hasAttributeNamed(jpt, genName)) >+ return genName; >+ genName = name + "_" + i; //$NON-NLS-1$ >+ } >+ return genName; >+ } >+ >+ >+ private boolean hasAttributeNamed(JavaPersistentType jpt, String name) { >+ Iterable<String> hier = jpt.getAllAttributeNames(); >+ Iterator<String> it = hier.iterator(); >+ while (it.hasNext()) { >+ String atName = it.next(); >+ if (name.equals(atName)) >+ return true; >+ } >+ return false; >+ } >+ >+ public String getMappedSuperclassPackageDeclaration(JavaPersistentType jpt) throws JavaModelException { >+ String packageName = null; >+ IPackageDeclaration[] packages = JPAEditorUtil.getCompilationUnit(jpt) >+ .getPackageDeclarations(); >+ if (packages.length > 0) { >+ IPackageDeclaration packageDecl = packages[0]; >+ packageName = packageDecl.getElementName(); >+ } >+ return packageName; >+ } >+ >+ > } >\ No newline at end of file >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/ResourceChangeListener.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/ResourceChangeListener.java,v >retrieving revision 1.1 >diff -u -r1.1 ResourceChangeListener.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/ResourceChangeListener.java 15 Jul 2011 12:33:06 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/ResourceChangeListener.java 26 Mar 2012 13:43:30 -0000 >@@ -1,3 +1,18 @@ >+/******************************************************************************* >+ * <copyright> >+ * >+ * Copyright (c) 2005, 2010 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: >+ * Stefan Dimov - initial API, implementation and documentation >+ * >+ * </copyright> >+ * >+ *******************************************************************************/ > package org.eclipse.jpt.jpadiagrameditor.ui.internal.util; > > import org.eclipse.core.resources.IFile; >@@ -7,8 +22,10 @@ > import org.eclipse.core.resources.IResourceChangeEvent; > import org.eclipse.core.resources.IResourceChangeListener; > import org.eclipse.core.resources.IResourceDelta; >+import org.eclipse.graphiti.mm.pictograms.Diagram; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.ModelIntegrationUtil; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorDiagramTypeProvider; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorReference; > import org.eclipse.ui.IWorkbenchPage; >@@ -18,16 +35,23 @@ > > public void resourceChanged(IResourceChangeEvent event) { > IMarkerDelta[] markerDeltas = event.findMarkerDeltas(null, true); >- >+ IProject pr = null; > for (IMarkerDelta delta : markerDeltas) { >- if (delta.getResource().getType() != IResource.FILE) >+ int resType = delta.getResource().getType(); >+ if (resType == IResource.PROJECT) { >+ pr = (IProject)delta.getResource(); > continue; >- if (delta.getKind() != IResourceDelta.REMOVED) >+ } >+ if (resType != IResource.FILE) > continue; > final IFile file = (IFile) delta.getResource(); >+ pr = file.getProject(); > if (file.exists()) > continue; >+ if (delta.getKind() != IResourceDelta.REMOVED) >+ continue; > final IProject project = file.getProject(); >+ pr = project; > final String name = project.getName(); > if (file.getFullPath().equals(ModelIntegrationUtil.getDiagramXMLFullPath(name))) { > PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { >@@ -49,7 +73,27 @@ > }); > > } >- } >+ } >+ >+ if (pr == null) >+ return; >+ rearrangeIsARelations(pr); >+ >+ } >+ >+ private void rearrangeIsARelations(IProject pr) { >+ if (pr == null) return; >+ final Diagram d = ModelIntegrationUtil.getDiagramByProject(pr); >+ if (d == null) return; >+ final JPAEditorDiagramTypeProvider provider = ModelIntegrationUtil.getProviderByDiagram(d.getName()); >+ if (provider == null) >+ return; >+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { >+ public void run() { >+ JpaArtifactFactory.instance().rearrangeIsARelationsInTransaction(provider.getFeatureProvider()); >+ } >+ }); >+ > } > > } >\ No newline at end of file >#P org.eclipse.jpt.jpadiagrameditor.ui.tests >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/AllJpaEditorTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/AllJpaEditorTests.java,v >retrieving revision 1.8 >diff -u -r1.8 AllJpaEditorTests.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/AllJpaEditorTests.java 12 Sep 2011 09:37:12 -0000 1.8 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/AllJpaEditorTests.java 26 Mar 2012 13:43:32 -0000 >@@ -83,7 +83,7 @@ > @BeforeClass > public static void verifyRequiredJarsExists() throws NoSuchElementException { > verifyJpaJarExists(); >- verifyEclipseLinkJarExists(); >+ //verifyEclipseLinkJarExists(); > } > > private static void verifyJpaJarExists() throws NoSuchElementException { >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/AddRelationFeatureTest.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/AddRelationFeatureTest.java,v >retrieving revision 1.2 >diff -u -r1.2 AddRelationFeatureTest.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/AddRelationFeatureTest.java 27 Apr 2011 22:45:24 -0000 1.2 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/AddRelationFeatureTest.java 26 Mar 2012 13:43:32 -0000 >@@ -76,7 +76,7 @@ > > private IAddConnectionContext context; > >- private IPeServiceUtil peUtil; >+ private IPeServiceUtil peServiceUtil; > > private IGaService gaUtil; > >@@ -100,7 +100,7 @@ > diagramProvider = EasyMock.createMock(IDiagramTypeProvider.class); > diagram = EasyMock.createMock(Diagram.class); > context = EasyMock.createMock(IAddConnectionContext.class); >- peUtil = EasyMock.createMock(IPeServiceUtil.class); >+ peServiceUtil = EasyMock.createMock(IPeServiceUtil.class); > gaUtil = EasyMock.createMock(IGaService.class); > ft = EasyMock.createMock(IAddBendpointFeature.class); > >@@ -191,7 +191,7 @@ > Polyline pl = EasyMock.createMock(Polyline.class); > expect(pl.getX()).andReturn(0); > expect(pl.getY()).andReturn(0); >- expect(imageCreator.createArrowConnectionDecorator(isA(Connection.class), eq(location))).andReturn(d); >+ expect(imageCreator.createArrowConnectionDecorator(isA(Connection.class), eq(location), false)).andReturn(d); > expect(d.getGraphicsAlgorithm()).andReturn(pl); > replay(d, pl); > } >@@ -213,7 +213,7 @@ > private void configureProvidersForAdd(IRelation relation) { > expect(diagramProvider.getDiagram()).andReturn(diagram); > expect(featureProvider.getDiagramTypeProvider()).andReturn(diagramProvider); >- expect(featureProvider.getPeUtil()).andReturn(peUtil); >+ expect(featureProvider.getPeServiceUtil()).andReturn(peServiceUtil); > expect(featureProvider.getAddBendpointFeature(isA(IAddBendpointContext.class))).andStubReturn(ft); > expect(context.getNewObject()).andReturn(relation); > >@@ -255,7 +255,7 @@ > gaUtil.setLocation(isA(Polyline.class), EasyMock.anyInt() , EasyMock.anyInt()); > > FreeFormConnection connection = createConnection(startAnchor, endAnchor); >- expect(peUtil.createFreeFormConnection(diagram)).andReturn(connection); >+ expect(peServiceUtil.createFreeFormConnection(diagram)).andReturn(connection); > expect(imageCreator.createConnectionLine(diagram, connection)).andReturn(null); > ft.addBendpoint(isA(IAddBendpointContext.class)); > >@@ -320,7 +320,7 @@ > replay(diagramProvider); > replay(diagram); > replay(context); >- replay(peUtil); >+ replay(peServiceUtil); > replay(gaUtil); > replay(ft); > return new AddRelationFeature(featureProvider, imageCreator, jpaEditorUtil); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/DeleteRelationFeatureTest.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/DeleteRelationFeatureTest.java,v >retrieving revision 1.1 >diff -u -r1.1 DeleteRelationFeatureTest.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/DeleteRelationFeatureTest.java 8 Mar 2011 17:59:18 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/DeleteRelationFeatureTest.java 26 Mar 2012 13:43:32 -0000 >@@ -28,7 +28,7 @@ > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.DeleteRelationFeature; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; >-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.BidirectionalRelation; >+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; > import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; > import org.eclipse.jpt.jpadiagrameditor.ui.tests.internal.util.IEditor; > import org.eclipse.ui.IWorkbenchPartSite; >@@ -45,7 +45,7 @@ > IDeleteContext ctx = EasyMock.createMock(IDeleteContext.class); > PictogramElement pe = EasyMock.createMock(PictogramElement.class); > expect(ctx.getPictogramElement()).andStubReturn(pe); >- BidirectionalRelation rel = EasyMock.createMock(BidirectionalRelation.class); >+ IBidirectionalRelation rel = EasyMock.createMock(IBidirectionalRelation.class); > ICompilationUnit cu1 = EasyMock.createMock(ICompilationUnit.class); > ICompilationUnit cu2 = EasyMock.createMock(ICompilationUnit.class); > JavaPersistentType jpt1 = EasyMock.createMock(JavaPersistentType.class); >Index: src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/LayoutEntityFeatureTest.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/LayoutEntityFeatureTest.java,v >retrieving revision 1.1 >diff -u -r1.1 LayoutEntityFeatureTest.java >--- src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/LayoutEntityFeatureTest.java 8 Mar 2011 17:59:18 -0000 1.1 >+++ src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/feature/LayoutEntityFeatureTest.java 26 Mar 2012 13:43:32 -0000 >@@ -45,7 +45,7 @@ > EList<Shape> shList = new BasicInternalEList<Shape>(Shape.class); > EasyMock.expect(cs.getChildren()).andStubReturn(shList); > IPeServiceUtil peUtil = EasyMock.createMock(IPeServiceUtil.class); >- EasyMock.expect(fp.getPeUtil()).andStubReturn(peUtil); >+ EasyMock.expect(fp.getPeServiceUtil()).andStubReturn(peUtil); > EasyMock.expect(peUtil.getProperty(cs, JPAEditorConstants.COLLAPSE_FEATURES)).andStubReturn(null); > EasyMock.expect(peUtil.removeProperty(cs, JPAEditorConstants.COLLAPSE_FEATURES)).andStubReturn(false); > IGraphicsUpdater gu = EasyMock.createMock(IGraphicsUpdater.class);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 334142
:
207013
|
207014
| 213179