Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » adding the project explorer to a perspective(how to refresh it)
adding the project explorer to a perspective [message #677359] Wed, 08 June 2011 09:43 Go to next message
nicolas h is currently offline nicolas h
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Hi there,
I added to a perspective the model explorer using :

myFolderLayout.addView(IPageLayout.ID_PROJECT_EXPLORER);


project explorer is correctly displayed but seems "dirty" : I don't see my projects in the workspace.

If I right click in the project explorer (just right click, I don't select "refresh" entry in the context menu), model explorer will be refreshed.

How can I refresh it automatically ?

I tried this :

IViewReference[] viewReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (IViewReference  viewRef : viewReferences)
{
	if (viewRef.getId().compareTo(IPageLayout.ID_PROJECT_EXPLORER) == 0)
	{
		System.out.println("Wake up !");
		ProjectExplorer projectExplorer = (ProjectExplorer)(viewRef.getView(true));
		System.out.println (projectExplorer.isDirty()); // return false
		projectExplorer.getCommonViewer().refresh();
		projectExplorer.getCommonViewer().expandAll();
	}
}


It doesn't work, nothing happens.

Does anyone have an idea to solve this problem ?

Best regards,

--
Nicolas
Re: adding the project explorer to a perspective [message #677421 is a reply to message #677359] Wed, 08 June 2011 13:13 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What are you returning from your org.eclipse.ui.application.WorkbenchAdvisor.getDefaultPageInput() method? In the IDE we return ResourcesPlugin.getWorkspace().getRoot()

PW


Re: adding the project explorer to a perspective [message #677485 is a reply to message #677421] Wed, 08 June 2011 16:16 Go to previous message
nicolas h is currently offline nicolas h
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Thank you for your reply.
I didn't override this method yet, so null was returned.

that works width ResourcesPlugin.getWorkspace().getRoot() returned.

Thanks,

--
Nicolas
Previous Topic:Problem with the RCP Texteditor example
Next Topic:How to use global actions in a context menu
Goto Forum:
  


Current Time: Tue Sep 16 11:43:07 GMT 2014

Powered by FUDForum. Page generated in 0.13042 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software