Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to get TreeViewer selection to show in PropertiesView
How to get TreeViewer selection to show in PropertiesView [message #393117] Fri, 27 May 2005 10:09 Go to next message
Eclipse UserFriend
Originally posted by: bencomo.us.ibm.com

Hi,

I've created a ViewPart that contains a TreeViewer which is displaying the
contents of my EMF model. I have set the viewer as a Selection provider,
getViewSite().setSelectionProvider(treeViewer), and added the
IPartListener and the getAdapter(Class key) and getPropertySheetPage()
methods (copied shamelessly from the generated editor). However, the
Property View is updated only when my view regains focus from another part
(i.e. when I switch between Navigator and my view), never when it is
activated for the first time.


Thanks in advance,
Al.-
Re: How to get TreeViewer selection to show in PropertiesView [message #393123 is a reply to message #393117] Fri, 27 May 2005 10:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Al,

Are you setting the selection when you are activated the first time?


Al Bencomo wrote:

> Hi,
>
> I've created a ViewPart that contains a TreeViewer which is displaying
> the contents of my EMF model. I have set the viewer as a Selection
> provider, getViewSite().setSelectionProvider(treeViewer), and added
> the IPartListener and the getAdapter(Class key) and
> getPropertySheetPage() methods (copied shamelessly from the generated
> editor). However, the Property View is updated only when my view
> regains focus from another part (i.e. when I switch between Navigator
> and my view), never when it is activated for the first time.
>
> Thanks in advance,
> Al.-
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to get TreeViewer selection to show in PropertiesView [message #393145 is a reply to message #393123] Fri, 27 May 2005 18:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bencomo.us.ibm.com

Hey Ed,

Thank you for your reply. I am setting the selection in the PartListener
when the view is activated (see below). Do I have to set it up in any
other place?

protected IPartListener partListener = new IPartListener()
{
public void partActivated(IWorkbenchPart p)
{
if (p == ERUPConfigurationView.this)
{
treeViewer.setSelection(treeViewer.getSelection(), true);
}
}

Thanks,
Al.-
Re: How to get TreeViewer selection to show in PropertiesView [message #393146 is a reply to message #393145] Fri, 27 May 2005 18:18 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Al,

I wonder if this gets called when the part is being created? Maybe
during initial construction the selection is being set before the
listener is hooked up... One could always do a delayed selection using
Display.asyncExec.


Al Bencomo wrote:

> Hey Ed,
>
> Thank you for your reply. I am setting the selection in the
> PartListener when the view is activated (see below). Do I have to set
> it up in any other place?
>
> protected IPartListener partListener = new IPartListener()
> {
> public void partActivated(IWorkbenchPart p)
> {
> if (p == ERUPConfigurationView.this)
> {
> treeViewer.setSelection(treeViewer.getSelection(), true);
> }
> }
>
> Thanks,
> Al.-
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:URI to IFile?
Next Topic:Load a XML-File into a Map
Goto Forum:
  


Current Time: Thu Apr 25 10:47:07 GMT 2024

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

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

Back to the top