Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Setting contextType for templates
Setting contextType for templates [message #649316] Tue, 18 January 2011 17:53 Go to next message
Fredrik Lindqvist is currently offline Fredrik LindqvistFriend
Messages: 13
Registered: November 2009
Junior Member
I've run into some problems that I'm not sure how to solve. I'll describe what I want to achieve and then what I have done and tried so far. Hopefully someone can point out where I've gone wrong.

What I want to achieve:

The user edits an XML file in the WTP XML editor (or any other editor). If my plugin is active, the user should be able to get templates suggested that are relevant for the type of XMLs we use. These templates are linked to three different namespaces and only the templates that are appropriate depending on the current edit position should be shown.

My work so far:
I created three new context types: "org.eclipse.ui.editors.templates" - "contextType". Each context type will correspond to the three namespaces that will be relevant for us. I've added all templates to the extension point "org.eclipse.ui.editors.templates" - "template" and each template is set to one of my contextType.

Now when the user want to get a template I have to determine which contexttype is relevant. This means finding out the namespace where the user is editing.

So I have created a "org.eclipse.wst.sse.ui.completionProposal" - "proposalComputer". The class org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCom pletionProposalComputer looked real nice to reuse, using the right interface and being abstract and all, BUT it is internal and I get "discouraged access" warning. Alot of other classes that would be real useful, like org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistU tils have the same access problem.

With copying several org.eclipse.wst.xml.ui.internal.* classes to my project and hardcoding one of the contexttype, I've been able to get the editor to show the templates, so it is working.

But the discouraged access warning tells me that I'm probably on the wrong path...

Bug atleast tells me I'm not the only one who've run into this issue.

I guess I could create a specific editor that handles our XMLs, but since all we really want are the templates it seems like overkill.
Re: Setting contextType for templates [message #824294 is a reply to message #649316] Mon, 19 March 2012 13:56 Go to previous message
Torbjörn Lindberg is currently offline Torbjörn LindbergFriend
Messages: 1
Registered: March 2012
Junior Member
How did it turned out? Im currently working on my exam project and one part consists of doing generating some dynamic content assist proposals. Im trying to find a plugin.xml that extends the 'org.eclipse.wst.sse.ui.completionProposal' and explains exactly what i need but haven't been able to do so. Is there a chance you would like to post yours here and explain a bit about your completionProposal extension? MVH /Tobbe Smile
Previous Topic:Generating axis2 web service client in project
Next Topic:Error in JPA preferences page in Juno M6
Goto Forum:

Current Time: Wed Sep 30 00:40:38 GMT 2020

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

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

Back to the top