@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<IEObjectDescription>() { @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(); } } }
@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); }
public DefaultResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy, IResourceScopeCache cache) { this.resource = resource; this.strategy = strategy; this.cache = cache; this.uri = getNormalizedURI(resource); }
/** {@inheritDoc} */ @Override public Set<Binding> getGuiceBindingsRt(final Grammar grammar) { final BindFactory bindFactory = new BindFactory(); final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getName(grammar); //$NON-NLS-1$ final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getName(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"); } } bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager"); //$NON-NLS-1$ return bindFactory.getBindings(); }
@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; }
@Override public void configure(Binder binder) { super.configure(binder); binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class); // https://github.com/Yakindu/statecharts/issues/1199 binder.bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.NullUnloader.class); }
@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); }
@Inject public GamlResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy, final IResourceScopeCache cache, final BuiltinGlobalScopeProvider provider) { super(resource, strategy, cache); this.provider = provider; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return KronusDefaultResourceDescriptionStrategy.class; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return XbaseResourceDescriptionStrategy.class; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return EcoreResourceDescriptionStrategy.class; }
/** * For testing. Uses a {@link org.eclipse.xtext.util.IResourceScopeCache.NullImpl}. */ public DefaultResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy) { this(resource, strategy, new IResourceScopeCache.NullImpl()); }
protected IResourceDescription internalGetResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy) { return new DefaultResourceDescription(resource, strategy, cache); }
public void setStrategy(IDefaultResourceDescriptionStrategy strategy) { this.strategy = strategy; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return XtextResourceDescriptionStrategy.class; }
@Override protected IResourceDescription createResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy) { return new ResourceDescription2(resource, strategy, getCache()); }
public ResourceDescription2(final Resource resource, final IDefaultResourceDescriptionStrategy strategy, final IResourceScopeCache cache) { super(resource, strategy, cache); this.strategy = strategy; }
@Override protected IResourceDescription internalGetResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy) { return new GamlResourceDescription(resource, strategy, getCache(), provider); }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return JenaResourceDescriptionStrategy.class; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return SadlResourceDescriptionStrategy.class; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return XRobotResourceDescriptionStrategy.class; }
public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return SmallJavaResourceDescriptionsStrategy.class; }
/** * Binds {@link IDefaultResourceDescriptionStrategy}. * * @return {@link ScopeResourceDescriptionStrategy} */ public Class<? extends IDefaultResourceDescriptionStrategy> bindIDefaultResourceDescriptionStrategy() { return ScopeResourceDescriptionStrategy.class; }