| Summary: | Remove ugly reflection code to get IFile from IFileEditorInput | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Graphiti | Reporter: | Hernan Gonzalez <hjg.com.ar> | ||||
| Component: | Core | Assignee: | Tim Kaiser <tim.kaiser> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | CC: | michael.wenz | ||||
| Version: | 0.8.0 | Flags: | tim.kaiser:
juno+
|
||||
| Target Milestone: | 0.9.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=349439 | ||||||
| Whiteboard: | Juno M2 Theme_round_offs | ||||||
| Attachments: |
|
||||||
You're right in that this coding is ugly, unfortunatly it is necessary to enable Graphiti to run in an RCP application without IDE being installed, but on the other hand benefit from the IFile stuff provided in the IDE installation. For details on this issue see the comments in the class and https://bugs.eclipse.org/bugs/show_bug.cgi?id=349439. If you know a better way to solve this please let us know. Michael (In reply to comment #1) Sorry, just forget that comment, that's of course nonsense... :-( > You're right in that this coding is ugly, unfortunatly it is necessary to > enable Graphiti to run in an RCP application without IDE being installed, but > on the other hand benefit from the IFile stuff provided in the IDE > installation. > For details on this issue see the comments in the class and > https://bugs.eclipse.org/bugs/show_bug.cgi?id=349439. > If you know a better way to solve this please let us know. > Michael It should be possible to apply that change, but I would like to consult the colleague who did the RCP enabling (on vacation this week). Michael I applied the patch. Bookkeeping: Set target release Part of Graphiti 0.9.0 (Eclipse Juno) |
Created attachment 203186 [details] patch (for version 0.9) I believe that the (very) ugly code in org.eclipse.graphiti.ui.internal.util.ReflectionUtil to deal with IFileEditorInput could be more elegantly done in this way: public static IFile getFile(Object input) { if(input instanceof IAdaptable) { IFile file = (IFile)((IAdaptable)input).getAdapter(IFile.class); if(file!=null) return file; } return null; } That's the point of adapters, isn't it?