Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problems invoking selectReveal() on ProjectExplorer view
Problems invoking selectReveal() on ProjectExplorer view [message #1767305] Tue, 04 July 2017 14:43 Go to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
Hey guys,

we want to select a file in the Project Explorer when we are clicking on an certain item in another view.

Therefore, we do the following:

final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
final IViewPart viewPart = page.findView(IPageLayout.ID_PROJECT_EXPLORER);
((ISetSelectionTarget)viewPart).selectReveal(new StructuredSelection(iResource));

The selectReveal() method works very fine, when the path to the file which has to be selected, was expanded and selected once BEFORE.


When the file is selected and we click the "Collapse All" button and then we click on our item in the other view again, then the file is not selected. The project stays collapsed and the tree is not expanded.


We already opened a topic on Stackoverflow too, but there were no successful solutions:

https://stackoverflow.com/questions/44903291/selecting-a-resource-programatically-in-eclipse-does-not-expand-tree


Are we doing something wrong or is this maybe a known bug?

Kind Regards and thanks in advance!





Re: Problems invoking selectReveal() on ProjectExplorer view [message #1767396 is a reply to message #1767305] Wed, 05 July 2017 15:39 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

selectReveal() is the same codepath that's used by the Project Explorer's Link with Editor[/em] that automatically reveals the resources associated with an editor. That opens and reveals resources, and it provides org.eclipse.core.resources.IFile instances.

So you need to heed the faint voice of Obiwan Kenobi urging you to "Use the Source, Luke!"[/em] and use your debugger and start stepping into the code to find out what is happening.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Problems invoking selectReveal() on ProjectExplorer view [message #1767441 is a reply to message #1767396] Thu, 06 July 2017 06:46 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
Thanks for the fast answer =)

We didn't even need "The Source", because it's already working =).
The problem was that we had integrated CDT in our product. When we did this, the "Link with Editor" feature did not work anymore. When we deactivated the navigator part of CDT, "Link with Editor" worked fine again and additionally also selectReveal() worked of course.
Re: Problems invoking selectReveal() on ProjectExplorer view [message #1767844 is a reply to message #1767441] Tue, 11 July 2017 14:16 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Hmm, there are no open bugs against CDT about Link with Editor being broken. Could you file a new one with a test project to demonstrate the problem?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT&component=cdt-core

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:Windows Command is not executed correctly
Next Topic:How to know when IResource.refreshLocal has finished in Oxygen?
Goto Forum:
  


Current Time: Sun Sep 23 15:43:52 GMT 2018

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

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

Back to the top