use of org.whole.lang.grammars.codebase.IGrammarProvider in project whole by wholeplatform.
the class GrammarsResourceBindingsContributor method addResourceBindings.
public void addResourceBindings(IBindingManager bm) {
if (!bm.wIsSet("grammarProvider")) {
Collection<Grammar> grammars = GrammarsRegistry.instance().grammars();
if (!grammars.isEmpty()) {
IGrammarProvider provider = new DialogGrammarProvider(bm);
bm.wDefValue("grammarProvider", provider);
}
}
}
use of org.whole.lang.grammars.codebase.IGrammarProvider in project whole by wholeplatform.
the class GrammarsUtils method getGrammarUri.
public static String getGrammarUri(IBindingManager bm) {
String grammarUri = null;
boolean grammarFromBindings = bm.wIsSet("grammar");
if (grammarFromBindings) {
Grammar grammar = (Grammar) bm.wGet("grammar");
InterpreterOperation.interpret(grammar, bm);
grammarUri = grammar.getUri().getValue();
} else if (bm.wIsSet("grammarURI"))
grammarUri = bm.wStringValue("grammarURI");
if (grammarUri == null && bm.wIsSet("grammarProvider")) {
IGrammarProvider provider = (IGrammarProvider) bm.wGetValue("grammarProvider");
grammarUri = provider.getGrammarUri(null);
}
return grammarUri;
}
Aggregations