org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy Java Examples

The following examples show how to use org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy. 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: SCTXtextIntegrationModule.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void configure(Binder binder) {
	binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("sct");
	binder.bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
	binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class);
	binder.bind(org.eclipse.jface.viewers.ILabelProvider.class)
			.annotatedWith(org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider.class)
			.to(DefaultDescriptionLabelProvider.class);
	binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
	
	binder.bind(MarkerCreator.class).to(SCTMarkerCreator.class);
	binder.bind(MarkerTypeProvider.class).to(SCTMarkerTypeProvider.class);
	binder.bind(IDiagnosticConverter.class).to(SCTDiagnosticConverterImpl.class);
	binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(SCTFileEditorOpener.class);
	
	binder.bind(IMarkerContributor.class).to(TaskMarkerContributor.class);
	binder.bind(ITaskFinder.class).to(DomainSpecificTaskFinder.class);
	binder.bind(TaskMarkerCreator.class).to(SCTTaskMarkerCreator.class);
	binder.bind(TaskMarkerTypeProvider.class).to(SCTTaskMarkerTypeProvider.class);
}
 
Example #2
Source File: GlobalObjectScope.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void buildMap(Resource resource, Map<QualifiedName, IEObjectDescription> elements) {
	IDefaultResourceDescriptionStrategy strategy = ((XtextResource) resource).getResourceServiceProvider()
			.get(IDefaultResourceDescriptionStrategy.class);
	TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(resource, false);
	IAcceptor<IEObjectDescription> acceptor = new IAcceptor<>() {
		@Override
		public void accept(IEObjectDescription description) {
			elements.put(description.getQualifiedName(), description);
		}
	};
	while (allProperContents.hasNext()) {
		EObject content = allProperContents.next();
		if (!strategy.createEObjectDescriptions(content, acceptor)) {
			allProperContents.prune();
		}
	}
}
 
Example #3
Source File: GamlResourceDescription.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public GamlResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy,
		final IResourceScopeCache cache, final BuiltinGlobalScopeProvider provider) {
	super(resource, strategy, cache);
	this.provider = provider;

}
 
Example #4
Source File: GamlRuntimeModule.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configure(final Binder binder) {
	super.configure(binder);
	staticInitialize();
	// binder.bind(ExpressionDescriptionBuilder.class);
	// binder.bind(IDocManager.class).to(GamlResourceDocumenter.class);
	// binder.bind(GamlSyntacticConverter.class);
	binder.bind(IDefaultResourceDescriptionStrategy.class).to(GamlResourceDescriptionStrategy.class);
	binder.bind(IQualifiedNameConverter.class).to(GamlNameConverter.class);
	binder.bind(IResourceDescription.Manager.class).to(GamlResourceDescriptionManager.class);
	// binder.bind(IOutputConfigurationProvider.class).to(GamlOutputConfigurationProvider.class);
	binder.bind(IResourceValidator.class).to(GamlResourceValidator.class);
	binder.bind(ErrorToDiagnoticTranslator.class);

}
 
Example #5
Source File: DefaultResourceDescription.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public DefaultResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy,
			IResourceScopeCache cache) {
	this.resource = resource;
	this.strategy = strategy;
	this.cache = cache;
	this.uri = getNormalizedURI(resource);
}
 
Example #6
Source File: AbstractCachingResourceDescriptionManager.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IResourceDescription internalGetResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy) {
  IResourceDescription result = getCache().get(CACHE_KEY, resource, new Provider<IResourceDescription>() {
    @Override
    public IResourceDescription get() {
      return createResourceDescription(resource, descriptionStrategy);
    }
  });
  return result;
}
 
Example #7
Source File: ResourceDescriptionStrategyFragment.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void contributeRuntimeGuiceBindings() {
  final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory();
  if ((this.isGenerateStub() || this.isGenerateXtendStub())) {
    bindingFactory.addTypeToType(TypeReference.typeRef(IDefaultResourceDescriptionStrategy.class), this.getStubResourceDescriptionStrategyClass());
  } else {
    bindingFactory.addTypeToType(TypeReference.typeRef(IDefaultResourceDescriptionStrategy.class), this.getDefaultResourceDescriptionStrategyClass());
  }
  bindingFactory.contributeTo(this.getLanguage().getRuntimeGenModule());
}
 
Example #8
Source File: ExportFragment.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bindFactory = new BindFactory();
  final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getSimpleName(grammar); //$NON-NLS-1$
  final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getSimpleName(grammar); //$NON-NLS-1$

  ExportModel m = getModel(grammar);
  if (m != null) {
    bindFactory.addTypeToType(IQualifiedNameProvider.class.getName(), namingPrefix + "ExportedNamesProvider"); //$NON-NLS-1$
    if (!m.getInterfaces().isEmpty()) {
      bindFactory.addTypeToType(IFingerprintComputer.class.getName(), resourcePrefix + "FingerprintComputer"); //$NON-NLS-1$
    }
    if (!m.getExports().isEmpty()) {
      bindFactory.addTypeToType(IDefaultResourceDescriptionStrategy.class.getName(), resourcePrefix + "ResourceDescriptionStrategy"); //$NON-NLS-1$
    }
    if (Iterables.any(m.getExports(), new Predicate<Export>() {
      @Override
      public boolean apply(final Export input) {
        return input.isFingerprint() && input.getFragmentAttribute() != null;
      }
    })) {
      bindFactory.addTypeToType(IFragmentProvider.class.getName(), resourcePrefix + "FragmentProvider"); //$NON-NLS-1$
    }
  }
  bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager"); //$NON-NLS-1$
  return bindFactory.getBindings();
}
 
Example #9
Source File: EcoreRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return EcoreResourceDescriptionStrategy.class;
}
 
Example #10
Source File: ProcResourceDescriptionManager.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public void setStrategy(IDefaultResourceDescriptionStrategy strategy) {
	super.setStrategy(strategy);
	this.localStrategy = strategy;
}
 
Example #11
Source File: ProcResourceDescriptionManager.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected IResourceDescription internalGetResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy) {
       return new InEditoProcResourceDescription(resource, (DefaultResourceDescriptionStrategy) strategy, getCache());
}
 
Example #12
Source File: AbstractSARLRuntimeModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return XtendResourceDescriptionStrategy.class;
}
 
Example #13
Source File: GamlResourceDescriptionManager.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected IResourceDescription internalGetResourceDescription(final Resource resource,
		final IDefaultResourceDescriptionStrategy strategy) {
	return new GamlResourceDescription(resource, strategy, getCache(), provider);
}
 
Example #14
Source File: ResourceDescription2.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public ResourceDescription2(final Resource resource, final IDefaultResourceDescriptionStrategy strategy, final IResourceScopeCache cache) {
  super(resource, strategy, cache);
  this.strategy = strategy;
}
 
Example #15
Source File: AbstractCachingResourceDescriptionManager.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IResourceDescription createResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy) {
  return new ResourceDescription2(resource, strategy, getCache());
}
 
Example #16
Source File: XtextRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return XtextResourceDescriptionStrategy.class;
}
 
Example #17
Source File: DefaultResourceDescriptionManager.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void setStrategy(IDefaultResourceDescriptionStrategy strategy) {
	this.strategy = strategy;
}
 
Example #18
Source File: DefaultResourceDescriptionManager.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected IResourceDescription internalGetResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy) {
	return new DefaultResourceDescription(resource, strategy, cache);
}
 
Example #19
Source File: DefaultResourceDescription.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * For testing. Uses a {@link org.eclipse.xtext.util.IResourceScopeCache.NullImpl}.
 */
public DefaultResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy) {
	this(resource, strategy, new IResourceScopeCache.NullImpl());
}
 
Example #20
Source File: XtendResourceDescriptionManager.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public IResourceDescription createResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy) {
  IResourceScopeCache _cache = this.getCache();
  return new XtendResourceDescription(resource, strategy, _cache, this.typeResolver, this.nameConverter);
}
 
Example #21
Source File: XtendResourceDescription.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public XtendResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy, final IResourceScopeCache cache, final IBatchTypeResolver typeResolver, final IQualifiedNameConverter nameConverter) {
  super(resource, strategy, cache);
  this.typeResolver = typeResolver;
  this.nameConverter = nameConverter;
}
 
Example #22
Source File: XtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return XtendResourceDescriptionStrategy.class;
}
 
Example #23
Source File: EcoreRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return EcoreResourceDescriptionStrategy.class;
}
 
Example #24
Source File: DefaultXbaseRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return XbaseResourceDescriptionStrategy.class;
}
 
Example #25
Source File: JSONRuntimeModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** Bind extension based resource description strategy for JSON resources. */
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
	return JSONResourceDescriptionStrategy.class;
}
 
Example #26
Source File: ScopeRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Binds {@link IDefaultResourceDescriptionStrategy}.
 *
 * @return {@link ScopeResourceDescriptionStrategy}
 */
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() {
  return ScopeResourceDescriptionStrategy.class;
}