Package com.intellij.psi

Examples of com.intellij.psi.PsiFile


  }

  @Nullable
  public static Document getDocument(@NotNull Project project, @NotNull Issue issue)
  {
    PsiFile psiFile = getPsiFile(project, issue);
    return (psiFile == null) ? null : PsiDocumentManager.getInstance(project).getDocument(psiFile);
  }
View Full Code Here


        }

    }

    private void doAddCompletions(CompletionParameters parameters, CompletionResultSet result) {
        PsiFile originalFile = parameters.getOriginalFile();
        if (originalFile instanceof DBLanguageFile) {
            DBLanguageFile file = (DBLanguageFile) originalFile;

            CodeCompletionContext context = new CodeCompletionContext(file, parameters, result);
            CodeCompletionLookupConsumer consumer = new CodeCompletionLookupConsumer(context);
View Full Code Here

    @NotNull
    public FormattingModel createModel(final PsiElement element, final CodeStyleSettings codeStyleSettings) {
        DBLanguage language = (DBLanguage) PsiUtil.getLanguage(element);

        PsiFile psiFile = element.getContainingFile();
        CodeStyleCustomSettings settings = language.getCodeStyleSettings(element.getProject());

        boolean deliberate = CommonUtil.isCalledThrough(CodeFormatterFacade.class);
        if (deliberate && settings.getCaseSettings().isEnabled()) {
            DBLCodeStyleManager.getInstance(element.getProject()).formatCase(element.getContainingFile());
View Full Code Here

    }

    public ExecutablePsiElement getExecutablePsiElement() {
        if (originalPsiElement == null) {
            PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(executionProcessor.getProject());
            PsiFile previewFile = psiFileFactory.createFileFromText("preview", connectionHandler.getLanguageDialect(SQLLanguage.INSTANCE), originalStatement);

            PsiElement firstChild = previewFile.getFirstChild();
            if (firstChild instanceof ExecutableBundlePsiElement) {
                ExecutableBundlePsiElement rootPsiElement = (ExecutableBundlePsiElement) firstChild;
                originalPsiElement = rootPsiElement.getExecutablePsiElements().get(0);
            }
        }
View Full Code Here

    public int getHeaderEndOffset() {
        return offsets.getHeaderEndOffset();
    }

    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

        FileConnectionMappingManager mappingManager = FileConnectionMappingManager.getInstance(psiElement.getProject());
        return mappingManager.getCurrentSchema(virtualFile);
    }

    public static VirtualFile getVirtualFileForElement(PsiElement psiElement) {
        PsiFile psiFile = null;
        try {
            psiFile = psiElement.getContainingFile().getOriginalFile();
            if (psiFile == null) psiFile = psiElement.getContainingFile();
        } catch (PsiInvalidElementAccessException e) {
            System.out.println("");
        }
        return psiFile == null ? null : psiFile.getVirtualFile();
    }
View Full Code Here

        return null;
    }


    public static boolean introduceWhitespace(PsiFile file, int caretOffset) {
        PsiFile originalFile = file.getOriginalFile();
        if (originalFile != null && originalFile != file) {
            PsiElement elementAtCaret = originalFile.findElementAt(caretOffset);
            return !(elementAtCaret instanceof PsiWhiteSpace) || elementAtCaret.getNextSibling() == null;
        }
        return false;
    }
View Full Code Here

        }
        return null;
    }

    public static int getCaretOffset(PsiFile file) {
        PsiFile originalFile = file.getOriginalFile();
        if (originalFile != null) file = originalFile;
        Document document = DocumentUtil.getDocument(file);
        Editor[] editors = EditorFactory.getInstance().getEditors(document);

        //Editor editor = FileEditorManager.getInstance(file.getProject()).getSelectedTextEditor();
View Full Code Here

        }
        return caretOffset;
    }

    public static void moveCaretOutsideExecutable(Editor editor) {
        PsiFile file = DocumentUtil.getFile(editor);

        ExecutablePsiElement executablePsiElement = lookupExecutableAtCaret(file);
        if (executablePsiElement != null) {
            int offset = executablePsiElement.getTextOffset();
            editor.getCaretModel().moveToOffset(offset);
View Full Code Here

    public void actionPerformed(AnActionEvent e) {
        Project project = ActionUtil.getProject(e);
        Editor editor = e.getData(PlatformDataKeys.EDITOR);
        if (project != null && editor != null) {
            StatementExecutionManager.getInstance(project).executeSelectedStatement(editor);
            PsiFile file = DocumentUtil.getFile(editor);
            DocumentUtil.refreshEditorAnnotations(file);
        }
    }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiFile

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.