Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.FileName


        @Override
        protected Status compute()
        {
            final Value<?> value = context( Value.class );
            final CreateWorkspaceFileOp op = value.nearest( CreateWorkspaceFileOp.class );
            final FileName fileName = (FileName) value.content();
           
            if( fileName != null )
            {
                final String extension = fileName.extension();
               
                if( extension != null )
                {
                    final FileExtensionsService fileExtensionsService = value.service( FileExtensionsService.class );
                   
View Full Code Here


    public void testStringToFileName() throws Exception
    {
        final MasterConversionService service = Sapphire.service( MasterConversionService.class );
       
        assertEquals( new FileName( "abc" ), service.convert( "abc", FileName.class ) );
        assertEquals( new FileName( "abc.txt" ), service.convert( "abc.txt", FileName.class ) );
       
        assertNull( service.convert( "folder/abc.txt", FileName.class ) );
    }
View Full Code Here

    public void testFileNameToString() throws Exception
    {
        final MasterConversionService service = Sapphire.service( MasterConversionService.class );
       
        assertEquals( "abc", service.convert( new FileName( "abc" ), String.class ) );
        assertEquals( "abc.txt", service.convert( new FileName( "abc.txt" ), String.class ) );
    }
View Full Code Here

           
            final String segment = path.substring( start, ( end == -1 ? lastPosition + 1 : end ) );

            if( ! segment.equals( "." ) && ! segment.equals( ".." ) )
            {
                new FileName( segment ); // Validation for illegal characters, etc.
            }

            newSegments[ i ] = segment;
            next = end + 1;
        }
View Full Code Here

    }

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

TOP

Related Classes of org.eclipse.sapphire.FileName

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.