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 80649 Details for
Bug 206598
Wrong graphical information on associations with same relationship names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch
assocGIPatch2 (text/plain), 9.13 KB, created by
Bence Oláh
on 2007-10-18 06:37:21 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Bence Oláh
Created:
2007-10-18 06:37:21 EDT
Size:
9.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ohf.h3et.mif.core >Index: src/org/eclipse/ohf/h3et/mif/core/ssm/graphicalinformation/AssociationGraphicalInformation.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.ohf/plugins/org.eclipse.ohf.h3et.mif.core/src/org/eclipse/ohf/h3et/mif/core/ssm/graphicalinformation/AssociationGraphicalInformation.java,v >retrieving revision 1.6 >diff -u -r1.6 AssociationGraphicalInformation.java >--- src/org/eclipse/ohf/h3et/mif/core/ssm/graphicalinformation/AssociationGraphicalInformation.java 5 Oct 2007 08:14:09 -0000 1.6 >+++ src/org/eclipse/ohf/h3et/mif/core/ssm/graphicalinformation/AssociationGraphicalInformation.java 18 Oct 2007 10:35:47 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ohf.h3et.mif.core.ssm.graphicalinformation; > >+import java.util.Iterator; > import java.util.List; > > import org.eclipse.ohf.h3et.core.H3ETException; >@@ -18,41 +19,94 @@ > import org.eclipse.ohf.h3et.mif.core.model.MIFStaticModel; > import org.eclipse.ohf.h3et.mif.core.model.MIFStaticPackageDiagramGraphicInformation; > import org.eclipse.ohf.h3et.mif.core.ssm.Artefact; >+import org.eclipse.ohf.h3et.mif.core.ssm.Association; > > /** >- * /** >- * This class represents the graphical information for associations. >+ * /** This class represents the graphical information for associations. >+ * > * @author bbanfai >- * >+ * > */ >-public class AssociationGraphicalInformation extends GraphicalInformation { >+public class AssociationGraphicalInformation extends GraphicalInformation >+{ > > private String connectToShapeId; >- >+ > private GraphEdge graphEdge; > >- public AssociationGraphicalInformation(MIFStaticModel staticModel, Artefact artefact) { >+ public AssociationGraphicalInformation(MIFStaticModel staticModel, >+ Artefact artefact) throws H3ETException >+ { >+ >+ if (staticModel.hasGraphicRepresentations()) >+ { >+ >+ List<MIFStaticPackageDiagramGraphicInformation> graphicRepresentationList = staticModel >+ .getGraphicRepresentationList(); >+ >+ /* >+ * The shape id of two model element is equal? >+ */ >+ boolean isTargetShapeIdEqual; >+ boolean isSourceShapeIdEqual; >+ >+ // Iterate thru all the graphic info (MIF 2.0 it is aggregated) >+ for (MIFStaticPackageDiagramGraphicInformation graphicInformation : graphicRepresentationList) >+ { >+ >+ // Associations... >+ if (graphicInformation.hasAssociations()) >+ { >+ >+ List<MIFAssociationGraphicInformation> associationList = graphicInformation >+ .getAssociationList(); >+ >+ // iterate the associations to find the corresponding one >+ // based on the source and target shape id >+ for (MIFAssociationGraphicInformation information : associationList) >+ { >+ isTargetShapeIdEqual = false; >+ isSourceShapeIdEqual = false; >+ >+ String otherSourceShapeId = information >+ .getGraphElement().getConnectToShapeId(); >+ String otherTargetShapeId = information >+ .getGraphElement().getShapeId(); >+ GraphicalInformation[] sourceGraphicalInformationArray = ((Association) artefact) >+ .getSource().getGraphicalInformation(); >+ GraphicalInformation[] targetGraphicalInformationArray = ((Association) artefact) >+ .getTarget().getGraphicalInformation(); >+ >+ /* >+ * searching for equal source shape ids >+ */ >+ for (int i = 0; i < sourceGraphicalInformationArray.length; i++) >+ { >+ if (sourceGraphicalInformationArray[i].getShapeId() >+ .equals(otherSourceShapeId)) >+ isSourceShapeIdEqual = true; >+ break; >+ } > >- if (staticModel.hasGraphicRepresentations()) { >- >- List<MIFStaticPackageDiagramGraphicInformation> graphicRepresentationList = staticModel.getGraphicRepresentationList(); >- >- //Iterate thru all the graphic info (MIF 2.0 it is aggregated) >- for (MIFStaticPackageDiagramGraphicInformation graphicInformation : graphicRepresentationList) { >- >- //Associations... >- if (graphicInformation.hasAssociations()) { >- >- List<MIFAssociationGraphicInformation> associationList = graphicInformation.getAssociationList(); >- >- //iterate the associations to find the corresponding one based on the name >- for (MIFAssociationGraphicInformation information : associationList) { >- try { >- if (information.getRelationshipName().equals(artefact.getName())) >- loadFields(information); >- } catch (H3ETException e) { >- // TODO Auto-generated catch block >- e.printStackTrace(); >+ /* >+ * searching for equal target shape ids >+ */ >+ for (int i = 0; i < targetGraphicalInformationArray.length; i++) >+ { >+ if (targetGraphicalInformationArray[i].getShapeId() >+ .equals(otherTargetShapeId)) >+ isTargetShapeIdEqual = true; >+ break; >+ } >+ >+ /* >+ * This is the point: if the shape ids are equal then >+ * the matching elements are found. >+ */ >+ if (isTargetShapeIdEqual >+ && isSourceShapeIdEqual) >+ { >+ loadFields(information); > } > } > } >@@ -60,70 +114,87 @@ > } > } > >- public String getConnectToShapeId() { >+ public String getConnectToShapeId() >+ { > return connectToShapeId; > } > >- public void setConnectToShapeId(String connectToShapeId) { >+ public void setConnectToShapeId(String connectToShapeId) >+ { > this.connectToShapeId = connectToShapeId; > } > >- public GraphEdge getGraphEdge() { >+ public GraphEdge getGraphEdge() >+ { > return graphEdge; > } > >- public void setGraphEdge(GraphEdge graphEdge) { >+ public void setGraphEdge(GraphEdge graphEdge) >+ { > this.graphEdge = graphEdge; > } >- >- private void loadFields(MIFAssociationGraphicInformation information) { >- >- if (information.hasGraphElement()) { >- MIFContainedGraphConnectorWithEdge graphElement = information.getGraphElement(); >+ >+ private void loadFields(MIFAssociationGraphicInformation information) >+ { >+ >+ if (information.hasGraphElement()) >+ { >+ MIFContainedGraphConnectorWithEdge graphElement = information >+ .getGraphElement(); > > if (graphElement.hasShapeId()) >- shapeId=graphElement.getShapeId(); >- >+ shapeId = graphElement.getShapeId(); >+ > // Connect to shape id > if (graphElement.hasConnectToShapeId()) >- connectToShapeId=graphElement.getConnectToShapeId(); >+ connectToShapeId = graphElement.getConnectToShapeId(); > > // Container diagram > if (graphElement.hasContainerDiagramName()) >- containerDiagramName=graphElement.getContainerDiagramName(); >+ containerDiagramName = graphElement.getContainerDiagramName(); > > // Graph element > if (graphElement.hasGraphEdge()) >- graphEdge=new GraphEdge(graphElement.getGraphEdge()); >- >+ graphEdge = new GraphEdge(graphElement.getGraphEdge()); >+ > // Position > if (graphElement.hasPosition()) >- position=new Point(graphElement.getPosition()); >- >+ position = new Point(graphElement.getPosition()); >+ > // Position > if (graphElement.hasLastAdjustedDateTime()) >- lastAdjustedDateAndTime=graphElement.getLastAdjustedDateTime(); >+ lastAdjustedDateAndTime = graphElement >+ .getLastAdjustedDateTime(); > > } > } > >- /* (non-Javadoc) >+ /* >+ * (non-Javadoc) >+ * > * @see java.lang.Object#hashCode() > */ > @Override >- public int hashCode() { >+ public int hashCode() >+ { > final int PRIME = 31; > int result = super.hashCode(); >- result = PRIME * result + ((connectToShapeId == null) ? 0 : connectToShapeId.hashCode()); >- result = PRIME * result + ((graphEdge == null) ? 0 : graphEdge.hashCode()); >+ result = PRIME >+ * result >+ + ((connectToShapeId == null) ? 0 : connectToShapeId.hashCode()); >+ result = PRIME * result >+ + ((graphEdge == null) ? 0 : graphEdge.hashCode()); > return result; > } > >- /* (non-Javadoc) >+ /* >+ * (non-Javadoc) >+ * > * @see java.lang.Object#equals(java.lang.Object) > */ > @Override >- public boolean equals(Object obj) { >+ public boolean equals(Object obj) >+ { > if (this == obj) > return true; > if (!super.equals(obj)) >@@ -131,12 +202,14 @@ > if (getClass() != obj.getClass()) > return false; > final AssociationGraphicalInformation other = (AssociationGraphicalInformation) obj; >- if (connectToShapeId == null) { >+ if (connectToShapeId == null) >+ { > if (other.connectToShapeId != null) > return false; > } else if (!connectToShapeId.equals(other.connectToShapeId)) > return false; >- if (graphEdge == null) { >+ if (graphEdge == null) >+ { > if (other.graphEdge != null) > return false; > } else if (!graphEdge.equals(other.graphEdge)) >@@ -144,11 +217,14 @@ > return true; > } > >- /* (non-Javadoc) >+ /* >+ * (non-Javadoc) >+ * > * @see org.eclipse.ohf.h3et.mif.core.ssm.graphicalinformation.GraphicalInformation#toString() > */ > @Override >- public String toString() { >+ public String toString() >+ { > StringBuffer result = new StringBuffer(); > result.append(super.toString()); > result.append(getGraphEdge() + "; ");
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 206598
:
80540
| 80649