Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » ISelectionProvider and Proxy Objects
ISelectionProvider and Proxy Objects [message #656432] Fri, 25 February 2011 15:55 Go to next message
Philipp Schill is currently offline Philipp Schill
Messages: 11
Registered: July 2010
Junior Member
Hi,
does anyone know a good solution for this problem:

Guess, I have a TreeViewer based ViewPart showing a number of objects. Due to performance reasons, we want to give a minimal number of information to the client (id and name). Only the ViewPart should work with these objects.

As soon as e.g. another view or wizard gets the selection from the tree (via ISelectionProvider), the tree should return a fully initialized object (not the lightweight object).

I tried to implement my own SelectionProvider but the problem is that getSelection() method is called from the owning ViewPart itself and I'm not able to distinguish that from an 'external' getSelection() call.

Does anyone know a good concept to get this work within the Eclipse architecture?

Thanks in advance
Regards
philipp
Re: ISelectionProvider and Proxy Objects [message #656459 is a reply to message #656432] Fri, 25 February 2011 18:17 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The API you're working with basically returns selected objects 1 to 1.

Sounds like you can do one of:

1) make your objects light-weight that can then initialize themselves
when selected (becoming the full object)

2) deliberately offer reference objects, so consumers now to go
ref.getDelegate().

3) if you can deal in interfaces, use java.lang.reflect.Proxy where you
can switch out the reference for the real object and the client can't
tell the difference.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
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


Previous Topic:[Wizard]: TableViewer selectionProvider inside a Wizard
Next Topic:Databinding custom cell editor
Goto Forum:
  


Current Time: Sun Sep 21 00:17:41 GMT 2014

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

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