[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] problem disposing a view

Hi,

i have a view that is registered as a selectionChange-Listener with an editor. In the method selectionChanged() of that view i do the following:

if (part!=null && selection!=null){
if (part!=ViewTabelleninhalt.this && selection instanceof IStructuredSelection) {
refresh();
}
}else{
ISelectionService s = getSite().getWorkbenchWindow().getSelectionService();
s.removePostSelectionListener(this);
s.removeSelectionListener(this);
getViewSite().getPage().hideView(this);
this.dispose();
}


That means, that when there is an editor present and there is an active selection i refresh the view. When there is no editor present, i want the view to be closed. But the way i close the editor doesnŽt seem to be sufficient. The next time i open the editor the selectionChange-event is triggered and although i had removed the view from the group of listeners, the above method still is executed.

How can i make the view really disappear?

Thanks for any help.
Regards
Christoph