Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Give selected Node to Property View
Give selected Node to Property View [message #716480] Wed, 17 August 2011 14:19 Go to next message
Mathew Missing name is currently offline Mathew Missing name
Messages: 6
Registered: August 2011
Junior Member
I'm working with plugin, which goal is to help developers to write specific xml files with given semantics. To simplify the problem - I have extended standard XML editor (XMLMultiPageEditorPart) and introduced new view where xml is parsed into simplier tree. Every item on tree has reference to some node in xml file.

What I would like to achieve:
After clicking item (let's call it SomeWidget) I would like to show on properties view corresponding node. I found that setting getSite().setSelectionProvider(treeViewer) and making SomeWidget implementing IPropertySource could help me. I overwrote getPropertyDescriptors() method and now every attribute of node is present on properties view. But... there isn't possibility to edit it.
Mysterious function getEditableValue sounds fine to solution, but I have no idea how to use it.

Another way (I think prefered) is to "reopen" current file with marker on line where current node is. No idea how to get it.
Re: Give selected Node to Property View [message #716600 is a reply to message #716480] Wed, 17 August 2011 19:41 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
On 8/17/2011 10:19 AM, Mathew wrote:
> implementing IPropertySource could help me. I overwrote
> getPropertyDescriptors() method and now every attribute of node is
> present on properties view. But... there isn't possibility to edit it.
> Mysterious function getEditableValue sounds fine to solution, but I have
> no idea how to use it.

You might find
org.eclipse.wst.xml.ui.internal.properties.XMLPropertySource to be a
good example, along with the property descriptors it creates.

--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: Give selected Node to Property View [message #717052 is a reply to message #716600] Fri, 19 August 2011 07:19 Go to previous messageGo to next message
Mathew Missing name is currently offline Mathew Missing name
Messages: 6
Registered: August 2011
Junior Member
Thanks, this helped.

I have another question, a bit connected to previous one. How can I made XMLMultiPageEditorPart selecting given Node? I would like to achieve exact behaviour as in outline. After double clicking on some item in outline it moves cursor to corresponding node. Can I make this using existing methods/classes or have I to write it on my own (finding index of node in body, opening editor with given marker)?
Re: Give selected Node to Property View [message #717153 is a reply to message #717052] Fri, 19 August 2011 12:48 Go to previous message
Mathew Missing name is currently offline Mathew Missing name
Messages: 6
Registered: August 2011
Junior Member
It's a bit sad, that I'm answering myself again:)

	ElementImpl element = (ElementImpl) (node)
	IStructuredDocumentRegion firstStructuredDocumentRegion = element.getFirstStructuredDocumentRegion();
	int position = firstStructuredDocumentRegion.getStart();
Previous Topic:Adding Content Assist for external Javascript library
Next Topic:JavaScript Outline types
Goto Forum:
  


Current Time: Sun Oct 26 07:06:11 GMT 2014

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

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