| EMF object & propertyTester [message #482356] | 
Wed, 26 August 2009 07:04   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, 
 
In an extension definition of a popup menu contribution in the MANIFEST file (visibleWhen element), I'd like to test whether the object is a mymodel EMF instance ( myfile.mymodel file ). 
 
Do I have to write the testProperty class or does EMF generates something that could help me ? 
Is there a classical way to perform this task ? 
 
Thanks a lot, 
 
Cyril. 
 |  
 |  
  | 
| Re: EMF object & propertyTester [message #482370 is a reply to message #482356] | 
Wed, 26 August 2009 07:24    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
This is a multi-part message in MIME format. 
--------------070500070503090203060407 
Content-Type: text/plain; charset=UTF-8; format=flowed 
Content-Transfer-Encoding: 7bit 
 
Cyril, 
 
You should be able to register the popup for specific types of objects,  
e.g., 
 
      <objectContribution 
            id="org.eclipse.emf.ecore.editor.CreateDynamicInstance" 
           * objectClass="org.eclipse.emf.ecore.EClass">* 
         <action 
               id="org.eclipse.emf.ecore.editor.CreateDynamicInstanceAction " 
               label="%_UI_CreateDynamicInstance_menu_item" 
               menubarPath="additions" 
                
class="org.eclipse.emf.ecore.action.CreateDynamicInstanceAction " 
               enablesFor="1"/> 
      </objectContribution> 
 
Cyril Giraudon wrote: 
> Hello, 
> 
> In an extension definition of a popup menu contribution in the  
> MANIFEST file (visibleWhen element), I'd like to test whether the  
> object is a mymodel EMF instance ( myfile.mymodel file ). 
> 
> Do I have to write the testProperty class or does EMF generates  
> something that could help me ? 
> Is there a classical way to perform this task ? 
> 
> Thanks a lot, 
> 
> Cyril. 
> 
 
--------------070500070503090203060407 
Content-Type: text/html; charset=UTF-8 
Content-Transfer-Encoding: 8bit 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> 
</head> 
<body bgcolor="#ffffff" text="#000000"> 
Cyril,<br> 
<br> 
You should be able to register the popup for specific types of objects, 
e.g.,<br> 
<br> 
      <objectContribution<br> 
            id="org.eclipse.emf.ecore.editor.CreateDynamicInstance"<br > 
           <b> objectClass="org.eclipse.emf.ecore.EClass"></b><br > 
         <action<br> 
               
id="org.eclipse.emf.ecore.editor.CreateDynamicInstanceAction "<br> 
               label="%_UI_CreateDynamicInstance_menu_item"<br> 
               menubarPath="additions"<br> 
               
class="org.eclipse.emf.ecore.action.CreateDynamicInstanceAction "<br> 
               enablesFor="1"/><br> 
      </objectContribution><br> 
<br> 
Cyril Giraudon wrote: 
<blockquote cite="mid:h734re$7v2$1@build.eclipse.org" type="cite">Hello, 
  <br> 
  <br> 
In an extension definition of a popup menu contribution in the MANIFEST 
file (visibleWhen element), I'd like to test whether the object is a 
mymodel EMF instance ( myfile.mymodel file ). 
  <br> 
  <br> 
Do I have to write the testProperty class or does EMF generates 
something that could help me ? 
  <br> 
Is there a classical way to perform this task ? 
  <br> 
  <br> 
Thanks a lot, 
  <br> 
  <br> 
Cyril. 
  <br> 
  <br> 
</blockquote> 
</body> 
</html> 
 
--------------070500070503090203060407--
 |  
 |  
  | 
| Re: EMF object & propertyTester [message #482462 is a reply to message #482370] | 
Wed, 26 August 2009 12:13   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
thanks Ed, but I use the command API. 
 
I've finally succeeded with : 
 
               <visibleWhen 
                     checkEnabled="false"> 
                  <with 
                        variable="selection"> 
                     <iterate 
                           ifEmpty="false" 
                           operator="or"> 
                        <and> 
                           <instanceof 
                                 value="org.eclipse.core.resources.IResource"> 
                           </instanceof> 
                           <test 
                                 property="org.eclipse.core.resources.extension" 
                                 value="mymodel"> 
                           </test> 
                        </and> 
                     </iterate> 
                  </with> 
               </visibleWhen> 
 
Cyril. 
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03459 seconds