From 3885a8dc2720b557b2f58baaef8f142c4e41c5e1 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 11 Nov 2014 11:36:46 +0100 Subject: [PATCH] IDEA-132645 Eclipse integration problem: all imported modules have been lost after project reloading (100% reproduce) --- .../impl/ModuleRootManagerComponent.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java index 46f0cb1b4697..66db0cc72b63 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -40,15 +40,20 @@ public class ModuleRootManagerComponent extends ModuleRootManagerImpl implements super(module, projectRootManager, filePointerManager); } - public static class StorageChooser implements StateStorageChooser { + static class StorageChooser implements StateStorageChooser { @Override public Storage[] selectStorages(Storage[] storages, ModuleRootManagerImpl moduleRootManager, final StateStorageOperation operation) { - final boolean isDefaultStorageType = ClassPathStorageUtil.isDefaultStorage(moduleRootManager.getModule()); - final String id = isDefaultStorageType ? ClassPathStorageUtil.DEFAULT_STORAGE: ClasspathStorage.SPECIAL_STORAGE; - for (Storage storage : storages) { - if (storage.id().equals(id)) return new Storage[]{storage}; + if (ClassPathStorageUtil.isDefaultStorage(moduleRootManager.getModule())) { + for (Storage storage : storages) { + if (storage.id().equals(ClassPathStorageUtil.DEFAULT_STORAGE)) { + return new Storage[]{storage}; + } + } + throw new IllegalArgumentException(); + } + else { + return storages; } - throw new IllegalArgumentException(); } } }