From 6df4c04c3996366d958962c1987302bf4563df9d Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Wed, 25 Jan 2017 11:48:08 +0700 Subject: [PATCH] IDEA-167087 Pressing cancel in Project Structure|SDKs|Sourcepath|'+' file chooser dialog results in confusing dialog box --- .../intellij/openapi/projectRoots/ui/PathEditor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java index 452daeeda18b..4567cfa5171d 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -26,7 +26,10 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; -import com.intellij.openapi.vfs.*; +import com.intellij.openapi.vfs.JarFileSystem; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtilCore; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.ex.http.HttpFileSystem; import com.intellij.ui.*; import com.intellij.ui.components.JBList; @@ -166,6 +169,9 @@ public class PathEditor { protected VirtualFile[] doAddItems() { Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel)); VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myPanel, project, myAddBaseDir); + if (files.length == 0) { + return VirtualFile.EMPTY_ARRAY; + } files = adjustAddedFileSet(myPanel, files); List added = new ArrayList<>(files.length); for (VirtualFile vFile : files) {