Examples of ISapphireUiDef


Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

       
        final String additionalContributorsStr = def.getHint( PropertyEditorDef.HINT_ASSIST_CONTRIBUTORS );
       
        if( additionalContributorsStr != null )
        {
            final ISapphireUiDef rootdef = def.nearest( ISapphireUiDef.class );
           
            for( String segment : additionalContributorsStr.split( "," ) )
            {
                final Class<?> cl = rootdef.resolveClass( segment.trim() );
               
                if( cl != null )
                {
                    contributorClasses.add( cl );
                }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

            this.pageDefs.put( type, cs );
        }
       
        if( systemDefaultPageDef == null )
        {
            final ISapphireUiDef root = ISapphireUiDef.TYPE.instantiate();
            systemDefaultPageDef = (CompositeDef) root.getPartDefs().insert( CompositeDef.TYPE );
        }
    }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

    @Override
    protected void init()
    {
        super.init();
       
        final ISapphireUiDef rootdef = this.definition.nearest( ISapphireUiDef.class );
        final PropertyEditorDef propertyEditorPartDef = (PropertyEditorDef) this.definition;
       
        final String propertyEditorPath = substituteParams( propertyEditorPartDef.getProperty().text() );
        this.property = getModelElement().property( new ModelPath( propertyEditorPath ) );
       
        if( this.property == null )
        {
            throw new RuntimeException( invalidPath.format( propertyEditorPath ) );
        }
       
        // Read the property to ensure that initial events are broadcast and avoid being surprised
        // by them later.
       
        this.property.empty();
       
        // Child properties.       
       
        final ListFactory<ModelPath> childPropertiesListFactory = ListFactory.start();
        final ElementType type = this.property.definition().getType();
       
        if( type != null )
        {
            if( propertyEditorPartDef.getChildProperties().isEmpty() )
            {
                for( PropertyDef childProperty : type.properties() )
                {
                    if( childProperty instanceof ValueProperty )
                    {
                        childPropertiesListFactory.add( new ModelPath( childProperty.name() ) );
                    }
                }
            }
            else
            {
                for( PropertyEditorDef childPropertyEditor : propertyEditorPartDef.getChildProperties() )
                {
                    final ModelPath childPropertyPath = new ModelPath( childPropertyEditor.getProperty().content() );
                    boolean invalid = false;
                   
                    if( childPropertyPath.length() == 0 )
                    {
                        invalid = true;
                    }
                    else
                    {
                        ElementType t = type;
                       
                        for( int i = 0, n = childPropertyPath.length(); i < n && ! invalid; i++ )
                        {
                            final ModelPath.Segment segment = childPropertyPath.segment( i );
                           
                            if( segment instanceof ModelPath.PropertySegment )
                            {
                                final PropertyDef p = t.property( ( (ModelPath.PropertySegment) segment ).getPropertyName() );
                               
                                if( p instanceof ValueProperty )
                                {
                                    if( i + 1 != n )
                                    {
                                        invalid = true;
                                    }
                                }
                                else if( p instanceof ImpliedElementProperty )
                                {
                                    if( i + 1 == n )
                                    {
                                        invalid = true;
                                    }
                                    else
                                    {
                                        t = p.getType();
                                    }
                                }
                                else
                                {
                                    invalid = true;
                                }
                            }
                            else
                            {
                                invalid = true;
                            }
                        }
                    }
                   
                    if( invalid )
                    {
                        final String msg = invalidChildPropertyPath.format( this.property.name(), childPropertyPath.toString() );
                        Sapphire.service( LoggingService.class ).logError( msg );
                    }
                    else
                    {
                        childPropertiesListFactory.add( childPropertyPath );
                    }
                }
            }
        }
       
        this.childPropertyPaths = childPropertiesListFactory.result();
        this.childPropertyEditors = new HashMap<Element,Map<ModelPath,PropertyEditorPart>>();
       
        // Listen for PropertyValidationEvent and update property editor's validation.
       
        if( this.property instanceof ElementList || this.property instanceof ElementHandle )
        {
            this.propertyValidationListener = new FilteredListener<PropertyEvent>()
            {
                @Override
                protected void handleTypedEvent( final PropertyEvent event )
                {
                    if( ! ( event instanceof PropertyContentEvent && event.property() instanceof Value ) )
                    {
                        refreshValidation();
                    }
                }
            };
           
            this.property.attach( this.propertyValidationListener, "*" );
        }
        else
        {
            this.propertyValidationListener = new FilteredListener<PropertyEvent>()
            {
                @Override
                protected void handleTypedEvent( final PropertyEvent event )
                {
                    if( event instanceof PropertyValidationEvent || event instanceof PropertyEnablementEvent )
                    {
                        refreshValidation();
                    }
                }
            };
           
            this.property.attach( this.propertyValidationListener );
        }

        // Hints

        this.hints = new HashMap<String,Object>();
       
        for( ISapphireHint hint : propertyEditorPartDef.getHints() )
        {
            final String name = hint.getName().text();
            final String valueString = hint.getValue().text();
            Object parsedValue = valueString;
           
            if( name.equals( PropertyEditorDef.HINT_SHOW_HEADER ) ||
                name.equals( PropertyEditorDef.HINT_BORDER ) ||
                name.equals( PropertyEditorDef.HINT_BROWSE_ONLY ) ||
                name.equals( PropertyEditorDef.HINT_READ_ONLY ) )
            {
                parsedValue = Boolean.parseBoolean( valueString );
            }
            else if( name.startsWith( PropertyEditorDef.HINT_FACTORY ) ||
                     name.startsWith( PropertyEditorDef.HINT_AUX_TEXT_PROVIDER ) )
            {
                parsedValue = rootdef.resolveClass( valueString );
            }
            else if( name.equals( PropertyEditorDef.HINT_LISTENERS ) )
            {
                final List<Class<?>> contributors = new ArrayList<Class<?>>();
               
                for( String segment : valueString.split( "," ) )
                {
                    final Class<?> cl = rootdef.resolveClass( segment.trim() );
                   
                    if( cl != null )
                    {
                        contributors.add( cl );
                    }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

    public static final class Condition extends ServiceCondition
    {
        @Override
        public boolean applicable( final ServiceContext context )
        {
            final ISapphireUiDef def = context.find( ISapphireUiDef.class );
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( def != null && property != null && property.getTypeClass() == JavaTypeName.class )
            {
                final Reference referenceAnnotation = property.getAnnotation( Reference.class );
   
                if( referenceAnnotation != null && referenceAnnotation.target() == JavaType.class )
                {
                    final IProject project = def.adapt( IProject.class );
                   
                    if( project != null )
                    {
                        try
                        {
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

           
            if( searchImportedDefinitions )
            {
                for( IDefinitionReference ref : rootdef.getImportedDefinitions() )
                {
                    final ISapphireUiDef sdef = ref.getPath().target();
                   
                    if( sdef != null )
                    {
                        final PartDef def = sdef.getPartDef( id, true, expectedType );
                       
                        if( def != null )
                        {
                            return def;
                        }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

            if( searchImportedDefinitions )
            {
                for( IDefinitionReference ref : rootdef.getImportedDefinitions() )
                {
                    final ISapphireUiDef sdef = ref.getPath().target();
                   
                    if( sdef != null )
                    {
                        final ISapphireDocumentationDef def = sdef.getDocumentationDef( id, true );
                       
                        if( def != null )
                        {
                            return def;
                        }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

public final class DocumentationRefMethods
{
    public static ISapphireDocumentationDef resolve( final ISapphireDocumentationRef ref )
    {
        final ISapphireUiDef rootdef = ref.nearest( ISapphireUiDef.class );
        return rootdef.getDocumentationDef( ref.getId().text(), true );
    }
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

       
        InputStream stream = null;
       
        if( string != null && ! string.contains( "/" ) )
        {
            final ISapphireUiDef sdef = element.nearest( ISapphireUiDef.class );
           
            if( sdef != null )
            {
                for( IPackageReference p : sdef.getImportedPackages() )
                {
                    final String pname = p.getName().content();
                   
                    if( pname != null )
                    {
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

    @Override
    public JavaType resolve( final String name )
    {
        if( name != null )
        {
            final ISapphireUiDef sdef = context( ISapphireUiDef.class );
            final Context context = sdef.adapt( Context.class );
           
            if( context != null )
            {
                Class<?> cl = context.findClass( name );
               
                if( cl == null && name.indexOf( '.' ) == -1 )
                {
                    for( IPackageReference packageRef : sdef.getImportedPackages() )
                    {
                        final String packageName = packageRef.getName().text();
                       
                        if( packageName != null )
                        {
View Full Code Here

Examples of org.eclipse.sapphire.ui.def.ISapphireUiDef

public final class MasterDetailsContentNodeRefMethods
{
    public static MasterDetailsContentNodeChildDef resolve( final MasterDetailsContentNodeRef ref )
    {
        final ISapphireUiDef rootdef = ref.nearest( ISapphireUiDef.class );
        return (MasterDetailsContentNodeChildDef) rootdef.getPartDef( ref.getPart().text(), true, MasterDetailsContentNodeChildDef.class );
    }
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.