Package com.intellij.psi

Examples of com.intellij.psi.PsiFile


     *
     * @return {@code true} if the POM xml is valid, {@code false} otherwise.
     */
    public boolean isValid() {
        final PsiDocumentManager mgr = PsiDocumentManager.getInstance(project);
        final PsiFile file = mgr.getCachedPsiFile(document);
        if (file == null)
            return false;
        return file.isValid();
    }
View Full Code Here


            desc.navigate(true);
            final FileEditor fileEditor = fileMgr.getSelectedEditor(script);
            if (fileEditor instanceof TextEditor) {
                final Editor editor = ((TextEditor) fileEditor).getEditor();
                final Document document = editor.getDocument();
                final PsiFile psiFile = psiMgr.getPsiFile(document);
                if (!(psiFile instanceof XmlFile))
                    return;

                final XmlFile xmlFile = (XmlFile) psiFile;
                final XmlDocument xmlDoc = xmlFile.getDocument();
View Full Code Here

     */
    public static XmlFile findXmlFile(final Project pProject,
                                      final Document pDocument) {
        final PsiDocumentManager psiDocMgr = PsiDocumentManager.getInstance(pProject);

        PsiFile psiFile = psiDocMgr.getCachedPsiFile(pDocument);
        if (psiFile == null)
            psiFile = psiDocMgr.getPsiFile(pDocument);

        if (psiFile == null || psiFile instanceof XmlFile)
            return (XmlFile) psiFile;

        final VirtualFile virtualFile = psiFile.getVirtualFile();
        final String path;
        if (virtualFile != null)
            path = virtualFile.getPath();
        else
            path = "No virtual file.";
View Full Code Here

  {
    if (file == null)
    {
      return;
    }
    PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
    if (psiFile == null)
    {
      return;
    }
    if (!(element instanceof PsiElement))
View Full Code Here

  }

  @NotNull
  private Editor buildEditor(@NotNull final VirtualFile vFile) throws RevuException
  {
    PsiFile psiFile = PsiManager.getInstance(project).findFile(vFile);
    if (psiFile == null)
    {
      throw new RevuException(RevuBundle.message("issueForm.preview.error.fileNotFound.text", vFile.getPath()));
    }

    Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);

    final Editor editor = EditorFactory.getInstance().createEditor(document, project, psiFile.getFileType(), true);

    EditorSettings settings = editor.getSettings();
    settings.setLineMarkerAreaShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setAdditionalColumnsCount(0);
View Full Code Here

  }

  @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

  {
    if (!super.canSelect(fileSystemItem) || !(fileSystemItem instanceof PsiFile))
    {
      return false;
    }
    PsiFile file = (PsiFile) fileSystemItem;

    VirtualFile vFile = file.getVirtualFile();
    if (vFile == null)
    {
      return false;
    }
View Full Code Here

        globalScheme.getAttributes(
            EditorColors.SEARCH_RESULT_ATTRIBUTES);

    assert editor != null;
    assert project != null;
    final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    assert psiFile != null;

    //region Interesting part where I track down usages
    PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
    element = (element != null) ? element.getParent() : null;
    final List<PsiElement> usages = new ArrayList<PsiElement>();
    if (element instanceof Symbol) {
//      usages.add(element);
View Full Code Here

public class MathematicaCharFilter extends CharFilter {
  @Nullable
  @Override
  public Result acceptChar(final char c, final int prefixLength, final Lookup lookup) {
    if (!lookup.isFocused()) return null;
    final PsiFile psiFile = lookup.getPsiFile();

    if (psiFile != null && !psiFile.getViewProvider().getLanguages().contains(MathematicaLanguage.INSTANCE))
      return null;

    switch (c) {
      case '[':
      case '(':
View Full Code Here

    dialogBuilder.setTitle("Formatting Block structure");

    final String text = editor != null ? editor.getDocument().getText() : "";
    final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
    MathematicaFormattingModelBuilder modelBuilder = new MathematicaFormattingModelBuilder();
    final PsiFile file = PsiFileFactory.getInstance(project).createFileFromText("a.m", MathematicaLanguage.INSTANCE, text);
    final FormattingModel model = modelBuilder.createModel(file.getNode().getPsi(), settings);
    final Block rootBlock = model.getRootBlock();
    final String blockText = printBlock((AbstractBlock) rootBlock, text);

    JTextArea textArea = new JTextArea(blockText);
    final JScrollPane pane = new JScrollPane(textArea);
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.