Class PlainJavaResource

    • Constructor Detail

      • PlainJavaResource

        public PlainJavaResource​(java.io.File wrapped)
    • Method Detail

      • isAccessible

        public boolean isAccessible()
        Description copied from interface: AResource
        An accessible resource AResource.exists() and can be used. For example a project in Eclipse needs to be open to be accessible.
        Specified by:
        isAccessible in interface AResource
        Returns:
        whether this resource is accessible
      • exists

        public boolean exists()
        Description copied from interface: AResource
        A resource exists if its file-system equivalent exists (the path corresponds to an actual file/folder).
        Specified by:
        exists in interface AResource
        Returns:
        whether this resource exists
      • getParent

        public AContainer getParent()
        Description copied from interface: AResource
        A resource's parent ist the resource representing the containing folder. Not all resources have a parent, for example a workspace only contains other resources but has not parent.
        Specified by:
        getParent in interface AResource
        Returns:
        this resource's parent, or null if it has no parent
      • getName

        public java.lang.String getName()
        Description copied from interface: AResource
        The local name of this resource inside its parent.
        Specified by:
        getName in interface AResource
        Returns:
        this resource's name
      • getLocation

        public java.nio.file.Path getLocation()
        Description copied from interface: AResource
        Returns the absolute location of this resource in the file system.
        Specified by:
        getLocation in interface AResource
        Returns:
        this resource's location
      • getProjectRelativePath

        public java.nio.file.Path getProjectRelativePath()
        Description copied from interface: AResource
        Returns the relative location of this resource in the containing project.
        Specified by:
        getProjectRelativePath in interface AResource
        Returns:
        this resource's location relative to its project or an empty path if the resource is not contained in a project
      • getWorkspaceRelativePath

        public java.nio.file.Path getWorkspaceRelativePath()
        Description copied from interface: AResource
        Returns the relative location of this resource in the containing workspace.
        Specified by:
        getWorkspaceRelativePath in interface AResource
        Returns:
        this resource's location relative to its project or an empty path if the resource is not contained in a workspace
      • delete

        public void delete​(org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Deletes the resource from the file system.
        Specified by:
        delete in interface AResource
        Parameters:
        monitor - a progress monitor that is notified about the deletion process. When deleting a directory, individual file deletions are reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
      • getModificationStamp

        public long getModificationStamp()
        Description copied from interface: AResource
        Returns the corresponding file's modification stamp. This may correspond to the AResource.getLocalTimeStamp() from the file system or be more fine-grained.
        Specified by:
        getModificationStamp in interface AResource
        Returns:
        the file's modification time stamp, or -1 if the file does not exist
      • getLocalTimeStamp

        public long getLocalTimeStamp()
        Description copied from interface: AResource
        Returns the corresponding file's last modification as milliseconds since the epoch (1970-1-1).
        Specified by:
        getLocalTimeStamp in interface AResource
        Returns:
        the file's time stamp, or -1 if the file does not exist
      • findMarkers

        public java.util.Set<AMarker> findMarkers​(java.lang.String type,
                                                  boolean includeSubtypes,
                                                  AResource.AResourceTreeTraversalDepth depth)
        Description copied from interface: AResource
        Returns all markers of the given type on this resource. If includeSubtypes is true, then markers of types that are subtypes of the given type are also returned. The depth determines whether only markers from this resource are returned or also from its children (if this resource is a container).
        Specified by:
        findMarkers in interface AResource
        Parameters:
        type - a marker type
        includeSubtypes - whether to include subtypes of the given marker type
        depth - whether to scan only this resource, or also its children (and their children...)
        Returns:
        all markers matching the given type and search depth
      • recursive

        protected void recursive​(java.util.function.Consumer<PlainJavaResource> consumer,
                                 AResource.AResourceTreeTraversalDepth depth,
                                 @CheckForNull
                                 org.eclipse.core.runtime.IProgressMonitor monitor,
                                 java.lang.String taskName)
        Executes the given Consumer for this resource and, according to the given depth, its children, notifying the given monitor of progress of the given task.
        Parameters:
        depth - is ignored if this resource is not AContainer.
        monitor - a progress monitor that is notified about this process. When processing a directory, individual file processing is reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
        taskName - the name of the task, to be reported to the progress monitor
      • createMarker

        public AMarker createMarker​(java.lang.String markerType)
        Description copied from interface: AResource
        Creates a new marker of the given type for this resource.
        Specified by:
        createMarker in interface AResource
        Parameters:
        markerType - the marker type
        Returns:
        the created marker
      • deleteMarkers

        public void deleteMarkers​(java.lang.String type,
                                  boolean includeSubtypes,
                                  AResource.AResourceTreeTraversalDepth depth)
        Description copied from interface: AResource
        Deletes all markers of the given type from this resource. If includeSubtypes is true, then markers of types that are subtypes of the given type are also deleted. The depth determines whether only markers from this resource are deleted or also from its children.
        Specified by:
        deleteMarkers in interface AResource
        Parameters:
        type - a marker type
        includeSubtypes - whether to include subtypes of the given marker type
        depth - whether to clean only this resource, or also its children (and their children...)
      • deleteMarker

        public void deleteMarker​(PlainJavaMarker plainJavaMarker)
      • isDerived

        public boolean isDerived()
        Description copied from interface: AResource
        Returns whether this resource is derived (can be recreated from source files).
        Specified by:
        isDerived in interface AResource
      • setDerived

        public void setDerived​(boolean isDerived,
                               org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Sets this resource (and, in case this is a container, its children) as derived.
        Specified by:
        setDerived in interface AResource
        Parameters:
        isDerived - whether to mark this resource as derived
        monitor - a progress monitor that is notified about this process. When marking a directory as (not) derived, individual file processing is reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
      • getProject

        public AProject getProject()
        Description copied from interface: AResource
        Returns the project containing this resource.
        Specified by:
        getProject in interface AResource
        Returns:
        the project containing this resource; the project itself if this resource is a project and null if this resource is the workspace.
      • refreshLocal

        public void refreshLocal​(AResource.AResourceTreeTraversalDepth depth,
                                 org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Synchronizes this resource with its corresponding file-system objects.
        Specified by:
        refreshLocal in interface AResource
        Parameters:
        depth - whether to synchronize only this resource, or also its children (and their children...)
        monitor - a progress monitor that is notified about this process. When synchronizing a directory, individual file synchronization is reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
      • refreshInternal

        protected void refreshInternal()
      • getWorkspace

        public PlainJavaWorkspace getWorkspace()
        Description copied from interface: AResource
        Returns the workspace containing this resource.
        Specified by:
        getWorkspace in interface AResource
        Returns:
        the workspace containing this resource; the workspace itself if this resource is a workspace.
      • copy

        public void copy​(java.nio.file.Path destination,
                         org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Copies this resource to the given destination.
        Specified by:
        copy in interface AResource
        Parameters:
        destination - an existing resource of the same type as this resource
        monitor - a progress monitor that is notified about the copy process. When copying a directory, individual file copies are reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
      • move

        public void move​(java.nio.file.Path destination,
                         org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Moves this resource to the given destination.
        Specified by:
        move in interface AResource
        Parameters:
        destination - an existing resource of the same type as this resource
        monitor - a progress monitor that is notified about the move process. When moving a directory, individual file copies are reported to the monitor to allow fine-grained progress reporting. The monitor may be null when progress does not need to be reported.
      • touch

        public void touch​(org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AResource
        Marks this resource as modified, updating the local time stamp and modification stamp.
        Specified by:
        touch in interface AResource
        Parameters:
        monitor - a progress monitor that is notified about this process. The monitor may be null when progress does not need to be reported.
      • isSynchronized

        public boolean isSynchronized​(AResource.AResourceTreeTraversalDepth depth)
        Description copied from interface: AResource
        Checks whether this resource is in sync with its corresponding file-system resource. Both need to
        Specified by:
        isSynchronized in interface AResource
        Parameters:
        depth - whether to check only this resource, or also its children (and their children...)
        Returns:
        whether this resource (and its children) is/are in sync with its/their corresponding file-system resource(s)
      • isSynchronizedInternal

        protected boolean isSynchronizedInternal()