Download presentation
Presentation is loading. Please wait.
1
1 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference l Parameter passing org.eclipse.core.resources
2
2 Package org.eclipse.core.resource l Provides basic support for managing a workspace and its resources. l The entire API for the Resources plug-in. l The resources plug-in defines the notions of »Workspaces and »Resources. l The workspace's resource model is similar to a file system. »All resources are backed by a real file or directory in the native file system. »Stored in their native form (i.e., no extra bytes or markup) using their normal names. l In addition to basic resource management, the Resources plug-in supports various workspace lifecycle events such as save and snapshot, and resource change events.
3
3 Interface summary l interface for rsources l IFile »Files are leaf resources which contain data. l ICommand »A builder command names a builder and supplies a table of name-value argument pairs. l IContainer »Interface for resources which may contain other resources (termed its members). l IFileModificationValidator »The file modification validator is a VCM-related hook for pre- checking operations that modify the contents of files. l IFileState »A previous state of a file stored in the workspace's local history.
4
4 l IFolder »Folders may be leaf or non-leaf resources and may contain files and/or other folders. l IMarker »Markers are a general mechanism for associating notes and metadata with resources. l IMarkerDelta »A marker delta describes the change to a single marker. l IProject »A project is a type of resource which groups resources into buildable, reusable units. l IProjectDescription »A project description contains the metadata required to define a project. l IProjectNature »Interface for project nature runtime classes. l IProjectNatureDescriptor »A project nature descriptor contains information about a project nature obtained from the plug-in manifest ( plugin.xml ) file.
5
5 l IResource »The workspace analog of file system files and directories. l IResourceChangeEvent »Resource change events describe changes to resources. l IResourceChangeListener »A resource change listener is notified of changes to resources in the workspace. l IResourceDelta »A resource delta represents changes in the state of a resource tree between two discrete points in time. l IResourceDeltaVisitor »An objects that visits resource deltas. l IResourceStatus »Represents status related to resources in the Resources plug-in and defines the relevant status code constants. l IResourceVisitor »This interface is implemented by objects that visit resource trees. l ISaveContext »A context for workspace save operations. l ISavedState »A data structure returned by addSaveParticipant containing a save number and an optional resource delta.
6
6 l ISaveParticipant »A participant in the saving of the workspace. l IStorage »A storage object represents a set of bytes which can be accessed. l ISynchronizer »A synchronizer which maintains a list of registered partners and, on behalf of each partner, it keeps resource level synchonization information (a byte array). l IWorkspace »Workspaces are the basis for Eclipse Platform resource management. l IWorkspaceDescription »A workspace description represents the workspace preferences. l IWorkspaceRoot »A root resource represents the top of the resource hierarchy in a workspace. l IWorkspaceRunnable »A runnable which executes as a batch operation within the workspace.
7
7 Learn by Doing l All programs in the book are available on the CD that comes with the book l It is a good idea to run the programs as you read about them Do not forget that you will need the SavitchIn.java file for keyboard input l Classes are used to define objects and provide methods to act on the objects l Classes are also programs that declare these objects and process them to solve the problem
8
8 Project-related API l IProject »A project is a type of resource which groups resources into buildable, reusable units. l IProjectDescription »A project description contains the metadata required to define a project. l IProjectNature »Interface for project nature runtime classes. l IProjectNatureDescriptor »A project nature descriptor contains information about a project nature obtained from the plug-in manifest ( plugin.xml ) file.
9
9 IProjectNature String getLabel() »Returns a displayable label for this nature. »nameAttr l String getNatureId() »Returns the unique identifer of this nature. »plugId + idAttr l String[] getNatureSetIds() »Returns the identifiers of the nature sets that this nature belongs to. l String[] getRequiredNatureIds() »Returns the unique identifiers of the natures required by this nature.
10
10 IProjectDescription l Contains the metadata required to define a project. »is a project's "content". »not intended to be implemented by clients (Constant) Fields : »static String DESCRIPTION_FILE_NAME »= ".project “ Methods: l boolean hasNature(String natureId) »test if the project nature has been added to the described project. l ICommand newCommand() »Returns a new build command. not become part of build spec until installed via the setBuildSpec method.
11
11 Properties of IProjectDescriptor l buildSpec :ICommand[] »list of build commands to run when building the described project. l comment :String »comment for the described project l location : IPath »the local file system location for the described project. l name : String »the project name l natureIds : String[] »list of natures associated with the described project. l referencedProjects : IProject[] »referenced projects, ignoring any duplicates.
12
12 IProjectNature l Interface for project nature runtime classes. »A project can be configured or deconfigure with zero or more project natures. »if configured =>recorded in the list of project natures on the project. »Individual project natures may expose a more specific runtime type, with additional API for manipulating the project in a nature-specific way. »Clients may implement this interface.
13
13 Methods of IProjectNature void configure() »Configures this nature for its project. »called by the workspace when natures are added to the project using IProject.setDescription and should not be called directly by clients. l void deconfigure() »Deconfigures this nature for its project. »called by worksapce and should not be called by client. l IProject getProject() »Returns the project to which this project nature applies. l void setProject(IProject project) »Sets the project to which this nature applies. »Used when instantiating this project nature runtime. This is called by IProject.create() or IProject.setDescription() and should not be called directly by clients.
14
14 IProject l public interface IProject extends IContainer, IAdaptable l is a type of resource which groups resources into buildable, reusable units. l Features of projects include: »collects together a set of files and folders. »A project's location controls where the project's resources are stored in the local file system. »A project's build spec controls how building is done on the project. »A project can carry session and persistent properties. »A project can be open or closed; a closed project is passive and has a minimal in-memory footprint. »A project can carry references to other projects. »A project can have one or more project natures. l This interface is not intended to be implemented by clients.
15
15 IResource l The workspace analog of file system files and directories. l There are four types of resource: »IFile, IFolder, IProject, IWorkspacRoot l Features of resources: » IResource objects are handles to state maintained by a workspace,but some methods and operations require that an actual resource be available. »can have two kinds of properties (identified by qualified name key) –session properties :Object value –persistent properties:String value »Resources are identified by type and by their path »Resources can be local or non-local »Phantom resource represent incoming additions or outgoing deletions which have yet to be reconciled with a synchronization partner l not intended to be implemented by clients
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.