mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-32
@@ -30,19 +30,14 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiJavaModule;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.util.PsiMethodUtil;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import com.intellij.util.PathsList;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -50,7 +45,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunConfigurationModule>
|
||||
implements CommonJavaRunConfigurationParameters, SingleClassConfiguration, RefactoringListenerProvider {
|
||||
@@ -292,34 +286,9 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
PsiJavaModule mainModule = JavaModuleGraphUtil.findDescriptorByElement(mainClass);
|
||||
if (mainModule != null) {
|
||||
params.setModuleName(mainModule.getModuleName());
|
||||
|
||||
PathsList modulePath = params.getModulePath(), classPath = params.getClassPath();
|
||||
ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(module.getProject());
|
||||
JavaModuleGraphUtil.moduleDependencies(mainModule).stream()
|
||||
.map(PsiImplUtil::getModuleVirtualFile)
|
||||
.flatMap(f -> classRoots(f, index))
|
||||
.forEach(f -> {
|
||||
modulePath.add(f);
|
||||
classPath.remove(f);
|
||||
});
|
||||
params.getModulePath().addAll(params.getClassPath().getPathList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Stream<VirtualFile> classRoots(VirtualFile file, ProjectFileIndex index) {
|
||||
if (index.isInSourceContent(file)) {
|
||||
Module module = index.getModuleForFile(file);
|
||||
if (module != null) {
|
||||
return Stream.of(OrderEnumerator.orderEntries(module).runtimeOnly().withoutSdk().withoutLibraries().withoutDepModules().getClassesRoots());
|
||||
}
|
||||
}
|
||||
else {
|
||||
VirtualFile root = index.getClassRootForFile(file);
|
||||
if (root != null) {
|
||||
return Stream.of(root);
|
||||
}
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-4
@@ -25,6 +25,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.util.PathsList;
|
||||
import com.intellij.util.text.VersionComparatorUtil;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
@@ -32,6 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -85,7 +87,8 @@ public class JavaParameters extends SimpleJavaParameters {
|
||||
if (!pathsList.getPathList().isEmpty()) {
|
||||
ParametersList vmParameters = getVMParametersList();
|
||||
if (vmParameters.hasProperty(JAVA_LIBRARY_PATH_PROPERTY)) {
|
||||
LOG.info(JAVA_LIBRARY_PATH_PROPERTY + " property is already specified, native library paths from dependencies (" + pathsList.getPathsString() + ") won't be added");
|
||||
LOG.info(JAVA_LIBRARY_PATH_PROPERTY + " property is already specified, " +
|
||||
"native library paths from dependencies (" + pathsList.getPathsString() + ") won't be added");
|
||||
}
|
||||
else {
|
||||
vmParameters.addProperty(JAVA_LIBRARY_PATH_PROPERTY, pathsList.getPathsString());
|
||||
@@ -154,7 +157,9 @@ public class JavaParameters extends SimpleJavaParameters {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void configureByProject(final Project project, @MagicConstant(valuesFromClass = JavaParameters.class) final int classPathType, final Sdk jdk) throws CantRunException {
|
||||
public void configureByProject(Project project,
|
||||
@MagicConstant(valuesFromClass = JavaParameters.class) int classPathType,
|
||||
Sdk jdk) throws CantRunException {
|
||||
if ((classPathType & JDK_ONLY) != 0) {
|
||||
if (jdk == null) {
|
||||
throw CantRunException.noJdkConfigured();
|
||||
@@ -170,7 +175,7 @@ public class JavaParameters extends SimpleJavaParameters {
|
||||
configureJavaLibraryPath(OrderEnumerator.orderEntries(project));
|
||||
}
|
||||
|
||||
private static OrderRootsEnumerator configureEnumerator(OrderEnumerator enumerator, @MagicConstant(valuesFromClass = JavaParameters.class) int classPathType, Sdk jdk) {
|
||||
private static OrderRootsEnumerator configureEnumerator(OrderEnumerator enumerator, int classPathType, Sdk jdk) {
|
||||
if ((classPathType & JDK_ONLY) == 0) {
|
||||
enumerator = enumerator.withoutSdk();
|
||||
}
|
||||
@@ -180,8 +185,14 @@ public class JavaParameters extends SimpleJavaParameters {
|
||||
OrderRootsEnumerator rootsEnumerator = enumerator.classes();
|
||||
if ((classPathType & JDK_ONLY) != 0) {
|
||||
rootsEnumerator = rootsEnumerator.usingCustomRootProvider(
|
||||
e -> e instanceof JdkOrderEntry ? jdk.getRootProvider().getFiles(OrderRootType.CLASSES) : e.getFiles(OrderRootType.CLASSES));
|
||||
e -> e instanceof JdkOrderEntry ? jdkRoots(jdk) : e.getFiles(OrderRootType.CLASSES));
|
||||
}
|
||||
return rootsEnumerator;
|
||||
}
|
||||
|
||||
private static VirtualFile[] jdkRoots(Sdk jdk) {
|
||||
return Arrays.stream(jdk.getRootProvider().getFiles(OrderRootType.CLASSES))
|
||||
.filter(f -> !JrtFileSystem.isModuleRoot(f))
|
||||
.toArray(VirtualFile[]::new);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@ import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.ui.components.JBList;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
+4
-24
@@ -63,14 +63,10 @@ public class JavaModuleGraphUtil {
|
||||
}
|
||||
|
||||
public static boolean reads(@NotNull PsiJavaModule source, @NotNull PsiJavaModule destination) {
|
||||
return getRequiresGraph(source).reads(source, destination);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<PsiJavaModule> moduleDependencies(@NotNull PsiJavaModule start) {
|
||||
Set<PsiJavaModule> result = ContainerUtil.newHashSet();
|
||||
visit(getRequiresGraph(start), start, result);
|
||||
return result;
|
||||
Project project = source.getProject();
|
||||
RequiresGraph graph = CachedValuesManager.getManager(project).getCachedValue(project, () ->
|
||||
Result.create(buildRequiresGraph(project), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT));
|
||||
return graph.reads(source, destination);
|
||||
}
|
||||
|
||||
// Looks for cycles between Java modules in the project sources.
|
||||
@@ -121,12 +117,6 @@ public class JavaModuleGraphUtil {
|
||||
return map;
|
||||
}
|
||||
|
||||
private static RequiresGraph getRequiresGraph(@NotNull PsiJavaModule source) {
|
||||
Project project = source.getProject();
|
||||
return CachedValuesManager.getManager(project).getCachedValue(project, () ->
|
||||
Result.create(buildRequiresGraph(project), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT));
|
||||
}
|
||||
|
||||
// Starting from source modules, collects all module dependencies in the project.
|
||||
// The resulting graph is used for tracing readability.
|
||||
private static RequiresGraph buildRequiresGraph(Project project) {
|
||||
@@ -158,12 +148,6 @@ public class JavaModuleGraphUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void visit(RequiresGraph graph, PsiJavaModule module, Set<PsiJavaModule> result) {
|
||||
if (result.add(module)) {
|
||||
graph.dependencies(module).forEach(dependency -> visit(graph, dependency, result));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RequiresGraph {
|
||||
private final Graph<PsiJavaModule> myGraph;
|
||||
private final Set<String> myPublicEdges;
|
||||
@@ -187,10 +171,6 @@ public class JavaModuleGraphUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Iterable<PsiJavaModule> dependencies(PsiJavaModule node) {
|
||||
return myGraph.getNodes().contains(node) ? () -> myGraph.getIn(node) : Collections.emptyList();
|
||||
}
|
||||
|
||||
public static String key(PsiJavaModule module, PsiJavaModule exporter) {
|
||||
return module.getModuleName() + '/' + exporter.getModuleName();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -20,7 +20,7 @@ import com.intellij.lang.LangBundle;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.presentation.java.ClassPresentationUtil;
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
@@ -161,7 +161,6 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("HardCodedStringLiteral")
|
||||
public String getBinPath(@NotNull Sdk sdk) {
|
||||
return getConvertedHomePath(sdk) + "bin";
|
||||
}
|
||||
@@ -372,7 +371,6 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("HardCodedStringLiteral")
|
||||
public void setupSdkPaths(@NotNull Sdk sdk) {
|
||||
String homePath = sdk.getHomePath();
|
||||
assert homePath != null : sdk;
|
||||
@@ -488,11 +486,6 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
return versionString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull String versionString, @NotNull String versionNumber) {
|
||||
return getVersionNumber(versionString).compareTo(versionNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaSdkVersion getVersion(@NotNull Sdk sdk) {
|
||||
String version = sdk.getVersionString();
|
||||
@@ -665,12 +658,10 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
List<VirtualFile> result = ContainerUtil.newArrayList();
|
||||
VirtualFileManager fileManager = VirtualFileManager.getInstance();
|
||||
|
||||
String path = file.getPath();
|
||||
if (JrtFileSystem.isModularJdk(path)) {
|
||||
String url = VirtualFileManager.constructUrl(JrtFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path) + JrtFileSystem.SEPARATOR);
|
||||
for (String module : JrtFileSystem.listModules(path)) {
|
||||
ContainerUtil.addIfNotNull(result, fileManager.findFileByUrl(url + module));
|
||||
}
|
||||
VirtualFile jrt = fileManager.findFileByUrl(
|
||||
VirtualFileManager.constructUrl(JrtFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(file.getPath()) + JrtFileSystem.SEPARATOR));
|
||||
if (jrt != null) {
|
||||
ContainerUtil.addAll(result, jrt.getChildren());
|
||||
}
|
||||
|
||||
for (File root : JavaSdkUtil.getJdkClassesRoots(file, isJre)) {
|
||||
@@ -678,7 +669,7 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
ContainerUtil.addIfNotNull(result, fileManager.findFileByUrl(url));
|
||||
}
|
||||
|
||||
Collections.sort(result, (o1, o2) -> o1.getPath().compareTo(o2.getPath()));
|
||||
Collections.sort(result, Comparator.comparing(VirtualFile::getPath));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -691,13 +682,11 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("HardCodedStringLiteral")
|
||||
private static VirtualFile findSources(File file) {
|
||||
return findSources(file, "src");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("HardCodedStringLiteral")
|
||||
private static VirtualFile findSources(File file, final String srcName) {
|
||||
File jarFile = new File(file, srcName + ".jar");
|
||||
if (!jarFile.exists()) {
|
||||
@@ -719,7 +708,6 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("HardCodedStringLiteral")
|
||||
private static void addDocs(File file, SdkModificator rootContainer) {
|
||||
VirtualFile vFile = findDocs(file, "docs/api");
|
||||
if (vFile != null) {
|
||||
|
||||
+10
-70
@@ -23,18 +23,22 @@ import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.impl.ArchiveHandler;
|
||||
import com.intellij.openapi.vfs.newvfs.*;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
|
||||
import com.intellij.openapi.vfs.newvfs.VfsImplUtil;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -42,36 +46,19 @@ import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.intellij.util.containers.ContainerUtil.newTroveMap;
|
||||
|
||||
public class JrtFileSystem extends ArchiveFileSystem {
|
||||
public static final String PROTOCOL = StandardFileSystems.JRT_PROTOCOL;
|
||||
public static final String PROTOCOL_PREFIX = StandardFileSystems.JRT_PROTOCOL_PREFIX;
|
||||
public static final String SEPARATOR = JarFileSystem.JAR_SEPARATOR;
|
||||
|
||||
private static final boolean SUPPORTED =
|
||||
SystemInfo.isJavaVersionAtLeast("9") || SystemInfo.isJavaVersionAtLeast("1.8") && !SystemInfo.isJavaVersionAtLeast("1.9");
|
||||
|
||||
private static final URI ROOT_URI = URI.create("jrt:/");
|
||||
|
||||
public class JrtFileSystemImpl extends JrtFileSystem {
|
||||
private final Map<String, ArchiveHandler> myHandlers = newTroveMap(FileUtil.PATH_HASHING_STRATEGY);
|
||||
private final AtomicBoolean mySubscribed = new AtomicBoolean(false);
|
||||
|
||||
public JrtFileSystem() {
|
||||
public JrtFileSystemImpl() {
|
||||
scheduleConfiguredSdkCheck();
|
||||
}
|
||||
|
||||
@@ -213,51 +200,4 @@ public class JrtFileSystem extends ArchiveFileSystem {
|
||||
protected boolean isCorrectFileType(@NotNull VirtualFile local) {
|
||||
return isModularJdk(FileUtil.toSystemDependentName(local.getPath()));
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
return SUPPORTED;
|
||||
}
|
||||
|
||||
public static boolean isModularJdk(@NotNull String homePath) {
|
||||
return new File(homePath, "lib/modules").exists() && new File(homePath, "jrt-fs.jar").isFile();
|
||||
}
|
||||
|
||||
public static boolean isRoot(@NotNull VirtualFile file) {
|
||||
return file.getParent() == null && file.getFileSystem() instanceof JrtFileSystem;
|
||||
}
|
||||
|
||||
public static boolean isModuleRoot(@NotNull VirtualFile file) {
|
||||
VirtualFile parent = file.getParent();
|
||||
return parent != null && isRoot(parent);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> listModules(@NotNull String path) {
|
||||
try {
|
||||
Path root = getFileSystem(path).getPath("/modules");
|
||||
return Files.list(root).map(p -> p.getFileName().toString()).collect(Collectors.toList());
|
||||
}
|
||||
catch (IOException | InvalidPathException e) {
|
||||
Logger.getInstance(JrtFileSystem.class).warn(path, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
static FileSystem getFileSystem(String path) throws IOException {
|
||||
try {
|
||||
if (SystemInfo.isJavaVersionAtLeast("9")) {
|
||||
return FileSystems.newFileSystem(ROOT_URI, Collections.singletonMap("java.home", path));
|
||||
}
|
||||
else {
|
||||
File file = new File(path, "jrt-fs.jar");
|
||||
if (!file.exists()) throw new IOException("Missing provider: " + file);
|
||||
URL url = file.toURI().toURL();
|
||||
ClassLoader loader = new URLClassLoader(new URL[]{url}, null);
|
||||
return FileSystems.newFileSystem(ROOT_URI, Collections.emptyMap(), loader);
|
||||
}
|
||||
}
|
||||
catch (Error e) {
|
||||
throw new IOException("Error mounting JRT filesystem at " + path, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,20 +15,27 @@
|
||||
*/
|
||||
package com.intellij.openapi.vfs.impl.jrt;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.impl.ArchiveHandler;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
class JrtHandler extends ArchiveHandler {
|
||||
private static final URI ROOT_URI = URI.create("jrt:/");
|
||||
|
||||
private SoftReference<FileSystem> myFileSystem;
|
||||
|
||||
public JrtHandler(@NotNull String path) {
|
||||
@@ -38,8 +45,23 @@ class JrtHandler extends ArchiveHandler {
|
||||
private synchronized FileSystem getFileSystem() throws IOException {
|
||||
FileSystem fs = SoftReference.dereference(myFileSystem);
|
||||
if (fs == null) {
|
||||
fs = JrtFileSystem.getFileSystem(getFile().getPath());
|
||||
myFileSystem = new SoftReference<>(fs);
|
||||
String path = getFile().getPath();
|
||||
try {
|
||||
if (SystemInfo.isJavaVersionAtLeast("9")) {
|
||||
fs = FileSystems.newFileSystem(ROOT_URI, Collections.singletonMap("java.home", path));
|
||||
}
|
||||
else {
|
||||
File file = new File(path, "jrt-fs.jar");
|
||||
if (!file.exists()) throw new IOException("Missing provider: " + file);
|
||||
URL url = file.toURI().toURL();
|
||||
ClassLoader loader = new URLClassLoader(new URL[]{url}, null);
|
||||
fs = FileSystems.newFileSystem(ROOT_URI, Collections.emptyMap(), loader);
|
||||
}
|
||||
myFileSystem = new SoftReference<>(fs);
|
||||
}
|
||||
catch (RuntimeException | Error e) {
|
||||
throw new IOException("Error mounting JRT filesystem at " + path, e);
|
||||
}
|
||||
}
|
||||
return fs;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.openapi.roots.SourceFolder;
|
||||
import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
|
||||
@@ -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.
|
||||
@@ -61,14 +61,14 @@ public class AnnotationTargetUtil {
|
||||
}
|
||||
|
||||
if (owner instanceof PsiModifierList) {
|
||||
if (((PsiModifierList)owner).getNextSibling() instanceof PsiErrorElement) {
|
||||
return TargetType.EMPTY_ARRAY;
|
||||
}
|
||||
PsiElement element = ((PsiModifierList)owner).getParent();
|
||||
if (element instanceof PsiPackageStatement) {
|
||||
return PACKAGE_TARGETS;
|
||||
}
|
||||
if (element instanceof PsiClass) {
|
||||
if (((PsiClass)element).getModifierList() != owner){
|
||||
return TargetType.EMPTY_ARRAY;
|
||||
}
|
||||
if (((PsiClass)element).isAnnotationType()) {
|
||||
return ANNOTATION_TARGETS;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.intellij.openapi.vfs;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.impl.jrt.JrtFileSystem;
|
||||
import com.intellij.openapi.vfs.jrt.JrtFileSystem;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import org.junit.Before;
|
||||
@@ -64,9 +64,10 @@ public class JrtFileSystemTest extends BareTestFixtureTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moduleListing() {
|
||||
String path = myTempDir.getRoot().getPath();
|
||||
assertThat(JrtFileSystem.listModules(path)).containsExactlyInAnyOrder("java.base", "test1");
|
||||
public void nonRoot() {
|
||||
String url = VirtualFileManager.constructUrl(JrtFileSystem.PROTOCOL, JavaTestUtil.getJavaTestDataPath() + JrtFileSystem.SEPARATOR);
|
||||
VirtualFile root = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
assertThat(root).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.
|
||||
@@ -17,33 +17,27 @@ package com.intellij.openapi.projectRoots;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.projectRoots.impl.SdkVersionUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class JavaSdk extends SdkType implements JavaSdkType {
|
||||
public JavaSdk(@NotNull @NonNls String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static JavaSdk getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(JavaSdk.class);
|
||||
}
|
||||
|
||||
public JavaSdk(@NotNull String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final Sdk createJdk(@NotNull String jdkName, @NotNull String jreHome) {
|
||||
return createJdk(jdkName, jreHome, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #isOfVersionOrHigher(Sdk, JavaSdkVersion)} instead
|
||||
*/
|
||||
public abstract int compareTo(@NotNull String versionString, @NotNull String versionNumber);
|
||||
|
||||
@NotNull
|
||||
public abstract Sdk createJdk(@NonNls String jdkName, @NotNull String home, boolean isJre);
|
||||
public abstract Sdk createJdk(String jdkName, @NotNull String home, boolean isJre);
|
||||
|
||||
@Nullable
|
||||
public abstract JavaSdkVersion getVersion(@NotNull Sdk sdk);
|
||||
@@ -65,4 +59,4 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType {
|
||||
public static String getJdkVersion(@NotNull String sdkHome) {
|
||||
return SdkVersionUtil.detectJdkVersion(sdkHome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.vfs.jrt;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class JrtFileSystem extends ArchiveFileSystem {
|
||||
public static final String PROTOCOL = StandardFileSystems.JRT_PROTOCOL;
|
||||
public static final String PROTOCOL_PREFIX = StandardFileSystems.JRT_PROTOCOL_PREFIX;
|
||||
public static final String SEPARATOR = URLUtil.JAR_SEPARATOR;
|
||||
|
||||
private static final boolean SUPPORTED =
|
||||
SystemInfo.isJavaVersionAtLeast("9") || SystemInfo.isJavaVersionAtLeast("1.8") && !SystemInfo.isJavaVersionAtLeast("1.9");
|
||||
|
||||
public static boolean isSupported() {
|
||||
return SUPPORTED;
|
||||
}
|
||||
|
||||
public static boolean isModularJdk(@NotNull String homePath) {
|
||||
return new File(homePath, "lib/modules").exists() && new File(homePath, "jrt-fs.jar").isFile();
|
||||
}
|
||||
|
||||
public static boolean isRoot(@NotNull VirtualFile file) {
|
||||
return file.getParent() == null && file.getFileSystem() instanceof JrtFileSystem;
|
||||
}
|
||||
|
||||
public static boolean isModuleRoot(@NotNull VirtualFile file) {
|
||||
VirtualFile parent = file.getParent();
|
||||
return parent != null && isRoot(parent);
|
||||
}
|
||||
}
|
||||
@@ -81,13 +81,6 @@ public class PathsList {
|
||||
add(LOCAL_PATH.fun(file));
|
||||
}
|
||||
|
||||
public void remove(VirtualFile file) {
|
||||
String path = LOCAL_PATH.fun(file);
|
||||
if (path != null) {
|
||||
remove(path);
|
||||
}
|
||||
}
|
||||
|
||||
public void addFirst(String path) {
|
||||
int index = 0;
|
||||
for (String element : chooseFirstTimeItems(path)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -17,15 +17,17 @@ package com.intellij.openapi.roots;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Root types that can be queried from OrderEntry.
|
||||
* @see OrderEntry
|
||||
*
|
||||
* @author dsl
|
||||
* @see OrderEntry
|
||||
*/
|
||||
public class OrderRootType {
|
||||
private final String myName;
|
||||
@@ -35,29 +37,30 @@ public class OrderRootType {
|
||||
|
||||
protected static PersistentOrderRootType[] ourPersistentOrderRootTypes = new PersistentOrderRootType[0];
|
||||
|
||||
protected OrderRootType(@NonNls String name) {
|
||||
protected OrderRootType(String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Classpath without output directories for modules.
|
||||
* Includes:
|
||||
* <li> classes roots for libraries and jdk
|
||||
* <li> recursively for module dependencies: only exported items
|
||||
* Classpath without output directories for modules. Includes:
|
||||
* <ul>
|
||||
* <li>classes roots for libraries and jdk</li>
|
||||
* <li>recursively for module dependencies: only exported items</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final OrderRootType CLASSES = new PersistentOrderRootType("CLASSES", "classPath", null, "classPathEntry");
|
||||
|
||||
/**
|
||||
* Sources.
|
||||
* Includes:
|
||||
* <li> production and test source roots for modules
|
||||
* <li> source roots for libraries and jdk
|
||||
* <li> recursively for module dependencies: only exported items
|
||||
* Sources. Includes:
|
||||
* <ul>
|
||||
* <li>production and test source roots for modules</li>
|
||||
* <li>source roots for libraries and jdk</li>
|
||||
* <li>recursively for module dependencies: only exported items</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final OrderRootType SOURCES = new PersistentOrderRootType("SOURCES", "sourcePath", null, "sourcePathEntry");
|
||||
|
||||
/**
|
||||
* Documentation.
|
||||
* Generic documentation order root type
|
||||
*/
|
||||
public static final OrderRootType DOCUMENTATION = new DocumentationRootType();
|
||||
@@ -67,19 +70,14 @@ public class OrderRootType {
|
||||
* cases if supported by LibraryType.
|
||||
*/
|
||||
public static class DocumentationRootType extends OrderRootType {
|
||||
|
||||
public DocumentationRootType() {
|
||||
super("DOCUMENTATION");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean skipWriteIfEmpty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getSdkRootName() {
|
||||
return "documentation";
|
||||
}
|
||||
}
|
||||
|
||||
public String name() {
|
||||
@@ -117,13 +115,13 @@ public class OrderRootType {
|
||||
|
||||
protected static <T> T getOrderRootType(final Class<? extends T> orderRootTypeClass) {
|
||||
OrderRootType[] rootTypes = Extensions.getExtensions(EP_NAME);
|
||||
for(OrderRootType rootType: rootTypes) {
|
||||
for (OrderRootType rootType : rootTypes) {
|
||||
if (orderRootTypeClass.isInstance(rootType)) {
|
||||
//noinspection unchecked
|
||||
return (T)rootType;
|
||||
@SuppressWarnings("unchecked") T t = (T)rootType;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
assert false : "Root type "+orderRootTypeClass+" not found. All roots: "+ Arrays.asList(rootTypes);
|
||||
assert false : "Root type " + orderRootTypeClass + " not found. All roots: " + Arrays.asList(rootTypes);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -139,4 +137,4 @@ public class OrderRootType {
|
||||
public String toString() {
|
||||
return "Root " + name();
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-9
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.structuralsearch.impl.matcher.handlers;
|
||||
|
||||
import com.intellij.dupLocator.iterators.FilteringNodeIterator;
|
||||
@@ -119,22 +134,26 @@ public class SubstitutionHandler extends MatchingHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
MatchResultImpl result = context.getResult().findSon(name);
|
||||
|
||||
MatchResultImpl result = context.hasResult() ? context.getResult().findSon(name) : null;
|
||||
|
||||
if (result == null && context.getPreviousResult() != null) {
|
||||
result = context.getPreviousResult().findSon(name);
|
||||
}
|
||||
|
||||
if (result!=null) {
|
||||
if (result != null) {
|
||||
if (minOccurs == 1 && maxOccurs == 1) {
|
||||
// check if they are the same
|
||||
return validateOneMatch(match, start, end, result,context);
|
||||
} else if (maxOccurs > 1 && totalMatchedOccurs!=-1) {
|
||||
final int size = result.getAllSons().size();
|
||||
if (matchedOccurs >= size) {
|
||||
return false;
|
||||
} else if (maxOccurs > 1 && totalMatchedOccurs != -1) {
|
||||
if (result.isMultipleMatch()) {
|
||||
final int size = result.getAllSons().size();
|
||||
if (matchedOccurs >= size) {
|
||||
return false;
|
||||
}
|
||||
if (size != 0) {
|
||||
result = (MatchResultImpl)result.getAllSons().get(matchedOccurs);
|
||||
}
|
||||
}
|
||||
result = size == 0 ?result:(MatchResultImpl)result.getAllSons().get(matchedOccurs);
|
||||
// check if they are the same
|
||||
return validateOneMatch(match, start, end, result, context);
|
||||
}
|
||||
@@ -241,7 +260,7 @@ public class SubstitutionHandler extends MatchingHandler {
|
||||
}
|
||||
|
||||
boolean validate(MatchContext context, Class elementContext) {
|
||||
MatchResult substitution = context.getResult().findSon(name);
|
||||
MatchResult substitution = context.hasResult() ? context.getResult().findSon(name) : null;
|
||||
|
||||
if (minOccurs >= 1 &&
|
||||
( substitution == null ||
|
||||
|
||||
+440
-1545
File diff suppressed because it is too large
Load Diff
+27
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.structuralsearch.impl.matcher.compiler;
|
||||
|
||||
import com.intellij.structuralsearch.MalformedPatternException;
|
||||
@@ -239,6 +254,18 @@ public class StringToConstraintsTransformerTest {
|
||||
test("'a:[regex( .* ) ]");
|
||||
}
|
||||
|
||||
@Test(expected = MalformedPatternException.class)
|
||||
public void testInvalidRegex() {
|
||||
test("'T:{ ;");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSpacesSurroundingRegexNeeded() {
|
||||
test("'t:[regex(a)]");
|
||||
final MatchVariableConstraint constraint = myOptions.getVariableConstraint("t");
|
||||
assertEquals("a", constraint.getRegExp());
|
||||
}
|
||||
|
||||
private void test(String pattern) {
|
||||
myOptions.setSearchPattern(pattern);
|
||||
StringToConstraintsTransformer.transformOldPattern(myOptions);
|
||||
|
||||
+6
-3
@@ -25,7 +25,10 @@ import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.InspectionGadgetsFix;
|
||||
import com.siyeh.ig.psiutils.*;
|
||||
import com.siyeh.ig.psiutils.DeclarationSearchUtils;
|
||||
import com.siyeh.ig.psiutils.ExpressionUtils;
|
||||
import com.siyeh.ig.psiutils.LibraryUtil;
|
||||
import com.siyeh.ig.psiutils.ParenthesesUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -61,7 +64,7 @@ public abstract class MisorderedAssertEqualsArgumentsInspectionBase extends Base
|
||||
return new FlipArgumentsFix();
|
||||
}
|
||||
|
||||
private static class FlipArgumentsFix extends InspectionGadgetsFix {
|
||||
private class FlipArgumentsFix extends InspectionGadgetsFix {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@@ -85,7 +88,7 @@ public abstract class MisorderedAssertEqualsArgumentsInspectionBase extends Base
|
||||
if (method == null) {
|
||||
return;
|
||||
}
|
||||
final ExpectedActual expectedActual = ExpectedActual.create(method, callExpression.getArgumentList().getExpressions(), true);
|
||||
final ExpectedActual expectedActual = ExpectedActual.create(method, callExpression.getArgumentList().getExpressions(), checkTestNG());
|
||||
if (expectedActual == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-15
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.naming;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiSuperMethodUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
@@ -54,14 +53,9 @@ public class LambdaUnfriendlyMethodOverloadInspectionBase extends BaseInspection
|
||||
|
||||
private static class LambdaUnfriendlyMethodOverloadVisitor extends BaseInspectionVisitor {
|
||||
|
||||
private static final Key<Boolean> SKIP_MARKER = new Key<>("skip marker for lambda unfriendly method overload inspection");
|
||||
|
||||
@Override
|
||||
public void visitMethod(PsiMethod method) {
|
||||
super.visitMethod(method);
|
||||
if (method.getUserData(SKIP_MARKER) == Boolean.TRUE) {
|
||||
return;
|
||||
}
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
final int parametersCount = parameterList.getParametersCount();
|
||||
if (parametersCount == 0) {
|
||||
@@ -84,7 +78,6 @@ public class LambdaUnfriendlyMethodOverloadInspectionBase extends BaseInspection
|
||||
return;
|
||||
}
|
||||
final String name = method.getName();
|
||||
boolean problemFound = false;
|
||||
for (PsiMethod sameNameMethod : containingClass.findMethodsByName(name, true)) {
|
||||
if (method.equals(sameNameMethod) || PsiSuperMethodUtil.isSuperMethod(method, sameNameMethod)) {
|
||||
continue;
|
||||
@@ -103,16 +96,10 @@ public class LambdaUnfriendlyMethodOverloadInspectionBase extends BaseInspection
|
||||
}
|
||||
|
||||
if (areSameShapeFunctionalTypes(functionalType, otherFunctionalType)) {
|
||||
problemFound = true;
|
||||
if (containingClass.equals(sameNameMethod.getContainingClass())) {
|
||||
registerMethodError(sameNameMethod, sameNameMethod);
|
||||
sameNameMethod.putUserData(SKIP_MARKER, Boolean.TRUE);
|
||||
}
|
||||
registerMethodError(method, method);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (problemFound) {
|
||||
registerMethodError(method, method);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean areSameShapeFunctionalTypes(PsiType one, PsiType two) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<fileEditorProvider implementation="org.jetbrains.plugins.terminal.vfs.TerminalSessionEditorProvider"/>
|
||||
|
||||
<applicationService serviceImplementation="org.jetbrains.plugins.terminal.TerminalOptionsProvider"/>
|
||||
<projectService serviceImplementation="org.jetbrains.plugins.terminal.TerminalProjectOptionsProvider"/>
|
||||
</extensions>
|
||||
|
||||
<project-components>
|
||||
|
||||
@@ -61,7 +61,6 @@ public class TerminalOptionsConfigurable implements SearchableConfigurable, Conf
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
myPanel = new TerminalSettingsPanel();
|
||||
if (myProjectOptionsProvider == null) return new JPanel();
|
||||
return myPanel.createPanel(myOptionsProvider, myProjectOptionsProvider);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import java.io.File;
|
||||
* @author traff
|
||||
*/
|
||||
@State(
|
||||
name = "TerminalOptionsProvider",
|
||||
name = "TerminalProjectOptionsProvider",
|
||||
storages = @Storage("terminal.xml")
|
||||
)
|
||||
public class TerminalProjectOptionsProvider implements PersistentStateComponent<TerminalProjectOptionsProvider.State> {
|
||||
@@ -42,7 +42,7 @@ public class TerminalProjectOptionsProvider implements PersistentStateComponent<
|
||||
private State myState = new State();
|
||||
private final Project myProject;
|
||||
|
||||
public TerminalProjectOptionsProvider(Project project) {myProject = project;}
|
||||
public TerminalProjectOptionsProvider(@NotNull Project project) {myProject = project;}
|
||||
|
||||
|
||||
public static TerminalProjectOptionsProvider getInstance(@NotNull Project project) {
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
|
||||
<application-components>
|
||||
<component>
|
||||
<implementation-class>com.intellij.openapi.vfs.impl.jrt.JrtFileSystem</implementation-class>
|
||||
<interface-class>com.intellij.openapi.vfs.jrt.JrtFileSystem</interface-class>
|
||||
<implementation-class>com.intellij.openapi.vfs.impl.jrt.JrtFileSystemImpl</implementation-class>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>com.intellij.util.xml.impl.JavaDomApplicationComponent</implementation-class>
|
||||
|
||||
Reference in New Issue
Block a user