Search in sources :

Example 11 with Package

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");
}
Also used : Package(com.redhat.ceylon.model.typechecker.model.Package)

Example 12 with Package

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();
    }
}
Also used : Package(com.redhat.ceylon.model.typechecker.model.Package)

Example 13 with Package

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;
}
Also used : LazyPackage(com.redhat.ceylon.model.loader.model.LazyPackage) Package(com.redhat.ceylon.model.typechecker.model.Package) LazyPackage(com.redhat.ceylon.model.loader.model.LazyPackage)

Example 14 with Package

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();
}
Also used : Package(com.redhat.ceylon.model.typechecker.model.Package) Module(com.redhat.ceylon.model.typechecker.model.Module) File(java.io.File) TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration)

Example 15 with Package

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);
                }
            }
        }
    }
}
Also used : Function(com.redhat.ceylon.model.typechecker.model.Function) Package(com.redhat.ceylon.model.typechecker.model.Package) Declaration(com.redhat.ceylon.model.typechecker.model.Declaration) TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration) Module(com.redhat.ceylon.model.typechecker.model.Module) TypeDeclaration(com.redhat.ceylon.model.typechecker.model.TypeDeclaration)

Aggregations

Package (com.redhat.ceylon.model.typechecker.model.Package)47 TypeDeclaration (com.redhat.ceylon.model.typechecker.model.TypeDeclaration)18 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)17 Module (com.redhat.ceylon.model.typechecker.model.Module)16 Scope (com.redhat.ceylon.model.typechecker.model.Scope)16 TypedDeclaration (com.redhat.ceylon.model.typechecker.model.TypedDeclaration)14 ClassOrInterface (com.redhat.ceylon.model.typechecker.model.ClassOrInterface)11 ArrayList (java.util.ArrayList)10 Class (com.redhat.ceylon.model.typechecker.model.Class)8 Interface (com.redhat.ceylon.model.typechecker.model.Interface)7 TypeParameter (com.redhat.ceylon.model.typechecker.model.TypeParameter)6 Value (com.redhat.ceylon.model.typechecker.model.Value)6 PhasedUnit (com.redhat.ceylon.compiler.typechecker.context.PhasedUnit)5 Function (com.redhat.ceylon.model.typechecker.model.Function)5 FunctionOrValue (com.redhat.ceylon.model.typechecker.model.FunctionOrValue)5 Type (com.redhat.ceylon.model.typechecker.model.Type)4 JCNewClass (com.sun.tools.javac.tree.JCTree.JCNewClass)4 CeylonCompilationUnit (com.redhat.ceylon.compiler.java.codegen.CeylonCompilationUnit)3 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)3 File (java.io.File)3