Package org.eclipse.sapphire.modeling

Examples of org.eclipse.sapphire.modeling.Path


        {
            return Collections.emptyList();
        }
        else
        {
            return Collections.singletonList( new Path( file.getParent() ) );
        }
    }
View Full Code Here


    }

    @Override
    protected Status compute()
    {
        final Path path = (Path) context( Value.class ).content();
       
        if( path != null )
        {
            final Path absolutePath = this.relativePathService.convertToAbsolute( path );
           
            if( absolutePath == null )
            {
                final String message = couldNotResolveRelative.format( path.toString() );
                return Status.createErrorStatus( message );
            }
            else
            {
                final File absolutePathFile = absolutePath.toFile();
               
                if( absolutePathFile.exists() )
                {
                    if( this.validResourceType == FileSystemResourceType.FILE )
                    {
                        if( absolutePathFile.isFile() )
                        {
                            return validateExtensions( path );
                        }
                        else
                        {
                            final String message = pathIsNotFile.format( absolutePath.toPortableString() );
                            return Status.createErrorStatus( message );
                        }
                    }
                    else if( this.validResourceType == FileSystemResourceType.FOLDER )
                    {
                        if( ! absolutePathFile.isDirectory() )
                        {
                            final String message = pathIsNotFolder.format( absolutePath.toPortableString() );
                            return Status.createErrorStatus( message );
                        }
                    }
                   
                    return Status.createOkStatus();
View Full Code Here

{
    @Override
    protected Status compute()
    {
        final Value<?> value = context( Value.class );
        final Path path = (Path) value.content( false );
       
        if( path != null )
        {
            final File f = path.toFile();
           
            if( f.exists() )
            {
                if( this.validResourceType == FileSystemResourceType.FILE )
                {
                    if( f.isFile() )
                    {
                        return validateExtensions( path );
                    }
                    else
                    {
                        final String message = pathIsNotFile.format( path.toString() );
                        return Status.createErrorStatus( message );
                    }
                }
                else if( this.validResourceType == FileSystemResourceType.FOLDER )
                {
                    if( ! f.isDirectory() )
                    {
                        final String message = pathIsNotFolder.format( path.toString() );
                        return Status.createErrorStatus( message );
                    }
                }
            }
            else
            {
                if( this.resourceMustExist )
                {
                    if( this.validResourceType == FileSystemResourceType.FILE )
                    {
                        final String message = fileMustExist.format( path.toString() );
                        return Status.createErrorStatus( message );
                    }
                    else if( this.validResourceType == FileSystemResourceType.FOLDER )
                    {
                        final String message = folderMustExist.format( path.toString() );
                        return Status.createErrorStatus( message );
                    }
                    else
                    {
                        final String message = resourceMustExistMessage.format( path.toString() );
                        return Status.createErrorStatus( message );
                    }
                }
            }
        }
View Full Code Here

        try
        {
            assertNull( fr.value() );
           
            element.setPath( "abc/file.txt" );
            assertEquals( ( new Path( new File( "" ).getCanonicalPath() ) ).append( "abc/file.txt" ), fr.value() );
        }
        finally
        {
            fr.dispose();
        }
View Full Code Here

public final class TestRelativePathService extends RelativePathService
{
    @Override
    public List<Path> roots()
    {
        return ListFactory.singleton( new Path( new File( "" ).getAbsolutePath() ) );
    }
View Full Code Here

   
    public final Path convertToRelative( final String path )
    {
        if( path != null )
        {
            return convertToRelative( new Path( path ) );
        }
       
        return null;
    }
View Full Code Here

            if( enclosed() && path.segmentCount() > 0 && path.segment( 0 ).equals( ".." ) )
            {
                return null;
            }
           
            Path absolute = null;
           
            for( Path root : roots() )
            {
                try
                {
                    final File file = root.append( path ).toFile().getCanonicalFile();
                    absolute = new Path( file.getPath() );
                   
                    if( file.exists() )
                    {
                        break;
                    }
View Full Code Here

    public final Path convertToAbsolute( final String path )
    {
        if( path != null )
        {
            return convertToAbsolute( new Path( path ) );
        }
       
        return null;
    }
View Full Code Here

    }

    @Override
    public Path convert( final String string )
    {
        Path result = null;
       
        try
        {
            result = new Path( string );
        }
        catch( IllegalArgumentException e )
        {
            // Intentionally ignored.
        }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.modeling.Path

Copyright © 2018 www.massapicom. 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.