[java] drops obsolete JRT validity check

This commit is contained in:
Roman Shevchenko
2016-11-21 13:20:43 +01:00
parent 656cd6a649
commit 0b36b9242d
3 changed files with 1 additions and 64 deletions
@@ -18,7 +18,6 @@ package com.intellij.openapi.projectRoots.impl;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.util.ExecUtil;
import com.intellij.icons.AllIcons;
import com.intellij.lang.LangBundle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.application.PathManager;
@@ -286,19 +285,7 @@ public class JavaSdkImpl extends JavaSdk {
@NotNull
@Override
public FileChooserDescriptor getHomeChooserDescriptor() {
final FileChooserDescriptor baseDescriptor = super.getHomeChooserDescriptor();
final FileChooserDescriptor descriptor = new FileChooserDescriptor(baseDescriptor) {
@Override
public void validateSelectedFiles(VirtualFile[] files) throws Exception {
if (files.length > 0 && !JrtFileSystem.isSupported()) {
String path = files[0].getPath();
if (JrtFileSystem.isModularJdk(path) || JrtFileSystem.isModularJdk(adjustSelectedSdkHome(path))) {
throw new Exception(LangBundle.message("jrt.not.available.message"));
}
}
baseDescriptor.validateSelectedFiles(files);
}
};
FileChooserDescriptor descriptor = super.getHomeChooserDescriptor();
descriptor.putUserData(KEY, Boolean.TRUE);
return descriptor;
}
@@ -15,19 +15,9 @@
*/
package com.intellij.openapi.vfs.impl.jrt;
import com.intellij.ide.AppLifecycleListener;
import com.intellij.lang.LangBundle;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
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.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.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
@@ -42,7 +32,6 @@ 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;
import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,7 +39,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
import static com.intellij.util.containers.ContainerUtil.newTroveMap;
@@ -58,40 +46,6 @@ public class JrtFileSystemImpl extends JrtFileSystem {
private final Map<String, ArchiveHandler> myHandlers = newTroveMap(FileUtil.PATH_HASHING_STRATEGY);
private final AtomicBoolean mySubscribed = new AtomicBoolean(false);
public JrtFileSystemImpl() {
scheduleConfiguredSdkCheck();
}
private static void scheduleConfiguredSdkCheck() {
Application app = ApplicationManager.getApplication();
final MessageBusConnection connection = app.getMessageBus().connect();
connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
@Override
public void appStarting(Project project) {
app.invokeLater(() -> {
for (Sdk sdk : ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance())) {
Stream.of(sdk.getRootProvider().getUrls(OrderRootType.CLASSES))
.filter(url -> url.startsWith(PROTOCOL_PREFIX))
.findFirst()
.ifPresent(url -> {
if (!isSupported()) {
String title = LangBundle.message("jrt.not.available.title", sdk.getName());
String message = LangBundle.message("jrt.not.available.message");
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, message, NotificationType.WARNING));
}
else if (url.endsWith(SEPARATOR)) {
String title = LangBundle.message("jrt.outdated.title", sdk.getName());
String message = LangBundle.message("jrt.outdated.message");
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, message, NotificationType.WARNING));
}
});
}
connection.disconnect();
}, app.getDisposed());
}
});
}
@NotNull
@Override
public String getProtocol() {
@@ -54,10 +54,6 @@ quickfix.change.template.data.language.text=Change {0} template data language to
incorrect.name=Incorrect name
jrt.node.short=[JRT]
jrt.not.available.message=You need to run IDEA on Java 8+ to be able to use modular JDK. Sorry.
jrt.not.available.title=Unsupported JDK ''{0}'' detected
jrt.outdated.message=JDK definition need to be updated. Please delete and re-create the JDK.
jrt.outdated.title=Outdated JDK ''{0}''
compound.run.configuration.cycle={0} ''{1}'' causes dependency cycle and cannot be added