Examples of RelativePathService


Examples of org.eclipse.sapphire.services.RelativePathService

        return property().service( RelativePathService.class ).roots();
    }
   
    protected boolean enclosed()
    {
        final RelativePathService service = property().service( RelativePathService.class );
       
        if( service == null )
        {
            return true;
        }
        else
        {
            return service.enclosed();
        }
    }
View Full Code Here

Examples of org.eclipse.sapphire.services.RelativePathService

   
    protected Path convertToRelative( final Path path )
    {
        if( path != null )
        {
            final RelativePathService service = property().service( RelativePathService.class );
           
            if( service == null )
            {
                if( enclosed() )
                {
                    for( Path root : getBasePaths() )
                    {
                        if( root.isPrefixOf( path ) )
                        {
                            return path.makeRelativeTo( root );
                        }
                    }
                }
                else
                {
                    final String pathDevice = path.getDevice();
                   
                    for( Path root : getBasePaths() )
                    {
                        if( MiscUtil.equal( pathDevice, root.getDevice() ) )
                        {
                            return path.makeRelativeTo( root );
                        }
                    }
                }
            }
            else
            {
                return service.convertToRelative( path );
            }
        }
       
        return null;
    }
View Full Code Here

Examples of org.eclipse.sapphire.services.RelativePathService

   
    protected Path convertToAbsolute( final Path path )
    {
        if( path != null )
        {
            final RelativePathService service = property().service( RelativePathService.class );
           
            if( service == null )
            {
                if( enclosed() && path.segmentCount() > 0 && path.segment( 0 ).equals( ".." ) )
                {
                    return null;
                }
               
                Path absolute = null;
               
                for( Path root : getBasePaths() )
                {
                    try
                    {
                        final File file = root.append( path ).toFile().getCanonicalFile();
                        absolute = new Path( file.getPath() );
                       
                        if( file.exists() )
                        {
                            break;
                        }
                    }
                    catch( IOException e )
                    {
                        // Intentionally ignoring to continue to the next root. If none of the roots
                        // produce a viable absolute path, a null return from this method signifies
                        // being unable to convert the relative path. That is sufficient.
                    }
                }
               
                return absolute;
            }
            else
            {
                return service.convertToAbsolute( path );
            }
        }
       
        return null;
    }
View Full Code Here

Examples of org.eclipse.sapphire.services.RelativePathService

    {
        final Object content = value.content();
       
        if( content instanceof Path )
        {
            final RelativePathService relativePathService = value.service( RelativePathService.class );
           
            if( relativePathService != null )
            {
                return relativePathService.convertToAbsolute( (Path) content );
            }
        }
       
        return value.text();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.