mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
pass project to psi file factory
This commit is contained in:
@@ -28,7 +28,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.components.JBLayeredPane;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.PairFunction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class LanguageConsoleBuilder {
|
||||
private Condition<LanguageConsoleImpl> executionEnabled = Conditions.alwaysTrue();
|
||||
|
||||
@Nullable
|
||||
private NotNullFunction<VirtualFile, PsiFile> psiFileFactory;
|
||||
private PairFunction<VirtualFile, Project, PsiFile> psiFileFactory;
|
||||
@Nullable
|
||||
private BaseConsoleExecuteActionHandler executeActionHandler;
|
||||
@Nullable
|
||||
@@ -70,7 +70,7 @@ public final class LanguageConsoleBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public LanguageConsoleBuilder psiFileFactory(@NotNull NotNullFunction<VirtualFile, PsiFile> value) {
|
||||
public LanguageConsoleBuilder psiFileFactory(@NotNull PairFunction<VirtualFile, Project, PsiFile> value) {
|
||||
psiFileFactory = value;
|
||||
return this;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public final class LanguageConsoleBuilder {
|
||||
public GutteredLanguageConsole(@NotNull Project project,
|
||||
@NotNull Language language,
|
||||
@Nullable GutterContentProvider gutterContentProvider,
|
||||
@Nullable NotNullFunction<VirtualFile, PsiFile> psiFileFactory) {
|
||||
@Nullable PairFunction<VirtualFile, Project, PsiFile> psiFileFactory) {
|
||||
super(project, language.getDisplayName() + " Console", language, psiFileFactory);
|
||||
|
||||
setShowSeparatorLine(false);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
}
|
||||
};
|
||||
|
||||
private final NotNullFunction<VirtualFile, PsiFile> myPsiFileFactory;
|
||||
private final PairFunction<VirtualFile, Project, PsiFile> myPsiFileFactory;
|
||||
|
||||
public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull Language language) {
|
||||
this(project, title, language, true);
|
||||
@@ -122,7 +122,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
this(project, title, new LightVirtualFile(title, language, ""), initComponents);
|
||||
}
|
||||
|
||||
public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull Language language, @Nullable NotNullFunction<VirtualFile, PsiFile> psiFileFactory) {
|
||||
public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull Language language, @Nullable PairFunction<VirtualFile, Project, PsiFile> psiFileFactory) {
|
||||
this(project, title, new LightVirtualFile(title, language, ""), false, psiFileFactory);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
@NotNull String title,
|
||||
@NotNull LightVirtualFile lightFile,
|
||||
boolean initComponents,
|
||||
@Nullable NotNullFunction<VirtualFile, PsiFile> psiFileFactory) {
|
||||
@Nullable PairFunction<VirtualFile, Project, PsiFile> psiFileFactory) {
|
||||
myProject = project;
|
||||
myTitle = title;
|
||||
myVirtualFile = lightFile;
|
||||
@@ -695,7 +695,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
return ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(virtualFile));
|
||||
}
|
||||
else {
|
||||
return myPsiFileFactory.fun(virtualFile);
|
||||
return myPsiFileFactory.fun(virtualFile, project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.PairFunction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
import org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment;
|
||||
@@ -40,11 +40,11 @@ public class GroovyConsoleAction extends GroovyShellActionBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LanguageConsoleImpl createConsole(final @NotNull Project project, String title) {
|
||||
return new LanguageConsoleImpl(project, title, GroovyFileType.GROOVY_LANGUAGE, new NotNullFunction<VirtualFile, PsiFile>() {
|
||||
protected LanguageConsoleImpl createConsole(@NotNull Project project, String title) {
|
||||
return new LanguageConsoleImpl(project, title, GroovyFileType.GROOVY_LANGUAGE, new PairFunction<VirtualFile, Project, PsiFile>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiFile fun(VirtualFile file) {
|
||||
public PsiFile fun(@NotNull VirtualFile file, @NotNull Project project) {
|
||||
return new GroovyCodeFragment(project, file);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user