Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » extending the wtp xml-editor
extending the wtp xml-editor [message #639722] Wed, 17 November 2010 10:18 Go to next message
Luke Missing name is currently offline Luke Missing name
Messages: 5
Registered: October 2010
Junior Member
Hey,

I would like to add something like a listener to a projection annotation,
which will be notified when a folding will be extended. In dependence of the
information in this node which was expanded I would like to expand several
other nodes. All in all the extension should do a context related expansion
of folding elements.

My first idea was this extension where I was able to add my own folding
strategy. But I dont know how to go further....any ideas?

<extension point="org.eclipse.wst.sse.ui.editorConfiguration">

<provisionalConfiguration

type="foldingstrategy"

class="...TestspecFoldingStrategy"

target="mytarget" />

</extension>


Thanks

Lukas
Re: extending the wtp xml-editor [message #639860 is a reply to message #639722] Thu, 18 November 2010 02:56 Go to previous messageGo to next message
Sarika Sinha is currently offline Sarika Sinha
Messages: 45
Registered: February 2010
Location: Bangalore, India
Member
Hi,
Yes you can use this extemsion pt to extend folding strategy. Your new class can extend org.eclipse.wst.xml.ui.internal.projection.XMLFoldingStrateg y and do the additional work.


Sarika Sinha
JDT Programmer
Re: extending the wtp xml-editor [message #639971 is a reply to message #639722] Thu, 18 November 2010 10:16 Go to previous messageGo to next message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
Luke,

I am not clear on what you are trying to do. But I *THINK* that 'foldingstrategy' extension is not what you need. And if it was I would strongly recommend against extending our internal XMLFoldingStrategy and stay with using the public API.

From what I can tell what you want to do is:

1. listen to events of when people close and open folding annotations
2. react to thous events by opening and closing other folding annotations

What I think you don't want to do is add any new folding annotations, which is what the 'foldingstrategy' extension is for.

Let me know if my assessment is correct and I maybe able to help you further.


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Re: extending the wtp xml-editor [message #640641 is a reply to message #639971] Mon, 22 November 2010 11:46 Go to previous messageGo to next message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
Lukas,

I would suggest taking a look at org.eclipse.jface.text.source.AnnotationModel. It is the one keeping track of all of the folding annotations added by the SSE extensions and looks like it may have some listener hooks that you could use.

Blue Skies,

~Ian


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Re: extending the wtp xml-editor [message #640864 is a reply to message #639971] Tue, 23 November 2010 06:26 Go to previous messageGo to next message
Luke Missing name is currently offline Luke Missing name
Messages: 5
Registered: October 2010
Junior Member
Ian,

thanks for your help. I finally get notified when one or more ProjectionAnnotation were collapsed or expanded. The solution is to add a listener to the ProjectionAnnotationModel. The model offers a method to retrieve a modification stamp which contains all modified annotatios. But next question is how can i get further information about the xml-node related to this annotation. I can't see the connection between it!?
Re: extending the wtp xml-editor [message #640894 is a reply to message #640864] Tue, 23 November 2010 08:26 Go to previous message
Ian Tewksbury is currently offline Ian Tewksbury
Messages: 48
Registered: July 2009
Location: RTP, NC, USA
Member
Luke,

I am not sure what information you get from the ProjectionAnnotationModel but you probably want to get your hands on the IStructuredDocument or maybe the IStructuredModel for the file with the annoation and then you can use the offsets of the annoation to get the information for the region being folded from either the document or the model depending on which has the exact info you are looking for. You can use the org.eclipse.wst.sse.core.StructuredModelManager to get the document (if you don't already have it) or the Model.

Blue Skies,

~Ian


Ian Tewksbury
WTP JavaScript Tools
IBM Rational
-----
“When once you have tasted flight, you will forever walk the earth with your eyes turned skyward, for there you have been, and there you will always long to return.” ~Leonardo da Vinci
Previous Topic:quickasist/markerresolution triggered by clicking on the left side editor icon?
Next Topic:Trying to set multiple source folders in Java facet
Goto Forum:
  


Current Time: Fri Aug 22 04:06:43 EDT 2014

Powered by FUDForum. Page generated in 0.07051 seconds