Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 385744 - Can't adapt EditPart to EObject in a plugin.xml
Summary: Can't adapt EditPart to EObject in a plugin.xml
Status: RESOLVED WONTFIX
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 385726
  Show dependency tree
 
Reported: 2012-07-23 10:32 EDT by Vincent Lorenzo CLA
Modified: 2016-12-14 11:18 EST (History)
1 user (show)

See Also:


Attachments
This plugin provides an handler to test the handler activation on a selection adapted to EObject (7.51 KB, application/octet-stream)
2012-07-23 10:33 EDT, Vincent Lorenzo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Lorenzo CLA 2012-07-23 10:32:12 EDT
Hi all, I'm trying to create an action where the handler is active when the selected elements can be adapted to EObject. 
I can't do it in a Diagram and I think there is a bug...
I use the example Ecore Diagram to test it and the plugin attached to this bug.

Steps to reproduce : 
	1/ create a new Ecore Diagram
	2/ Create 2 EClass in this Diagram
	3/ Select them
	4/ right Click, my plugin should provide an action called "Handler Test" in this menu, but it doesn't work properly.

my code : 
<extension
         point="org.eclipse.ui.menus">
            <menuContribution
                  allPopups="true"
                  locationURI="popup:org.eclipse.ui.popup.any">
               <command
                     commandId="testHandlerActivation"
                     label="Handler Test"
                     style="push">
                  <visibleWhen
                        checkEnabled="false">
                     <with
                           variable="selection">
                        <iterate>
                           <adapt
                                 type="org.eclipse.emf.ecore.EObject">
                           </adapt>
                        </iterate>
                     </with>
                  </visibleWhen>
               </command>
            </menuContribution>
   </extension>
Comment 1 Vincent Lorenzo CLA 2012-07-23 10:33:04 EDT
Created attachment 219051 [details]
This plugin provides an handler to test the handler activation on a selection adapted to EObject
Comment 2 Alexander Nyßen CLA 2012-07-23 14:01:41 EDT
GEF is neutral w.r.t. to the implementation technology of its model. Thus, EditParts should not be adaptable to EObjects by default. You may achieve your desired behavior by overwriting the getAdapter() method within your custom EditParts respectively. I am resolving this as wont fix thus.