|
|
Re: Updating treeviewer from editor [message #824354 is a reply to message #824345] |
Mon, 19 March 2012 15:15 |
El Shorty Messages: 37 Registered: March 2012 |
Member |
|
|
I didn't use the EMF item providers, when looking on how to best create a treeview I came upon a tutorial from vogela. It's a jface treeviewer.
Here is the code from the treeviewer:
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL);
Tree tree = treeViewer.getTree();
tree.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
tree.setLocation(0, 0);
tree.setSize(576, 429);
getSite().setSelectionProvider(treeViewer);
treeViewer.setContentProvider(new GroupContentProvider());
treeViewer.setLabelProvider(new GroupLabelProvider());
treeViewer.setAutoExpandLevel(3);
treeViewer.setInput(new GroupList());
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
(this is to open the editor for the selected item
}
});
But apparently EMF has its own item providers (well I know this, just don't know how to use them), I'll try google it and maybe change my treeviewer. Still I would like to know if there is a way to do it using this code. I have created my own content provider and label provider, you need that code aswell? I'm new to the whole EMF/RCP story but I only got 2 months to finish my project and learn how to understand it all. It is a lot to take in, so sorry for if I ask alot of questions but really thanks for all the help
[Updated on: Mon, 19 March 2012 15:38] Report message to a moderator
|
|
|
Re: Updating treeviewer from editor [message #824395 is a reply to message #824354] |
Mon, 19 March 2012 16:16 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 19/03/2012 4:15 PM, El Shorty wrote:
> I didn't use the EMF item providers, when looking on how to best
> create a treeview I came upon a tutorial from vogela. It's a jface
> treeviewer.
>
> Here is the code from the treeviewer:
>
>
> treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
> | SWT.V_SCROLL);
> Tree tree = treeViewer.getTree();
> tree.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
> tree.setLocation(0, 0);
> tree.setSize(576, 429);
> getSite().setSelectionProvider(treeViewer);
> treeViewer.setContentProvider(new GroupContentProvider());
> treeViewer.setLabelProvider(new GroupLabelProvider());
> treeViewer.setAutoExpandLevel(3);
> treeViewer.setInput(new GroupList());
> treeViewer.addSelectionChangedListener(new
> ISelectionChangedListener() {
> public void selectionChanged(SelectionChangedEvent event) {
> (this is to open the editor for the selected item
> }
> });
>
>
> But apparently EMF has its own item providers, I'll try google it and
> maybe change my treeviewer. Still I would like to know if there is a
> way to do it using this code.
Yes, you can listen to notifications from the model. That's what the
item providers do. The introductory EMF overview describes this.
> I have created my own content provider and label provider, you need
> that code aswell?
I'm not going to solve your problems for you. You can look at working
examples, like EMF's generated editor. Wouldn't that be faster, given
it just works out of the box?
> I'm new to the whole EMF/RCP story but I only got 2 months to finish
> my project and learn how to understand it all. It is a lot to take in,
> so sorry for if I ask alot of questions but really thanks for all the
> help
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02989 seconds