Eclipse: how to programmatically update the current project

I am creating an eclipse plugin in which I am going to create a new file in my project. Is there a way to update the current project?

I know that I can have a link to the whole project by calling

ResourcesPlugin.getWorkspace().getRoot().getProjects()

And iterate between them and use

IResource.refreshLocal()

However, this approach is not the best, especially if the user has many projects.

An alternative would be to study the project to check if there is a new file or not, but I would avoid it.

+5
source share
2 answers

No need to refer to refreshLocalif you are creating a file with a workspace API, seeorg.eclipse.core.resources.IFile.create(InputStream, boolean, IProgressMonitor)

How to create a file, see the fragment in the Eclipse plugin: create a new file

+2
source

It is much easier to update at the project level.

IProject project = root.getProject(currentProjectName);
project.refreshLocal(IResource.DEPTH_INFINITE, null);

, , , .

+4

All Articles