Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Working set Location predicate on different platforms
Working set Location predicate on different platforms [message #1777364] Tue, 28 November 2017 21:00 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 350
Registered: March 2011
Senior Member
Is the location predicate sensitive to the path separator of different platforms?

In a setup model I have the following:

    <workingSet
        name="${scope.project.name} - tooling">
      <predicate
          xsi:type="predicates:LocationPredicate"
          pattern="${git.clone.posysml.location}/plugins/tooling/.*"/>
    </workingSet>


... which works on macOS (and presumably on Linux, although I haven't tested it there), but it is ignored on Windows. Must I write the following (quite horrible) predicate?

    <workingSet
        name="${scope.project.name} - tooling">
      <predicate
          xsi:type="predicates:LocationPredicate"
          pattern="${git.clone.posysml.location}(\\|/)plugins(\\|/)tooling(\\|/).*"/>
    </workingSet>


Not only that is quite unappealing and error prone, but some messages in the forum (cf https://www.eclipse.org/forums/index.php?t=msg&th=1085942&goto=1760836&#msg_1760836) suggest that using this with \\ doesn't work.

I've been looking for the implementation of the Working Sets task in Oomph's git repo at http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/ but I can't find where this is implemented. Where should I look?

By the way, is "Pattern" supposed to be a Java regex according to java.util.regex.Pattern, or some inhouse pattern?

[Updated on: Tue, 28 November 2017 21:01]

Report message to a moderator

Re: Working set Location predicate on different platforms [message #1777399 is a reply to message #1777364] Wed, 29 November 2017 08:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29539
Registered: July 2009
Senior Member
It's implemented by org.eclipse.oomph.predicates.impl.LocationPredicateImpl.matches(IResource) like this:
  public boolean matches(IResource resource)
  {
    if (resource != null)
    {
      IPath location = resource.getLocation();
      if (location != null)
      {
        return getCompiledPattern().matcher(location.toPortableString()).matches();
      }
    }

    return false;
  }
That uses java.util.regex.Pattern and apparently toPortableString does use "/" as a separator. But it seems to me you have to be pretty careful with ${git.clone.posysml.location} because that might well look like it has patterns in it, and will definitely use a \ on Windows. It's better to use ${git.clone.posysml.location|path} to be sure that / is used and not \, also also likely safer to use \Q${git.clone.posysml.location|path}\E to ensure that it's used literally and not in any way as a pattern.
Previous Topic:User.setup preferences contains lots of REMOVE_PREFERENCES_MARKER
Next Topic:Preferences not updated on restart
Goto Forum:
  


Current Time: Thu Sep 20 19:55:32 GMT 2018

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

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

Back to the top