Skip to content

Commit

Permalink
support multiple interface bindings when looking up the contributed g…
Browse files Browse the repository at this point in the history
…enerators
  • Loading branch information
amlajmi committed Sep 22, 2016
1 parent a6dd79b commit d72c029
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.xtext.generator.GeneratorDelegate;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.osgi.framework.Bundle;
Expand Down Expand Up @@ -146,15 +147,18 @@ private void initialize() throws CoreException {
Binding<IGenerator> binding = injector.getBinding(IGenerator.class);
if (binding!=null) {
IGenerator generator = injector.getInstance(IGenerator.class);
//The list of generators
//IGenerator generator =(IGenerator) configElement.createExecutableExtension(WorkbenchContribution_class);
if (generator!=null) {
generators.add(generator);
}
}
} catch (ConfigurationException ex) {
//do nothing, there is no generator contributed.
logger.info("There is no generator contributed");
logger.info("There is no generator contributed implementing IGenerator.");
// Xtext 2.10: try IGenerator2
GeneratorDelegate delegate = injector.getInstance(GeneratorDelegate.class);
if (delegate!=null) {
generators.add(delegate);
}
}
//Done.
LanguageContribution contribution = new LanguageContribution(xtextGrammarPath, fileExtension, injector, generators);
Expand Down

0 comments on commit d72c029

Please sign in to comment.