Destructor
Destructor

Reputation: 3284

Refresh Navigation View in eclipse application

I want to Refresh Navigation View in eclipse application. The project explorer in the eclipse application does not show the projects , untill it is refreshed or right clicked on it. How to refresh it programmatically? And where to put this code?

Upvotes: 0

Views: 842

Answers (2)

Destructor
Destructor

Reputation: 3284

Thanks for the reply @greg-449. refreshLocal is useful, but i was missing a small piece of code and refrshing was not needed. Eventually i figured out the answer. I had to ovverride a function as I mentioned in one of my comments. I was trying to use the getDefaultPageInput in a wrong way and hence i was getting errors. Eventually i removed the erroneous code in my project and added following to WorkbenchAdvisor.java

@Override 
public IWorkspaceRoot getDefaultPageInput()
{ 
    return ResourcesPlugin.getWorkspace().getRoot(); 
}

Upvotes: 0

greg-449
greg-449

Reputation: 111142

If at all possible you should use the create methods of org.eclipse.core.resources.IFile and IFolder to create files and folders.

If that is not possible use the refreshLocal method of IProject or IFolder to update the workspace.

All these calls will generate one or more IResourceChangeEvent events which will be seen by views and anything else that needs to know about resource changes. The view will update automatically when it sees these events.

To reduce the number of resource change events generated enclose your modifications in a WorkspaceJob or WorkspaceModifyOperation or IWorkspaceRunnable.

Upvotes: 1

Related Questions