Moderators: Eric Clayberg, Dan Rubel
Tony Weddle wrote:I can't find anything in the index about refreshing the project (apart from references to a few API descriptions). Although I'm working my way through the book, I'm also having to do some work on an existing plug-in and was hoping I could use the book as a kind of reference. In my particular case, I have a plug-in that generates new Java classes, from a wizard interface, and would like to have the project refresh, to pick up those new classes rather than require the user to do the refresh manually. Is there anything in the book about that?
Eric Clayberg wrote:Have you tried the IResource refreshLocal(int depth, IProgressMonitor monitor) method?
Tony Weddle wrote:I discovered, by drilling down though the eclipse code, that the depth parameter, for the refreshLocal call, is really a depth indicator that can only take a few values, it's not an arbitrary depth level. I set it to IResource.DEPTH_INFINITE and that worked, when I had a selected resource with which to track back to the project.
Tony Weddle wrote:I'm looking at how to get at the project without a selected resource.
Oh my goodness, you did! I saw the API and knew I'd tried it, but the fact that you used the constant as the depth parameter didn't sink in. Sorry.Eric Clayberg wrote:Isn't that exactly what I suggested?
Thanks, I'll try that later; I'm trying a different tack, at the moment. But how do I find this information in the book? There's nothing in the index about ResourcesPlugin or IWorkspaceRoot, not that I would know to look at those anyway.Eric Clayberg wrote:Use the IWorkspaceRoot getProject(String name) method. E.g.,ResourcesPlugin.getWorkspace().getProject("MyProject")
Tony Weddle wrote: That is excellent information, thanks. This is another example of what I was referring to in my post about the index...
Tony Weddle wrote: The thing I haven't spotted yet is information on the classes I can specify for an object contribution. What are the typical model classes that could be selected in, say, a package explorer or navigator? I've come across IFile, IResource, ICompilationUnit and JavaProject, so far. However, JavaProject is not an implementer of IProject, which caused me a problem until I found the getProject method on JavaProject, a method I didn't expect. I think adapters have a part to play here but what classes can be specified as the objectClass attribute on the various elements related to visibility?
Return to Book: Eclipse Plug-Ins (3rd Edition)
Users browsing this forum: No registered users and 1 guest