Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Resource


            }
           
            if( ! range.initialized() )
            {
                Element modElement = element;
                Resource resource = modElement.resource();
                XmlElement xmlElement = null;
               
                if( resource != null )
                {
                    xmlElement = ( (XmlResource) resource ).getXmlElement();
View Full Code Here


                final ElementList<?> list = element.property( (ListProperty) property );
                final List<XmlNode> xmlNodes = new ArrayList<XmlNode>( list.size() );
               
                for( Element entry : list )
                {
                    final Resource resource = entry.resource();
                   
                    if( resource instanceof XmlResource )
                    {
                        final XmlNode xmlNode = ( (XmlResource) resource ).getXmlElement();
                       
                        if( xmlNode != null )
                        {
                            xmlNodes.add( xmlNode );
                        }
                    }
                }
               
                return xmlNodes;
            }
            else if( property instanceof ElementProperty && ! ( property instanceof ImpliedElementProperty ) )
            {
                final Element child = element.property( (ElementProperty) property ).content();
               
                if( child != null )
                {
                    final Resource resource = child.resource();
                   
                    if( resource instanceof XmlResource )
                    {
                        final XmlNode xmlNode = ( (XmlResource) resource ).getXmlElement();
                       
                        if( xmlNode != null )
                        {
                            return Collections.singletonList( xmlNode );
                        }
                    }
                }
            }
            else
            {
                final Resource resource = element.resource();
               
                if( resource instanceof XmlResource )
                {
                    final XmlResource r = (XmlResource) resource;
                    final XmlNode xmlNode = ( (XmlValueBindingImpl) r.binding( element.property( property ) ) ).getXmlNode();
View Full Code Here

    }

    @Override
    public Document convert( final ElementImpl element )
    {
        final Resource resource = element.resource();
       
        if( resource instanceof XmlResource )
        {
            return resource.adapt( RootXmlResource.class ).getDomDocument();
        }
       
        return null;
    }
View Full Code Here

    }

    @Override
    public Element convert( final ElementImpl element )
    {
        final Resource resource = element.resource();
       
        if( resource instanceof XmlResource )
        {
            final XmlElement xmlElement = ( (XmlResource) resource ).getXmlElement();
           
View Full Code Here

    }

    @Override
    public XmlElement convert( final ElementImpl element )
    {
        final Resource resource = element.resource();
       
        if( resource instanceof XmlResource )
        {
            return ( (XmlResource) resource ).getXmlElement();
        }
View Full Code Here

    private void refreshVisibility()
    {
        final MasterDetailsContentNodePart node = (MasterDetailsContentNodePart) getPart();
        final Element element = node.getLocalModelElement();
        final Resource resource = element.resource();
       
        setVisible( resource instanceof XmlResource && ( (XmlResource) resource ).getXmlElement() != null );
    }
View Full Code Here

            final WorkspaceFileType fileTypeAnnotation = operation.type().getAnnotation( WorkspaceFileType.class );
           
            if( fileTypeAnnotation != null )
            {
                final ElementType type = ElementType.read( fileTypeAnnotation.value() );
                final Resource resource = type.service( MasterConversionService.class ).convert( newFileHandle, Resource.class );
               
                if( resource != null )
                {
                    try
                    {
                        final Element element = type.instantiate( resource );
                       
                        try
                        {
                            element.initialize();
                            resource.save();
                        }
                        finally
                        {
                            element.dispose();
                        }
View Full Code Here

        if( stream == null )
        {
            throw new IllegalArgumentException();
        }
       
        final Resource resource;
       
        try
        {
            try
            {
View Full Code Here

           
            final ElementType persistedStateElementType = ElementType.read( (Class<?>) persistedStateElementJavaType.artifact() );
           
            try
            {
                final Resource resource = new RootXmlResource( new XmlResourceStore( file ) ) ;
               
                resource.setCorruptedResourceExceptionInterceptor
                (
                    new CorruptedResourceExceptionInterceptor()
                    {
                        @Override
                        public boolean shouldAttemptRepair()
View Full Code Here

        final IProject project = project();
       
        final IFile xmlFile = project.getFile( "file.xml" );
        xmlFile.create( new ByteArrayInputStream( new byte[ 0 ] ), true, null );
       
        final Resource xmlFileResource = service.convert( xmlFile, Resource.class );
        assertNotNull( xmlFileResource );

        final IFile txtFile = project.getFile( "file.txt" );
        txtFile.create( new ByteArrayInputStream( new byte[ 0 ] ), true, null );
       
        final Resource txtFileStore = service.convert( txtFile, Resource.class );
        assertNull( txtFileStore );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Resource

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.