X-Git-Url: https://git.jetbrains.org/?p=idea%2Fcommunity.git;a=blobdiff_plain;f=platform%2Fcore-impl%2Fsrc%2Fcom%2Fintellij%2Fide%2Fplugins%2FPluginManagerCore.java;h=e2711874aff74037cf9748c6a0c65d6f63ef65c3;hp=1922fb6cfcbbd055ae5626d276e05c17a0eddba0;hb=ae06d36a7382c58f8b5b775efd9e58559cbfe7bb;hpb=be9338022f8e1ad91c4d5f16c332522ae7ddeb21 diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java index 1922fb6cfcbb..e2711874aff7 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java @@ -619,56 +619,57 @@ public class PluginManagerCore { descriptor = loadDescriptorFromDir(file, fileName); if (descriptor == null) { - File libDir = new File(file, "lib"); - if (!libDir.isDirectory()) { - return null; - } - final File[] files = libDir.listFiles(); - if (files == null || files.length == 0) { - return null; - } - Arrays.sort(files, new Comparator() { - @Override - public int compare(@NotNull File o1, @NotNull File o2) { - if (o2.getName().startsWith(file.getName())) return Integer.MAX_VALUE; - if (o1.getName().startsWith(file.getName())) return -Integer.MAX_VALUE; - if (o2.getName().startsWith("resources")) return -Integer.MAX_VALUE; - if (o1.getName().startsWith("resources")) return Integer.MAX_VALUE; - return 0; - } - }); - for (final File f : files) { - if (FileUtil.isJarOrZip(f)) { - descriptor = loadDescriptorFromJar(f, fileName); - if (descriptor != null) { - descriptor.setPath(file); - break; - } -// getLogger().warn("Cannot load descriptor from " + f.getName() + ""); - } - else if (f.isDirectory()) { - IdeaPluginDescriptorImpl descriptor1 = loadDescriptorFromDir(f, fileName); - if (descriptor1 != null) { - if (descriptor != null) { - getLogger().info("Cannot load " + file + " because two or more plugin.xml's detected"); - return null; - } - descriptor = descriptor1; - descriptor.setPath(file); - } - } - } - } + File libDir = new File(file, "lib"); + if (!libDir.isDirectory()) { + return null; + } + final File[] files = libDir.listFiles(); + if (files == null || files.length == 0) { + return null; + } + Arrays.sort(files, new Comparator() { + @Override + public int compare(@NotNull File o1, @NotNull File o2) { + if (o2.getName().startsWith(file.getName())) return Integer.MAX_VALUE; + if (o1.getName().startsWith(file.getName())) return -Integer.MAX_VALUE; + if (o2.getName().startsWith("resources")) return -Integer.MAX_VALUE; + if (o1.getName().startsWith("resources")) return Integer.MAX_VALUE; + return 0; + } + }); + for (final File f : files) { + if (FileUtil.isJarOrZip(f)) { + descriptor = loadDescriptorFromJar(f, fileName); + if (descriptor != null) { + descriptor.setPath(file); + break; + } + // getLogger().warn("Cannot load descriptor from " + f.getName() + ""); + } + else if (f.isDirectory()) { + IdeaPluginDescriptorImpl descriptor1 = loadDescriptorFromDir(f, fileName); + if (descriptor1 != null) { + if (descriptor != null) { + getLogger().info("Cannot load " + file + " because two or more plugin.xml's detected"); + return null; + } + descriptor = descriptor1; + descriptor.setPath(file); + } + } + } + } } else if (StringUtil.endsWithIgnoreCase(file.getName(), ".jar") && file.exists()) { descriptor = loadDescriptorFromJar(file, fileName); } if (descriptor != null && descriptor.getOptionalConfigs() != null && !descriptor.getOptionalConfigs().isEmpty()) { - final Map descriptors = new THashMap(descriptor.getOptionalConfigs().size()); - for (Map.Entry entry: descriptor.getOptionalConfigs().entrySet()) { + final Map descriptors = + new THashMap(descriptor.getOptionalConfigs().size()); + for (Map.Entry entry : descriptor.getOptionalConfigs().entrySet()) { String optionalDescriptorName = entry.getValue(); - assert !Comparing.equal(fileName, optionalDescriptorName) : "recursive dependency: "+ fileName; + assert !Comparing.equal(fileName, optionalDescriptorName) : "recursive dependency: " + fileName; IdeaPluginDescriptorImpl optionalDescriptor = loadDescriptor(file, optionalDescriptorName); if (optionalDescriptor == null && !FileUtil.isJarOrZip(file)) { @@ -690,6 +691,7 @@ public class PluginManagerCore { } descriptor.setOptionalDescriptors(descriptors); } + return descriptor; }