Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Views] Communication between views.
[Views] Communication between views. [message #75411] Mon, 16 June 2003 13:16 Go to next message
Dinesh Varadharajan is currently offline Dinesh VaradharajanFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,
I am having couple of views with treeViewers. I want to pass the selection
of treeviewer in one view to the other view. Anybody have any idea abt it.
(I want something like IEditorInput).

Currently I am using showView() API to open the secong view.

Thanks,
Dinesh
Re: [Views] Communication between views. [message #75499 is a reply to message #75411] Mon, 16 June 2003 14:04 Go to previous messageGo to next message
Emil Einarsson is currently offline Emil EinarssonFriend
Messages: 24
Registered: July 2009
Junior Member
Hi.

A few ways spring to mind.

1 - Using singleton static getInstance() methods in the views.
By statically referencing the views, like this:
View1{
method(){
View2.getInstance().newSelection(selection);
}

View2{
public static View2 getInstance(){
return instance;
}
public void newSelection(...){
// do stuff
}
}

2 - Using ViewPart.setSelectionProvider(treeviewer)
register selection provider in one view (can be a tree viewer):
this.getSite().setSelectionProvider(theTreeViewer);

and register selectionchangedlistener in some other view:
this.getSite().getSelectionProvider().addSelectionChangedLis tener(aSelection
ChangedListener);

Good luck,
Emil

"Dinesh Varadharajan" <dvaradharajan@selectica.com> skrev i meddelandet
news:bckfud$3sj$1@rogue.oti.com...
> Hi,
> I am having couple of views with treeViewers. I want to pass the selection
> of treeviewer in one view to the other view. Anybody have any idea abt it.
> (I want something like IEditorInput).
>
> Currently I am using showView() API to open the secong view.
>
> Thanks,
> Dinesh
>
>
Re: [Views] Communication between views. [message #75614 is a reply to message #75499] Mon, 16 June 2003 15:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

I don't recommend (1) because you can have more the one workbench page
open at a time, and each could have an instance of your view. So there
is no one static instance.

Rich
Re: [Views] Communication between views. [message #76010 is a reply to message #75614] Tue, 17 June 2003 06:51 Go to previous messageGo to next message
Martin Kersten is currently offline Martin KerstenFriend
Messages: 306
Registered: July 2009
Senior Member
"Richard L. Kulp" <richkulp@NOSPAM.us.ibm.com> schrieb im Newsbeitrag
news:bcknb6$aj7$3@rogue.oti.com...
> I don't recommend (1) because you can have more the one workbench page
> open at a time, and each could have an instance of your view. So there
> is no one static instance.
>
Right. What I sometimes do is to provide a domain for every window/worbench
page
and allow to also listen up to a global change which changes depending on
the local changes.

Registering the domain is just easy by using a singelton domain context
manager and map the domains depending on the window/workbench page.


Works well here... .


Bye

Martin (Kersten)
Worked >> [Views] Communication between views. [message #76232 is a reply to message #75499] Tue, 17 June 2003 12:23 Go to previous message
Dinesh Varadharajan is currently offline Dinesh VaradharajanFriend
Messages: 26
Registered: July 2009
Junior Member
Thanks a lot, The second option worked fine for me. I didn't tested with the
first one.

Thanks,
Dinesh

"Emil Einarsson" <emil.einarsson@solme.se> wrote in message
news:bckir3$6qn$1@rogue.oti.com...
> Hi.
>
> A few ways spring to mind.
>
> 1 - Using singleton static getInstance() methods in the views.
> By statically referencing the views, like this:
> View1{
> method(){
> View2.getInstance().newSelection(selection);
> }
>
> View2{
> public static View2 getInstance(){
> return instance;
> }
> public void newSelection(...){
> // do stuff
> }
> }
>
> 2 - Using ViewPart.setSelectionProvider(treeviewer)
> register selection provider in one view (can be a tree viewer):
> this.getSite().setSelectionProvider(theTreeViewer);
>
> and register selectionchangedlistener in some other view:
>
this.getSite().getSelectionProvider().addSelectionChangedLis tener(aSelection
> ChangedListener);
>
> Good luck,
> Emil
>
> "Dinesh Varadharajan" <dvaradharajan@selectica.com> skrev i meddelandet
> news:bckfud$3sj$1@rogue.oti.com...
> > Hi,
> > I am having couple of views with treeViewers. I want to pass the
selection
> > of treeviewer in one view to the other view. Anybody have any idea abt
it.
> > (I want something like IEditorInput).
> >
> > Currently I am using showView() API to open the secong view.
> >
> > Thanks,
> > Dinesh
> >
> >
>
>
Previous Topic:classpathVariableInitializer doesn't seem to work under Eclipse 2.01
Next Topic:undo / redo
Goto Forum:
  


Current Time: Fri Apr 26 07:53:38 GMT 2024

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

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

Back to the top