Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Obtaining the reference to a view from code
Obtaining the reference to a view from code [message #227334] Mon, 12 April 2004 23:00 Go to next message
Eclipse UserFriend
Originally posted by: sridharm.virtusa.com

I have a plugin which has two views (say view1 and view2) which need to
communicate with each other. How can view1 obtain the reference to view2
programmatically?

Help greatly appreciated.
Re: Obtaining the reference to a view from code [message #227341 is a reply to message #227334] Tue, 13 April 2004 00:39 Go to previous message
Eclipse UserFriend
1. if u just want that selection in view1 leads to some event in view2 try
using:

// to provide other views with info about any selection in this viewer.

getSite().setSelectionProvider(getViewer()); // keep this in one view say
view1

and let view2 implement ISelectionListener and so u'll have to overwrite a
method:

/* (non-Javadoc)

* @see
org.eclipse.ui.ISelectionListener#selectionChanged(org.eclip se.ui.IWorkbench
Part, org.eclipse.jface.viewers.ISelection)

*/

public void selectionChanged(IWorkbenchPart part, ISelection selection)

In this way any change in viewer of view1 will inform this through an event
to view2

2. otherwise use findview(String Id) method in IWorkbenchPage to get
reference to the View. there are other useful methods in this class u may
require later.



PS: there is an article abt this in eclipse.org... i think.

HTH,

Happy coding :-)

Vishal

"Sridhar Mothukuri" <sridharm@virtusa.com> wrote in message
news:c5fl4b$rh7$1@eclipse.org...
> I have a plugin which has two views (say view1 and view2) which need to
> communicate with each other. How can view1 obtain the reference to view2
> programmatically?
>
> Help greatly appreciated.
>
Previous Topic:Encoding support for M8
Next Topic:How can I attach process to the console?
Goto Forum:
  


Current Time: Fri May 09 21:30:45 EDT 2025

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

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

Back to the top