Search in sources :

Example 26 with AbsNature

use of org.absmodels.abs.plugin.builder.AbsNature in project abstools by abstools.

the class ABSContentOutlineProvider method getParent.

@Override
public Object getParent(Object element) {
    if (element instanceof InternalASTNode<?>) {
        InternalASTNode<?> node = (InternalASTNode<?>) element;
        AbsNature nature = node.getNature();
        ASTNode<?> parent = node.getASTNode().getParent();
        assert nature != null;
        /* Root nodes don't have parents, so there's nothing to wrap (ABSTools #301) */
        if (parent == null) {
            assert node.getASTNode() instanceof Model : element;
            return null;
        }
        return new InternalASTNode<ASTNode<?>>(parent, nature);
    }
    return null;
}
Also used : InternalASTNode(org.absmodels.abs.plugin.util.InternalASTNode) AbsNature(org.absmodels.abs.plugin.builder.AbsNature)

Example 27 with AbsNature

use of org.absmodels.abs.plugin.builder.AbsNature in project abstools by abstools.

the class ABSContentOutlineProvider method getChildrenOf.

private Object[] getChildrenOf(IProject project) {
    if (project.isOpen()) {
        AbsNature nature = UtilityFunctions.getAbsNature(project);
        java.util.List<Object> children = new ArrayList<Object>();
        children.add(nature.getPackages());
        children.addAll(Arrays.asList(baseProvider.getChildren(project)));
        return children.toArray();
    }
    return EMPTY_OBJECT_ARRAY;
}
Also used : ArrayList(java.util.ArrayList) AbsNature(org.absmodels.abs.plugin.builder.AbsNature)

Aggregations

AbsNature (org.absmodels.abs.plugin.builder.AbsNature)27 IProject (org.eclipse.core.resources.IProject)10 Model (abs.frontend.ast.Model)9 ModuleDecl (abs.frontend.ast.ModuleDecl)9 UtilityFunctions.getAbsNature (org.absmodels.abs.plugin.util.UtilityFunctions.getAbsNature)8 ArrayList (java.util.ArrayList)6 AbsJobException (org.absmodels.abs.plugin.exceptions.AbsJobException)6 InternalASTNode (org.absmodels.abs.plugin.util.InternalASTNode)6 CompilationUnit (abs.frontend.ast.CompilationUnit)4 IFile (org.eclipse.core.resources.IFile)4 CoreException (org.eclipse.core.runtime.CoreException)4 WrongProgramArgumentException (abs.common.WrongProgramArgumentException)3 DeltaModellingException (abs.frontend.delta.DeltaModellingException)3 IOException (java.io.IOException)3 LocationType (abs.frontend.typechecker.locationtypes.LocationType)2 InferMain (abs.frontend.typechecker.locationtypes.infer.InferMain)2 LocationTypeVariable (abs.frontend.typechecker.locationtypes.infer.LocationTypeVariable)2 File (java.io.File)2 TypeCheckerException (org.absmodels.abs.plugin.exceptions.TypeCheckerException)2 NoModelException (org.absmodels.abs.plugin.internal.NoModelException)2