show .class files located in source content in project view

This commit is contained in:
peter
2015-11-14 20:41:50 +01:00
parent cee043b70d
commit ee5fad06d2
3 changed files with 7 additions and 1 deletions
@@ -21,7 +21,9 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.impl.PsiManagerImpl;
import com.intellij.psi.impl.compiled.ClsFileImpl;
import com.intellij.psi.impl.file.PsiBinaryFileImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -40,7 +42,7 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
protected PsiFile createFile(@NotNull final Project project, @NotNull final VirtualFile vFile, @NotNull final FileType fileType) {
FileIndexFacade fileIndex = ServiceManager.getService(project, FileIndexFacade.class);
if (!fileIndex.isInLibraryClasses(vFile) && fileIndex.isInSource(vFile)) {
return null;
return new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this);
}
// skip inners & anonymous
@@ -73,6 +73,7 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
" Class1.java\n" +
" Class2.java\n" +
" Class4.java\n" +
" emptyClassFile.class\n" +
" Form1.form\n" +
" Form1.java\n" +
" Form2.form\n" +
@@ -120,6 +121,7 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
" Class1.java\n" +
" Class2.java\n" +
" Class4.java\n" +
" emptyClassFile.class\n" +
" Form1.form\n" +
" Form1.java\n" +
" Form2.form\n" +
@@ -168,6 +170,7 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
" Class1.java\n" +
" Class2.java\n" +
" Class4.java\n" +
" emptyClassFile.class\n" +
" Form1.form\n" +
" Form1.java\n" +
" Form2.form\n" +
@@ -182,6 +185,7 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
" Class1.java\n" +
" Class2.java\n" +
" Class4.java\n" +
" emptyClassFile.class\n" +
" Form1.form\n" +
" Form1.java\n" +
" Form2.form\n" +