Java Code Examples for org.eclipse.xtext.util.Modules2#mixin()

The following examples show how to use org.eclipse.xtext.util.Modules2#mixin() . 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: N4JSGracefulActivator.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Injector createInjector(String language) {
	try {
		Module runtimeModule = getRuntimeModule(language);
		Module sharedStateModule = getSharedStateModule();
		Module uiModule = getUiModule(language);
		Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		// An exception occurring here might be related to Guice:
		// https://stackoverflow.com/questions/39918622/why-is-guice-throwing-computationexception-from-uncaughtexceptionhandler-in-mai.
		e.printStackTrace();
		UIUtils.showError(e);
		System.exit(-1);
		return null;
	}
}
 
Example 2
Source File: CodetemplatesActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 3
Source File: XbaseActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 4
Source File: TestsActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 5
Source File: ArithmeticsActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 6
Source File: TestLanguageActivator.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		Module runtimeModule = getRuntimeModule(language);
		Module sharedStateModule = getSharedStateModule();
		Module uiModule = getUiModule(language);
		Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 7
Source File: PurexbaseActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 8
Source File: TestlanguagesActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 9
Source File: TestsActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 10
Source File: SourceFolderDefaultImplTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected com.google.inject.Module getServerModule() {
	com.google.inject.Module defaultModule = super.getServerModule();
	com.google.inject.Module customModule = new AbstractModule() {
		@Override
		protected void configure() {
			bind(WorkspaceManager.class).in(Scopes.SINGLETON);
		}
	};
	return Modules2.mixin(defaultModule, customModule);
}
 
Example 11
Source File: Activator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 12
Source File: SemverActivator.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 13
Source File: TestsActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 14
Source File: TestlanguagesActivator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 15
Source File: HelloworldActivator.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 16
Source File: AbstractLanguageServerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected com.google.inject.Module getServerModule() {
  ServerModule _serverModule = new ServerModule();
  final com.google.inject.Module _function = (Binder it) -> {
    it.<RequestManager>bind(RequestManager.class).to(AbstractLanguageServerTest.DirectRequestManager.class);
  };
  return Modules2.mixin(_serverModule, _function);
}
 
Example 17
Source File: TypesActivator.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 18
Source File: IndexOnlyProjectTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public com.google.inject.Module getServerModule() {
  ServerModule _serverModule = new ServerModule();
  final com.google.inject.Module _function = (Binder it) -> {
    AnnotatedBindingBuilder<IMultiRootWorkspaceConfigFactory> _bind = it.<IMultiRootWorkspaceConfigFactory>bind(IMultiRootWorkspaceConfigFactory.class);
    _bind.toInstance(new MultiRootWorkspaceConfigFactory() {
      @Override
      public void addProjectsForWorkspaceFolder(final WorkspaceConfig workspaceConfig, final WorkspaceFolder workspaceFolder, final Set<String> existingNames) {
        String _uri = null;
        if (workspaceFolder!=null) {
          _uri=workspaceFolder.getUri();
        }
        boolean _tripleNotEquals = (_uri != null);
        if (_tripleNotEquals) {
          URI _uri_1 = this.getUriExtensions().toUri(workspaceFolder.getUri());
          String _uniqueProjectName = this.getUniqueProjectName(workspaceFolder.getName(), existingNames);
          final FileProjectConfig project = new FileProjectConfig(_uri_1, _uniqueProjectName) {
            @Override
            public boolean isIndexOnly() {
              return true;
            }
          };
          project.addSourceFolder(".");
          workspaceConfig.addProject(project);
        }
      }
    });
  };
  return Modules2.mixin(_serverModule, _function);
}
 
Example 19
Source File: CheckActivator.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		Module runtimeModule = getRuntimeModule(language);
		Module sharedStateModule = getSharedStateModule();
		Module uiModule = getUiModule(language);
		Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}
 
Example 20
Source File: N4JSActivator.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
protected Injector createInjector(String language) {
	try {
		com.google.inject.Module runtimeModule = getRuntimeModule(language);
		com.google.inject.Module sharedStateModule = getSharedStateModule();
		com.google.inject.Module uiModule = getUiModule(language);
		com.google.inject.Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
		return Guice.createInjector(mergedModule);
	} catch (Exception e) {
		logger.error("Failed to create injector for " + language);
		logger.error(e.getMessage(), e);
		throw new RuntimeException("Failed to create injector for " + language, e);
	}
}