Class ModuleNature
- All Implemented Interfaces:
IProjectNature
- Author:
- Christopher Mindus
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic voidassociateNature(IProject project, PluginDescriptor[] plugins, IProgressMonitor monitor) Associating the IIZI Nature with a Project.voidConfigures the IIZI Module Project nature for its project.voidDe-configures this nature for its project.getModel()Gets the model for the project.Returns the project to which this project nature applies.static booleanhasModuleNature(IProject project) Checks if the project has the Module Model nature.static voidreopenProject(IProject project, IProgressMonitor monitor) Closes and reopens a Module project and tells both changes, so that the Project Manager loads the project: when this method returns, the project is loaded.voidsetProject(IProject project) Sets the project to which this nature applies.
Field Details
NATURE_ID
Constructor Details
ModuleNature
public ModuleNature()Default Eclipse constructor.
Method Details
hasModuleNature
Checks if the project has the Module Model nature.- Parameters:
project- The project.- Returns:
trueif project is accessible and has the Module Model nature,falseotherwise.- Throws:
CoreException- If project nature cannot be retrieved.
associateNature
public static void associateNature(IProject project, PluginDescriptor[] plugins, IProgressMonitor monitor) throws CoreException Associating the IIZI Nature with a Project.The project is closed and opened again once it has the nature: setting the nature registers the project's model with the Project Manager without loading it, the close takes that registration away, and the change notification of the re-open is what makes the Project Manager load the project. Eclipse sends no change notification at the end of an operation while an operation of another thread is under way (a job inside
IWorkspace.run, aWorkspaceJob, a build), and a close and a re-open that are told together are no change: the project then stayed open, with its nature, and was never loaded. Each of the two is therefore told here withIWorkspace.checkpoint, which sends what was not told yet and sends nothing when Eclipse told it: when this method returns, the project is loaded.Not so when the caller is inside a workspace operation of its own (the calling thread holds a scheduling rule): Eclipse tells what such an operation changed when it ends, nothing is told from here, and the project is not loaded when this method returns. The quickstart wizard calls it that way, builds its panels on the model that is not loaded, and calls
reopenProject(IProject, IProgressMonitor)once its operation has ended.- Parameters:
project- The project.plugins- The plugins for the project.monitor- The progress monitor.- Throws:
CoreException- If this method doesn't complete.
setProject
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.- Specified by:
setProjectin interfaceIProjectNature- Parameters:
project- Project the project to which this nature applies.
getProject
Returns the project to which this project nature applies.- Specified by:
getProjectin interfaceIProjectNature- Returns:
- The project handle.
configure
Configures the IIZI Module Project nature for its project. This is called by the workspace when natures are added to the project using IProject.setDescription and should not be called directly by clients. The nature extension id is added to the list of natures before this method is called, and need not be added here.Exceptions thrown by this method will be propagated back to the caller of IProject.setDescription, but the nature will remain in the project description.
- Specified by:
configurein interfaceIProjectNature- Throws:
CoreException- If this method fails.
deconfigure
De-configures this nature for its project. This is called by the workspace when natures are removed from the project using IProject.setDescription and should not be called directly by clients. The nature extension id is removed from the list of natures before this method is called, and need not be removed here.Exceptions thrown by this method will be propagated back to the caller of IProject.setDescription, but the nature will still be removed from the project description.
- Specified by:
deconfigurein interfaceIProjectNature- Throws:
CoreException- If this method fails.
getModel
Gets the model for the project.- Returns:
- The model, or null if not initialized/configured yet.
reopenProject
Closes and reopens a Module project and tells both changes, so that the Project Manager loads the project: when this method returns, the project is loaded. For a caller that calledassociateNature(IProject, PluginDescriptor[], IProgressMonitor)inside a workspace operation of its own, where nothing is told and the project is not loaded: it calls this method once that operation has ended (the quickstart wizard, which creates its panels inside its operation). LikeassociateNature(IProject, PluginDescriptor[], IProgressMonitor)it tells nothing when the calling thread holds a scheduling rule.- Parameters:
project- The project, with the IIZI Module nature.monitor- The progress monitor, null for none.- Throws:
CoreException- If the project cannot be closed or opened.