mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
partially revert "module options management — use Key instead of string keys" — module options concept should be deprecated, but not improved
This commit is contained in:
-3
@@ -17,7 +17,6 @@ package org.jetbrains.jps.model.serialization;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileFilters;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -64,9 +63,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
|
||||
private static final Logger LOG = Logger.getInstance(JpsProjectLoader.class);
|
||||
private static final BoundedTaskExecutor ourThreadPool = new BoundedTaskExecutor(SharedThreadPool.getInstance(), Runtime.getRuntime().availableProcessors());
|
||||
public static final String CLASSPATH_ATTRIBUTE = "classpath";
|
||||
public static final Key<String> CLASSPATH_ATTRIBUTE_KEY = Key.create(CLASSPATH_ATTRIBUTE);
|
||||
public static final String CLASSPATH_DIR_ATTRIBUTE = "classpath-dir";
|
||||
public static final Key<String> CLASSPATH_DIR_ATTRIBUTE_KEY = Key.create(CLASSPATH_DIR_ATTRIBUTE);
|
||||
private final JpsProject myProject;
|
||||
private final Map<String, String> myPathVariables;
|
||||
|
||||
|
||||
+14
-22
@@ -18,19 +18,17 @@ package com.intellij.openapi.components.impl.stores;
|
||||
import com.intellij.openapi.components.PathMacroSubstitutor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.OptionManager;
|
||||
import com.intellij.openapi.module.impl.ModuleManagerImpl;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.keyFMap.KeyFMap;
|
||||
import org.jdom.Attribute;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData implements OptionManager {
|
||||
private KeyFMap options;
|
||||
private TreeMap<String, String> options;
|
||||
private final Module myModule;
|
||||
|
||||
private boolean dirty = true;
|
||||
@@ -39,7 +37,7 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
super(rootElementName);
|
||||
|
||||
myModule = module;
|
||||
options = KeyFMap.EMPTY_MAP;
|
||||
options = new TreeMap<String, String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,7 +50,7 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
|
||||
myModule = storageData.myModule;
|
||||
dirty = storageData.dirty;
|
||||
options = storageData.options;
|
||||
options = new TreeMap<String, String>(storageData.options);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +60,7 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
for (Attribute attribute : rootElement.getAttributes()) {
|
||||
String name = attribute.getName();
|
||||
if (!name.equals(BaseFileConfigurableStoreImpl.VERSION_OPTION) && !StringUtil.isEmpty(name)) {
|
||||
options = options.plus(ModuleManagerImpl.createOptionKey(name), attribute.getValue());
|
||||
options.put(name, attribute.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,11 +70,10 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
@Override
|
||||
protected void writeOptions(@NotNull Element root, @NotNull String versionString) {
|
||||
if (!options.isEmpty()) {
|
||||
//noinspection unchecked
|
||||
for (Key<String> key : options.getKeys()) {
|
||||
for (String key : options.keySet()) {
|
||||
String value = options.get(key);
|
||||
if (value != null) {
|
||||
root.setAttribute(key.toString(), value);
|
||||
root.setAttribute(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +92,7 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
@Override
|
||||
public Set<String> getChangedComponentNames(@NotNull StorageData newStorageData, @Nullable PathMacroSubstitutor substitutor) {
|
||||
final ModuleFileData data = (ModuleFileData)newStorageData;
|
||||
if (options != data.options) {
|
||||
if (!options.equals(data.options)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -103,27 +100,22 @@ final class ModuleFileData extends BaseFileConfigurableStoreImpl.BaseStorageData
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption(@NotNull Key<String> key, @NotNull String optionValue) {
|
||||
if (optionValue.equals(options.get(key))) {
|
||||
return;
|
||||
public void setOption(@NotNull String key, @NotNull String value) {
|
||||
if (!value.equals(options.put(key, value))) {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
options = options.plus(key, optionValue);
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOption(@NotNull Key<String> key) {
|
||||
KeyFMap newOptions = options.minus(key);
|
||||
if (newOptions != options) {
|
||||
options = newOptions;
|
||||
public void clearOption(@NotNull String key) {
|
||||
if (options.remove(key) != null) {
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getOptionValue(@NotNull Key<String> key) {
|
||||
public String getOptionValue(@NotNull String key) {
|
||||
return options.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ComponentManager;
|
||||
import com.intellij.openapi.extensions.AreaInstance;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -40,8 +39,6 @@ public interface Module extends ComponentManager, AreaInstance, Disposable, Opti
|
||||
|
||||
@NonNls String ELEMENT_TYPE = "type";
|
||||
|
||||
Key<String> ELEMENT_TYPE_KEY = Key.create("type");
|
||||
|
||||
/**
|
||||
* Returns the <code>VirtualFile</code> for the module .iml file.
|
||||
*
|
||||
@@ -81,17 +78,6 @@ public interface Module extends ComponentManager, AreaInstance, Disposable, Opti
|
||||
|
||||
boolean isLoaded();
|
||||
|
||||
@Deprecated
|
||||
void setOption(@NotNull String optionName, @NotNull String optionValue);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
void clearOption(@NotNull String optionName);
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
String getOptionValue(@NotNull String optionName);
|
||||
|
||||
/**
|
||||
* Returns module scope including sources and tests, excluding libraries and dependencies.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.module;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -25,7 +24,7 @@ public interface OptionManager {
|
||||
*
|
||||
* @param key the name of the custom option.
|
||||
*/
|
||||
void clearOption(@NotNull Key<String> key);
|
||||
void clearOption(@NotNull String key);
|
||||
|
||||
/**
|
||||
* Sets a custom option for this module.
|
||||
@@ -33,7 +32,7 @@ public interface OptionManager {
|
||||
* @param key the name of the custom option.
|
||||
* @param value the value of the custom option.
|
||||
*/
|
||||
void setOption(@NotNull Key<String> key, @NotNull String value);
|
||||
void setOption(@NotNull String key, @NotNull String value);
|
||||
|
||||
/**
|
||||
* Gets the value of a custom option for this module.
|
||||
@@ -42,5 +41,5 @@ public interface OptionManager {
|
||||
* @return the value of the custom option, or null if no value has been set.
|
||||
*/
|
||||
@Nullable
|
||||
String getOptionValue(@NotNull Key<String> key);
|
||||
String getOptionValue(@NotNull String key);
|
||||
}
|
||||
|
||||
+2
-2
@@ -255,11 +255,11 @@ public abstract class AbstractExternalSystemLocalSettings {
|
||||
pathsToForget.remove(projectSettings.getExternalProjectPath());
|
||||
}
|
||||
for (Module module : myPlatformFacade.getModules(myProject)) {
|
||||
String id = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID);
|
||||
String id = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
|
||||
if (!myExternalSystemId.toString().equals(id)) {
|
||||
continue;
|
||||
}
|
||||
pathsToForget.remove(module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH));
|
||||
pathsToForget.remove(module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY));
|
||||
}
|
||||
|
||||
if (!pathsToForget.isEmpty()) {
|
||||
|
||||
+7
-7
@@ -782,42 +782,42 @@ public class ExternalSystemApiUtil {
|
||||
|
||||
@Contract(value = "_, null -> false", pure=true)
|
||||
public static boolean isExternalSystemAwareModule(@NotNull ProjectSystemId systemId, @Nullable Module module) {
|
||||
return module != null && !module.isDisposed() && systemId.getId().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID));
|
||||
return module != null && !module.isDisposed() && systemId.getId().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY));
|
||||
}
|
||||
|
||||
@Contract(value = "_, null -> false", pure=true)
|
||||
public static boolean isExternalSystemAwareModule(@NotNull String systemId, @Nullable Module module) {
|
||||
return module != null && !module.isDisposed() && systemId.equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID));
|
||||
return module != null && !module.isDisposed() && systemId.equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract(pure=true)
|
||||
public static String getExternalProjectPath(@Nullable Module module) {
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH) : null;
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract(pure=true)
|
||||
public static String getExternalRootProjectPath(@Nullable Module module) {
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH) : null;
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract(pure=true)
|
||||
public static String getExternalProjectId(@Nullable Module module) {
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_ID) : null;
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_ID_KEY) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract(pure=true)
|
||||
public static String getExternalProjectGroup(@Nullable Module module) {
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP) : null;
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract(pure=true)
|
||||
public static String getExternalProjectVersion(@Nullable Module module) {
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION) : null;
|
||||
return module != null && !module.isDisposed() ? module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY) : null;
|
||||
}
|
||||
|
||||
public static void subscribe(@NotNull Project project,
|
||||
|
||||
+1
-13
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.externalSystem.util;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -25,23 +24,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @since 4/16/13 11:44 AM
|
||||
*/
|
||||
public class ExternalSystemConstants {
|
||||
|
||||
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_ID_KEY = "external.system.id";
|
||||
public static final Key<String> EXTERNAL_SYSTEM_ID = Key.create(EXTERNAL_SYSTEM_ID_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String LINKED_PROJECT_PATH_KEY = "external.linked.project.path";
|
||||
public static final Key<String> LINKED_PROJECT_PATH = Key.create(LINKED_PROJECT_PATH_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String ROOT_PROJECT_PATH_KEY = "external.root.project.path";
|
||||
public static final Key<String> ROOT_PROJECT_PATH = Key.create(ROOT_PROJECT_PATH_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String LINKED_PROJECT_ID_KEY = "external.linked.project.id";
|
||||
public static final Key<String> LINKED_PROJECT_ID = Key.create(LINKED_PROJECT_ID_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_MODULE_GROUP_KEY = "external.system.module.group";
|
||||
public static final Key<String> EXTERNAL_SYSTEM_MODULE_GROUP = Key.create(EXTERNAL_SYSTEM_MODULE_GROUP_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_MODULE_VERSION_KEY = "external.system.module.version";
|
||||
public static final Key<String> EXTERNAL_SYSTEM_MODULE_VERSION = Key.create(EXTERNAL_SYSTEM_MODULE_VERSION_KEY);
|
||||
|
||||
@NonNls @NotNull public static final String TOOL_WINDOW_TOOLBAR_ACTIONS_GROUP_ID = "ExternalSystem.ToolWindow.Toolbar";
|
||||
@NonNls @NotNull public static final String TREE_ACTIONS_GROUP_ID = "ExternalSystem.Tree.Context";
|
||||
@@ -71,6 +61,4 @@ public class ExternalSystemConstants {
|
||||
public static final int UNORDERED = 1000;
|
||||
|
||||
public static final int TEXT_FIELD_WIDTH_IN_COLUMNS = 20;
|
||||
|
||||
public static final Key<String> MAVEN_MODULE_KEY = Key.create("org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule");
|
||||
}
|
||||
|
||||
+2
-2
@@ -210,9 +210,9 @@ public abstract class ExternalSystemBeforeRunTaskProvider extends BeforeRunTaskP
|
||||
|
||||
String desc = StringUtil.join(task.getTaskExecutionSettings().getTaskNames(), " ");
|
||||
for (Module module : ModuleManager.getInstance(myProject).getModules()) {
|
||||
if (!mySystemId.toString().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID))) continue;
|
||||
if (!mySystemId.toString().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY))) continue;
|
||||
|
||||
if (StringUtil.equals(externalProjectPath, module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH))) {
|
||||
if (StringUtil.equals(externalProjectPath, module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY))) {
|
||||
desc = module.getName() + ": " + desc;
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ public class ContentRootDataService extends AbstractProjectDataService<ContentRo
|
||||
AbstractExternalSystemSettings externalSystemSettings =
|
||||
ExternalSystemApiUtil.getSettings(module.getProject(), projectSystemId);
|
||||
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
if (path != null) {
|
||||
ExternalProjectSettings projectSettings = externalSystemSettings.getLinkedProjectSettings(path);
|
||||
createEmptyContentRootDirectories = projectSettings != null && projectSettings.isCreateEmptyContentRootDirectories();
|
||||
|
||||
+13
-13
@@ -402,12 +402,12 @@ public class ModuleDataService extends AbstractProjectDataService<ModuleData, Mo
|
||||
}
|
||||
|
||||
public static void unlinkModuleFromExternalSystem(@NotNull Module module) {
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID);
|
||||
module.clearOption(ExternalSystemConstants.LINKED_PROJECT_ID);
|
||||
module.clearOption(ExternalSystemConstants.LINKED_PROJECT_PATH);
|
||||
module.clearOption(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP);
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION);
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
|
||||
module.clearOption(ExternalSystemConstants.LINKED_PROJECT_ID_KEY);
|
||||
module.clearOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
|
||||
module.clearOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY);
|
||||
module.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY);
|
||||
}
|
||||
|
||||
private class ImportModulesTask implements Runnable {
|
||||
@@ -450,20 +450,20 @@ public class ModuleDataService extends AbstractProjectDataService<ModuleData, Mo
|
||||
ModuleData moduleData = moduleDataNode.getData();
|
||||
module.putUserData(MODULE_DATA_KEY, moduleData);
|
||||
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID, moduleData.getOwner().toString());
|
||||
module.setOption(ExternalSystemConstants.LINKED_PROJECT_ID, moduleData.getId());
|
||||
module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH, moduleData.getLinkedExternalProjectPath());
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
|
||||
module.setOption(ExternalSystemConstants.LINKED_PROJECT_ID_KEY, moduleData.getId());
|
||||
module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
|
||||
final ProjectData projectData = moduleDataNode.getData(ProjectKeys.PROJECT);
|
||||
module.setOption(ExternalSystemConstants.ROOT_PROJECT_PATH, projectData != null ? projectData.getLinkedExternalProjectPath() : "");
|
||||
module.setOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY, projectData != null ? projectData.getLinkedExternalProjectPath() : "");
|
||||
|
||||
if (moduleData.getGroup() != null) {
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP, moduleData.getGroup());
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY, moduleData.getGroup());
|
||||
}
|
||||
if (moduleData.getVersion() != null) {
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION, moduleData.getVersion());
|
||||
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY, moduleData.getVersion());
|
||||
}
|
||||
|
||||
// clear maven option
|
||||
module.clearOption(ExternalSystemConstants.MAVEN_MODULE_KEY);
|
||||
module.clearOption("org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -908,7 +908,7 @@ public class ExternalSystemUtil {
|
||||
|
||||
PlatformFacade platformFacade = ServiceManager.getService(PlatformFacade.class);
|
||||
for (Module module : platformFacade.getModules(ideProject)) {
|
||||
String path = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH);
|
||||
String path = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
|
||||
if (!StringUtil.isEmpty(path) && !externalModulePaths.remove(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public abstract class ModuleType<T extends ModuleBuilder> {
|
||||
}
|
||||
|
||||
public static boolean is(@NotNull Module module, @NotNull ModuleType moduleType) {
|
||||
return moduleType.getId().equals(module.getOptionValue(Module.ELEMENT_TYPE_KEY));
|
||||
return moduleType.getId().equals(module.getOptionValue(Module.ELEMENT_TYPE));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -121,7 +121,7 @@ public abstract class ModuleType<T extends ModuleBuilder> {
|
||||
if (instance == null) {
|
||||
return EMPTY;
|
||||
}
|
||||
return instance.findByID(module.getOptionValue(Module.ELEMENT_TYPE_KEY));
|
||||
return instance.findByID(module.getOptionValue(Module.ELEMENT_TYPE));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.impl.storage.ClasspathStorage;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
@@ -52,8 +51,6 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.openapi.module.impl.ModuleManagerImpl.createOptionKey;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
@@ -250,12 +247,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption(@NotNull String optionName, @NotNull String optionValue) {
|
||||
setOption(createOptionKey(optionName), optionValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption(@NotNull Key<String> key, @NotNull String value) {
|
||||
public void setOption(@NotNull String key, @NotNull String value) {
|
||||
OptionManager manager = getOptionManager();
|
||||
if (manager != null) {
|
||||
manager.setOption(key, value);
|
||||
@@ -274,12 +266,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOption(@NotNull String optionName) {
|
||||
clearOption(createOptionKey(optionName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOption(@NotNull Key<String> key) {
|
||||
public void clearOption(@NotNull String key) {
|
||||
OptionManager manager = getOptionManager();
|
||||
if (manager != null) {
|
||||
manager.clearOption(key);
|
||||
@@ -287,13 +274,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOptionValue(@NotNull String optionName) {
|
||||
return getOptionValue(createOptionKey(optionName));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getOptionValue(@NotNull Key<String> key) {
|
||||
public String getOptionValue(@NotNull String key) {
|
||||
OptionManager manager = getOptionManager();
|
||||
return manager == null ? null : manager.getOptionValue(key);
|
||||
}
|
||||
|
||||
+5
-5
@@ -184,7 +184,7 @@ public class ClasspathStorage extends StateStorageBase<ClasspathStorage.MyStorag
|
||||
@NotNull
|
||||
public static String getStorageRootFromOptions(@NotNull Module module) {
|
||||
String moduleRoot = getModuleDir(module);
|
||||
String storageRef = module.getOptionValue(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE_KEY);
|
||||
String storageRef = module.getOptionValue(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE);
|
||||
if (storageRef == null) {
|
||||
return moduleRoot;
|
||||
}
|
||||
@@ -212,12 +212,12 @@ public class ClasspathStorage extends StateStorageBase<ClasspathStorage.MyStorag
|
||||
|
||||
provider = getProvider(storageId);
|
||||
if (provider == null) {
|
||||
module.clearOption(JpsProjectLoader.CLASSPATH_ATTRIBUTE_KEY);
|
||||
module.clearOption(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE_KEY);
|
||||
module.clearOption(JpsProjectLoader.CLASSPATH_ATTRIBUTE);
|
||||
module.clearOption(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE);
|
||||
}
|
||||
else {
|
||||
module.setOption(JpsProjectLoader.CLASSPATH_ATTRIBUTE_KEY, storageId);
|
||||
module.setOption(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE_KEY, provider.getContentRoot(model));
|
||||
module.setOption(JpsProjectLoader.CLASSPATH_ATTRIBUTE, storageId);
|
||||
module.setOption(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE, provider.getContentRoot(model));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.intellij.openapi.roots.impl.ModuleFileIndexImpl;
|
||||
import com.intellij.openapi.roots.impl.ModuleRootManagerImpl;
|
||||
import com.intellij.openapi.roots.impl.ProjectRootManagerImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
|
||||
@@ -183,22 +182,6 @@ public class CoreModule extends MockComponentManager implements ModuleEx {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption(@NotNull Key<String> optionName, @NotNull String optionValue) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOption(@NotNull Key<String> key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getOptionValue(@NotNull Key<String> key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GlobalSearchScope getModuleScope() {
|
||||
|
||||
+2
-13
@@ -97,22 +97,11 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
myMessageBus = messageBus;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Key<String> createOptionKey(@NotNull String name) {
|
||||
if (name.equals(Module.ELEMENT_TYPE)) {
|
||||
return Module.ELEMENT_TYPE_KEY;
|
||||
}
|
||||
else {
|
||||
return Key.create(name);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cleanCachedStuff() {
|
||||
myCachedModuleComparator = null;
|
||||
myCachedSortedModules = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
@@ -721,10 +710,10 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
initModule(module, filePath, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
newModule.setOption(Module.ELEMENT_TYPE_KEY, moduleTypeId);
|
||||
newModule.setOption(Module.ELEMENT_TYPE, moduleTypeId);
|
||||
if (options != null) {
|
||||
for (Map.Entry<String, String> option : options.entrySet()) {
|
||||
newModule.setOption(createOptionKey(option.getKey()), option.getValue());
|
||||
newModule.setOption(option.getKey(), option.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class ClassPathStorageUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getStorageType(@NotNull Module module) {
|
||||
String id = module.getOptionValue(JpsProjectLoader.CLASSPATH_DIR_ATTRIBUTE_KEY);
|
||||
String id = module.getOptionValue(JpsProjectLoader.CLASSPATH_ATTRIBUTE);
|
||||
return id == null ? DEFAULT_STORAGE : id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.mock;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -144,20 +143,4 @@ public class MockModule extends MockComponentManager implements Module {
|
||||
public void clearOption(@NotNull String optionName) {
|
||||
throw new UnsupportedOperationException("Method clearOption is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption(@NotNull Key<String> optionName, @NotNull String optionValue) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOption(@NotNull Key<String> key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getOptionValue(@NotNull Key<String> key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -167,12 +167,12 @@ public class UseDistributionWithSourcesNotificationProvider extends EditorNotifi
|
||||
|
||||
@Nullable
|
||||
private static String getRootProjectPath(@NotNull Module module) {
|
||||
String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID);
|
||||
String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
|
||||
if (externalSystemId == null || !GradleConstants.SYSTEM_ID.toString().equals(externalSystemId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
return StringUtil.isEmpty(path) ? null : path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class GradlePositionManager extends ScriptPositionManagerHelper {
|
||||
|
||||
@Nullable
|
||||
private ClassLoader createGradleClassLoader(@NotNull Module module) {
|
||||
String rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
String rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
if (StringUtil.isEmpty(rootProjectPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public class GradleResourceCompilerConfigurationGenerator {
|
||||
|
||||
if (shouldBeBuiltByExternalSystem(module)) continue;
|
||||
|
||||
final String gradleProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
final String gradleProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
assert gradleProjectPath != null;
|
||||
final ExternalProject externalRootProject = lazyExternalProjectMap.get(gradleProjectPath);
|
||||
if (externalRootProject == null) {
|
||||
|
||||
@@ -220,7 +220,7 @@ public class GradleScriptType extends GroovyRunnableScriptType {
|
||||
if (module == null) {
|
||||
throw new CantRunException("Target module is undefined");
|
||||
}
|
||||
String rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
String rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
if (StringUtil.isEmpty(rootProjectPath)) {
|
||||
throw new CantRunException(String.format("Module '%s' is not backed by gradle", module.getName()));
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public class GradleScriptType extends GroovyRunnableScriptType {
|
||||
GlobalSearchScope result = GlobalSearchScope.EMPTY_SCOPE;
|
||||
final Module module = ModuleUtilCore.findModuleForPsiElement(file);
|
||||
if (module != null) {
|
||||
String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID);
|
||||
String externalSystemId = module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
|
||||
if(!GradleConstants.SYSTEM_ID.toString().equals(externalSystemId)) return baseScope;
|
||||
|
||||
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
|
||||
@@ -331,7 +331,7 @@ public class GradleScriptType extends GroovyRunnableScriptType {
|
||||
}
|
||||
}
|
||||
|
||||
String modulePath = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH);
|
||||
String modulePath = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
|
||||
if(modulePath == null) return result;
|
||||
|
||||
files = GradleBuildClasspathManager.getInstance(file.getProject()).getModuleClasspathEntries(modulePath);
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class GradleOrderEnumeratorHandler extends OrderEnumerationHandler {
|
||||
if (!type.equals(OrderRootType.CLASSES)) return false;
|
||||
if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, rootModel.getModule())) return false;
|
||||
|
||||
final String gradleProjectPath = rootModel.getModule().getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
final String gradleProjectPath = rootModel.getModule().getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
if (gradleProjectPath == null) {
|
||||
LOG.error("Root project path of the Gradle project not found for " + rootModel.getModule());
|
||||
return false;
|
||||
|
||||
+3
-3
@@ -57,12 +57,12 @@ public class AllInPackageGradleConfigurationProducer extends GradleTestRunConfig
|
||||
if (module == null) return false;
|
||||
|
||||
if (!StringUtil.equals(
|
||||
module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String linkedGradleProject = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH);
|
||||
final String linkedGradleProject = module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
|
||||
if (linkedGradleProject == null) return false;
|
||||
configuration.getSettings().setExternalProjectPath(linkedGradleProject);
|
||||
configuration.getSettings().setTaskNames(TASKS_TO_RUN);
|
||||
@@ -88,7 +88,7 @@ public class AllInPackageGradleConfigurationProducer extends GradleTestRunConfig
|
||||
if (context.getModule() == null) return false;
|
||||
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY),
|
||||
configuration.getSettings().getExternalProjectPath())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+7
-7
@@ -74,12 +74,12 @@ public class TestClassGradleConfigurationProducer extends GradleTestRunConfigura
|
||||
if (context.getModule() == null) return false;
|
||||
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH));
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY));
|
||||
configuration.getSettings().setTaskNames(TASKS_TO_RUN);
|
||||
configuration.getSettings()
|
||||
.setScriptParameters(String.format("--tests %s", testClass.getQualifiedName()));
|
||||
@@ -112,7 +112,7 @@ public class TestClassGradleConfigurationProducer extends GradleTestRunConfigura
|
||||
if (context.getModule() == null) return false;
|
||||
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY),
|
||||
configuration.getSettings().getExternalProjectPath())) {
|
||||
return false;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class TestClassGradleConfigurationProducer extends GradleTestRunConfigura
|
||||
@Override
|
||||
protected void runForClasses(List<PsiClass> classes, PsiMethod method, ConfigurationContext context, Runnable performRunnable) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class TestClassGradleConfigurationProducer extends GradleTestRunConfigura
|
||||
ConfigurationContext context,
|
||||
Runnable performRunnable) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return;
|
||||
}
|
||||
@@ -163,12 +163,12 @@ public class TestClassGradleConfigurationProducer extends GradleTestRunConfigura
|
||||
@NotNull ConfigurationContext context,
|
||||
@NotNull PsiClass... containingClasses) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH));
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY));
|
||||
configuration.getSettings().setTaskNames(TASKS_TO_RUN);
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
+5
-5
@@ -100,7 +100,7 @@ public class TestMethodGradleConfigurationProducer extends GradleTestRunConfigur
|
||||
if (context.getModule() == null) return false;
|
||||
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY),
|
||||
configuration.getSettings().getExternalProjectPath())) {
|
||||
return false;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class TestMethodGradleConfigurationProducer extends GradleTestRunConfigur
|
||||
@Override
|
||||
protected void runForClasses(List<PsiClass> classes, PsiMethod method, ConfigurationContext context, Runnable performRunnable) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class TestMethodGradleConfigurationProducer extends GradleTestRunConfigur
|
||||
ConfigurationContext context,
|
||||
Runnable performRunnable) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return;
|
||||
}
|
||||
@@ -154,12 +154,12 @@ public class TestMethodGradleConfigurationProducer extends GradleTestRunConfigur
|
||||
@NotNull PsiMethod psiMethod,
|
||||
@NotNull PsiClass... containingClasses) {
|
||||
if (!StringUtil.equals(
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID),
|
||||
context.getModule().getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY),
|
||||
GradleConstants.SYSTEM_ID.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH));
|
||||
configuration.getSettings().setExternalProjectPath(context.getModule().getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY));
|
||||
configuration.getSettings().setTaskNames(TASKS_TO_RUN);
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
+1
-1
@@ -462,7 +462,7 @@ public class GradleInstallationManager {
|
||||
|
||||
if(rootProjectPath == null) {
|
||||
for (Module module : myPlatformFacade.getModules(project)) {
|
||||
rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
rootProjectPath = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
List<File> result = findGradleSdkClasspath(project, rootProjectPath);
|
||||
if(!result.isEmpty()) return result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ public class GradleImplicitContributor implements GradleMethodContextContributor
|
||||
|
||||
Module module = ModuleUtilCore.findModuleForPsiElement(place);
|
||||
if (module == null) return;
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
|
||||
GradleLocalSettings localSettings = GradleLocalSettings.getInstance(place.getProject());
|
||||
Collection<ExternalTaskPojo> taskPojos = localSettings.getAvailableTasks().get(path);
|
||||
if (taskPojos == null) return;
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
<orderEntry type="module" module-name="external-system-impl" />
|
||||
<orderEntry type="library" name="Slf4j" level="project" />
|
||||
<orderEntry type="library" name="Log4J" level="project" />
|
||||
<orderEntry type="module" module-name="external-system-api" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
+12
-9
@@ -27,7 +27,6 @@ import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompileTask;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
@@ -530,7 +529,7 @@ public class MavenProjectsManager extends MavenSimpleProjectComponent
|
||||
public boolean isMavenizedModule(final Module m) {
|
||||
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
return !m.isDisposed() && "true".equals(m.getOptionValue(ExternalSystemConstants.MAVEN_MODULE_KEY));
|
||||
return !m.isDisposed() && "true".equals(m.getOptionValue(getMavenizedModuleOptionName()));
|
||||
}
|
||||
finally {
|
||||
accessToken.finish();
|
||||
@@ -543,22 +542,26 @@ public class MavenProjectsManager extends MavenSimpleProjectComponent
|
||||
if (m.isDisposed()) continue;
|
||||
|
||||
if (mavenized) {
|
||||
m.setOption(ExternalSystemConstants.MAVEN_MODULE_KEY, "true");
|
||||
m.setOption(getMavenizedModuleOptionName(), "true");
|
||||
|
||||
// clear external system API options
|
||||
// see com.intellij.openapi.externalSystem.service.project.manage.ModuleDataService#setModuleOptions
|
||||
m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID);
|
||||
m.clearOption(ExternalSystemConstants.LINKED_PROJECT_PATH);
|
||||
m.clearOption(ExternalSystemConstants.ROOT_PROJECT_PATH);
|
||||
m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP);
|
||||
m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION);
|
||||
m.clearOption("external.system.id");
|
||||
m.clearOption("external.linked.project.path");
|
||||
m.clearOption("external.root.project.path");
|
||||
m.clearOption("external.system.module.group");
|
||||
m.clearOption("external.system.module.version");
|
||||
}
|
||||
else {
|
||||
m.clearOption(ExternalSystemConstants.MAVEN_MODULE_KEY);
|
||||
m.clearOption(getMavenizedModuleOptionName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getMavenizedModuleOptionName() {
|
||||
return "org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule";
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void resetManagedFilesAndProfilesInTests(List<VirtualFile> files, MavenExplicitProfiles profiles) {
|
||||
myWatcher.resetManagedFilesAndProfilesInTests(files, profiles);
|
||||
|
||||
Reference in New Issue
Block a user