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 264177 Details for
Bug 501508
GraphicalEditPart makes too strong assumption about semantic element's implementation class names
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]
Potential patch in GMF Runtime
0001-Remove-assumption-about-model-implementation-class-n.patch (text/plain), 2.35 KB, created by
Pierre-Charles David
on 2016-09-15 11:56:29 EDT
(
hide
)
Description:
Potential patch in GMF Runtime
Filename:
MIME Type:
Creator:
Pierre-Charles David
Created:
2016-09-15 11:56:29 EDT
Size:
2.35 KB
patch
obsolete
>From d093c98b9d3bbc5cd11c0e7908d8968363b2a611 Mon Sep 17 00:00:00 2001 >From: Pierre-Charles David <pierre-charles.david@obeo.fr> >Date: Thu, 15 Sep 2016 17:43:10 +0200 >Subject: [PATCH] Remove assumption about model implementation class name > >GraphicalEditPart.getAccessibleEditPart() assumes all the implementation >classes of the semantic model elements end with the "Impl" suffix. This >is not necessarily true if the EMF generators have been customized, or >if sub-classes with different names are used to isolate non-generated >code (for example in Sirius we have many XXXSpec classes which override >the generated XXXImpl with custom code). > >When called on a class which does not match this assumption, >getAccessibleEditPart() crashes with a StringIndexOutOfBoundsException >because it fails to check the result of indexOf(). > >It looks like all that is needed here is a "plain name" for the semantic >element's type, so the EClass name should do. > >Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr> >--- > .../gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > >diff --git a/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java b/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java >index 5cbc29d..cdfa463 100644 >--- a/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java >+++ b/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java >@@ -1151,10 +1151,7 @@ public abstract class GraphicalEditPart > EObject semanticElement = resolveSemanticElement(); > > if( semanticElement != null ) { >- String name = semanticElement.getClass().getName(); >- int startIndex = name.lastIndexOf('.') + 1; >- int endIndex = name.lastIndexOf( "Impl" ); //$NON-NLS-1$ >- return name.substring(startIndex, endIndex); >+ return semanticElement.eClass().getName(); > } > > return null; >@@ -1713,4 +1710,4 @@ public abstract class GraphicalEditPart > return getFlag(FLAG__AUTO_CONNECTIONS_VISIBILITY); > } > >-} >\ No newline at end of file >+} >-- >2.7.4 >
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 501508
: 264177