mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PsiManagerEx.getInstanceEx
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public class TreeViewUtil {
|
||||
final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap();
|
||||
map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
|
||||
if (map == newMap) {
|
||||
((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
|
||||
PsiManagerEx.getInstanceEx(project).registerRunnableToRunOnChange(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
newMap.clear();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,6 +62,6 @@ public class PsiMigrationManager {
|
||||
myCurrentMigration = null;
|
||||
}
|
||||
|
||||
((PsiManagerEx)PsiManager.getInstance(myProject)).beforeChange(true);
|
||||
PsiManagerEx.getInstanceEx(myProject).beforeChange(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment
|
||||
@Nullable PsiElement context) {
|
||||
super(TokenType.CODE_FRAGMENT,
|
||||
contentElementType,
|
||||
((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
|
||||
PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
|
||||
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
|
||||
);
|
||||
myContext = context;
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class JavaFileManagerImpl implements JavaFileManager, Disposable {
|
||||
private final PackageIndex myPackageIndex;
|
||||
|
||||
public JavaFileManagerImpl(Project project) {
|
||||
myManager = (PsiManagerEx)PsiManager.getInstance(project);
|
||||
myManager = PsiManagerEx.getInstanceEx(project);
|
||||
myPackageIndex = PackageIndex.getInstance(myManager.getProject());
|
||||
project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,5 +42,5 @@ public abstract class JavaPsiFacadeEx extends JavaPsiFacade {
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public abstract void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, Disposable parentDisposable);
|
||||
public abstract void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, @NotNull Disposable parentDisposable);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -414,7 +414,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
|
||||
|
||||
@TestOnly
|
||||
@Override
|
||||
public void setAssertOnFileLoadingFilter(@NotNull final VirtualFileFilter filter, Disposable parentDisposable) {
|
||||
public void setAssertOnFileLoadingFilter(@NotNull final VirtualFileFilter filter, @NotNull Disposable parentDisposable) {
|
||||
((PsiManagerImpl)PsiManager.getInstance(myProject)).setAssertOnFileLoadingFilter(filter, parentDisposable);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
|
||||
// gc softly-referenced file and AST
|
||||
PlatformTestUtil.tryGcSoftlyReachableObjects();
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
assertNull(psiManager.getFileManager().getCachedPsiFile(file));
|
||||
|
||||
assertFalse(count1 == tracker.getJavaStructureModificationCount());
|
||||
@@ -257,7 +257,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
|
||||
public void testClassShouldNotDisappearWithoutEvents_NoDocument() throws IOException {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
|
||||
final VirtualFile file = addFileToProject("Foo.java", "class Foo {}").getVirtualFile();
|
||||
assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass("Foo", GlobalSearchScope.allScope(getProject())));
|
||||
@@ -279,7 +279,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
long count0 = tracker.getJavaStructureModificationCount();
|
||||
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
VirtualFile parentDir = createChildDirectory(getProject().getBaseDir(), "tmp");
|
||||
|
||||
assertNull(((FileManagerImpl)psiManager.getFileManager()).getCachedDirectory(parentDir));
|
||||
@@ -296,7 +296,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
long count0 = tracker.getJavaStructureModificationCount();
|
||||
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
VirtualFile parentDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(createTempDirectory());
|
||||
assertNull(((FileManagerImpl)psiManager.getFileManager()).getCachedDirectory(parentDir));
|
||||
|
||||
@@ -310,7 +310,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
|
||||
public void testClassShouldNotDisappearWithoutEvents_VirtualFileDeleted() throws IOException {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
|
||||
final VirtualFile file = addFileToProject("Foo.java", "class Foo {}").getVirtualFile();
|
||||
assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass("Foo", GlobalSearchScope.allScope(getProject())));
|
||||
@@ -328,7 +328,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
|
||||
public void testClassShouldNotDisappearWithoutEvents_ParentVirtualDirectoryDeleted() throws Exception {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
|
||||
final VirtualFile file = addFileToProject("foo/Foo.java", "package foo; class Foo {}").getVirtualFile();
|
||||
assertNotNull(JavaPsiFacade.getInstance(getProject()).findClass("foo.Foo", GlobalSearchScope.allScope(getProject())));
|
||||
@@ -347,7 +347,7 @@ public class PsiModificationTrackerTest extends CodeInsightTestCase {
|
||||
|
||||
public void testVirtualFileRename_WithPsi() throws IOException {
|
||||
PsiModificationTracker tracker = PsiManager.getInstance(getProject()).getModificationTracker();
|
||||
final PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
final PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(getProject());
|
||||
GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
|
||||
|
||||
final VirtualFile file = addFileToProject("foo/Foo.java", "package foo; class Foo {}").getVirtualFile();
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiElementFactory;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||
@@ -104,7 +103,7 @@ public abstract class JavaCodeInsightFixtureTestCase extends UsefulTestCase{
|
||||
}
|
||||
|
||||
protected PsiManagerEx getPsiManager() {
|
||||
return (PsiManagerEx)PsiManager.getInstance(getProject());
|
||||
return PsiManagerEx.getInstanceEx(getProject());
|
||||
}
|
||||
|
||||
public PsiElementFactory getElementFactory() {
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiInvalidElementAccessException;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.CheckUtil;
|
||||
import com.intellij.psi.impl.PsiElementBase;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
@@ -66,7 +65,7 @@ public abstract class ASTDelegatePsiElement extends PsiElementBase {
|
||||
public PsiManagerEx getManager() {
|
||||
Project project = ProjectCoreUtil.theOnlyOpenProject();
|
||||
if (project != null) {
|
||||
return (PsiManagerEx)PsiManager.getInstance(project);
|
||||
return PsiManagerEx.getInstanceEx(project);
|
||||
}
|
||||
PsiElement parent = this;
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ import com.intellij.openapi.project.ProjectCoreUtil;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiInvalidElementAccessException;
|
||||
import com.intellij.psi.PsiLock;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
@@ -282,7 +285,7 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
|
||||
public PsiManagerEx getManager() {
|
||||
Project project = ProjectCoreUtil.theOnlyOpenProject();
|
||||
if (project != null) {
|
||||
return (PsiManagerEx)PsiManager.getInstance(project);
|
||||
return PsiManagerEx.getInstanceEx(project);
|
||||
}
|
||||
return (PsiManagerEx)getContainingFile().getManager();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi.impl;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.file.impl.FileManager;
|
||||
@@ -24,6 +25,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class PsiManagerEx extends PsiManager {
|
||||
public static PsiManagerEx getInstanceEx(Project project) {
|
||||
return (PsiManagerEx)getInstance(project);
|
||||
}
|
||||
public abstract boolean isBatchFilesProcessingMode();
|
||||
|
||||
public abstract boolean isAssertOnFileLoading(@NotNull VirtualFile file);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -99,7 +99,7 @@ class SmartPsiElementPointerImpl<E extends PsiElement> implements SmartPointerEx
|
||||
|
||||
void cacheElement(@Nullable E element) {
|
||||
myElement = element == null ? null :
|
||||
((PsiManagerEx)PsiManager.getInstance(getProject())).isBatchFilesProcessingMode() ? new WeakReference<E>(element) :
|
||||
PsiManagerEx.getInstanceEx(getProject()).isBatchFilesProcessingMode() ? new WeakReference<E>(element) :
|
||||
new SoftReference<E>(element);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.intellij.openapi.project.ProjectCoreUtil;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiLock;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.ElementBase;
|
||||
@@ -70,7 +69,7 @@ public abstract class TreeElement extends ElementBase implements ASTNode, Clonea
|
||||
public PsiManagerEx getManager() {
|
||||
Project project = ProjectCoreUtil.theOnlyOpenProject();
|
||||
if (project != null) {
|
||||
return (PsiManagerEx)PsiManager.getInstance(project);
|
||||
return PsiManagerEx.getInstanceEx(project);
|
||||
}
|
||||
TreeElement element;
|
||||
for (element = this; element.getTreeParent() != null; element = element.getTreeParent()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.RecursionManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -130,7 +129,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
if (vFile.getFileType().isBinary()) {
|
||||
return -1;
|
||||
}
|
||||
PsiFile psiFile = ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().getCachedPsiFile(vFile);
|
||||
PsiFile psiFile = PsiManagerEx.getInstanceEx(project).getFileManager().getCachedPsiFile(vFile);
|
||||
if (psiFile instanceof PsiFileImpl && ((PsiFileImpl)psiFile).isContentsLoaded()) {
|
||||
return psiFile.getTextLength();
|
||||
}
|
||||
@@ -172,7 +171,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
|
||||
VirtualFile file = virtualFile;
|
||||
int count = 0;
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
if (((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().findCachedViewProvider(file) != null) {
|
||||
if (PsiManagerEx.getInstanceEx(project).getFileManager().findCachedViewProvider(file) != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.ui.CollectionComboBoxModel;
|
||||
import com.intellij.ui.DoubleClickListener;
|
||||
@@ -128,7 +127,7 @@ public class FileTypeChooser extends DialogWrapper {
|
||||
@Nullable
|
||||
public static FileType getKnownFileTypeOrAssociate(@NotNull VirtualFile file, @Nullable Project project) {
|
||||
if (project != null && !(file instanceof FakeVirtualFile)) {
|
||||
((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().findFile(file); // autodetect text file if needed
|
||||
PsiManagerEx.getInstanceEx(project).getFileManager().findFile(file); // autodetect text file if needed
|
||||
}
|
||||
FileType type = file.getFileType();
|
||||
if (type == FileTypes.UNKNOWN) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.util.CachedValue;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -45,7 +44,7 @@ public class PsiErrorElementUtil {
|
||||
if (project.isDisposed() || !virtualFile.isValid()) {
|
||||
return false;
|
||||
}
|
||||
PsiManagerEx psiManager = (PsiManagerEx)PsiManager.getInstance(project);
|
||||
PsiManagerEx psiManager = PsiManagerEx.getInstanceEx(project);
|
||||
PsiFile psiFile = psiManager.getFileManager().findFile(virtualFile);
|
||||
return psiFile != null && hasErrors(psiFile);
|
||||
}
|
||||
|
||||
+5
-2
@@ -36,7 +36,10 @@ import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.PersistentFSConstants;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiBinaryFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiPlainTextFile;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
@@ -234,7 +237,7 @@ public class FileTypesTest extends PlatformTestCase {
|
||||
|
||||
assertEquals(PlainTextFileType.INSTANCE, vFile.getFileType()); // type autodetected during indexing
|
||||
|
||||
PsiFile psiFile = ((PsiManagerEx)PsiManager.getInstance(getProject())).getFileManager().findFile(vFile); // autodetect text file if needed
|
||||
PsiFile psiFile = PsiManagerEx.getInstanceEx(getProject()).getFileManager().findFile(vFile); // autodetect text file if needed
|
||||
assertNotNull(psiFile);
|
||||
assertEquals(PlainTextFileType.INSTANCE, psiFile.getFileType());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import java.util.Set;
|
||||
* @author cdr
|
||||
*/
|
||||
public class FileTreeAccessFilter implements VirtualFileFilter {
|
||||
protected final Set<VirtualFile> myAddedClasses = new THashSet<VirtualFile>();
|
||||
private final Set<VirtualFile> myAddedClasses = new THashSet<>();
|
||||
private boolean myTreeAccessAllowed;
|
||||
|
||||
@Override
|
||||
@@ -52,6 +52,6 @@ public class FileTreeAccessFilter implements VirtualFileFilter {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "JAVA {allowed=" + myTreeAccessAllowed + " files=" + new ArrayList<VirtualFile>(myAddedClasses) + "}";
|
||||
return "JAVA {allowed=" + myTreeAccessAllowed + " files=" + new ArrayList<>(myAddedClasses) + "}";
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class GroovyPsiManager {
|
||||
public GroovyPsiManager(Project project) {
|
||||
myProject = project;
|
||||
|
||||
((PsiManagerEx)PsiManager.getInstance(myProject)).registerRunnableToRunOnAnyChange(new Runnable() {
|
||||
PsiManagerEx.getInstanceEx(myProject).registerRunnableToRunOnAnyChange(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dropTypesCache();
|
||||
|
||||
@@ -23,7 +23,7 @@ public class IpnbPyFragment extends PyFileImpl {
|
||||
private FileViewProvider myViewProvider;
|
||||
|
||||
public IpnbPyFragment(Project project, CharSequence text, boolean isPhysical, IpnbCodeSourcePanel codeSourcePanel) {
|
||||
super(((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
|
||||
super(PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
|
||||
new LightVirtualFile("code.py", IpnbPyLanguageDialect.getInstance(), text), isPhysical)
|
||||
);
|
||||
myPhysical = isPhysical;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,6 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.FileViewProvider;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.SingleRootFileViewProvider;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.file.impl.FileManager;
|
||||
@@ -38,7 +37,7 @@ public class PyExpressionCodeFragmentImpl extends PyFileImpl implements PyExpres
|
||||
private FileViewProvider myViewProvider;
|
||||
|
||||
public PyExpressionCodeFragmentImpl(Project project, @NonNls String name, CharSequence text, boolean isPhysical) {
|
||||
super(((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
|
||||
super(PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
|
||||
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
|
||||
);
|
||||
myPhysical = isPhysical;
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.jetbrains.python.refactoring.changeSignature;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiCodeFragment;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.SingleRootFileViewProvider;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -39,7 +38,7 @@ public class PyExpressionCodeFragment extends PyFileImpl implements PsiCodeFragm
|
||||
public PyExpressionCodeFragment(@NotNull final Project project,
|
||||
@NonNls final String name,
|
||||
@NotNull final CharSequence text) {
|
||||
super(((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
|
||||
super(PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
|
||||
new LightVirtualFile(name, PythonFileType.INSTANCE, text), true));
|
||||
((SingleRootFileViewProvider)getViewProvider()).forceCachedPsi(this);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,10 @@ import com.intellij.pom.event.PomModelEvent;
|
||||
import com.intellij.pom.event.PomModelListener;
|
||||
import com.intellij.pom.xml.XmlAspect;
|
||||
import com.intellij.pom.xml.XmlChangeSet;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlElement;
|
||||
@@ -160,7 +163,7 @@ public final class DomManagerImpl extends DomManager {
|
||||
}
|
||||
|
||||
private PsiFile getCachedPsiFile(VirtualFile file) {
|
||||
return ((PsiManagerEx)PsiManager.getInstance(myProject)).getFileManager().getCachedPsiFile(file);
|
||||
return PsiManagerEx.getInstanceEx(myProject).getFileManager().getCachedPsiFile(file);
|
||||
}
|
||||
|
||||
private List<DomEvent> calcDomChangeEvents(final VirtualFile file) {
|
||||
|
||||
Reference in New Issue
Block a user