use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.
the class N4ClassDeclarationImpl method getExportedName.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getExportedName() {
boolean _isExported = this.isExported();
if (_isExported) {
EObject _eContainer = this.eContainer();
final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
boolean _isDefaultExport = exportDecl.isDefaultExport();
if (_isDefaultExport) {
return "default";
}
final ExportableElement me = this;
String _switchResult = null;
boolean _matched = false;
if (me instanceof NamedElement) {
_matched = true;
_switchResult = ((NamedElement) me).getName();
}
if (!_matched) {
if (me instanceof IdentifiableElement) {
_matched = true;
_switchResult = ((IdentifiableElement) me).getName();
}
}
return _switchResult;
}
return null;
}
use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.
the class ExportDeclarationImpl method basicSetExportedElement.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExportedElement(ExportableElement newExportedElement, NotificationChain msgs) {
ExportableElement oldExportedElement = exportedElement;
exportedElement = newExportedElement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, N4JSPackage.EXPORT_DECLARATION__EXPORTED_ELEMENT, oldExportedElement, newExportedElement);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.
the class N4JSDocumentationProvider method getDocumentationNodes.
/**
* Returns documentation nodes for N4JS AST and type elements (in which case the method returns the nodes of the
* corresponding AST element). If the AST element has no documentation nodes itself, but is an exportable element,
* then the documentation of the export statement is returned if present.
*/
@Override
public List<INode> getDocumentationNodes(EObject object) {
final EObject astNode = N4JSASTUtils.getCorrespondingASTNode(object);
if (astNode != null) {
List<INode> nodes = super.getDocumentationNodes(astNode);
if (nodes.isEmpty() && astNode instanceof VariableDeclaration) {
TypeRef typeRef = ((VariableDeclaration) astNode).getDeclaredTypeRef();
if (typeRef != null) {
nodes = getDocumentationNodes(typeRef);
}
}
if (nodes.isEmpty()) {
if (astNode instanceof ExportedVariableDeclaration && astNode.eContainer() instanceof ExportedVariableStatement) {
EList<VariableDeclaration> decls = ((ExportedVariableStatement) astNode.eContainer()).getVarDecl();
if (decls.size() == 1) {
return getDocumentationNodes(astNode.eContainer());
}
}
if (astNode instanceof ExportableElement && astNode.eContainer() instanceof ExportDeclaration) {
nodes = super.getDocumentationNodes(astNode.eContainer());
}
}
if (nodes.isEmpty()) {
// failure case, was ASI grabbing the doc?
// backward search for first non-hidden element, over-stepping if it is a LeafNodeWithSyntaxError from
// ASI.
ICompositeNode ptNodeOfASTNode = NodeModelUtils.getNode(astNode);
LeafNode lNode = searchLeafNodeDocumentation(ptNodeOfASTNode);
if (lNode != null) {
return Collections.<INode>singletonList(lNode);
}
}
return nodes;
}
return super.getDocumentationNodes(object);
}
use of org.eclipse.n4js.n4JS.ExportableElement in project n4js by eclipse.
the class N4TypeDeclarationImpl method getExportedName.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getExportedName() {
boolean _isExported = this.isExported();
if (_isExported) {
EObject _eContainer = this.eContainer();
final ExportDeclaration exportDecl = ((ExportDeclaration) _eContainer);
boolean _isDefaultExport = exportDecl.isDefaultExport();
if (_isDefaultExport) {
return "default";
}
final ExportableElement me = this;
String _switchResult = null;
boolean _matched = false;
if (me instanceof NamedElement) {
_matched = true;
_switchResult = ((NamedElement) me).getName();
}
if (!_matched) {
if (me instanceof IdentifiableElement) {
_matched = true;
_switchResult = ((IdentifiableElement) me).getName();
}
}
return _switchResult;
}
return null;
}
Aggregations