Class DesignerProjectTreeImpl

    • Constructor Detail

      • DesignerProjectTreeImpl

        public DesignerProjectTreeImpl​(Project project)
    • Method Detail

      • updateEffectiveState

        protected ProjectDiff updateEffectiveState()
        Description copied from class: AbstractProject
        Call this after one or more resources or manifests have been changed. This will calculate the effective change to the resources and notify listeners.
        Overrides:
        updateEffectiveState in class AbstractProject
      • getResource

        public java.util.Optional<ProjectResource> getResource​(ResourcePath path)
        Description copied from interface: Project
        Finds the resource at the given path, using an effective view of the resources in this project chain.
        Specified by:
        getResource in interface Project
        Parameters:
        path - Not null
        Returns:
        The matching project resource or empty if not found.
      • browse

        public java.util.Optional<java.util.List<ProjectResource>> browse​(@Nonnull
                                                                          ResourcePath path)
        Specified by:
        browse in interface Project
        Parameters:
        path - the resourcePath of the folder to browse
        Returns:
        an empty optional if the given path was not found or is not browseable, otherwise its direct children
      • discardChanges

        public boolean discardChanges​(ResourcePath path)
        Description copied from interface: DesignableProject
        Discards any local changes for a path.
        Specified by:
        discardChanges in interface DesignableProject
        Returns:
        true if there were changes to discard, false if there were no changes in the first place.
      • isLocal

        public boolean isLocal​(ResourcePath path)
        Specified by:
        isLocal in interface DesignableProject
        Returns:
        True if there is a project resource at the given path that defined in the local project.
      • isChanged

        public boolean isChanged​(ResourcePath path)
        Specified by:
        isChanged in interface DesignableProject
        Returns:
        True if there is a resource at the given path that has been locally altered.
      • isInherited

        public boolean isInherited​(ResourcePath path)
        Specified by:
        isInherited in interface DesignableProject
        Returns:
        True if there is a resource at the given path that is inherited from a parent project
      • isOverridable

        public boolean isOverridable​(ResourcePath path)
        Specified by:
        isOverridable in interface DesignableProject
        Returns:
        False if there is an inherited resource that does not allow overrides. True otherwise.
      • isOverridden

        public boolean isOverridden​(ResourcePath path)
        Specified by:
        isOverridden in interface DesignableProject
        Returns:
        True if there is a resource at the given path defined in this project that is overriding a resource from a parent project at the same path.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Project
        Returns:
        the name of this Project.
      • getProjectInheritanceStructure

        public java.util.List<NamedManifest> getProjectInheritanceStructure()
        Specified by:
        getProjectInheritanceStructure in interface Project
        Returns:
        A list of all of the projects and their manifests that comprise the inheritance chain of this project. This list is ordered in ascending inheritance order, from leaf project first to super-most project last.
      • getAllResources

        public java.util.Map<ProjectResourceId,​ProjectResource> getAllResources()
        Description copied from interface: Project
        Get a List of all resources in this project and all parent projects.

        This includes resources belonging to parent projects in the inheritance chain if this is a "stack" of projects. This means that there may be multiple resources for any given ResourcePath.

        This project instance may not contain all resources that exist for the project on disk, depending on the ResourceFilter used to load it.

        Specified by:
        getAllResources in interface Project
        Returns:
        all the resources belonging to this project instance, including resources from parent projects.
      • getProjectSnapshots

        public java.util.List<ProjectSnapshot> getProjectSnapshots()
        Description copied from interface: Project
        Gets the snapshots from the effective project, in order of project inheritance (leaf project last)
        Specified by:
        getProjectSnapshots in interface Project
        Returns:
        A list of ProjectSnapshots, one per project represented in the effective project.
      • getChanges

        public java.util.List<ChangeOperation> getChanges()
        Specified by:
        getChanges in interface DesignableProject
        Returns:
        The change operations that have occurred on this project since loaded or since the last applyChanges
      • getConflicts

        public java.util.Collection<ChangeOperation> getConflicts​(java.util.Collection<ChangeOperation> changes)
        Specified by:
        getConflicts in interface DesignableProject
        Parameters:
        changes - Diff operations applicable to the local project
        Returns:
        a collection of the change operations that conflict with local changes
      • applyChange

        public void applyChange​(ProjectChange change)
                         throws NameCollisionException
        Apply a set of changes, pulled from the gateway, to this project. For local resources, this will update the "local" reference of the ResourceTreeNode so that further calls to get snapshots will reflect these changes.
        Parameters:
        change - The change collection to apply.
        Throws:
        NameCollisionException
      • notifyPushComplete

        public void notifyPushComplete​(java.util.List<ChangeOperation> changesPushed)
        Notify that a push was completed. This is a signal to the project that some resources may no longer be considered modified.
        Parameters:
        changesPushed - A list of the changes that were pushed, which may be a subset of those retrieved via getChanges()