org.eclipse.xtext.ui.resource.IResourceSetProvider Java Examples

The following examples show how to use org.eclipse.xtext.ui.resource.IResourceSetProvider. 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: WorkbenchResolutionAdaptorRunTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void configure() {
  bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("com.avaloq.tools.dsl.TestLang"); //$NON-NLS-1$
  bind(IWorkbench.class).toInstance(mock(IWorkbench.class));
  bind(IResourceDescriptions.class).toInstance(mock(IResourceDescriptions.class));
  bind(IWorkspace.class).toInstance(mock(IWorkspace.class));

  bind(IModificationContextRegistry.class).toInstance(mock(IModificationContextRegistry.class));

  bind(WorkbenchMarkerResolutionGenerator.RegistryProvider.class).toInstance(mockRegistryProvider);
  bind(IStorage2UriMapper.class).toInstance(mockStorage2UriMapper);
  bind(ILanguageResourceHelper.class).toInstance(mockLanguageResourceHelper);
  bind(IssueResolutionProvider.class).toInstance(mockIssueResolutionProvider);

  bind(IResourceSetProvider.class).toInstance(mockResourceSetProvider);
  bind(IDirtyStateManager.class).toInstance(mockDirtyStateManager);
}
 
Example #2
Source File: PackageJSONTestHelper.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Loads the given project description file (using {@link Resource}) and applies
 * {@code projectDescriptionAdjustments} to the {@link JSONObject} to be found in the root of the given
 * {@code package.json} project description file.
 *
 * After the adjustments have been applied, the resource is saved.
 */
public void updateProjectDescription(IFile projectDescriptionFile,
		Consumer<JSONObject> projectDescriptionAdjustments) throws IOException {
	final URI uri = URI.createPlatformResourceURI(projectDescriptionFile.getFullPath().toString(), true);
	final ResourceSet resourceSet = getInjector().getInstance(IResourceSetProvider.class)
			.get(projectDescriptionFile.getProject());
	final Resource resource = resourceSet.getResource(uri, true);

	final JSONObject root = PackageJSONTestUtils.getPackageJSONRoot(resource);
	projectDescriptionAdjustments.accept(root);
	resource.save(null);
}
 
Example #3
Source File: TestsStandaloneSetup.java    From joynr with Apache License 2.0 5 votes vote down vote up
private Module getStaticTestModule() {
    return new AbstractModule() {

        @Override
        protected void configure() {
            bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
        }
    };
}
 
Example #4
Source File: ParallelResourceLoader.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
public ParallelResourceLoader(final IResourceSetProvider resourceSetProvider, final Sorter sorter, final int nThreads, final int queueSize) {
  super(resourceSetProvider, sorter);
  this.nThreads = nThreads;
  this.queueSize = queueSize;
  this.timeout = MAX_WAIT_TIME;
  String slowLoadingTimeString = System.getProperty(SLOW_LOADING_TIME_PROPERTY);
  try {
    slowLoadingTime = Long.parseLong(slowLoadingTimeString);
  } catch (NumberFormatException e) {
    if (slowLoadingTimeString != null) {
      LOGGER.warn(String.format("Slow loading timeout property '%s' is set to invalid value '%s'. Using default value of %d ms instead.", SLOW_LOADING_TIME_PROPERTY, slowLoadingTimeString, SLOW_LOADING_TIME_DEFAULT)); //$NON-NLS-1$
    }
    slowLoadingTime = SLOW_LOADING_TIME_DEFAULT;
  }
}
 
Example #5
Source File: StratumBreakpointAdapterFactory.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected String getClassNamePattern(IResource res) {
	if (!(res instanceof IStorage))
		return null;
	URI uri = uriMapper.getUri((IStorage) res);
	IResourceServiceProvider provider = providerRegistry.getResourceServiceProvider(uri);
	if (provider == null)
		return null;
	IResourceSetProvider resourceSetProvider = provider.get(IResourceSetProvider.class);
	ResourceSet set = resourceSetProvider.get(res.getProject());
	Resource resource = set.getResource(uri, true);
	if (resource instanceof XtextResource) {
		return getClassNamePattern((XtextResource) resource);
	}
	return null;
}
 
Example #6
Source File: SharedCommonTypesModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void configure(Binder binder) {
	binder.bind(IEObjectHoverProvider.class).to(JdtHoverProvider.class);
	binder.bind(IEObjectHoverDocumentationProvider.class).to(JdtHoverDocumentationProvider.class);
	binder.bind(IResourceServiceProvider.class).to(SharedCommonTypesResourceServiceProvider.class);
	binder.bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
	binder.bindConstant().annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).to("java");

	binder.bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
	binder.bind(ICopyQualifiedNameService.class).to(DefaultCopyQualifiedNameService.class);
	binder.bind(IJvmTypeProvider.Factory.class).to(JdtTypeProviderFactory.class);
	binder.bind(IRenameRefactoringProvider.class).to(DefaultRenameRefactoringProvider.class);
	binder.bind(AbstractRenameProcessor.class).to(JvmMemberRenameProcessor.class);
	binder.bind(IRenameStrategy.Provider.class).to(JvmMemberRenameStrategy.Provider.class);
	binder.bind(RefactoringResourceSetProvider.class).to(JvmRefactoringResourceSetProvider.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("Java");

	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
			.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
			.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
			.to(IBuilderState.class);

	binder.bind(IWorkspaceRoot.class).toInstance(ResourcesPlugin.getWorkspace().getRoot());
	binder.bind(ITraceForStorageProvider.class).to(TraceForStorageProvider.class);

	binder.bind(IReferenceUpdater.class).to(NullReferenceUpdater.class);
}
 
Example #7
Source File: TaskGenerateAdoc.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
TaskGenerateAdoc(JSDoc2ADocSpecProcessor jsDoc2SpecProcessor, IResourceSetProvider resourceSetProvider,
		IN4JSCore n4jsCore, IStructuredSelection selection, SpecConfigAdocPage configAdocPage,
		SpecProcessPage processAdocPage) {

	this.jsDoc2SpecProcessor = jsDoc2SpecProcessor;
	this.resourceSetProvider = resourceSetProvider;
	this.n4JSCore = n4jsCore;
	this.selection = selection;
	this.configAdocPage = configAdocPage;
	this.processAdocPage = processAdocPage;
}
 
Example #8
Source File: BuildScopeAwareParallelLoader.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IResourceSetProvider getResourceSetProvider() {
	if (resourceSetProvider == null) {
		throw new IllegalStateException();
	}
	return resourceSetProvider;
}
 
Example #9
Source File: ForwardingResourceAccess.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Configure the delegate.
 *
 * @param delegate
 *            the delegate to use.
 */

public ForwardingResourceAccess(IReferenceFinder.IResourceAccess delegate,
		IResourceSetProvider resourceSetProvider) {
	this.delegate = delegate;
	this.resourceSetProvider = resourceSetProvider;
}
 
Example #10
Source File: ProjectTestsUtils.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private static ResourceSet createResourceSet(IProject project) {
	return N4JSActivator.getInstance().getInjector(N4JSActivator.ORG_ECLIPSE_N4JS_N4JS)
			.getInstance(IResourceSetProvider.class).get(project);
}
 
Example #11
Source File: TaxonomyUiModule.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
	return SimpleResourceSetProvider.class;
}
 
Example #12
Source File: GamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
	return SimpleResourceSetProvider.class;
}
 
Example #13
Source File: AbstractN4JSContentAssistPluginUITest.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private XtextResourceSet getResourceSet() {
	IResourceSetProvider resourceSetProvider = get(IResourceSetProvider.class);
	ResourceSet result = resourceSetProvider.get(getJSProject());
	return (XtextResourceSet) result;
}
 
Example #14
Source File: BuildScopeAwareParallelLoaderProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IResourceSetProvider getResourceSetProvider() {
	return new ProviderOfEmptyResourceSet();
}
 
Example #15
Source File: XtendCopyQualifiedNameServiceTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public ResourceSet getResourceSet() {
  return this.getInjector().<IResourceSetProvider>getInstance(IResourceSetProvider.class).get(this.testHelper.getProject());
}
 
Example #16
Source File: XtendHoverGenericsResolverTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public ResourceSet getResourceSet() {
  return this.getInjector().<IResourceSetProvider>getInstance(IResourceSetProvider.class).get(this.testHelper.getProject());
}
 
Example #17
Source File: XtendHoverSignatureProviderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public ResourceSet getResourceSet() {
  return this.getInjector().<IResourceSetProvider>getInstance(IResourceSetProvider.class).get(this.testHelper.getProject());
}
 
Example #18
Source File: XtendHoverDocumentationProviderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public ResourceSet getResourceSet() {
  return this.getInjector().<IResourceSetProvider>getInstance(IResourceSetProvider.class).get(this.testHelper.getProject());
}
 
Example #19
Source File: XtextBuilder.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceSetProvider getResourceSetProvider() {
	return resourceSetProvider;
}
 
Example #20
Source File: ProjectOpenedOrClosedListener.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceSetProvider getResourceSetProvider() {
	return resourceSetProvider;
}
 
Example #21
Source File: BuildScopeAwareParallelLoader.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
BuiltInTypesReferencingResourceSetProvider(ResourceSet parent, IResourceSetProvider delegate) {
	this.parent = parent;
	this.delegate = delegate;
}
 
Example #22
Source File: SerialResourceLoader.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public SerialResourceLoader(IResourceSetProvider resourceSetProvider, Sorter sorter) {
	super(resourceSetProvider, sorter);
}
 
Example #23
Source File: ResourceLoaderProviders.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceSetProvider getResourceSetProvider() {
	return resourceSetProvider;
}
 
Example #24
Source File: ParallelResourceLoader.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ParallelResourceLoader(IResourceSetProvider resourceSetProvider, Sorter sorter, int nThreads, int queueSize) {
	super(resourceSetProvider, sorter);
	this.nThreads = nThreads;
	this.queueSize = queueSize;
	this.timeout = MAX_WAIT_TIME;
}
 
Example #25
Source File: AbstractResourceLoader.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceSetProvider getResourceSetProvider() {
	return resourceSetProvider;
}
 
Example #26
Source File: AbstractResourceLoader.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public AbstractResourceLoader(IResourceSetProvider resourceSetProvider, Sorter sorter) {
	this.resourceSetProvider = resourceSetProvider;
	this.sorter = sorter;
}
 
Example #27
Source File: BuildScopeAwareParallelLoader.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
BuildScopeAwareParallelLoader(IResourceSetProvider resourceSetProvider, Sorter sorter, int nThreads,
		int queueSize) {
	super(resourceSetProvider, sorter, nThreads, queueSize);
	this.nThreads = nThreads;
}
 
Example #28
Source File: ResourceForIEditorInputFactory.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected IResourceSetProvider getResourceSetProvider() {
	return resourceSetProvider;
}
 
Example #29
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
	return XtextResourceSetProvider.class;
}
 
Example #30
Source File: EmfUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
	return SimpleResourceSetProvider.class;
}