use of org.eclipse.n4js.n4JS.NamedElement in project n4js by eclipse.
the class FunctionDeclarationImpl 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.NamedElement in project n4js by eclipse.
the class ExportedVariableStatementImpl 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.NamedElement in project n4js by eclipse.
the class AnnotationListImpl 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.NamedElement in project n4js by eclipse.
the class ExportableElementImpl 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.NamedElement in project n4js by eclipse.
the class HyperlinkXpectMethod method getTargetDescription.
private String getTargetDescription(XtextResource resource, IHyperlink hyperlink) {
final StringBuffer sb = new StringBuffer();
// append hyperlink text. Only consider the element name and ignore the qualified part.
String hyperlinkText = hyperlink.getHyperlinkText();
hyperlinkText = hyperlinkText.substring(hyperlinkText.lastIndexOf('.') + 1);
if (hyperlinkText != null)
sb.append(hyperlinkText);
else
sb.append("<no hyperlink text>");
// append description of target element (path from the element to the root of the AST)
final EObject target = getTarget(resource, hyperlink);
if (target != null) {
// build chain of ancestor AST elements
sb.append(": ");
final int startLen = sb.length();
EObject currTarget = target;
while (currTarget != null) {
if (currTarget instanceof NamedElement || currTarget instanceof IdentifiableElement) {
if (sb.length() > startLen)
sb.append(" in ");
String name = currTarget instanceof NamedElement ? ((NamedElement) currTarget).getName() : ((IdentifiableElement) currTarget).getName();
if (name == null || name.trim().length() == 0)
name = "<unnamed>";
else
name = "\"" + name + "\"";
sb.append(name + "(" + currTarget.eClass().getName() + ")");
}
currTarget = currTarget.eContainer();
}
// add URI of resource
final URI targetResURI = target.eResource() != null ? target.eResource().getURI() : null;
final String fname = targetResURI != null ? targetResURI.lastSegment() : null;
if (fname != null && fname.trim().length() > 0) {
sb.append(" in file ");
sb.append(fname);
}
}
return sb.toString();
}
Aggregations