Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to extend OpenGeneratedFileHandler to position the cursor in the right region
How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777077] Fri, 24 November 2017 10:37 Go to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Hello all,

from one DSL file, I generate several .java files. The problem is that by default OpenGeneratedFileHandler opens a dialog to choose the right generated file.

I would like to use the ._trace to automatically choose the right file and position th cursor in the region of the generated file (and vice versa)

Any pointers that could me achieve that? I guess I must extend OpenGeneratedFileHandler but have no idea to start
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777079 is a reply to message #1777077] Fri, 24 November 2017 10:41 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
a simple

// may be def instead of override ?!?
override Class<? extends OpenGeneratedFileHandler> bindOpenGeneratedFileHandler() {
return MyOpenGeneratedFileHandler;
}

should do the trick


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777091 is a reply to message #1777079] Fri, 24 November 2017 11:24 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Thanks for the reply.

Sorry for the lame question but how will this be intercepted by the eclipe menu. Is it an extension?
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777093 is a reply to message #1777091] Fri, 24 November 2017 11:31 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
yes i thought you would have found that

	<extension point="org.eclipse.ui.handlers">
		<handler
			class="org.eclipse.xtext.example.homeautomation.ui.RuleEngineExecutableExtensionFactory:org.eclipse.xtext.ui.generator.trace.OpenGeneratedFileHandler"
			commandId="org.eclipse.xtext.ui.OpenGeneratedFileCommand">
			<activeWhen>
				<reference definitionId="org.eclipse.xtext.example.homeautomation.RuleEngine.Editor.opened" />
			</activeWhen>
		</handler>
	</extension>


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777100 is a reply to message #1777093] Fri, 24 November 2017 12:53 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Thanks for the help. Indeed I should have figured out.
Actually there is something strange when I debug OpenGeneratedFileHandler.
The method OpenGeneratedFileHandler either depends upon a traceBasedOpenerCollector or a derivedResourceMarkerBasedOpenerCollector.
Further debugging shows me traceForStorageProvider.getTraceToTarget(editorStorage) returns null.

Is there something to do to use the trace files?
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777102 is a reply to message #1777100] Fri, 24 November 2017 12:58 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
org.eclipse.xtext.ui.generator.trace.TraceBasedOpenerContributor.collectGeneratedFileOpeners(IEditorPart, IAcceptor<FileOpener>)
should find something

=> debug org.eclipse.xtext.generator.trace.internal.AbstractTraceForURIProvider.getTraceToTarget(SomeFile, AbsoluteURI, IProjectConfig)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777103 is a reply to message #1777102] Fri, 24 November 2017 13:01 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
I think I got it this is probably the reason:

!STACK 0
java.lang.IllegalArgumentException: Produced region is inconsistent with parent, this: TraceRegion [myOffset=318, myLength=142] associations={
  LocationData [TextRegionWithLineInformation [107:54][lineNumber=8, endLineNumber=10]][path=Forex-1.0.0.wkfs]
}, parent: TraceRegion [myOffset=0, myLength=457] associations={
  LocationData [TextRegionWithLineInformation [107:54][lineNumber=8, endLineNumber=10]][path=Forex-1.0.0.wkfs]
} nestedRegions={
  TraceRegion [myOffset=177, myLength=140] associations={
    LocationData [TextRegionWithLineInformation [107:54][lineNumber=8, endLineNumber=10]][path=Forex-1.0.0.wkfs]
  }
  TraceRegion [myOffset=318, myLength=142] associations={
    LocationData [TextRegionWithLineInformation [107:54][lineNumber=8, endLineNumber=10]][path=Forex-1.0.0.wkfs]
  }
}
	at org.eclipse.xtext.generator.trace.AbstractStatefulTraceRegion.<init>(AbstractStatefulTraceRegion.java:36)
	at org.eclipse.xtext.generator.trace.TraceRegion.<init>(TraceRegion.java:58)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer$IdentityStrategy.createRegion(TraceRegionSerializer.java:63)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer$IdentityStrategy.createRegion(TraceRegionSerializer.java:53)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:334)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:337)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:285)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.readTraceRegionFrom(TraceRegionSerializer.java:169)
	at org.eclipse.xtext.generator.trace.internal.AbstractTraceForURIProvider$CachedTraces.getTraceRegion(AbstractTraceForURIProvider.java:125)
	at org.eclipse.xtext.generator.trace.internal.AbstractTraceForURIProvider$1.getTraceRegion(AbstractTraceForURIProvider.java:208)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace.doGetRootTraceRegion(AbstractTrace.java:126)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace.getRootTraceRegion(AbstractTrace.java:102)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace.hasTraceData(AbstractTrace.java:109)
	at org.eclipse.xtext.ui.generator.trace.TraceBasedOpenerContributor.collectSourceFileOpeners(TraceBasedOpenerContributor.java:75)
	at org.eclipse.xtext.ui.generator.trace.TraceOrMarkerBasedOpenerContributor.collectSourceFileOpeners(TraceOrMarkerBasedOpenerContributor.java:35)
	at org.eclipse.xtext.ui.shared.internal.OpenSourceFilePropertyTester.canOpenSourceFile(OpenSourceFilePropertyTester.java:43)
	at org.eclipse.xtext.ui.shared.internal.OpenSourceFilePropertyTester.test(OpenSourceFilePropertyTester.java:59)
	at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
	at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:100)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:51)
	at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:75)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isCoreExpressionVisible(ContributionsAnalyzer.java:285)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isVisible(ContributionsAnalyzer.java:259)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.computeVisibility(ContributionRecord.java:167)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.updateVisibility(ContributionRecord.java:98)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MenuManagerRendererFilter.java:191)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MenuManagerRendererFilter.java:202)
	at org.eclipse.ui.internal.WorkbenchWindow$8.run(WorkbenchWindow.java:704)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)


So now the question is how did I end up generated bad traces.

Thanks so much for your help
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777104 is a reply to message #1777102] Fri, 24 November 2017 13:03 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
and org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2.flushSourceTraces(String)

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777105 is a reply to message #1777104] Fri, 24 November 2017 13:10 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
can you try to add

def Class<? extends EclipseSourceFolderProvider> bindEclipseSourceFolderProvider() {
return JDTAwareSourceFolderProvider;
}

to the ui module?


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777120 is a reply to message #1777105] Fri, 24 November 2017 17:30 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
So in the method flushSourceTraces(String generatorName), sourceFile is set to the correct file name but the like sourceFile.exists() returns false. Strange the file exists.
Do you still want me to add JDTAwareSourceFolderProvider?
Does the error message about the inconsistent region ring a bell?

thanks
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777121 is a reply to message #1777120] Fri, 24 November 2017 17:45 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
yes. if i do so the open gnerated file finds trace files.

am not sure about the inconsisten message. i test only with a hello world example. but yes that might be an issue?

on which os are you?
there is TraceAwarePostProcessor / LineSeparatorHarmonizer as well which might be relevant to bind on windows.

please test this with minimal possible traces.


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777122 is a reply to message #1777121] Fri, 24 November 2017 17:52 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
=> try

def Class<? extends LineSeparatorHarmonizer> bindLineSeparatorHarmonizer() {
TraceAwarePostProcessor;
}

as well


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777123 is a reply to message #1777122] Fri, 24 November 2017 17:57 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
and yes sourceFile.exists()
is caused by JDTAwareSourceFolderProvider


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777141 is a reply to message #1777123] Fri, 24 November 2017 22:27 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Hello,

I did add both
	def Class<? extends LineSeparatorHarmonizer> bindLineSeparatorHarmonizer() {
		TraceAwarePostProcessor
	}

in the RuntimeModule and
	def Class<? extends EclipseSourceFolderProvider> bindEclipseSourceFolderProvider() {
		JDTAwareSourceFolderProvider
	}

in the UIModule but the problem remains.

I also reduced the DSL file to the bare miinimum and I still have that error
!STACK 0
java.lang.IllegalArgumentException: Produced region is inconsistent with parent, this: TraceRegion [myOffset=318, myLength=142] associations={
  LocationData [TextRegionWithLineInformation [72:54][lineNumber=5, endLineNumber=7]][path=Forex-1.0.0.wkfs]
}, parent: TraceRegion [myOffset=0, myLength=457] associations={
  LocationData [TextRegionWithLineInformation [72:54][lineNumber=5, endLineNumber=7]][path=Forex-1.0.0.wkfs]
} nestedRegions={
  TraceRegion [myOffset=177, myLength=140] associations={
    LocationData [TextRegionWithLineInformation [72:54][lineNumber=5, endLineNumber=7]][path=Forex-1.0.0.wkfs]
  }
  TraceRegion [myOffset=318, myLength=142] associations={
    LocationData [TextRegionWithLineInformation [72:54][lineNumber=5, endLineNumber=7]][path=Forex-1.0.0.wkfs]
  }
}
	at org.eclipse.xtext.generator.trace.AbstractStatefulTraceRegion.<init>(AbstractStatefulTraceRegion.java:36)
	at org.eclipse.xtext.generator.trace.TraceRegion.<init>(TraceRegion.java:58)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer$IdentityStrategy.createRegion(TraceRegionSerializer.java:63)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer$IdentityStrategy.createRegion(TraceRegionSerializer.java:53)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:334)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:337)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.doReadFrom(TraceRegionSerializer.java:285)
	at org.eclipse.xtext.generator.trace.TraceRegionSerializer.readTraceRegionFrom(TraceRegionSerializer.java:169)
	at org.eclipse.xtext.generator.trace.internal.AbstractTraceForURIProvider$CachedTraces.getTraceRegion(AbstractTraceForURIProvider.java:125)
	at org.eclipse.xtext.generator.trace.internal.AbstractTraceForURIProvider$1.getTraceRegion(AbstractTraceForURIProvider.java:208)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace.doGetRootTraceRegion(AbstractTrace.java:126)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace.getRootTraceRegion(AbstractTrace.java:102)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace$3.iterator(AbstractTrace.java:460)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace$1$1.<init>(AbstractTrace.java:368)
	at org.eclipse.xtext.generator.trace.internal.AbstractTrace$1.iterator(AbstractTrace.java:366)
	at org.eclipse.xtext.common.types.shared.jdt38.OriginalEditorSelector.getXtextEditor(OriginalEditorSelector.java:162)
	at org.eclipse.xtext.common.types.shared.jdt38.OriginalEditorSelector.findXbaseEditor(OriginalEditorSelector.java:154)
	at org.eclipse.xtext.common.types.shared.jdt38.OriginalEditorSelector.overrideEditors(OriginalEditorSelector.java:71)
	at org.eclipse.ui.ide.IDE.overrideEditorAssociations(IDE.java:937)


I enabled the traces just by replacing

		fsa.generateFile(
			function.
				toClassFileName,   getFunctionStructure(function, context))

by
		fsa.generateTracedFile(
			function.
				toClassFileName, function,  getFunctionStructure(function, context))
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777154 is a reply to message #1777141] Sat, 25 November 2017 07:55 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
Can you please share a complete sample project so that I can reproduce this.
And are you on windows or are you not


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777155 is a reply to message #1777154] Sat, 25 November 2017 08:35 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
yes on windows, I will try to build a sample.

Did some more investigation and it seems that the problem is that on the following line:
if (parent.getMyOffset() + parent.getMyLength() < getMyOffset() + getMyLength())
	return false;

the line
parent.getMyOffset() + parent.getMyLength()  = 457

whereas
getMyOffset() + getMyLength() = 460


I understand from your question that you think of a carriage return problem or something of the sort.

The problem with that theory is that I have 26 lines and the difference should be higher. And indeed looking at the generated files:
the actual length is : 26 lines and 482 characters with lines ending with CR/LF

This is however in line with 457 (from the trace My end offset field) + 25 (CR)

So I think the CRLF does explain the missing 25 characters (do not have CRLF on the last line) but the +3 characters mentionned previously.



[Updated on: Sat, 25 November 2017 09:03]

Report message to a moderator

Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777160 is a reply to message #1777155] Sat, 25 November 2017 09:02 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
yes this is why i need something i can debug

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777162 is a reply to message #1777160] Sat, 25 November 2017 09:11 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
i tried my example in a windows vm and dont get the error.
so it must have something todo with the structure of your generator


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777790 is a reply to message #1777162] Mon, 04 December 2017 16:18 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Hello,

sorry for the late answer but I was not able to work on this project for a solid week.
So I reduced the code generation to the bare mimimum and it did work.
Now I am re-emabling step by step code generation.

I get a lot of "Type mismatch: cannot convert from IGeneratorNode to StringConcatenationClient"
What I do not get is that I explicit set the return type:

	@Traced def dispatch StringConcatenationClient  generatePath(ValueExpression root, Column target, Key key,  GeneratorContext context) {
        if (root instanceof LookupExpression) {
            generatePathForLookup(root as LookupExpression, target, key, context)
        }


@Traced def StringConcatenationClient  generatePathForLookup(LookupExpression root, Column target, Key key,  GeneratorContext context) {
	    val targetType = DatamodelTypeProvider.typeFor(target)
        switch (targetType.class) {


Any idea?
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777792 is a reply to message #1777790] Mon, 04 December 2017 16:22 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
xtend implentation logic => cannot answer/have no idea. the type inference is not as powerful as it should be

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777794 is a reply to message #1777792] Mon, 04 December 2017 16:41 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
=> i think @traced is not meant to be split up with explicit return type
this active annotation does some fiddeling around with methods and bodys so i will break


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777795 is a reply to message #1777794] Mon, 04 December 2017 16:43 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
potential workaround:

really create the client

@Traced def dispatch generatePath(Model root, GeneratorContext context) {
return '''¬ęgeneratePathForLookup(root,context)¬Ľ'''
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777810 is a reply to message #1777795] Mon, 04 December 2017 19:15 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Thanks Cristian,

it did the trick and the tracing seems to be working correctly. At least the cursor positioning is correct.
Thank you so much. No I will try to see what can be done from a debugger perspective.
Any news on this blog post of yours?

Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777817 is a reply to message #1777810] Mon, 04 December 2017 19:48 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
yes as posted in other thread its here https://blogs.itemis.com/en/debugging-dsls-in-xtext-and-eclipse

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777820 is a reply to message #1777817] Mon, 04 December 2017 20:13 Go to previous messageGo to next message
Steve Hostettler is currently offline Steve HostettlerFriend
Messages: 81
Registered: June 2016
Member
Ok thanks,
just tested it and while I did got any error and the Toggle breakpoint menu appears. The breakpoint is not actually created. I did check the getAdapter and the getClassNamePattern.
Do you prefer me to start a new thread to discuss it?
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777821 is a reply to message #1777820] Mon, 04 December 2017 20:22 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
Yes.

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to extend OpenGeneratedFileHandler to position the cursor in the right region [message #1777822 is a reply to message #1777821] Mon, 04 December 2017 21:05 Go to previous message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12185
Registered: July 2009
Senior Member
And you should debug the code

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xbase: Fields in generated inner class not recognized, no problems as class in own file
Next Topic:Trying to generate DSL files using Java
Goto Forum:
  


Current Time: Fri Aug 17 11:06:16 GMT 2018

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

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

Back to the top