use of org.eclipse.xtext.ui.shared.contribution.SharedStateContribution in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImpl method initializeContributions.
private synchronized ImmutableList<? extends SharedStateContribution> initializeContributions() {
if (contributions == null) {
final ImmutableList.Builder<SharedStateContribution> listBuilder = ImmutableList.builder();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(EXTENSION_POINT);
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
try {
Module childModule = (Module) configurationElement.createExecutableExtension("class");
SharedStateContribution contribution = createContribution(childModule);
listBuilder.add(contribution);
} catch (CoreException e) {
logger.error(e.getMessage(), e);
} catch (ProvisionException e) {
logger.error(e.getMessage(), e);
}
}
}
contributions = listBuilder.build();
}
return contributions;
}
use of org.eclipse.xtext.ui.shared.contribution.SharedStateContribution in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImplTest method testCreateContribution.
@Test
public void testCreateContribution() {
SharedStateContributionRegistryImpl registry = new SharedStateContributionRegistryImpl(injector);
SharedStateContribution contribution = registry.createContribution(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(CharSequenceClient.class).to(CharSequenceClientImpl.class);
}
});
Assert.assertTrue(contribution.isContributionSupported(CharSequenceClient.class));
Assert.assertFalse(contribution.isContributionSupported(IXtextDocument.class));
Assert.assertEquals("fromParentInjector", contribution.getContribution(CharSequenceClient.class).getSeq());
}
use of org.eclipse.xtext.ui.shared.contribution.SharedStateContribution in project xtext-eclipse by eclipse.
the class SharedStateContributionRegistryImpl method createContribution.
/*
* Public for testing purpose.
*/
public SharedStateContribution createContribution(final Module childModule) {
Injector childInjector = createInjectorWithoutJITBindings(childModule);
SharedStateContribution contribution = childInjector.getInstance(SharedStateContribution.class);
return contribution;
}
Aggregations