Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 424389 - [ViewMgmt] findViewReference always returns null when searching with secondary ID
Summary: [ViewMgmt] findViewReference always returns null when searching with secondar...
Status: CLOSED DUPLICATE of bug 401709
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-18 16:57 EST by Albert Choi CLA
Modified: 2013-12-19 03:09 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Choi CLA 2013-12-18 16:57:57 EST
I have a problem using the IWorkbenchPage::findViewReference(...) method with view ID and secondary ID parameters.

I am calling 
                
IViewReference viewRef = 
  activePage.findViewReference("org.eclipse.ui.console.ConsoleView", "mySecondaryID");

and it seems to always return null, even if the console view is open.

Internally, I see that findViewReference(...) loops through getViewReferences() and tries to match the IDs.  To debug, I added the following logging to my code:

IViewReference[] viewRefs = activePage.getViewReferences();
                
for (IViewReference viewReference : viewRefs) {
    logger.trace("view ref ID - " + viewReference.getId());
    logger.trace("view ref secondary ID - " + viewReference.getSecondaryId());
}

The console view is logged as:

view ref ID - org.eclipse.ui.console.ConsoleView:mySecondaryID
view ref secondary ID - mySecondaryID

The main ID is appended with the secondary ID, and thus never gets matched in findViewReference().

I ran the same test with an Indigo environment, and the logging gives:

view ref ID - org.eclipse.ui.console.ConsoleView
view ref secondary ID - mySecondaryID

And it does return the view reference from findViewReference()

Thanks
Comment 1 Paul Webster CLA 2013-12-18 18:10:01 EST
Secondary ID support might have been fixed in Kepler.  Eric?

PW
Comment 2 Wojciech Sudol CLA 2013-12-19 03:09:21 EST
See also bug 404795

*** This bug has been marked as a duplicate of bug 401709 ***