|
|
Re: Treeviewer only refreshes when clicked on [message #840729 is a reply to message #840622] |
Tue, 10 April 2012 12:52 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
EMF's generated editors show how to set up a tree viewer that updates
(responds to model notifications) as you change the model.
On 10/04/2012 12:00 PM, El Shorty wrote:
> Hey all,
>
> So I have a treeviewer with groups & the persons in the group but it
> only refreshes the moment I click on it. Isn't it possible to let it
> refresh the moment something changes?
>
> In my view that contains the treeviewer this is how I make it refresh:
>
> ISelectionListener listener = new ISelectionListener() {
> @Override
> public void selectionChanged(IWorkbenchPart part, ISelection
> sel) {
> if (!(sel instanceof IStructuredSelection))
> return;
> IStructuredSelection ss = (IStructuredSelection) sel;
> Object o = ss.getFirstElement();
> if (o instanceof Group || o instanceof Person)
> {
> treeViewer.setInput(new GroupList());
> treeViewer.refresh();
> }
> }
> };
>
> public void createPartControl(Composite parent) {
> ....
> getSite().getPage().addSelectionListener(listener);
> }
>
> @Override
> public void selectionChanged(IWorkbenchPart part, ISelection
> selection) {
> treeViewer.refresh();
>
> }
>
> When I click on an item in the treeviewer it opens an editor, the
> changes I make here (for example adding a new person to a group) works
> fine. When I click in the treeviewer, it refreshes and shows me the
> correct data. But what I want is that the moment I add the person to
> the group the treeviewer gets updates without that I need to click in it
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04774 seconds