Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » IViewSite (ico multi-instance view): no means to update secondaryId
IViewSite (ico multi-instance view): no means to update secondaryId [message #533886] Mon, 17 May 2010 07:44 Go to next message
Guy Rooms is currently offline Guy Rooms
Messages: 8
Registered: May 2010
Junior Member
Hello,

I have a situation/question concerning multi-instance views:

Situation:

- (single) view_A: showing list of available devices
- (multiple) view_B: displaying details for a single device

Requested Scenarios:

- Scenario A:
"Via context menu on View_A, provide means to Create (and jump to) new
instance of view_B."
This works fine using the secondaryId, e.g.:
"activePage.showView(<view_B_Id>, <secondaryId>, IWorkbenchPage.VIEW_CREATE);"
Here, the <secondaryId> corresponds to a device, and is used during
view_Bs creation (using "IViewSite.getSecondaryID()")

- Scenario B:
"Additionaly have a dropdown list in View_Bs toolbar to be able to
switch to another device."
Also this works fine: I can add a dropdown list, I can update view_B
its contents according to the newly selected device.
however the (internal) secondaryId (corresponding to the originally
selected device) remains the same.
As a result, a discrepancy is created between view_Bs content (details
on newly selected device) and its internal secondaryId (originally
selected device).

As a result, this breaks the expected behavior of Scenario A.

A solution to this problem could be to provide a means to extend the
IViewSite interface with a method to update the secondaryID.

Questions:
- Is it an option to have IViewSite extended with:
".setSecondaryId(String secId))",
- Is there another, existing solution I don't know about, fulfilling
both requested scenario's
- Any other, better solution ?

Thank you for your replies.
Re: IViewSite (ico multi-instance view): no means to update secondaryId [message #533888 is a reply to message #533886] Mon, 17 May 2010 07:59 Go to previous messageGo to next message
Guy Rooms is currently offline Guy Rooms
Messages: 8
Registered: May 2010
Junior Member
It Seems I have posted this to the wrong forum, should have been the "eclipse platform" iso RCP.
Can I (..) move this to the correct forum ? Sorry for the trouble.

Guy (first time poster)
Re: IViewSite (ico multi-instance view): no means to update secondaryId [message #533910 is a reply to message #533886] Mon, 17 May 2010 09:04 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6857
Registered: July 2009
Location: Ottawa
Senior Member

This post is probably OK here as well. I'll just append my answer:

But I'll mention, we cannot add that enhancements (definitely not in
3.x, possibly not in 4.0 either). The primaryID+secondaryID are
immutable and point to an instance of the view in the framework
(scoped to a window, I believe).

Your best bet is to have your primaryID+secondaryID be a key into a
map of devices ... then you can swap out your model object and have
that view "key" point to the new device.

Later,
PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: IViewSite (ico multi-instance view): no means to update secondaryId [message #533964 is a reply to message #533910] Mon, 17 May 2010 11:06 Go to previous messageGo to next message
Guy Rooms is currently offline Guy Rooms
Messages: 8
Registered: May 2010
Junior Member
Thx for your reply.

>Your best bet is to have your primaryID+secondaryID be a key into a
>map of devices ... then you can swap out your model object and have
>that view "key" point to the new device.
If I understand well, this implies:
- not to use the "normal" mechanism for navigating from view_A to view_B:
activePage.showView(<view_B>, <secId>, IWorkbenchPage.VIEW_CREATE);
- instead use an object in between which
[a] keeps track of the deviceSelection done at (every instance of) view_B
[b] is used by view_A for creating/navigating to the correct instance of view_B.
Is this correct ?


Re: IViewSite (ico multi-instance view): no means to update secondaryId [message #533996 is a reply to message #533964] Mon, 17 May 2010 12:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6857
Registered: July 2009
Location: Ottawa
Senior Member

Guy Rooms wrote:
> If I understand well, this implies:
> - not to use the "normal" mechanism for navigating from view_A to
> view_B: activePage.showView(<view_B>, <secId>, IWorkbenchPage.VIEW_CREATE);
> - instead use an object in between which [a] keeps track of the
> deviceSelection done at (every instance of) view_B
> [b] is used by view_A for creating/navigating to the correct instance
> of view_B.

That would be one way ... creating your own DeviceViewManager.
dvm.openView(Device) -> shows the view you want and works out the
primaryId+secondaryID -> Device mapping

dvm.getDevice(IViewPart) reverses the logic. Or something less
complicated, or something more complicated, depending one what your main
usecases are.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: IViewSite (ico multi-instance view): no means to update secondaryId [message #534657 is a reply to message #533996] Wed, 19 May 2010 14:23 Go to previous message
Guy Rooms is currently offline Guy Rooms
Messages: 8
Registered: May 2010
Junior Member
Hello Paul,
Thank you for your suggestion, I've implemented my own ViewMgr, and that indeed is doing the job well.
Previous Topic:reuse Java perspective in an RCP application
Next Topic:ALT+F4
Goto Forum:
  


Current Time: Wed Jul 23 14:11:13 EDT 2014

Powered by FUDForum. Page generated in 0.06770 seconds