Java Code Examples for org.eclipse.xtext.xbase.compiler.DocumentationAdapter#getDocumentation()

The following examples show how to use org.eclipse.xtext.xbase.compiler.DocumentationAdapter#getDocumentation() . 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: XbaseHoverDocumentationProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected String resolveDocumentation(EObject object) {
	String documentation = documentationProvider.getDocumentation(object);
	if (documentation != null) {
		return documentation;
	}
	DocumentationAdapter adapter = getDocumentationAdapter(object);
	if (adapter != null) {
		documentation = adapter.getDocumentation();
	}
	if (documentation != null) {
		return documentation;
	}
	EObject primarySourceElement = associations.getPrimarySourceElement(object);
	if (primarySourceElement == null) {
		return null;
	}
	return documentationProvider.getDocumentation(primarySourceElement);
}
 
Example 2
Source File: SarlDocumentationProvider.java    From sarl with Apache License 2.0 6 votes vote down vote up
public String getDocumentation(EObject o) {
	// Get the documentation from the Xtext grammar hidden nodes.
	String text = super.getDocumentation(o);
	if (text == null) {
		// Get the grammar from the Ecore model element.
		if (o instanceof EModelElement) {
			text = EcoreUtil.getDocumentation((EModelElement) o);
		}
		if (text == null) {
			// Get the grammar from the code builder extension.
			DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getAdapter(
					o.eAdapters(), DocumentationAdapter.class);
			if (adapter != null) {
				return adapter.getDocumentation();
			}
		}
	}
	return text;
}
 
Example 3
Source File: JvmTypesBuilder.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Retrieves the attached documentation for the given source element.
 * By default this implementation provides the text of a multi line comment preceding the definition of the given source element.
 * 
 * @return the documentation of the given source, <code>null</code> if source is <code>null</code> or doesn't have any documentation.
 */
/* @Nullable */
public String getDocumentation(/* @Nullable */ EObject source) {
	if (source == null)
		return null;
	if (source instanceof JvmIdentifiableElement) {
		DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getAdapter(source.eAdapters(), DocumentationAdapter.class);
		if (adapter != null)
			return adapter.getDocumentation();
	}
	String documentation = documentationProvider.getDocumentation(source);
	return documentation;
}
 
Example 4
Source File: XtendHoverDocumentationProvider.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected String resolveDocumentationForJvmElement(EObject jvmElement) {
	String documentation = documentationProvider.getDocumentation(jvmElement);
	if (documentation != null) {
		return documentation;
	}
	DocumentationAdapter adapter = getDocumentationAdapter(jvmElement);
	return adapter == null ? null : adapter.getDocumentation();
}
 
Example 5
Source File: JvmMemberDeclarationImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String getDocComment() {
  Adapter _adapter = EcoreUtil.getAdapter(this.getDelegate().eAdapters(), DocumentationAdapter.class);
  final DocumentationAdapter adapter = ((DocumentationAdapter) _adapter);
  String _documentation = null;
  if (adapter!=null) {
    _documentation=adapter.getDocumentation();
  }
  return _documentation;
}