Package com.dci.intellij.dbn.language.common.psi

Examples of com.dci.intellij.dbn.language.common.psi.BasePsiElement


    public IterationChopDownIfLongPreset() {
        super("chop_down_if_long", "Chop down if long");
    }

    public Wrap getWrap(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();

        boolean shouldWrap = parentPsiElement.approximateLength() > settings.RIGHT_MARGIN;
        return getWrap(elementType, iterationElementType, shouldWrap);
    }
View Full Code Here


        boolean shouldWrap = parentPsiElement.approximateLength() > settings.RIGHT_MARGIN;
        return getWrap(elementType, iterationElementType, shouldWrap);
    }

    public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();

        boolean shouldWrap = parentPsiElement.approximateLength() > settings.RIGHT_MARGIN;
        return getSpacing(iterationElementType, elementType, shouldWrap);
    }
View Full Code Here

    public IterationChopDownIfNotSinglePreset() {
        super("chop_down_if_not_single", "Chop down unless single element");
    }

    public Wrap getWrap(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();

        boolean shouldWrap = PsiUtil.getChildrenCount(parentPsiElement) > 1;
        return getWrap(elementType, iterationElementType, shouldWrap);
    }
View Full Code Here

        boolean shouldWrap = PsiUtil.getChildrenCount(parentPsiElement) > 1;
        return getWrap(elementType, iterationElementType, shouldWrap);
    }

    public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();

        boolean shouldWrap = PsiUtil.getChildrenCount(parentPsiElement) > 1;
        return getSpacing(iterationElementType, elementType, shouldWrap);
    }
View Full Code Here

    public boolean accepts(BasePsiElement psiElement) {
        return getParentElementType(psiElement) instanceof IterationElementType;
    }

    public Wrap getWrap(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();
        return getWrap(elementType, iterationElementType, true);
    }
View Full Code Here

        ElementType elementType = psiElement.getElementType();
        return getWrap(elementType, iterationElementType, true);
    }

    public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
        BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
        IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
        ElementType elementType = psiElement.getElementType();
        return getSpacing(iterationElementType, elementType, true);
    }
View Full Code Here

    public boolean hasErrors() {
        return errorMap != null && errorMap.size() > 0;
    }

    private DBDataType lookupDataType(ExecVariablePsiElement variablePsiElement) {
        BasePsiElement parent = variablePsiElement.lookupEnclosingNamedPsiElement();
        Set<BasePsiElement> bucket = null;
        while (parent != null) {
            bucket = parent.collectObjectPsiElements(bucket, DBObjectType.COLUMN.getFamilyTypes(), IdentifierCategory.REFERENCE);
            if (bucket != null) {
                if (bucket.size() > 1) {
                    return null;
                }

                if (bucket.size() == 1) {
                    Object psiElement = bucket.toArray()[0];
                    if (psiElement instanceof IdentifierPsiElement) {
                        IdentifierPsiElement columnPsiElement = (IdentifierPsiElement) psiElement;
                        DBObject object = columnPsiElement.resolveUnderlyingObject();
                        if (object != null && object instanceof DBColumn) {
                            DBColumn column = (DBColumn) object;
                            return column.getDataType();
                        }

                    }
                    return null;
                }
            }

            parent = parent.lookupEnclosingNamedPsiElement();
            if (parent instanceof ExecutablePsiElement) break;
        }
        return null;
    }
View Full Code Here

    public void navigateTo(DBObject object) {
        PsiFile file = PsiUtil.getPsiFile(getObject().getProject(), getVirtualFile());
        if (file instanceof PSQLFile) {
            PSQLFile psqlFile = (PSQLFile) file;
            BasePsiElement navigable = psqlFile.lookupObjectDeclaration(object.getObjectType(), object.getName());
            if (navigable == null) navigable = psqlFile.lookupObjectSpecification(object.getObjectType(), object.getName());
            if (navigable != null) navigable.navigate(true);
        }
    }
View Full Code Here

    public final BasePsiElement findInParentScopeOf(final IdentifierPsiElement source) {
        //System.out.println(this);
        LookupScopeVisitor finder = new LookupScopeVisitor() {
            protected BasePsiElement performLookup(BasePsiElement scope) {
                BasePsiElement result = scope.lookupPsiElement(PsiLookupAdapter.this, 10);
                return result == null || result == source ? null : result;
            }
        };
        return finder.visit(source);
    }
View Full Code Here

import com.dci.intellij.dbn.language.common.psi.BasePsiElement;
import com.intellij.psi.PsiElement;

public abstract class PsiScopeVisitor<T> {
    public final T visit(BasePsiElement element) {
        BasePsiElement scope = element.getEnclosingScopePsiElement();
        while (scope!= null) {
            boolean breakTreeWalk = visitScope(scope);
            if (breakTreeWalk || scope.isScopeIsolation()) break;

            // LOOKUP
            PsiElement parent = scope.getParent();
            if (parent instanceof BasePsiElement) {
                BasePsiElement basePsiElement = (BasePsiElement) parent;
                scope = basePsiElement.getEnclosingScopePsiElement();

            } else {
                scope = null;
            }
        }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.language.common.psi.BasePsiElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.