Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » XML Tree with GEF
XML Tree with GEF [message #214605] Wed, 19 April 2006 08:31 Go to next message
Eclipse UserFriend
Originally posted by: kosteen.web.de

Hallo,
I am new to GEF and want to represent an xml-file as a tree with GEF. Should I create a model or is it possible to do it directly like, say, it is in swing?

Are there examples for it?
Re: XML Tree with GEF [message #214847 is a reply to message #214605] Mon, 24 April 2006 14:42 Go to previous message
Eclipse UserFriend
Originally posted by: guedes.bruno.gmail.com

Hi Shabaltas,

You can use a JFaces TreeViewer or a GEF TreeViewer.

To use the second one, you have to use the duo Model-EditPart, and
Policies to do action in the widget created !!

If you use the first one, you can do it without a model !!!

With GEF :

public class MyTreeEditor extends GraphicalEditorWithPalette {

public void createPartControl(Composite parent) {
gefTreeViewer = new TreeViewer();
gefTreeViewer.createControl(sf);
gefTreeViewer.setEditDomain(getEditDomain());
//The factory who create the edipart in relation of the model to
use !!
gefTreeViewer.setEditPartFactory(editPartFactory);
...
}

With JFaces :

viewer = new TreeViewer();
viewer.setUseHashlookup(true);

XmlEditorContentProvider xmlProvider = new
XmlEditorContentProvider();
viewer.setContentProvider(xmlProvider);

XmlEditorLabelProvider labelProvider = new XmlEditorLabelProvider();
viewer.setLabelProvider(labelProvider);

MyNode root = new MyNode("root");
MyNode fils = new MyNode("titi");
MyNode fils2 = new MyNode("tutu");
fils.addChild(new MyNode("test"));
fils.addChild(fils2);
root.addChild(fils);

viewer.setInput(root);

Have fun

Bruno
Previous Topic:Choosing constructor to create component instances
Next Topic:Passing Node Instance to EditPolicy
Goto Forum:
  


Current Time: Fri Dec 09 07:10:19 GMT 2022

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

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

Back to the top