Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » This is a bug with the quikfix?
This is a bug with the quikfix? [message #894501] Mon, 09 July 2012 12:57 Go to next message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member
Hi!

I'm trying the quickfix feature of xtext and I found the following problem.

If I use ISemanticModification this way ...

acceptor.accept(issue, "Change to "+ parentStateName + "." + viewName, "Replace the state ID for a valid View name.", "upcase.png", new ISemanticModification() {
	public void apply(EObject element, IModificationContext context) throws Exception {
		// sabemos que es un state de tipo view
		ScxmlStateType state = (ScxmlStateType) element;
		state.setName("\""+parentStateName + "." + viewName+"\"");
				}
	});


And use the quickfix in the second state (to fix the ERRONEUS_ID) in this text:

 
<state id="SecondOp" mymw:category="UseCase" initial="SecondOp.suma">
   <!-- Presentación suma -->
   <state id="ERRONEUS_ID" mymw:category="View">
     <!-- llamando a un método de una clase concreta al enviar un formulario -->
      <transition event="mySubmit.onsubmit" target="SecondOp.resultado">
.
.
.


The pre-and post comments to the line where I do the quickfix disappear! Confused The result...

    <state id="SecondOp" mymw:category="UseCase" initial="SecondOp.suma">

      <state id="CORRECT_ID" mymw:category="View">

        <transition event="mySubmit.onsubmit" target="SecondOp.resultado">
.
.
.


If I use IModification() this does not happen (the comments not disappear)...

			
acceptor.accept(issue, "Change to "+ parentStateName + "." + viewName, "Replace the state ID for a valid View name.", "upcase.png", new IModification() {
	public void apply(IModificationContext context) throws BadLocationException {
		
		IXtextDocument xtextDocument = context.getXtextDocument();				
	        xtextDocument.replace(issue.getOffset(), issue.getLength(), "\""+parentStateName + "." + viewName+"\"");
					
	}


Any idea that could be happening?

Thanks!!

[Updated on: Tue, 10 July 2012 06:59]

Report message to a moderator

Re: This is a bug with the quikfix? [message #894608 is a reply to message #894501] Mon, 09 July 2012 19:35 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Maybe you can complete your post? It seems to be truncated before
reaching a question.

Am 09.07.12 14:57, schrieb Vil Lpz:
> Hi!
>
> I'm trying the quickfix feature of xtext and I found the following problem.
>
> If I use ISemanticModification this way ...
>
> acceptor.accept(issue, "Change to "+ parentStateName + "." + viewName,
> "Replace the state ID for a valid View name.", "upcase.png", new
> ISemanticModification() {
> public void apply(EObject element, IModificationContext context) throws
> Exception {
> // sabemos que es un state de tipo view
> ScxmlStateType state = (ScxmlStateType) element;
> state.setName("\""+parentStateName + "." + viewName+"\"");
> }
> });
>
> And use the quickfix in this text:
>
>
> <state id="SecondOp" mymw:category="UseCase" initial="SecondOp.suma">
> <!-- Presentación suma -->
> <state id="ERONEUS_ID" mymw:category="View">
> <!-- llamando a un método de una clase concreta al enviar un formulario -->
> <transition event="mySubmit.onsubmit" target="SecondOp.resultado">


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: This is a bug with the quikfix? [message #894683 is a reply to message #894608] Tue, 10 July 2012 07:00 Go to previous messageGo to next message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member
Hi!

I think it´s ok now.

The question is...

Any idea about why, if I use ISemanticModification, the comment lines before and after the line where I use the quckfix disappear?

Thank you very much for the help.

Regards.
Re: This is a bug with the quikfix? [message #895466 is a reply to message #894501] Fri, 13 July 2012 07:26 Go to previous messageGo to next message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member
Hey.

Nobody has any idea where it may be the problem?

a greeting
Re: This is a bug with the quikfix? [message #895501 is a reply to message #894683] Fri, 13 July 2012 09:51 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Yes,

The comments are stored in the node model as belonging to the semantic
object you modify. After the semantic modification, the partial parsing
replaces the semantic object (and all its children in the AST) with a
new instance. Seems like the nodes containing the comments get lost.
Fell free to file a bug.

If you want to avoid that, use textual IModifications as a workaround.

Am 10.07.12 09:00, schrieb Vil Lpz:
> Hi!
>
> I think it´s ok now.
>
> The question is...
>
> Any idea about why, if I use ISemanticModification, the comment lines
> before and after the line where I use the quckfix disappear?
>
> Thank you very much for the help.
>
> Regards.


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: This is a bug with the quikfix? [message #895565 is a reply to message #895466] Fri, 13 July 2012 15:02 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 13.07.12 09:26, schrieb Vil Lpz:
> Hey.
>
> Nobody has any idea where it may be the problem?
>
> a greeting

It's not possible to answer your question given the sparse information
that you provide. Jan's answer is still valid. If you fear that you
stumbled accross a bug that leads to lost comments, please file a ticket
with a reproducable testcase attached.

Thanks,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: This is a bug with the quikfix? [message #895817 is a reply to message #895501] Mon, 16 July 2012 07:54 Go to previous messageGo to next message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member
thank you very much for the help!

Greetings.
Re: This is a bug with the quikfix? [message #895829 is a reply to message #895817] Mon, 16 July 2012 08:41 Go to previous message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member
Hello.

I attached the Code of a small project that reproduces the error that said, to see if someone can take a look.

To test run and create a file *.Test with (for example)

<?xml  ?>

  <scxml initial="test2_test" name='myname' >

   <!-- comment-->
   <state	id="test2_test" mymw:category="bad">
   <!-- comment -->
 
	 
   </state>
</scxml>    


When "mymw:category="bad"" is fixed comment disappear...

Thank you very much for your attention.

Regards
  • Attachment: test.zip
    (Size: 219.01KB, Downloaded 148 times)
Previous Topic:xbase generation exception
Next Topic:[xbase] How to parse Xbase expressions in Java code?
Goto Forum:
  


Current Time: Sat Apr 20 03:16:56 GMT 2024

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

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

Back to the top