Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext editor hanging for long time(xtext editor hanging for long time)
xtext editor hanging for long time [message #1736560] Thu, 30 June 2016 10:38 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

When I am copying 100 my dsl files in a project, xtext runtime application taking so much time to copying the dsl files in a directory. Why?

I assume that, while copying it is parsing the code inside dsl file. Is there any way to speed up the copying?
Re: xtext editor hanging for long time [message #1736562 is a reply to message #1736560] Thu, 30 June 2016 10:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
You should use a profiler to see what happens.
Is it better is you disable auto build before copying


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736599 is a reply to message #1736562] Thu, 30 June 2016 14:14 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I Did it but no luck. When I edit my dsl file and on saving screen is hanging.
index.php/fa/26309/0/
Re: xtext editor hanging for long time [message #1736600 is a reply to message #1736599] Thu, 30 June 2016 14:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
this looks like your parser is running amok (e.g. ragarding all the backtracking stuff you may have ...)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736604 is a reply to message #1736600] Thu, 30 June 2016 14:24 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
I set backtrack=true in Workflow. So it is causing this hanging right? Now what should I do now to get rid of it without removing backtrack=true.
Re: xtext editor hanging for long time [message #1736606 is a reply to message #1736604] Thu, 30 June 2016 14:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
you cannot. if xtext parsing / indexing takes too long it takes to long. you can use a profiler to find out which part of it but ...


what happens if you read the 100 files with a java main ?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736622 is a reply to message #1736606] Thu, 30 June 2016 15:37 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Yes. You are right. I am looking into the issue
Re: xtext editor hanging for long time [message #1736705 is a reply to message #1736622] Fri, 01 July 2016 09:24 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I understood the problem Automatic Build does run the lexer and Antler parser on the dsl files in the src directory, that needs to be synchronized with the mechanism that kicks off the Automatic Build procedure. But I didn't find the solution.

Any idea on this?

[Updated on: Fri, 01 July 2016 09:24]

Report message to a moderator

Re: xtext editor hanging for long time [message #1736708 is a reply to message #1736705] Fri, 01 July 2016 09:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
you mean programmatically turn of auto build?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736709 is a reply to message #1736708] Fri, 01 July 2016 09:35 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Yes sir
Re: xtext editor hanging for long time [message #1736710 is a reply to message #1736709] Fri, 01 July 2016 09:36 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
What's your suggestion for me to fix this issue?
Re: xtext editor hanging for long time [message #1736713 is a reply to message #1736710] Fri, 01 July 2016 09:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
Hi

Does the Xtext auto-build actually do anything for you? If not, then
there is a very simple solution; remove the Xtext nature.

From my observations, the Xtext nature/builder contributes to a variety
of time wasting activities, so I only use it in:
- plugins with a *.xtext file
- plugins with a *.xtend file
- plugins with a *.mwe2 file
I endeavour to keep those plugins simple. In partcular, I do not use the
Xtext nature on plugins with a *.ecore file and I isolate build *.mwe2's
from *.xtext.

Regards

Ed Willink



On 01/07/2016 10:36, Sachin Samaram wrote:
> What's your suggestion for me to fix this issue?
Re: xtext editor hanging for long time [message #1736717 is a reply to message #1736713] Fri, 01 July 2016 10:06 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi Ed Willink,

You mean:
right click on xtext project -> configure -> unconfigure xtext?

If not, could you please tell me how to disable xtext nature?

Re: xtext editor hanging for long time [message #1736719 is a reply to message #1736717] Fri, 01 July 2016 10:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
https://www.eclipse.org/forums/index.php/m/1278329/?srch=PREF_AUTO_BUILDING#msg_1278329

but as set before: you should take care why xtext takes so long to parse YOUR files. they will have to be parsed anyway right? why you you want to use xtext if not.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736720 is a reply to message #1736719] Fri, 01 July 2016 10:14 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
So if I unconfigure xtext nature it completely removes parsing the mydsl code?
Re: xtext editor hanging for long time [message #1736722 is a reply to message #1736717] Fri, 01 July 2016 10:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
Hi

Probably. But last time I looked it was Project->Configure->Remove Xtext
Nature. I'm not sure how significant the changed spelling is.

Regards

Ed Willink


On 01/07/2016 11:06, Sachin Samaram wrote:
> Hi Ed Willink,
>
> You mean:
> right click on xtext project -> configure -> unconfigure xtext?
>
> If not, could you please tell me how to disable xtext nature?
>
>
Re: xtext editor hanging for long time [message #1736727 is a reply to message #1736719] Fri, 01 July 2016 10:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
Hi

With an Xtext nature, many DSL files are parsed every time the
incremental builder gets tickled. If many plugins have Xtext natures
they can form vicious cycles of rebuilds that take a long time to
stabilize; the Xtext builder has/had at least one bad platform builder
interaction. https://bugs.eclipse.org/bugs/show_bug.cgi?id=412305,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=412634

Without an Xtext nature, a DSL file is parsed every time a DSL consumer
wants it. Much faster if the consumption is occasional and disciplined.
Much slower if the consumption relies on a tool that is unaware of
producer-consumer relationships such as the Xtext index. (Lack of
awareness forces the just-in-case reparse of many-producers for
all-consumers for almost any change.)

Regards

Ed Willink


On 01/07/2016 11:11, Christian Dietrich wrote:
> https://www.eclipse.org/forums/index.php/m/1278329/?srch=PREF_AUTO_BUILDING#msg_1278329
>
>
> but as set before: you should take care why xtext takes so long to
> parse YOUR files. they will have to be parsed anyway right? why you
> you want to use xtext if not.
Re: xtext editor hanging for long time [message #1736733 is a reply to message #1736727] Fri, 01 July 2016 11:32 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
If I remove xtext project nature it is parsing my code without any problem. But when every I am opening dsl file it is asking "Do you want to convert MyProject to Xtext Project?" Yes/No. I selected NO. But editor parsing my code. How to disable that message?
Re: xtext editor hanging for long time [message #1736734 is a reply to message #1736733] Fri, 01 July 2016 11:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
Ixtexteditorcallback. Subclass natureaddingxtexteditorcallback does this

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736751 is a reply to message #1736734] Fri, 01 July 2016 13:09 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi

I am getting an error like Assignment to final variable. How to solve it?

[Updated on: Fri, 01 July 2016 16:54]

Report message to a moderator

Re: xtext editor hanging for long time [message #1736753 is a reply to message #1736751] Fri, 01 July 2016 13:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
Use var not Val ?!?!?!

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736754 is a reply to message #1736753] Fri, 01 July 2016 13:36 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
thanks
Re: xtext editor hanging for long time [message #1736766 is a reply to message #1736754] Fri, 01 July 2016 15:12 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I have extended NatureAddingEditorCallback but on selecting yes/no from the dialog my code is not calling up. What could be the problem?

import org.eclipse.core.resources.IFile
import org.eclipse.core.resources.IWorkspace
import org.eclipse.core.resources.ResourcesPlugin
import org.eclipse.core.runtime.IPath
import org.eclipse.core.runtime.Path
import org.eclipse.xtext.ui.editor.IXtextEditorCallback
import org.eclipse.xtext.ui.editor.XtextEditor
import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback
import org.eclipse.xtext.ui.util.DontAskAgainDialogs
import org.eclipse.xtext.builder.nature.Messages
import org.eclipse.jface.dialogs.IDialogConstants
import com.google.inject.Inject
import org.eclipse.xtext.builder.nature.ToggleXtextNatureAction
import org.eclipse.jface.dialogs.MessageDialogWithToggle
import org.eclipse.core.resources.IResource

class EditorOnSave extends NatureAddingEditorCallback implements IXtextEditorCallback {

private static final String ADD_XTEXT_NATURE = "add_xtext_nature";
@Inject
private ToggleXtextNatureAction toggleNature;

@Inject DontAskAgainDialogs dialogs;

override void afterCreatePartControl(XtextEditor editor) {
println(" afterCreatePartControl ###########################")
super.afterCreatePartControl(editor);
val IResource resource = editor.getResource();
if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible()
&& !resource.getProject().isHidden()) {
val String title = Messages.NatureAddingEditorCallback_MessageDialog_Title;
val String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName()
+ Messages.NatureAddingEditorCallback_MessageDialog_Msg1;
var boolean addNature = false;
if (MessageDialogWithToggle.PROMPT.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) {
val int userAnswer = dialogs.askUser(message, title, ADD_XTEXT_NATURE, editor.getEditorSite().getShell());
if (userAnswer == IDialogConstants.YES_ID) {
println("Yes ID clicked.....")
return;
} else if (userAnswer == IDialogConstants.CANCEL_ID) {
println("Cancel ID clicked.....")
return;
}
} else if (MessageDialogWithToggle.ALWAYS.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) {
println("dialog ID clicked.....")
addNature = true;
}
if (addNature) {
toggleNature.toggleNature(null);
}
}
}

override afterSave(XtextEditor editor) {
val IWorkspace workspace= ResourcesPlugin.getWorkspace();
val IPath location= Path.fromOSString(editor.resource.rawLocation.toFile.getAbsolutePath());
val IFile ifile= workspace.getRoot().getFileForLocation(location);
GenerationHandler.exec(ifile)
}

override afterSetInput(XtextEditor xtextEditor) {}

override beforeDispose(XtextEditor editor) {}

override beforeSetInput(XtextEditor xtextEditor) {}

override onValidateEditorInputState(XtextEditor editor) {
return true
}
}

[Updated on: Fri, 01 July 2016 16:55]

Report message to a moderator

Re: xtext editor hanging for long time [message #1736767 is a reply to message #1736766] Fri, 01 July 2016 15:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
Is your code called at all?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736770 is a reply to message #1736767] Fri, 01 July 2016 15:30 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
No. It is not calling. It is showing a warning in my code like Discouraged access: The type NatureAddingEditorCallback is not accessible due to restriction on required project com.prolifics.jpl.JPLEditor.ui.

How to solve Discouraged access?
Re: xtext editor hanging for long time [message #1736772 is a reply to message #1736770] Fri, 01 July 2016 15:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
Dont care about rhe disc access. How does your gzice binding liok like

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736774 is a reply to message #1736772] Fri, 01 July 2016 15:40 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
But why my code is not calling up?
Re: xtext editor hanging for long time [message #1736776 is a reply to message #1736774] Fri, 01 July 2016 15:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
How goes your guice binding in JplUiModule look like

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736777 is a reply to message #1736776] Fri, 01 July 2016 15:57 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
class JPLEditorUiModule extends AbstractJPLEditorUiModule {
override configure(Binder binder) {
super.configure(binder);
binder.bind(String).annotatedWith(Names.named((XtextContentAssistProcessor.COMPLETION_AUTO_ACTIVATION_CHARS))).toInstance(">");
}
def Class<? extends AbstractAntlrTokenToAttributeIdMapper> bindAbstractAntlrTokenToAttributeIdMapper() {
JPLAntlrTokenToAttributeIdMapper
}
def configureMyXtextEditorCallback(Binder binder) {
binder.bind(IXtextEditorCallback).annotatedWith(Names.named("JPLEditorOnSave")).to(JPLEditorOnSave);
}
def Class<? extends IValueConverterService> bindIValueConverterService() {
return CustomTerminalConverters;
}
}
Re: xtext editor hanging for long time [message #1736779 is a reply to message #1736777] Fri, 01 July 2016 16:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
id have expected something like

class MyDslUiModule extends AbstractMyDslUiModule {

override bindIXtextEditorCallback() {
JPLEditorOnSave
}

}

or you split up the two callbacks


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: xtext editor hanging for long time [message #1736783 is a reply to message #1736779] Fri, 01 July 2016 16:48 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
It is working without any problem. Now the hanging problem is no more.
Re: xtext editor hanging for long time [message #1736787 is a reply to message #1736783] Fri, 01 July 2016 17:18 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi Christian,

Even I don't need to extend NatureAddingEditorCallback. (1) solves the complete problem. But what is the difference between below snippets (1) and (2)? (1) is my code and (2) is your code.

(1)
override bindIXtextEditorCallback() {
JPLEditorOnSave
}

(2)
def configureMyXtextEditorCallback(Binder binder) {
binder.bind(IXtextEditorCallback).annotatedWith(Names.named("JPLEditorOnSave")).to(JPLEditorOnSave);
}
Re: xtext editor hanging for long time [message #1736788 is a reply to message #1736787] Fri, 01 July 2016 17:25 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
You can have n callbacks with 1 you change the default with 2 you Register a 2nd callback

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Suppress or Override Quickfix for Unresolved Definition
Next Topic:Detecting the end of validation?
Goto Forum:
  


Current Time: Sun Dec 08 12:46:27 GMT 2024

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

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

Back to the top