Ramis
Ramis

Reputation: 349

How to use ElementTreeSelectionDialog in eclipse plugin

I'm trying to use the ElementTreeSelectionDialog but I am not sure how to set my input. I have an xml file which emulates the tree structure of the dialog.

I have no idea how to convert that into a variable which can be set into a input for the ElementTreeSelectionDialog.

Upvotes: 1

Views: 952

Answers (2)

Chandrayya G K
Chandrayya G K

Reputation: 8849

Have look at some example on selection dialogs here.

You need to implement ITreeContentProvider and ILabelProvider and use these implementations while creating ElementTreeSelectionDialog class.

Check the sources of org.eclipse.ui.model.WorkbenchContentProvider(which implements ITreeContentProvider) and org.eclipse.ui.model.WorkbenchLabelProvider(implements ILabelProvider) at http://grepcode.com/ for reference.

Upvotes: 1

Sashi
Sashi

Reputation: 177

You can use an XML parser say DOM parser (assuming that your XML is not very huge) to read the XML and get the root Document object. This object can be passed to the setInput() method for the dialog and you may have to implement the ITreeContentProvider and a label provider accordingly. In case you are not familiar with DOM parsers a lot of material can be found online on that.

Upvotes: 0

Related Questions