mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixing javascript parsing and lexing.
This commit is contained in:
@@ -2,9 +2,10 @@ package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewModel;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.ParserDefinition;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -29,8 +30,8 @@ public abstract class LanguageFileType implements FileType{
|
||||
}
|
||||
|
||||
public StructureViewModel getStructureViewModel(VirtualFile file, Project project) {
|
||||
final ParserDefinition parserDefinition = myLanguage.getParserDefinition();
|
||||
return parserDefinition != null ? myLanguage.getStructureViewModel(parserDefinition.createFile(project, file)) : null;
|
||||
final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
return psiFile != null ? myLanguage.getStructureViewModel(psiFile) : null;
|
||||
}
|
||||
|
||||
public final boolean isBinary() {
|
||||
|
||||
@@ -587,7 +587,7 @@ public class StructureViewComponent extends JPanel implements TreeActionsOwner,
|
||||
ArrayList<PsiElement> psiElements = new ArrayList<PsiElement>();
|
||||
for (int i = 0; i < selectedElements.length; i++) {
|
||||
Object selectedElement = selectedElements[i];
|
||||
if (selectedElement instanceof PsiElement){
|
||||
if (selectedElement instanceof PsiElement && ((PsiElement)selectedElement).isValid()){
|
||||
psiElements.add((PsiElement)selectedElement);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user