mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package com.intellij.openapi.module;
|
||||
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -69,9 +68,7 @@ public interface ModifiableModuleModel {
|
||||
* @return the module instance.
|
||||
* @throws InvalidDataException if the data in the .iml file is semantically incorrect.
|
||||
* @throws IOException if an I/O error occurred when loading the module file.
|
||||
* @throws JDOMException if the file contains invalid XML data.
|
||||
* @throws ModuleWithNameAlreadyExists if a module with such a name already exists in the project.
|
||||
* @throws LoadCancelledException if loading the module was cancelled by some of the components.
|
||||
*/
|
||||
@NotNull Module loadModule(@NotNull String filePath) throws IOException, ModuleWithNameAlreadyExists;
|
||||
|
||||
|
||||
+6
-10
@@ -39,6 +39,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.containers.StringInterner;
|
||||
@@ -50,7 +51,6 @@ import com.intellij.util.messages.MessageBus;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -74,7 +74,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
@NonNls public static final String COMPONENT_NAME = "ProjectModuleManager";
|
||||
private static final String MODULE_GROUP_SEPARATOR = "/";
|
||||
private List<ModulePath> myModulePaths;
|
||||
private final List<ModulePath> myFailedModulePaths = new ArrayList<>();
|
||||
private final List<ModulePath> myFailedModulePaths = new SmartList<>();
|
||||
@NonNls public static final String ELEMENT_MODULES = "modules";
|
||||
@NonNls public static final String ELEMENT_MODULE = "module";
|
||||
@NonNls private static final String ATTRIBUTE_FILEURL = "fileurl";
|
||||
@@ -148,7 +148,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
@Override
|
||||
public void loadState(Element state) {
|
||||
List<ModulePath> prevPaths = myModulePaths;
|
||||
readExternal(state);
|
||||
myModulePaths = new ArrayList<>(getPathsToModuleFiles(state));
|
||||
if (prevPaths == null) {
|
||||
return;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ModulePath[] getPathsToModuleFiles(@NotNull Element element) {
|
||||
public static List<ModulePath> getPathsToModuleFiles(@NotNull Element element) {
|
||||
final List<ModulePath> paths = new ArrayList<>();
|
||||
final Element modules = element.getChild(ELEMENT_MODULES);
|
||||
if (modules != null) {
|
||||
@@ -220,11 +220,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
paths.add(new ModulePath(filepath, group));
|
||||
}
|
||||
}
|
||||
return paths.toArray(new ModulePath[paths.size()]);
|
||||
}
|
||||
|
||||
public void readExternal(@NotNull Element element) {
|
||||
myModulePaths = new ArrayList<>(Arrays.asList(getPathsToModuleFiles(element)));
|
||||
return paths;
|
||||
}
|
||||
|
||||
protected void loadModules(@NotNull ModuleModelImpl moduleModel) {
|
||||
@@ -459,7 +455,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Module loadModule(@NotNull String filePath) throws IOException, JDOMException, ModuleWithNameAlreadyExists {
|
||||
public Module loadModule(@NotNull String filePath) throws IOException, ModuleWithNameAlreadyExists {
|
||||
incModificationCount();
|
||||
final ModifiableModuleModel modifiableModel = getModifiableModel();
|
||||
final Module module = modifiableModel.loadModule(filePath);
|
||||
|
||||
@@ -408,8 +408,7 @@ public class PathManagerEx {
|
||||
try {
|
||||
Element element = JDomSerializationUtil.findComponent(JDOMUtil.load(modulesXml), ModuleManagerImpl.COMPONENT_NAME);
|
||||
assert element != null;
|
||||
ModuleManagerImpl.ModulePath[] files = ModuleManagerImpl.getPathsToModuleFiles(element);
|
||||
for (ModuleManagerImpl.ModulePath file : files) {
|
||||
for (ModuleManagerImpl.ModulePath file : ModuleManagerImpl.getPathsToModuleFiles(element)) {
|
||||
String name = FileUtil.getNameWithoutExtension(PathUtil.getFileName(file.getPath()));
|
||||
ourCommunityModules.add(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user