org.eclipse.xtext.resource.FileExtensionProvider Java Examples
The following examples show how to use
org.eclipse.xtext.resource.FileExtensionProvider.
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: RegistryProvider.java From smarthome with Eclipse Public License 2.0 | 6 votes |
private void register(IResourceServiceProvider.Registry registry, Injector injector) { IResourceServiceProvider resourceServiceProvider = injector.getInstance(IResourceServiceProvider.class); FileExtensionProvider extensionProvider = injector.getInstance(FileExtensionProvider.class); for (String ext : extensionProvider.getFileExtensions()) { if (registry.getExtensionToFactoryMap().containsKey(ext)) { if (extensionProvider.getPrimaryFileExtension() == ext) { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } else { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, resourceFactory); } }
Example #2
Source File: RegistryProvider.java From openhab-core with Eclipse Public License 2.0 | 6 votes |
private void register(IResourceServiceProvider.Registry registry, Injector injector) { IResourceServiceProvider resourceServiceProvider = injector.getInstance(IResourceServiceProvider.class); FileExtensionProvider extensionProvider = injector.getInstance(FileExtensionProvider.class); for (String ext : extensionProvider.getFileExtensions()) { if (registry.getExtensionToFactoryMap().containsKey(ext)) { if (extensionProvider.getPrimaryFileExtension() == ext) { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } } else { registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider); } IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, resourceFactory); } }
Example #3
Source File: N4JSParseHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void setFileExtension(String ext) { FileExtensionProvider dummy = new FileExtensionProvider() { { setExtensions(ext); } }; resourceHelper.setFileExtensionProvider(dummy); this.fileExtension = ext; }
Example #4
Source File: WrappingInjectorProvider.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
private void registerFactory(Injector injector) { IResourceFactory factory = injector.getInstance(IResourceFactory.class); IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); FileExtensionProvider fileExtensionProvider = injector.getInstance(FileExtensionProvider.class); for(String ext: fileExtensionProvider.getFileExtensions()) { Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, factory); IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, serviceProvider); } }
Example #5
Source File: JavaProjectPreferencesInitializer.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@SuppressWarnings("restriction") @Inject public void addOwnFileExtensionsToJavaBuildResourceCopyFilter(FileExtensionProvider extensionProvider) { @SuppressWarnings("deprecation") IScopeContext defaultScope = new DefaultScope(); // The class org.eclipse.jdt.internal.launching.LaunchingPreferenceInitializer has this very nasty habit // of replacing all RESOURCE_COPY_FILTERs with its own filter. Calling getNode(LaunchingPlugin.ID_PLUGIN) // causes LaunchingPreferenceInitializer to be executed that afterwards we can append our filters safely. // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=395366 defaultScope.getNode(org.eclipse.jdt.internal.launching.LaunchingPlugin.ID_PLUGIN); IEclipsePreferences dnode = defaultScope.getNode(JavaCore.PLUGIN_ID); if (dnode == null) return; Set<String> filters = Sets.newLinkedHashSet(); for (String filter : dnode.get(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, "").split(",")) { String trimmed = filter.trim(); if (!"".equals(trimmed)) filters.add(trimmed); } for (String ext : extensionProvider.getFileExtensions()) filters.add("*." + ext); dnode.put(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, Joiner.on(", ").join(filters)); try { dnode.flush(); } catch (BackingStoreException e) { log.error("Error saving preferences", e); } }
Example #6
Source File: WrappingInjectorProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void registerFactory(Injector injector) { IResourceFactory factory = injector.getInstance(IResourceFactory.class); IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); FileExtensionProvider fileExtensionProvider = injector.getInstance(FileExtensionProvider.class); for(String ext: fileExtensionProvider.getFileExtensions()) { Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, factory); IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put(ext, serviceProvider); } }
Example #7
Source File: N4JSXParseHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void setFileExtension(String ext) { FileExtensionProvider dummy = new FileExtensionProvider() { { setExtensions(ext); } }; resourceHelper.setFileExtensionProvider(dummy); }
Example #8
Source File: ResourceHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #9
Source File: ParseHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
/** * @since 2.5 */ @Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #10
Source File: AbstractOutlineTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #11
Source File: AbstractOutlineTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #12
Source File: ResourceHelper.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #13
Source File: ParseHelper.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #14
Source File: AbstractCheckTestCase.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
public String getFileExtension() { return get(FileExtensionProvider.class).getFileExtensions().iterator().next(); }
Example #15
Source File: ReadOutWorkspaceConfiguration.java From n4js with Eclipse Public License 1.0 | 4 votes |
ReadOutWorkspaceConfiguration(FileSetupContext ctx, IN4JSCore core, FileExtensionProvider fileExtensionProvider) { super(ctx, core); this.fileExtensionProvider = fileExtensionProvider; }
Example #16
Source File: PropertyTester.java From sarl with Apache License 2.0 | 4 votes |
/** Change the file extension of the SARL script. * * @param fileExtensionProvider the file extension provider. */ @Inject public void setSarlFileExtension(FileExtensionProvider fileExtensionProvider) { this.fileExtensionProvider = fileExtensionProvider; }
Example #17
Source File: AbstractOutlineWorkbenchTest.java From xsemantics with Eclipse Public License 1.0 | 4 votes |
@Inject public void setFileExtensionProvider(FileExtensionProvider extensionProvider) { fileExtension = extensionProvider.getPrimaryFileExtension(); }
Example #18
Source File: AbstractXtextTestUtil.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * File extension associated with the instance's grammar. * * @return grammar specific file extension */ public String getFileExtension() { return get(FileExtensionProvider.class).getPrimaryFileExtension(); }