|
@@ -13,23 +13,20 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
|
|
|
public class EditPartUtils {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- public static IGraphicalEditPart findEditPartForSemanticElement(
|
|
|
- EditPart editPart, EObject semanticElement) {
|
|
|
+ public static IGraphicalEditPart findEditPartForSemanticElement(EditPart editPart, EObject semanticElement) {
|
|
|
if (semanticElement == null) {
|
|
|
return null;
|
|
|
}
|
|
|
if (editPart instanceof IGraphicalEditPart) {
|
|
|
- EObject resolveSemanticElement = ((IGraphicalEditPart) editPart)
|
|
|
- .resolveSemanticElement();
|
|
|
+ EObject resolveSemanticElement = ((IGraphicalEditPart) editPart).resolveSemanticElement();
|
|
|
|
|
|
- if (EcoreUtil.equals(resolveSemanticElement, semanticElement)) {
|
|
|
+ if (EcoreUtil.getURI(resolveSemanticElement).equals(EcoreUtil.getURI(semanticElement))) {
|
|
|
return (IGraphicalEditPart) editPart;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (Object child : editPart.getChildren()) {
|
|
|
- IGraphicalEditPart recursiveEditPart = findEditPartForSemanticElement(
|
|
|
- (EditPart) child, semanticElement);
|
|
|
+ IGraphicalEditPart recursiveEditPart = findEditPartForSemanticElement((EditPart) child, semanticElement);
|
|
|
if (recursiveEditPart != null) {
|
|
|
return recursiveEditPart;
|
|
|
}
|
|
@@ -37,13 +34,10 @@ public class EditPartUtils {
|
|
|
|
|
|
if (editPart instanceof NodeEditPart) {
|
|
|
List<Connection> connections = new ArrayList<Connection>();
|
|
|
- connections
|
|
|
- .addAll(((NodeEditPart) editPart).getSourceConnections());
|
|
|
- connections
|
|
|
- .addAll(((NodeEditPart) editPart).getTargetConnections());
|
|
|
+ connections.addAll(((NodeEditPart) editPart).getSourceConnections());
|
|
|
+ connections.addAll(((NodeEditPart) editPart).getTargetConnections());
|
|
|
for (Object connection : connections) {
|
|
|
- EObject resolveSemanticElement = ((IGraphicalEditPart) connection)
|
|
|
- .resolveSemanticElement();
|
|
|
+ EObject resolveSemanticElement = ((IGraphicalEditPart) connection).resolveSemanticElement();
|
|
|
if (EcoreUtil.equals(resolveSemanticElement, semanticElement)) {
|
|
|
return (IGraphicalEditPart) connection;
|
|
|
}
|