org.eclipse.xtext.util.DisposableRegistry Java Examples
The following examples show how to use
org.eclipse.xtext.util.DisposableRegistry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BromiumServlet.java From bromium with MIT License | 5 votes |
@Override public void init() { try { super.init(); final Injector injector = new BromiumWebSetup().createInjectorAndDoEMFRegistration(); this.disposableRegistry = injector.<DisposableRegistry>getInstance(DisposableRegistry.class); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example #2
Source File: WebIntegrationFragment.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("/**"); _builder.newLine(); _builder.append(" "); _builder.append("* Deploy this class into a servlet container to enable DSL-specific services."); _builder.newLine(); _builder.append(" "); _builder.append("*/"); _builder.newLine(); { if (WebIntegrationFragment.this.useServlet3Api) { _builder.append("@"); TypeReference _typeReference = new TypeReference("javax.servlet.annotation.WebServlet"); _builder.append(_typeReference); _builder.append("(name = \"XtextServices\", urlPatterns = \"/xtext-service/*\")"); _builder.newLineIfNotEmpty(); } } _builder.append("public class "); String _simpleName = WebIntegrationFragment.this.getServletClass(WebIntegrationFragment.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" extends "); TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.web.servlet.XtextServlet"); _builder.append(_typeRef); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append(DisposableRegistry.class, "\t"); _builder.append(" disposableRegistry;"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public void init() throws "); TypeReference _typeRef_1 = TypeReference.typeRef("javax.servlet.ServletException"); _builder.append(_typeRef_1, "\t"); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("super.init();"); _builder.newLine(); _builder.append("\t\t"); TypeReference _typeRef_2 = TypeReference.typeRef("com.google.inject.Injector"); _builder.append(_typeRef_2, "\t\t"); _builder.append(" injector = new "); TypeReference _webSetup = WebIntegrationFragment.this._xtextGeneratorNaming.getWebSetup(WebIntegrationFragment.this.getGrammar()); _builder.append(_webSetup, "\t\t"); _builder.append("().createInjectorAndDoEMFRegistration();"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("this.disposableRegistry = injector.getInstance("); _builder.append(DisposableRegistry.class, "\t\t"); _builder.append(".class);"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public void destroy() {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("if (disposableRegistry != null) {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("disposableRegistry.dispose();"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("disposableRegistry = null;"); _builder.newLine(); _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t\t"); _builder.append("super.destroy();"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("}"); _builder.newLine(); }
Example #3
Source File: ExecutorServiceProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Inject public void registerTo(DisposableRegistry disposableRegistry) { disposableRegistry.register(this); }