Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » creating View
creating View [message #43557] Thu, 22 May 2003 06:01 Go to next message
Eclipse UserFriend
Hi,

i am writing a view that need to listent to the navigator view -
i wrote this constractor :

/**
* The constructor.
*/
public View() {

try{
IViewReference[] r =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getViewReferences();

for(int i = 0; i < r.length; i ++)
{
if(r[i].getView(false)instanceof
org.eclipse.ui.views.navigator.ResourceNavigator){
((
org.eclipse.ui.views.navigator.ResourceNavigator)r[i].getVie w(false)).getTreeViewer
().addSelectionChangedListener(this);
}
}
}catch(Exception e){
}
}

whenever i open the workbench and my view is closed everything is working
fine - but i try to open the workbench and my view is already open - my
view is not working...
it seems that the navigetor as not created when my constractor is invoked..

thanks
Asaf Ben Ezra.
Re: creating View [message #44140 is a reply to message #43557] Thu, 22 May 2003 12:40 Go to previous message
Eclipse UserFriend
Originally posted by: simon.ibm.oti.lab

Your are going about this the wrong way...

Look at IWorkbenchWindow.getSelectionService().addSelectionListener( partId,
listener). You also need to remove your listener when your view is disposed.

Simon :-)

"Asaf Ben Ezra" <asafbe@il.ibm.com> wrote in message
news:bai755$7m6$1@rogue.oti.com...
> Hi,
>
> i am writing a view that need to listent to the navigator view -
> i wrote this constractor :
>
> /**
> * The constructor.
> */
> public View() {
>
> try{
> IViewReference[] r =
>
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getView
References();
>
> for(int i = 0; i < r.length; i ++)
> {
> if(r[i].getView(false)instanceof
> org.eclipse.ui.views.navigator.ResourceNavigator){
> ((
>
org.eclipse.ui.views.navigator.ResourceNavigator)r[i].getVie w(false)).getTre
eViewer
> ().addSelectionChangedListener(this);
> }
> }
> }catch(Exception e){
> }
> }
>
> whenever i open the workbench and my view is closed everything is working
> fine - but i try to open the workbench and my view is already open - my
> view is not working...
> it seems that the navigetor as not created when my constractor is
invoked..
>
> thanks
> Asaf Ben Ezra.
>
Previous Topic:Re: Preventing an Editor fom being restored!
Next Topic:Simple editor guidance requested
Goto Forum:
  


Current Time: Sat Jul 12 12:25:49 EDT 2025

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

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

Back to the top