Examples of LeafPsiElement


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

    @Override
    public boolean isInContext(@NotNull PsiFile file, int offset) {
        Language language = file.getLanguage();
        if (language instanceof DBLanguage) {
            // support PSQL in SQL language
            LeafPsiElement leafPsiElement = PsiUtil.lookupLeafBeforeOffset(file, offset);
            if (leafPsiElement != null) {
                if (leafPsiElement.getLanguage() instanceof PSQLLanguage) {
                    return !leafPsiElement.getEnclosingScopePsiElement().getTextRange().contains(offset);
                }
            } else {
                return language instanceof PSQLLanguage;
            }
        }
View Full Code Here

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

    @Override
    public boolean isInContext(@NotNull PsiFile file, int offset) {
        Language language = file.getLanguage();
        if (language instanceof SQLLanguage) {
            LeafPsiElement leafPsiElement = PsiUtil.lookupLeafBeforeOffset(file, offset);
            if (leafPsiElement != null) {
                if (leafPsiElement.getLanguage() instanceof SQLLanguage) {
                    return !leafPsiElement.getEnclosingScopePsiElement().getTextRange().contains(offset);
                }

            } else {
                return true;
            }
View Full Code Here

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


            int caretOffset = parameters.getOffset();
            if (file.findElementAt(caretOffset) instanceof PsiComment) return;

            LeafPsiElement leafBeforeCaret = PsiUtil.lookupLeafBeforeOffset(file, caretOffset);


            int invocationCount = parameters.getInvocationCount();
            if (invocationCount > 1) context.setExtended(true);

            if (leafBeforeCaret == null) {
                ElementTypeBundle elementTypeBundle = file.getElementTypeBundle();
                Set<LeafElementType> firstPossibleLeafs = elementTypeBundle.getRootElementType().getLookupCache().getFirstPossibleLeafs();
                for (LeafElementType firstPossibleLeaf : firstPossibleLeafs) {
                    if (firstPossibleLeaf instanceof TokenElementType) {
                        TokenElementType tokenElementType = (TokenElementType) firstPossibleLeaf;
                        if (context.getCodeCompletionFilterSettings().acceptReservedWord(tokenElementType.getTokenTypeCategory())) {
                            LookupItemFactory lookupItemFactory = tokenElementType.getLookupItemFactory(language);
                            lookupItemFactory.createLookupItem(tokenElementType, consumer);
                        }
                    }
                }
            } else {
                leafBeforeCaret = (LeafPsiElement) leafBeforeCaret.getOriginalElement();
                try {
                    buildElementRelativeVariants(leafBeforeCaret, consumer);
                } catch (ConsumerStoppedException e) {

                }
View Full Code Here

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

            TokenElementType tokenElementType = (TokenElementType) lookupElementObject;
            if(tokenElementType.getTokenType().isReservedWord()) {
                Editor editor = insertionContext.getEditor();
                CaretModel caretModel = editor.getCaretModel();

                LeafPsiElement leafPsiElement = PsiUtil.lookupLeafAtOffset(insertionContext.getFile(), insertionContext.getTailOffset());
                if (leafPsiElement == null || leafPsiElement.getTextOffset() != caretModel.getOffset()) {
                    if (completionChar == '\t' || completionChar == '\u0000' || completionChar == '\n') {
                        insertionContext.getDocument().insertString(insertionContext.getTailOffset(), " ");
                        caretModel.moveCaretRelatively(1, 0, false, false, false);
                    }
                }
View Full Code Here

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

        TokenElementType separatorToken = psiElement.getElementType().getSeparatorToken();
        PsiElement[] children = psiElement.getChildren();
        int index = 0;
        for (PsiElement child : children) {
            if (child instanceof LeafPsiElement) {
                LeafPsiElement leafPsiElement = (LeafPsiElement) child;

                if (leafPsiElement.getElementType() == separatorToken){
                    index++;
                } else {
                    if (leafs.length == index) {
                        // variant is too short for given QualifiedIdentifier
                        return false;
                    }

                    PsiElement reference = leafPsiElement.resolve();
                    LeafElementType leafElementType = (LeafElementType) leafPsiElement.getElementType();
                    if (reference == null) {
                        if (!(leafElementType.isIdentifier() && leafs[index].isIdentifier()) ||
                                !leafElementType.isSameAs(leafs[index])) {
                            if(child != children[children.length-1]) {
                                return false;
View Full Code Here

Examples of com.intellij.psi.impl.source.tree.LeafPsiElement

    }
    if (this instanceof HaxeStringLiteralExpression) {
      return HaxeClassResolveResult.create(HaxeResolveUtil.findClassByQName("String", this));
    }
    if (this instanceof HaxeLiteralExpression) {
      final LeafPsiElement child = (LeafPsiElement)getFirstChild();
      final IElementType childTokenType = child == null ? null : child.getElementType();
      return HaxeClassResolveResult.create(HaxeResolveUtil.findClassByQName(getLiteralClassName(childTokenType), this));
    }
    if (this instanceof HaxeArrayLiteral) {
      HaxeArrayLiteral haxeArrayLiteral = (HaxeArrayLiteral)this;
      HaxeExpressionList expressionList = haxeArrayLiteral.getExpressionList();
View Full Code Here

Examples of com.intellij.psi.impl.source.tree.LeafPsiElement

    return "GherkinStepParameter:" + getText();
  }

  @Override
  public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
    final LeafPsiElement content = PsiTreeUtil.getChildOfType(this, LeafPsiElement.class);
    PsiElement[] elements = GherkinElementFactory.getTopLevelElements(getProject(), name);
    getNode().replaceChild(content, elements[0].getNode());
    return this;
  }
View Full Code Here

Examples of com.intellij.psi.impl.source.tree.LeafPsiElement

    return getText();
  }

  @Override
  public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
    final LeafPsiElement content = PsiTreeUtil.getChildOfType(this, LeafPsiElement.class);
    PsiElement[] elements = GherkinElementFactory.getTopLevelElements(getProject(), name);
    getNode().replaceChild(content, elements[0].getNode());
    return this;
  }
View Full Code Here

Examples of com.intellij.psi.impl.source.tree.LeafPsiElement

    return this;
  }

  @Override
  public PsiElement getNameIdentifier() {
    final LeafPsiElement content = PsiTreeUtil.getChildOfType(this, LeafPsiElement.class);
    return content;
  }
View Full Code Here

Examples of com.intellij.psi.impl.source.tree.LeafPsiElement

  private static void addPrototypeTest(@NotNull JstdTestCaseStructure testCaseStructure,
                                       @Nullable JSExpression rightAssignmentOperand,
                                       @NotNull JSDefinitionExpression wholeLeftDefExpr) {
    JSReferenceExpression wholeLeftRefExpr = ObjectUtils.tryCast(wholeLeftDefExpr.getExpression(), JSReferenceExpression.class);
    LeafPsiElement testMethodLeafPsiElement = null;
    if (wholeLeftRefExpr != null) {
      testMethodLeafPsiElement = ObjectUtils.tryCast(wholeLeftRefExpr.getReferenceNameElement(), LeafPsiElement.class);
    }
    if (testMethodLeafPsiElement != null && testMethodLeafPsiElement.getElementType() == JSTokenTypes.IDENTIFIER) {
      JSFunctionExpression jsFunctionExpression = JsPsiUtils.extractFunctionExpression(rightAssignmentOperand);
      JstdTestStructure jstdTestStructure = JstdTestStructure.newPrototypeBasedTestStructure(wholeLeftDefExpr,
                                                                                             testMethodLeafPsiElement,
                                                                                             jsFunctionExpression);
      if (jstdTestStructure != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.