Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ide-dev] Resource Management thoughts

On 09/13/2013 07:31 PM, Mickael Istria wrote:
So far it has been safe in client code to assume that project.parent = workspace
Actually, it was not safe to assume that. Someone who is using project.getParent has never been guaranteed to get the workspace root. Instead, there is ResourcePlugin.getWorkspace().getRoot() for people who want the workspace root, and IResource.getType() to check that a resource is a Project.
So there is nothing that prevents us to break this rule.

and that workspace.children = all projects.
That's where the doubt remains (and makes this change somehow dangerous). Here is the only thing I've seen which specifies the relationship between IWorkspaceRoot and IProject:
* getProject(String name) :  Returns a handle to the project resource with the given name which is a child of this root.
* getProjects() :   Returns the collection of projects which exist under this root.

"a child of this root" and "under this root" don't make it clear whether this applies to sub-children or not, and current implementation doesn't take a decision on this.
In the end, it seems like the implementation of nested folder is just about refining the specification of those 2 methods to make clear whether they handle all projects or not.
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

Back to the top