use of com.redhat.ceylon.model.typechecker.model.Package in project ceylon-compiler by ceylon.
the class CeylonDoc method writePackageNavigation.
protected final void writePackageNavigation(Package pkg) throws IOException {
open("span class='package-identifier'");
if (!module.isDefault()) {
List<String> moduleNames = module.getName();
List<String> pkgNames = pkg.getName();
List<String> subpkgNames = pkgNames.subList(moduleNames.size(), pkgNames.size());
linkRenderer().to(module.getRootPackage()).write();
if (!subpkgNames.isEmpty()) {
StringBuilder subpkgNameBuilder = new StringBuilder(module.getNameAsString());
for (String subpkgName : subpkgNames) {
subpkgNameBuilder.append(".").append(subpkgName);
Package subpkg = module.getDirectPackage(subpkgNameBuilder.toString());
write(".");
if (subpkg != null) {
linkRenderer().to(subpkg).useCustomText(subpkgName).write();
} else {
write(subpkgName);
}
}
}
} else {
linkRenderer().to(pkg).write();
}
close("span");
}
use of com.redhat.ceylon.model.typechecker.model.Package in project ceylon-compiler by ceylon.
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();
}
}
use of com.redhat.ceylon.model.typechecker.model.Package in project ceylon-compiler by ceylon.
the class CeylonDocModuleManager method createPackage.
@Override
public Package createPackage(String pkgName, Module module) {
// never create a lazy package for ceylon.language when we're documenting it
if ((pkgName.equals(AbstractModelLoader.CEYLON_LANGUAGE) || pkgName.startsWith(AbstractModelLoader.CEYLON_LANGUAGE + ".")) && isModuleLoadedFromSource(AbstractModelLoader.CEYLON_LANGUAGE))
return super.createPackage(pkgName, module);
final Package pkg = new LazyPackage(getModelLoader());
List<String> name = pkgName.isEmpty() ? Collections.<String>emptyList() : splitModuleName(pkgName);
pkg.setName(name);
if (module != null) {
module.getPackages().add(pkg);
pkg.setModule(module);
}
return pkg;
}
use of com.redhat.ceylon.model.typechecker.model.Package in project ceylon-compiler by ceylon.
the class CeylonDocTool method getObjectFile.
private File getObjectFile(Object modPgkOrDecl) throws IOException {
final File file;
if (modPgkOrDecl instanceof TypeDeclaration) {
TypeDeclaration type = (TypeDeclaration) modPgkOrDecl;
String filename = getFileName(type);
file = new File(getFolder(type), filename);
} else if (modPgkOrDecl instanceof Module) {
String filename = "index.html";
file = new File(getApiOutputFolder((Module) modPgkOrDecl), filename);
} else if (modPgkOrDecl instanceof Package) {
String filename = "index.html";
file = new File(getFolder((Package) modPgkOrDecl), filename);
} else {
throw new RuntimeException(CeylondMessages.msg("error.unexpected", modPgkOrDecl));
}
return file.getCanonicalFile();
}
use of com.redhat.ceylon.model.typechecker.model.Package in project ceylon-compiler by ceylon.
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);
}
}
}
}
}
Aggregations