|
|
|
|
|
|
|
|
Re: syntax validation not active when opening document [message #799437 is a reply to message #799432] |
Wed, 15 February 2012 22:18 |
Phil R Messages: 99 Registered: September 2011 |
Member |
|
|
I wanted to add xtext nature automatically:
public class AutomaticAddXtextNature extends AbstractDirtyStateAwareEditorCallback{
@Inject
private ToggleNature toggleNature;
@Override
public void afterCreatePartControl(XtextEditor editor) {
super.afterCreatePartControl(editor);
IResource resource = editor.getResource();
if (resource!=null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) {
toggleNature.toggleNature(resource.getProject());
}
}
}
and
@Override
public Class<? extends org.eclipse.xtext.ui.editor.IXtextEditorCallback> bindIXtextEditorCallback() {
return AutomaticAddXtextNature.class;
}
and causes this the trouble? And then also if I check out this feature it could be that the problems are still active ?
So then I have used as a solution to use a project wizard where the xtext nature is automatically added. However the generated project wizard of xtext gives lots of extra's I don't need, like src folder, src-gen, generator, java libraries.. If the wizard is used then a clean project with only the xtext nature should be added
Regards,
Phil
[Updated on: Thu, 16 February 2012 10:59] Report message to a moderator
|
|
|
Re: syntax validation not active when opening document [message #799895 is a reply to message #799437] |
Thu, 16 February 2012 12:51 |
John J. Camilleri Messages: 33 Registered: November 2011 Location: Göteborg |
Member |
|
|
I have experienced the same problem as Phil, with the validation not triggering when opening a file. The same also applies when Eclipse launches and automatically re-opens the files which were open in the previous session - I need to alter the file in order for validation to be triggered.
I do not have the Xtext nature enabled on my DSL projects, mainly because I cannot understand what value it adds. I turned off the prompt for adding the nature by binding to org.eclipse.xtext.ui.editor.IXtextEditorCallback, like so:
MyDSLUiModule.java
@Override
public Class<? extends org.eclipse.xtext.ui.editor.IXtextEditorCallback> bindIXtextEditorCallback() {
return org.grammaticalframework.eclipse.ui.editor.MyEditorCallback.class;
}
MyEditorCallback
public class MyEditorCallback extends AbstractDirtyStateAwareEditorCallback {
// empty!
}
I'll be honest, I'm not really sure why that works, but it does.
My question would be twofold:
- Is there a way to get this validation to trigger when opening a file, without having to resort to enabling the Xtext nature?
- What would be the purpose of enabling the Xtext nature on my DSL projects?
Thanks for all the great work in these forums, guys.
[Updated on: Thu, 16 February 2012 12:57] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04983 seconds