DOM API understanding

Hello,

I try to develop a plugin to edit XML file in a graphical way.
Final objectif would be to assist end-user for XML construction.

As first attempt, I’d like to have a tree view of the XML file
and get the tree content in sync with changes in text editor
(for now without adding or removing elements, only change in values)

I start reading about XLM API, but it’s quite too difficult for me.
I known how to build a tree from XML document and display it in a tool window
I also succeeded in getting sync between a TextPanel and a TextControl , using doBind
(for example with an id of one node of the xml file)

But how to do with a more complex component like a tree ?
To which component bind the tree model ?

Another question is about TreeStructureProvider
Can such class help me or it is dedicated for tree view of files in a project ?
and as nothing to do with the subject of my project

Thanks
Bernard

0
1 comment
Avatar
Permanently deleted user

Hello,

Back to the projet of plugin to edit XML file in a graphical way.
I start using DomElement


For now the project's status is :
- definition of another fileEditorProvider
  (two tabs, the second one with a tree view of the xml file)
  The tree view build using XmlTag

- popup menu (on tree view tab) to add | remove nodes or change node value
  adding   node using XmlTag.createChildTag() + .add() or .addAfter()
  removing node using XmlTag.delete()
 
  This is OK. Changes are effective in the xml file

  But xml changes are not propagated to tree view (tree model)
  Obviously the question is how to link the tree model to PsiElement or XmlTag?
  I’m stuck with this point

 Do I have chosen the wrong direction  to think in term of Tree model ?

 Do I have to  deal with a PsiTreeChangeListener ?

regards,

Bernard

 

 


 

0

Please sign in to leave a comment.