项目:n4js
文件:N4HeadlessCompiler.java
/**
* Install the given resource's description into the given index. Raw JavaScript files will not be indexed. Note
* that when this method is called for the given resource,it is not yet fully processed and therefore the
* serialized type model is not added to the index.
* <p>
* This is due to the fact that we keep a common resource set for all projects that contains the resources of all
* projects with unprocessed dependencies,unlike in the IDE case where we have one resource set per open document
* and load the type models from the index.
* </p>
* <p>
* Since the type models are available in the resource set as long as they may still be referenced,they need not be
* serialized and stored into the index.
* </p>
*
* @param resource
* the resource to be indexed
* @param index
* the index to add the given resource to
*/
private void indexResource(Resource resource,ResourceDescriptionsData index) {
if (!shouldindexResource(resource))
return;
final URI uri = resource.getURI();
IResourceServiceProvider serviceProvider = IResourceServiceProvider.Registry.INSTANCE
.getResourceServiceProvider(uri);
if (serviceProvider != null) {
if (logger.isCreateDebugOutput()) {
logger.debug(" Indexing resource " + uri);
}
IResourceDescription.Manager resourceDescriptionManager = serviceProvider.getResourceDescriptionManager();
IResourceDescription resourceDescription = resourceDescriptionManager.getResourceDescription(resource);
if (resourceDescription != null) {
index.addDescription(uri,resourceDescription);
}
}
}
项目:n4js
文件:OwnResourceValidatorAwareValidatingEditorCallback.java
private ValidationJob newValidationJob(final XtextEditor editor) {
final IXtextDocument document = editor.getDocument();
final IAnnotationModel annotationModel = editor.getInternalSourceViewer().getAnnotationModel();
final IssueResolutionProvider issueResolutionProvider = getService(editor,IssueResolutionProvider.class);
final MarkerTypeProvider markerTypeProvider = getService(editor,MarkerTypeProvider.class);
final MarkerCreator markerCreator = getService(editor,MarkerCreator.class);
final IValidationIssueProcessor issueProcessor = new CompositeValidationIssueProcessor(
new AnnotationIssueProcessor(document,annotationModel,issueResolutionProvider),new MarkerIssueProcessor(editor.getResource(),markerCreator,markerTypeProvider));
return editor.getDocument().modify(resource -> {
final IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
return new ValidationJob(resourceValidator,editor.getDocument(),issueProcessor,ALL);
});
}
项目:n4js
文件:ReferenceFinderLabelProvider.java
/**
* Returns a string representation for the find references UI to represent the matches and the queried object.
* dispatches to the correct,language specific implementation.
*/
public String getText(EObject source) {
URI uri = source.eResource().getURI();
if (!resourceServiceProvider.canHandle(uri)) {
IResourceServiceProvider otherServiceProvider = resourceServiceProviderRegistry
.getResourceServiceProvider(uri);
if (otherServiceProvider != null) {
ReferenceFinderLabelProvider otherLabelProvider = otherServiceProvider
.get(ReferenceFinderLabelProvider.class);
if (otherLabelProvider != null) {
return otherLabelProvider.doGetText(source);
}
}
}
return doGetText(source);
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<List<? extends CodeLens>> codeLens(final CodeLensParams params) {
final Function1<CancelIndicator,List<? extends CodeLens>> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ICodeLensService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<ICodeLensService>get(ICodeLensService.class);
}
final ICodeLensService codeLensService = _get;
if ((codeLensService == null)) {
return CollectionLiterals.<CodeLens>emptyList();
}
final Function2<Document,XtextResource,List<? extends CodeLens>> _function_1 = (Document document,XtextResource resource) -> {
final List<? extends CodeLens> result = codeLensService.computeCodeLenses(document,resource,params,cancelIndicator);
this.installURI(result,uri.toString());
return result;
};
return this.workspaceManager.<List<? extends CodeLens>>doRead(uri,_function_1);
};
return this.requestManager.<List<? extends CodeLens>>runRead(_function);
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<List<? extends Location>> references(final ReferenceParams params) {
final Function1<CancelIndicator,List<? extends Location>> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
DocumentSymbolService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService == null)) {
return CollectionLiterals.<Location>emptyList();
}
final Function2<Document,List<? extends Location>> _function_1 = (Document document,XtextResource resource) -> {
return documentSymbolService.getReferences(document,this.resourceAccess,this.workspaceManager.getIndex(),cancelIndicator);
};
return this.workspaceManager.<List<? extends Location>>doRead(uri,_function_1);
};
return this.requestManager.<List<? extends Location>>runRead(_function);
}
项目:xtext-extras
文件:JavaSourceLanguageRuntimeModule.java
@Override
protected void configure() {
this.<Resource.Factory>bind(Resource.Factory.class).to(JavaResource.Factory.class);
this.<IResourceValidator>bind(IResourceValidator.class).toInstance(IResourceValidator.NULL);
this.<IGenerator>bind(IGenerator.class).to(IGenerator.NullGenerator.class);
this.<IEncodingProvider>bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
this.<IResourceServiceProvider>bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class);
this.<IContainer.Manager>bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class);
this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class);
this.<IQualifiednameProvider>bind(IQualifiednameProvider.class).to(JvmIdentifiableQualifiednameProvider.class);
this.<String>bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java");
this.<String>bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.java.Java");
this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class);
this.<ClassLoader>bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader());
this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class);
final IResourceDescriptionsprovider _function = (ResourceSet it) -> {
return ChunkedResourceDescriptions.findInEmfObject(it);
};
this.<IResourceDescriptionsprovider>bind(IResourceDescriptionsprovider.class).toInstance(_function);
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<SignatureHelp> signatureHelp(final TextDocumentPositionParams params) {
final Function1<CancelIndicator,SignatureHelp> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ISignatureHelpService _get = null;
if (serviceProvider!=null) {
_get=serviceProvider.<ISignatureHelpService>get(ISignatureHelpService.class);
}
final ISignatureHelpService helper = _get;
if ((helper == null)) {
return ISignatureHelpService.EMPTY;
}
final Function2<Document,SignatureHelp> _function_1 = (Document doc,XtextResource resource) -> {
return helper.getSignatureHelp(doc,cancelIndicator);
};
return this.workspaceManager.<SignatureHelp>doRead(uri,_function_1);
};
return this.requestManager.<SignatureHelp>runRead(_function);
}
项目:xtext-core
文件:AbstractResourceServiceProviderDescriptor.java
@Override
public IResourceServiceProvider get(URI uri,String contentType) {
Object extension = getExtension();
if (extension instanceof IResourceServiceProvider.Provider) {
IResourceServiceProvider.Provider provider = ((IResourceServiceProvider.Provider) extension);
IResourceServiceProvider result = provider.get(uri,contentType);
return result;
} else if (extension instanceof IResourceServiceProvider) {
return (IResourceServiceProvider) extension;
}
String type = extension == null ? "null" : extension.getClass().getName();
String valid = IResourceServiceProvider.class + " or " + IResourceServiceProvider.Provider.class;
String suffix = "";
String contributor = getContributor();
if (contributor != null) {
suffix += " contributed by " + contributor;
}
throw new ClassCastException("The type " + type + " is not a valid " + valid + suffix);
}
@Override
public IResourceDescription getResourceDescription(URI uri) {
IResourceDescription result = delegate.getResourceDescription(uri);
if (result == null) {
Resource resource = EcoreUtil2.getResource(context,uri.toString());
if (resource != null) {
IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
if (serviceProvider==null)
throw new IllegalStateException("No "+IResourceServiceProvider.class.getSimpleName()+" found in registry for uri "+uri);
final Manager resourceDescriptionManager = serviceProvider.getResourceDescriptionManager();
if (resourceDescriptionManager == null)
throw new IllegalStateException("No "+IResourceDescription.Manager.class.getName()+" provided by service provider for URI "+uri);
result = resourceDescriptionManager.getResourceDescription(resource);
}
}
return result;
}
项目:xtext-core
文件:WorkspaceSymbolService.java
public List<? extends Symbolinformation> getSymbols(final String query,final IReferenceFinder.IResourceAccess resourceAccess,final IResourceDescriptions indexData,final CancelIndicator cancelIndicator) {
final LinkedList<Symbolinformation> result = CollectionLiterals.<Symbolinformation>newLinkedList();
Iterable<IResourceDescription> _allResourceDescriptions = indexData.getAllResourceDescriptions();
for (final IResourceDescription resourceDescription : _allResourceDescriptions) {
{
this.operationCanceledManager.checkCanceled(cancelIndicator);
final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI());
DocumentSymbolService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService != null)) {
List<? extends Symbolinformation> _symbols = documentSymbolService.getSymbols(resourceDescription,query,resourceAccess,cancelIndicator);
Iterables.<Symbolinformation>addAll(result,_symbols);
}
}
}
return result;
}
项目:xtext-core
文件:ReferenceAcceptor.java
protected void computeExportedobjectsMap(final EObject source) {
final Resource resource = source.eResource();
final IResourceServiceProvider resourceServiceProvider = this.resourceServiceProviderRegistry.getResourceServiceProvider(resource.getURI());
if ((resourceServiceProvider != null)) {
final IResourceDescription resourceDescription = resourceServiceProvider.getResourceDescriptionManager().getResourceDescription(resource);
this.exportedContainersInCurrentResource = CollectionLiterals.<EObject,URI>newHashMap();
Iterable<IEObjectDescription> _exportedobjects = resourceDescription.getExportedobjects();
for (final IEObjectDescription description : _exportedobjects) {
{
EObject instance = description.getEObjectOrProxy();
boolean _eIsProxy = instance.eIsProxy();
if (_eIsProxy) {
instance = resource.getEObject(description.getEObjectURI().fragment());
}
this.exportedContainersInCurrentResource.put(instance,description.getEObjectURI());
}
}
} else {
this.exportedContainersInCurrentResource = CollectionLiterals.<EObject,URI>emptyMap();
}
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<WorkspaceEdit> rename(final RenameParams params) {
final Function1<CancelIndicator,WorkspaceEdit> _function = (CancelIndicator cancelIndicator) -> {
WorkspaceEdit _xblockexpression = null;
{
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
IRenameService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<IRenameService>get(IRenameService.class);
}
final IRenameService renameService = _get;
if ((renameService == null)) {
return new WorkspaceEdit();
}
_xblockexpression = renameService.rename(this.workspaceManager,cancelIndicator);
}
return _xblockexpression;
};
return this.requestManager.<WorkspaceEdit>runRead(_function);
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<List<? extends Command>> codeAction(final CodeActionParams params) {
final Function1<CancelIndicator,List<? extends Command>> _function = (CancelIndicator cancelIndicator) -> {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider serviceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ICodeActionService _get = null;
if (serviceProvider!=null) {
_get=serviceProvider.<ICodeActionService>get(ICodeActionService.class);
}
final ICodeActionService service = _get;
if ((service == null)) {
return CollectionLiterals.<Command>emptyList();
}
final Function2<Document,List<? extends Command>> _function_1 = (Document doc,XtextResource resource) -> {
return service.getCodeActions(doc,cancelIndicator);
};
return this.workspaceManager.<List<? extends Command>>doRead(uri,_function_1);
};
return this.requestManager.<List<? extends Command>>runRead(_function);
}
项目:dsl-devkit
文件:ResourceServiceProviderLocator.java
/**
* Finds the {@link IResourceServiceProvider} for a language by given its id.
*
* @param languageId
* the language id (grammar name)
* @return the {@link IResourceServiceProvider} for the given language id
*/
public IResourceServiceProvider getResourceServiceProviderById(final String languageId) {
ImmutableMap<Map<String,Object>,? extends Function<String,IResourceServiceProvider>> resourceProvidersMap = getProviderMaps();
for (Map.Entry<Map<String,IResourceServiceProvider>> mapEntry : resourceProvidersMap.entrySet()) {
Map<String,Object> map = mapEntry.getKey();
for (Map.Entry<String,Object> entry : map.entrySet()) {
try {
IResourceServiceProvider resourceServiceProvider = mapEntry.getValue().apply(entry.getKey());
if (resourceServiceProvider == null) {
continue;
}
IGrammaraccess grammaraccess = resourceServiceProvider.get(IGrammaraccess.class);
if (grammaraccess != null && grammaraccess.getGrammar().getName().equals(languageId)) {
return resourceServiceProvider;
}
// CHECKSTYLE:OFF
} catch (ConfigurationException ex) {
// CHECKSTYLE:ON
// ignore
}
}
}
return null;
}
/**
* Gets the all languages available in the workbench.
*
* @return set of all languages
*/
public Set<String> getAllLanguages() {
Set<String> languages = new HashSet<String>();
for (String extension : Registry.INSTANCE.getExtensionToFactoryMap().keySet()) {
final URI dummyUri = URI.createURI("foo:/foo." + extension);
IResourceServiceProvider resourceServiceProvider = Registry.INSTANCE.getResourceServiceProvider(dummyUri);
// By checking that description manager is AbstractCachingResourceDescriptionManager we exclude technical languages of the framework
if (resourceServiceProvider != null && resourceServiceProvider.getResourceDescriptionManager() instanceof AbstractCachingResourceDescriptionManager) {
try {
IGrammaraccess grammaraccess = resourceServiceProvider.get(IGrammaraccess.class);
if (grammaraccess != null && grammaraccess.getGrammar() != null) {
languages.add(grammaraccess.getGrammar().getName());
}
} catch (ConfigurationException e) {
// Will happen if no binding for IGrammaraccess was present.
}
}
}
return languages;
}
项目:xtext-core
文件:LanguageServerImpl.java
@Override
public CompletableFuture<CodeLens> resolveCodeLens(final CodeLens unresolved) {
final URI uri = this.uninstallURI(unresolved);
if ((uri == null)) {
return CompletableFuture.<CodeLens>completedFuture(unresolved);
}
final Function1<CancelIndicator,CodeLens> _function = (CancelIndicator cancelIndicator) -> {
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ICodeLensResolver _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<ICodeLensResolver>get(ICodeLensResolver.class);
}
final ICodeLensResolver resolver = _get;
if ((resolver == null)) {
return unresolved;
}
final Function2<Document,CodeLens> _function_1 = (Document document,XtextResource resource) -> {
final CodeLens result = resolver.resolveCodeLens(document,unresolved,cancelIndicator);
return result;
};
return this.workspaceManager.<CodeLens>doRead(uri,_function_1);
};
return this.requestManager.<CodeLens>runRead(_function);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.baernreuther.de/dsls/Pkmntcgo")) {
EPackage.Registry.INSTANCE.put("http://www.baernreuther.de/dsls/Pkmntcgo",PkmntcgoPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ptcgo",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("ptcgo",serviceProvider);
}
项目:n4js
文件:EagerResourceSetBasedResourceDescriptions.java
private IResourceDescription computeResourceDescription(URI uri) {
Resource resource = resourceSet.getResource(uri,false);
if (resource == null)
return null;
IResourceServiceProvider resourceServiceProvider = registry.getResourceServiceProvider(uri);
if (resourceServiceProvider == null)
return null;
IResourceDescription.Manager manager = resourceServiceProvider.getResourceDescriptionManager();
if (manager == null)
return null;
return manager.getResourceDescription(resource);
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4ts",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4ts",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/n4js/regex/RegularExpression")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/n4js/regex/RegularExpression",RegularExpressionPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("regex",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("regex",serviceProvider);
}
private static EObject getSelectedElement(final XtextEditor editor,final ITextSelection textSelection) {
return editor.getDocument().modify(
resource -> {
final IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
final EObjectAtOffsetHelper offsetHelper = serviceProvider.get(EObjectAtOffsetHelper.class);
return offsetHelper.resolveElementAt(resource,textSelection.getoffset());
});
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4js",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4js",serviceProvider);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsx",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsx",serviceProvider);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("js",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("js",serviceProvider);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("jsx",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("jsx",serviceProvider);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsd",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4jsd",serviceProvider);
}
private IParser getRegexParser() {
if (regexParser == null) {
// no need for sync since we can also use a new regexParser if concurrent access happens by accident
IResourceServiceProvider serviceProvider = serviceProviders.getResourceServiceProvider(URI
.createURI("a.regex"));
regexParser = serviceProvider.get(IParser.class);
}
return regexParser;
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("n4mf",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.xtext.org/example/mydsl/MyDsl")) {
EPackage.Registry.INSTANCE.put("http://www.xtext.org/example/mydsl/MyDsl",MyDslPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("mensa",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("mensa",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.hribol.com/bromium/dsl/bromium")) {
EPackage.Registry.INSTANCE.put("http://www.hribol.com/bromium/dsl/bromium",bromiumPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("brm",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("brm",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.gw4e/dsl/DSLPolicies")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.gw4e/dsl/DSLPolicies",DSLPoliciesPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("policies",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("policies",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.wamas.com/ide/launching/LcDsl")) {
EPackage.Registry.INSTANCE.put("http://www.wamas.com/ide/launching/LcDsl",LcDslPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("lc",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("lc",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/gemoc/Dsl")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gemoc/Dsl",DslPackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("dsl",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.xtext.org/dsl/restaurante/Restaurante")) {
EPackage.Registry.INSTANCE.put("http://www.xtext.org/dsl/restaurante/Restaurante",RestaurantePackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("rest",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("rest",serviceProvider);
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("occi",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("occi",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/xtext/purexbase/PureXbase")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/xtext/purexbase/PureXbase",PureXbasePackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xbase",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("xbase",serviceProvider);
}
项目:xtext-extras
文件:TraceAsSmapInstaller.java
protected String getStratumName(final SourceRelativeURI path) {
IResourceServiceProvider provider = serviceProviderRegistry.getResourceServiceProvider(path.getURI());
if (provider == null) {
// it might happen that trace data is in the workspace but the corresponding language is not installed.
// we use the file extension then.
String result = path.getURI().fileExtension();
if (result != null) {
return result;
}
return "unkNown";
}
final LanguageInfo languageInfo = provider.get(LanguageInfo.class);
String name = languageInfo.getShortName();
return name;
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("___xbase",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("___xbase",serviceProvider);
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/2011/xtext/ui/common/types/xtext/ui/Refactoring")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/2011/xtext/ui/common/types/xtext/ui/Refactoring",RefactoringTestLanguagePackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("typesRefactoring",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("typesRefactoring",serviceProvider);
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("formattertestlanguage",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("formattertestlanguage",serviceProvider);
if (!EPackage.Registry.INSTANCE.containsKey("http://formatter2/formattertestlanguage")) {
EPackage.Registry.INSTANCE.put("http://formatter2/formattertestlanguage",FormattertestlanguagePackage.eINSTANCE);
}
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("testlanguage",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("testlanguage",serviceProvider);
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/2008/xtext/TestLang")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/2008/xtext/TestLang",TestLangPackage.eINSTANCE);
}
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("treetestlanguage",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("treetestlanguage",serviceProvider);
if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/2008/tmf/xtext/TreeTestLanguage")) {
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/2008/tmf/xtext/TreeTestLanguage",TreeTestLanguagePackage.eINSTANCE);
}
}
public void register(Injector injector) {
if (!EPackage.Registry.INSTANCE.containsKey("http://eclipse.org/xtext/builderStandaloneTestLanguage")) {
EPackage.Registry.INSTANCE.put("http://eclipse.org/xtext/builderStandaloneTestLanguage",BuilderTestLanguagePackage.eINSTANCE);
}
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("buildertestlanguage",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("buildertestlanguage",serviceProvider);
}
public void register(Injector injector) {
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("abstracttestlanguage",resourceFactory);
IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("abstracttestlanguage",serviceProvider);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。