Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » QuickFix in XML Editor
QuickFix in XML Editor [message #231027] Tue, 05 May 2009 12:05 Go to next message
Xavier Coulon is currently offline Xavier Coulon
Messages: 58
Registered: July 2009
Member
Hello,

I managed to generate custom Markers (of my own type) in a plugin based on
the Eclipse XML Editor. It works fine, and given the content validation
result, I get error or warning markers in the left margin that are bound
into the 'problems' view.
Now, I'd like to provide some 'quick fix' as we can find in the Java
Editor, but for now, I'm a bit stuck.

First, I added an extension based on 'markerResolution' and it appears
correctly - yet *ONLY* - in the problems view. I did not find how to get
access to the 'Quick Fix' contextual menu in the editor's left column.
Secondly,I noticed a 'quick assistant' that provides a 'surround with
element' when I press 'Ctrl+1' as item I want to fix is selected in the
editor.
Adding a 'org.e.wst.sse.ui.quickFixProcessor' targeting a 'problemType'
that matches an attribute of the same name in my custom marker does not
seem to work :-( BTW, this custom attribute that was also declared in the
plugin.xml

Can you tell me what are the differences between 'quick fix' and 'quick
assistant' (or is it just the same) ?
Is it possible to have quickfix in the XML Editor's left margin ?
Otherwise, how can I contribute to the 'quick assist' contextual menu ?

Thank you in advance
Regards,
Xavier
Re: QuickFix in XML Editor [message #231210 is a reply to message #231027] Tue, 12 May 2009 02:06 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2266
Registered: July 2009
Senior Member
Xavier Coulon wrote:
> I managed to generate custom Markers (of my own type) in a plugin based
> on the Eclipse XML Editor. It works fine, and given the content
> validation result, I get error or warning markers in the left margin
> that are bound into the 'problems' view.
> Now, I'd like to provide some 'quick fix' as we can find in the Java
> Editor, but for now, I'm a bit stuck.
> First, I added an extension based on 'markerResolution' and it appears
> correctly - yet *ONLY* - in the problems view. I did not find how to get
> access to the 'Quick Fix' contextual menu in the editor's left column.
> Secondly,I noticed a 'quick assistant' that provides a 'surround with
> element' when I press 'Ctrl+1' as item I want to fix is selected in the
> editor.
> Adding a 'org.e.wst.sse.ui.quickFixProcessor' targeting a 'problemType'
> that matches an attribute of the same name in my custom marker does not
> seem to work :-( BTW, this custom attribute that was also declared in
> the plugin.xml
>
> Can you tell me what are the differences between 'quick fix' and 'quick
> assistant' (or is it just the same) ?
> Is it possible to have quickfix in the XML Editor's left margin ?
> Otherwise, how can I contribute to the 'quick assist' contextual menu ?

The order should be to present any available Quick Fixes first, and
then if there aren't any, to offer Quick Assists. But they're
essentially doing the same thing, the former just being tied to a
problem annotation of some kind.

If you were using 'org.e.wst.sse.ui.quickFixProcessor' literally, it
might just be that that's an incorrect form of
"org.eclipse.wst.sse.ui.quickFixProcessor". Could you post the part
of your plugin.xml that's meant to contribute your processor?

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


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: QuickFix in XML Editor [message #231473 is a reply to message #231210] Mon, 18 May 2009 08:22 Go to previous messageGo to next message
Xavier Coulon is currently offline Xavier Coulon
Messages: 58
Registered: July 2009
Member
Nitin Dahyabhai wrote:

> Xavier Coulon wrote:
>> I managed to generate custom Markers (of my own type) in a plugin based
>> on the Eclipse XML Editor. It works fine, and given the content
>> validation result, I get error or warning markers in the left margin
>> that are bound into the 'problems' view.
>> Now, I'd like to provide some 'quick fix' as we can find in the Java
>> Editor, but for now, I'm a bit stuck.
>> First, I added an extension based on 'markerResolution' and it appears
>> correctly - yet *ONLY* - in the problems view. I did not find how to get
>> access to the 'Quick Fix' contextual menu in the editor's left column.
>> Secondly,I noticed a 'quick assistant' that provides a 'surround with
>> element' when I press 'Ctrl+1' as item I want to fix is selected in the
>> editor.
>> Adding a 'org.e.wst.sse.ui.quickFixProcessor' targeting a 'problemType'
>> that matches an attribute of the same name in my custom marker does not
>> seem to work :-( BTW, this custom attribute that was also declared in
>> the plugin.xml
>>
>> Can you tell me what are the differences between 'quick fix' and 'quick
>> assistant' (or is it just the same) ?
>> Is it possible to have quickfix in the XML Editor's left margin ?
>> Otherwise, how can I contribute to the 'quick assist' contextual menu ?

> The order should be to present any available Quick Fixes first, and
> then if there aren't any, to offer Quick Assists. But they're
> essentially doing the same thing, the former just being tied to a
> problem annotation of some kind.

> If you were using 'org.e.wst.sse.ui.quickFixProcessor' literally, it
> might just be that that's an incorrect form of
> "org.eclipse.wst.sse.ui.quickFixProcessor". Could you post the part
> of your plugin.xml that's meant to contribute your processor?

Hello Nitin,

Thank you for your clarifications. My confusion between quickAssist and
QuickFix was that the QuickFixProcessor extension documentation states :
"This extension point is used to associate a quick *ASSIST* processor in
Structured Text Editors with a specific "kind" of problem (a marker or
annotation of a certain type or having certain attribute values)."

It's a clearer to me now.

In my plugin.xml file, I have the following extensions :

<extension
id="org.log4jconfig.xml.editor.deprecatedElementMarker"
name="Log4jconfig warning marker for deprecated elements"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.problemmarker">
</super>
<super type="org.eclipse.core.resources.textmarker">
</super>
<persistent value="true">
</persistent>
<attribute name="problemType">
</attribute>
<attribute name="baseElement">
</attribute>
</extension>

<extension
id=" org.log4jconfig.xml.editor.quickfix.deprecatedElementQuickFi x "
point="org.eclipse.wst.sse.ui.quickFixProcessor">
<quickFixProcessor

class=" org.log4jconfig.xml.editor.quickfix.DeprecatedElementQuickAs sistProcessor "

problemType="org.log4jconfig.xml.editor.deprecatedElementProblemType ">
</quickFixProcessor>
</extension>

<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator

class=" org.log4jconfig.xml.editor.quickfix.DeprecatedElementMarkerR esolutionGenerator "

markerType="org.log4jconfig.xml.editor.deprecatedElementMarker ">
</markerResolutionGenerator>
</extension>

As I mentionned in my initial post, the XML editor provides my problem
markers (error or warning) in the left margin when it is necessary, and
from the 'Problems' view, the 'Quick Fix' item is available from the
contextual menu.
What I would like is to have the same menu item from the contextual menu
bound to the marker in the xml editor margin. What should I add ?

Thank you in advance
Regards,
Xavier
Re: QuickFix in XML Editor [message #528965 is a reply to message #231473] Thu, 22 April 2010 14:02 Go to previous messageGo to next message
Yura is currently offline Yura
Messages: 4
Registered: July 2009
Junior Member
Why doesn't anyone answer for this post? I have the same problem and wanted to know how to add Quick Fix in editor instantly (not using Problems view) if it's possible.
Re: QuickFix in XML Editor [message #529939 is a reply to message #528965] Tue, 27 April 2010 18:44 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2266
Registered: July 2009
Senior Member
Generally I'd expect it to be invoked the same way as Quick Assist and Quick Fix in other editors: through Ctrl+1, not a menu of any sort.

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: QuickFix in XML Editor [message #530978 is a reply to message #529939] Mon, 03 May 2010 09:18 Go to previous messageGo to next message
Yura is currently offline Yura
Messages: 4
Registered: July 2009
Junior Member
Here is my plugin.xml code example. Fixes work only from Problem view. They are not available from editor context menu and Ctrl+1 accelerator.

<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class=" org.jboss.tools.jsf.web.validation.jsf2.action.JSF2Component ResolutionGenerator "
markerType="org.jboss.tools.jsf.jsf2problemmarker">
</markerResolutionGenerator>
</extension>
<extension
id="jsf2problemmarker"
name="%JSF2ProblemName"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.problemmarker">
</super>
<persistent
value="true">
</persistent>
<attribute
name="problemType">
</attribute>
<attribute
name="baseElement">
</attribute>
<super
type="org.eclipse.core.resources.textmarker">
</super>
</extension>
<extension
point="org.eclipse.wst.sse.ui.sourcevalidation">
<validator
class="org.jboss.tools.jsf.web.validation.jsf2.JSF2SourceValidator "
id="org.jboss.tools.jsf.jsf2sourcevalidator"
scope="total">
<contentTypeIdentifier
id="org.eclipse.wst.html.core.htmlsource">
<partitionType id="org.eclipse.wst.html.HTML_DEFAULT"/>
</contentTypeIdentifier>
<contentTypeIdentifier
id="org.eclipse.jst.jsp.core.jspsource">
<partitionType id="org.eclipse.jst.jsp.DEFAULT_JSP"/>
</contentTypeIdentifier>
</validator>
</extension>
<extension
point="org.eclipse.wst.sse.ui.quickFixProcessor">
<quickFixProcessor
class="org.jboss.tools.jsf.QuickAssistProcessor1"
problemType="org.jboss.tools.jsf.jsf2problemmarker">
</quickFixProcessor>
</extension>
Re: QuickFix in XML Editor [message #531032 is a reply to message #530978] Mon, 03 May 2010 12:54 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2266
Registered: July 2009
Senior Member
On 5/3/2010 5:18 AM, Yura wrote:
> Here is my plugin.xml code example. Fixes work only from Problem view.
> They are not available from editor context menu and Ctrl+1 accelerator.
>
....
> <extension
> point="org.eclipse.wst.sse.ui.sourcevalidation">
> <validator
> class="org.jboss.tools.jsf.web.validation.jsf2.JSF2SourceValidator "
> id="org.jboss.tools.jsf.jsf2sourcevalidator"
> scope="total">
> <contentTypeIdentifier
> id="org.eclipse.wst.html.core.htmlsource">
> <partitionType id="org.eclipse.wst.html.HTML_DEFAULT"/>
> </contentTypeIdentifier>
> <contentTypeIdentifier
> id="org.eclipse.jst.jsp.core.jspsource">
> <partitionType id="org.eclipse.jst.jsp.DEFAULT_JSP"/>
> </contentTypeIdentifier>
> </validator>
> </extension>
> <extension
> point="org.eclipse.wst.sse.ui.quickFixProcessor">
> <quickFixProcessor
> class="org.jboss.tools.jsf.QuickAssistProcessor1"
> problemType="org.jboss.tools.jsf.jsf2problemmarker">
> </quickFixProcessor>
> </extension>

Do the IMessages your source validator reports have a "problemType"
attribute that equals the value your QuickFixProcessor specifies in its
extension point element?

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


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: QuickFix in XML Editor [message #531349 is a reply to message #531032] Tue, 04 May 2010 15:15 Go to previous message
Yura is currently offline Yura
Messages: 4
Registered: July 2009
Junior Member
After hours of reading source code I found a problem and yes, there no problemType attr in IMarker implementation. Thanks.
Previous Topic:using WTP in Helios
Next Topic:Add and Remove to Liferay/Tomcat Server
Goto Forum:
  


Current Time: Wed Sep 17 03:38:04 GMT 2014

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

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