org.eclipse.xtext.documentation.IEObjectDocumentationProviderExtension Java Examples

The following examples show how to use org.eclipse.xtext.documentation.IEObjectDocumentationProviderExtension. 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: XtendValidator.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Check
public void checkJavaDocRefs(XtendMember member){
	if(isIgnored(IssueCodes.JAVA_DOC_LINKING_DIAGNOSTIC))
		return;
	List<INode> documentationNodes = ((IEObjectDocumentationProviderExtension) documentationProvider).getDocumentationNodes(member);
	for(INode node : documentationNodes){
		for(ReplaceRegion region : javaDocTypeReferenceProvider.computeTypeRefRegions(node)){
			String typeRefString = region.getText();
			if(typeRefString != null && typeRefString.length() > 0){
				IScope scope = scopeProvider.getScope(member, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
				IEObjectDescription candidate = scope.getSingleElement(qualifiedNameConverter.toQualifiedName(typeRefString));
				if(candidate == null){
					Severity severity = getIssueSeverities(getContext(), getCurrentObject()).getSeverity(IssueCodes.JAVA_DOC_LINKING_DIAGNOSTIC);
					if (severity != null)
						getChain().add(createDiagnostic(severity, "javaDoc: " + typeRefString + " cannot be resolved to a type", member, region.getOffset(), region.getLength(), IssueCodes.JAVA_DOC_LINKING_DIAGNOSTIC));
				}
			}
		}
	}
}
 
Example #2
Source File: DocumentationBuilderFragment.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public void generateRuntimeBindings(BindingFactory factory) {
	super.generateRuntimeBindings(factory);

	factory.addfinalTypeToType(getIDocumentationFormatter(), getDocumentationFormatterImpl());
	factory.addfinalTypeToTypeSingleton(getIEcoreDocumentationBuilder(), getEcoreDocumentationBuilderImpl());

	bindTypeReferences(factory,
			new TypeReference(IEObjectDocumentationProvider.class),
			getDocumentationProviderImpl(),
			getDocumentationProviderImplCustom());
	bindTypeReferences(factory,
			new TypeReference(IEObjectDocumentationProviderExtension.class),
			getDocumentationProviderImpl(),
			getDocumentationProviderImplCustom());
	bindTypeReferences(factory,
			new TypeReference(ISyntacticSequencer.class),
			getEcoreDocumentationSyntacticSequencer(),
			getEcoreDocumentationSyntacticSequencerCustom());
}
 
Example #3
Source File: JvmModelGenerator.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public void generateJavaDoc(final EObject it, final ITreeAppendable appendable, final GeneratorConfig config) {
  final DocumentationAdapter adapter = IterableExtensions.<DocumentationAdapter>head(Iterables.<DocumentationAdapter>filter(it.eAdapters(), DocumentationAdapter.class));
  if (((adapter != null) && (!StringExtensions.isNullOrEmpty(adapter.getDocumentation())))) {
    final Set<EObject> sourceElements = this.getSourceElements(it);
    if (((sourceElements.size() == 1) && (this.documentationProvider instanceof IEObjectDocumentationProviderExtension))) {
      final List<INode> documentationNodes = ((IEObjectDocumentationProviderExtension) this.documentationProvider).getDocumentationNodes(IterableExtensions.<EObject>head(sourceElements));
      this.addJavaDocImports(it, appendable, documentationNodes);
      this.generateDocumentation(adapter.getDocumentation(), documentationNodes, appendable, config);
    } else {
      this.generateDocumentation(adapter.getDocumentation(), CollectionLiterals.<INode>emptyList(), appendable, config);
    }
  }
}
 
Example #4
Source File: XtendFileHeaderProvider.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private boolean isTypeComment(final ILeafNode leafNode, final Resource resource) {
  final EObject content = IterableExtensions.<EObject>head(resource.getContents());
  if ((content instanceof XtendFile)) {
    final XtendTypeDeclaration type = IterableExtensions.<XtendTypeDeclaration>head(((XtendFile)content).getXtendTypes());
    if ((type != null)) {
      if ((this.documentationProvider instanceof IEObjectDocumentationProviderExtension)) {
        INode _head = IterableExtensions.<INode>head(((IEObjectDocumentationProviderExtension)this.documentationProvider).getDocumentationNodes(type));
        return Objects.equal(leafNode, _head);
      }
    }
  }
  return false;
}
 
Example #5
Source File: N4JSRuntimeModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Bind custom IEObjectDocumentationProviderExtension.
 */
public Class<? extends IEObjectDocumentationProviderExtension> bindIEObjectDocumentationProviderExtension() {
	return N4JSDocumentationProvider.class;
}
 
Example #6
Source File: TypeUsageCollector.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
private void setDocumentationProvider(IEObjectDocumentationProvider documentationProvider) {
	if(documentationProvider instanceof IEObjectDocumentationProviderExtension) 
		this.documentationProvider = (IEObjectDocumentationProviderExtension) documentationProvider;
}
 
Example #7
Source File: AbstractSARLRuntimeModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IEObjectDocumentationProviderExtension> bindIEObjectDocumentationProviderExtension() {
	return SarlDocumentationProvider.class;
}