use of org.eclipse.ceylon.model.typechecker.model.Package in project ceylon by eclipse.
the class CeylonDocTool method collectAnnotationConstructors.
private void collectAnnotationConstructors() {
for (Module module : modules) {
for (Package pkg : getPackages(module)) {
for (Declaration decl : pkg.getMembers()) {
if (decl instanceof Function && decl.isAnnotation() && shouldInclude(decl)) {
Function annotationCtor = (Function) decl;
TypeDeclaration annotationType = annotationCtor.getTypeDeclaration();
List<Function> annotationConstructorList = annotationConstructors.get(annotationType);
if (annotationConstructorList == null) {
annotationConstructorList = new ArrayList<Function>();
annotationConstructors.put(annotationType, annotationConstructorList);
}
annotationConstructorList.add(annotationCtor);
}
}
}
}
}
use of org.eclipse.ceylon.model.typechecker.model.Package in project ceylon by eclipse.
the class ClassDoc method writeSubNavBar.
private void writeSubNavBar() throws IOException {
Package pkg = tool.getPackage(klass);
open("div class='sub-navbar'");
writeLinkSourceCode(klass);
open("div class='sub-navbar-inner'");
open("span class='sub-navbar-package'");
writeIcon(pkg);
writePackageNavigation(pkg);
close("span");
write("<br/>");
writeClassSignature();
// sub-navbar-inner
close("div");
open("div class='sub-navbar-menu'");
writeSubNavBarLink(linkRenderer().to(module).getUrl(), "Overview", 'O', "Jump to module documentation");
writeSubNavBarLink(linkRenderer().to(pkg).getUrl(), "Package", 'P', "Jump to package documentation");
if (hasInitializer()) {
writeSubNavBarLink("#section-initializer", "Initializer", 'z', "Jump to initializer");
}
if (!constructors.isEmpty()) {
writeSubNavBarLink("#section-constructors", "Constructors", 't', "Jump to constructors");
}
if (hasAnyAttributes()) {
writeSubNavBarLink("#section-attributes", "Attributes", 'A', "Jump to attributes");
}
if (hasAnyMethods()) {
writeSubNavBarLink("#section-methods", "Methods", 'M', "Jump to methods");
}
if (!innerAliases.isEmpty()) {
writeSubNavBarLink("#section-nested-aliases", "Nested Aliases", 'l', "Jump to nested aliases");
}
if (!innerInterfaces.isEmpty()) {
writeSubNavBarLink("#section-nested-interfaces", "Nested Interfaces", 'I', "Jump to nested interfaces");
}
if (!innerClasses.isEmpty()) {
writeSubNavBarLink("#section-nested-classes", "Nested Classes", 'C', "Jump to nested classes");
}
if (!innerExceptions.isEmpty()) {
writeSubNavBarLink("#section-nested-exceptions", "Nested Exceptions", 'E', "Jump to nested exceptions");
}
if (isObject()) {
writeSubNavBarLink(linkRenderer().to(klass.getContainer()).useAnchor(klass.getName()).getUrl(), "Singleton object declaration", '\0', "Jump to singleton object declaration");
}
// sub-navbar-menu
close("div");
// sub-navbar
close("div");
}
use of org.eclipse.ceylon.model.typechecker.model.Package in project ceylon by eclipse.
the class LinkRenderer method isLinkable.
private boolean isLinkable(Declaration decl) {
if (decl == null) {
return false;
}
if (decl.isParameter()) {
return true;
}
if (!ceylonDocTool.isIncludeNonShared()) {
if (!decl.isShared()) {
return false;
}
Scope c = decl.getContainer();
while (c != null) {
boolean isShared = true;
if (c instanceof Declaration) {
isShared = ((Declaration) c).isShared();
}
if (c instanceof Package) {
isShared = ((Package) c).isShared();
}
if (!isShared) {
return false;
}
c = c.getContainer();
}
}
return true;
}
use of org.eclipse.ceylon.model.typechecker.model.Package in project ceylon by eclipse.
the class LinkRenderer method processAnnotationParam.
private String processAnnotationParam(String text) {
if (text.equals("module")) {
Module mod = getCurrentModule();
if (mod != null) {
return processModule(mod);
}
}
if (text.startsWith("module ")) {
String modName = text.substring(7);
for (Module m : ceylonDocTool.getTypeChecker().getContext().getModules().getListOfModules()) {
if (m.getNameAsString().equals(modName)) {
return processModule(m);
}
}
}
if (text.equals("package")) {
Package pkg = getCurrentPackage();
if (pkg != null) {
return processPackage(pkg);
}
}
if (text.startsWith("package ")) {
String pkgName = text.substring(8);
for (Module m : ceylonDocTool.getTypeChecker().getContext().getModules().getListOfModules()) {
if (pkgName.startsWith(m.getNameAsString() + ".")) {
Package pkg = m.getPackage(pkgName);
if (pkg != null) {
return processPackage(pkg);
}
}
}
}
if (text.equals("interface")) {
Interface interf = getCurrentInterface();
if (interf != null) {
return processProducedType(interf.getType());
}
}
if (text.equals("class")) {
Class clazz = getCurrentClass();
if (clazz != null) {
return processProducedType(clazz.getType());
}
}
String declName;
Scope currentScope;
int pkgSeparatorIndex = text.indexOf("::");
if (pkgSeparatorIndex == -1) {
declName = text;
currentScope = resolveScope(scope);
} else {
String pkgName = text.substring(0, pkgSeparatorIndex);
declName = text.substring(pkgSeparatorIndex + 2, text.length());
currentScope = ceylonDocTool.getCurrentModule().getPackage(pkgName);
}
String[] declNames = declName.split("\\.");
Declaration currentDecl = null;
boolean isNested = false;
for (String currentDeclName : declNames) {
currentDecl = resolveDeclaration(currentScope, currentDeclName, isNested);
if (currentDecl != null) {
if (isValueWithTypeObject(currentDecl)) {
TypeDeclaration objectType = ((Value) currentDecl).getTypeDeclaration();
currentScope = objectType;
currentDecl = objectType;
} else {
currentScope = resolveScope(currentDecl);
}
isNested = true;
} else {
break;
}
}
// we can't link to parameters yet, unless they're toplevel
if (currentDecl != null && !isParameter(currentDecl)) {
if (currentDecl instanceof TypeDeclaration) {
return processProducedType(((TypeDeclaration) currentDecl).getType());
} else {
return processTypedDeclaration((TypedDeclaration) currentDecl);
}
} else {
return getUnresolvableLink(text);
}
}
use of org.eclipse.ceylon.model.typechecker.model.Package in project ceylon by eclipse.
the class CeylonDoc method writePackagesTable.
protected final void writePackagesTable(String title, List<Package> packages) throws IOException {
if (!packages.isEmpty()) {
openTable("section-packages", title, 2, true);
for (Package pkg : packages) {
writePackagesTableRow(pkg);
}
closeTable();
}
}
Aggregations