|
|
|
|
|
Re: Custom Types [message #883124 is a reply to message #883114] |
Thu, 07 June 2012 21:56 |
Daniel Fath Messages: 14 Registered: March 2012 |
Junior Member |
|
|
Ok I tried to use the URI import but it doesn't seem to work.
The ImportUriGlobalScopeProvider I made like this:
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider;
public class DOMMLiteGlobalScopeProvider extends ImportUriGlobalScopeProvider {
@Override
protected LinkedHashSet<URI> getImportedUris(Resource resource) {
LinkedHashSet<URI> temp = super.getImportedUris(resource);
temp.add(URI.createURI("classpath:/builtin.domm"));
return temp;
}
}
But this doesn't seem to work. That tutorial says to modify AbstractDOMMLiteRuntimeModlue, but that is src-gen, which means it would get overwritten with a change. So I am still unsure how to procede...
[Updated on: Fri, 08 June 2012 18:02] Report message to a moderator
|
|
|
|
|
Re: Custom Types [message #883550 is a reply to message #883534] |
Fri, 08 June 2012 19:12 |
Daniel Fath Messages: 14 Registered: March 2012 |
Junior Member |
|
|
My model doesn't allow import other than the built in types. However there are also some custom validators and tagTypes that are hard to implement using enums.
I meant this tutorial: blogs.itemis.de/stundzig/archives/795 one you linked in your first response.
So if I understood you correctly. I made a .jar file containing 'builtin.domm' file. I added that file to buildpath (I assume that will make it available for the project I'm building). In it it clearly states:
Quote:You could make this change known analogous to the way the ImportUriGlobalScopeProvider is bound in the AbstractXRuntimeModule
AbstractXRuntimeModule is src-gen and not src. Just to be sure I tried to add DOMMLiteGlobalScopeProvider to DOMMLiteRuntimeModule like this:
public class DOMMLiteRuntimeModule extends ftn.danielfath.AbstractDOMMLiteRuntimeModule {
@Override
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
binder.bind(org.eclipse.xtext.scoping.IGlobalScopeProvider.class).
annotatedWith(com.google.inject.name.Names.named(
"org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate"
)).to(DOMMLiteGlobalScopeProvider.class);}
}
Which caused an error:
!MESSAGE A conflict occurred for CTRL+O:
Binding(CTRL+O,
ParameterizedCommand(Command(org.eclipse.graphiti.ui.internal.action.SaveImageAction,Export Diagram,
Export Diagram,
Category(org.eclipse.graphiti.ui.Graphiti_Category,Edit,Graphiti Diagram Editor,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+O,
ParameterizedCommand(Command(org.eclipse.papyrus.sysml.modelexplorer.FlowPort_OutCreateCommand,Create a new FlowPort_Out,
Create a new FlowPort_Out,
Category(org.eclipse.papyrus.editor.category,Papyrus Category,this a category of papyrus commands,true),
org.eclipse.papyrus.sysml.modelexplorer.handler.FlowPort_OutHandler,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
but then the editor was all messed up.
[Updated on: Fri, 08 June 2012 19:22] Report message to a moderator
|
|
|
Re: Custom Types [message #883554 is a reply to message #883550] |
Fri, 08 June 2012 19:24 |
|
Hi,
Strange Things you do. what the blog post says:
go to the runtime module and create a binding ANALGOUS to the one in the AbstractRuntimememodule.
so what do you have regarding your IGlobalScopeProvider in your abstract runtimemodule?
i have something like
public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
return org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider.class;
}
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(com.google.inject.name.Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider.class);
}
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Fri, 08 June 2012 19:36] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Custom Types [message #884350 is a reply to message #884298] |
Sun, 10 June 2012 22:17 |
Daniel Fath Messages: 14 Registered: March 2012 |
Junior Member |
|
|
Hi and thanks for help.
I figured out a way for it to work. If I comment out the global scope provider and just keep the local one, adding the jar to classpath of my test project will result in correct behavior. It's obvious that the global scope is the cause of problems.
Currently I need to add the mydsl.jar manually. Is there a way to auto-include mydsl.jar into my projects?
[Updated on: Sun, 10 June 2012 22:17] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.05140 seconds