Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Unable to check for file extension in expression?
Unable to check for file extension in expression? [message #972784] Mon, 05 November 2012 22:23 Go to next message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
Good day,

I am currently trying to check the file extension of the current selection. What kinds of expressions I tried which are correctly working:
- counting the elements in the current selection
- iterating over a selection, checking if they are all instance of (IFile|IFolder)

But what I cannot get to work is the name/extension property; I'm using the following definition to achieve this:

     <definition
            id="allWithMyDslExtension">
         <with
               variable="selection">
            <iterate
                  ifEmpty="true"
                  operator="and">
               <adapt
                     type="org.eclipse.core.resources.IFile">
                  <test
                        property="extension"
                        value="myDsl">
                  </test>
               </adapt>
            </iterate>
         </with>
      </definition>

I have tried to replace "extension" with "org.eclipse.core.resources.IResource.extension" and also "org.eclipse.core.resources.IFile.extension" to no avail. http://wiki.eclipse.org/Command_Core_Expressions#Variables_and_the_Command_Framework states that it should be possible to use wildcards, but even if I use value="*" the expression does not evaluate to true.

There are no errors in the log or in the console.

Is there something I'm doing wrong here? Is there a way to inspect or output the values/objects that I'm iterating over?
Re: Unable to check for file extension in expression? [message #987417 is a reply to message #972784] Mon, 26 November 2012 14:25 Go to previous message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
http://wiki.eclipse.org/Menu_Contributions/IFile_objectContribution says that I'm pointing to the attribute incorrectly.

I.e. property should not contain the class/interface definition part.

The snippet below works for me.

     <definition
            id="allWithMyDslExtension">
         <with
               variable="selection">
            <iterate
                  ifEmpty="true"
                  operator="and">
               <adapt
                     type="org.eclipse.core.resources.IFile">
                  <test
                        property="org.eclipse.core.resources.extension"
                        value="myDsl">
                  </test>
               </adapt>
            </iterate>
         </with>
      </definition>
Previous Topic:Renaming an item in a TreeView
Next Topic:CDT perspective integration in RCP product
Goto Forum:
  


Current Time: Thu Apr 18 07:23:17 GMT 2024

Powered by FUDForum. Page generated in 0.02463 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top