mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
get rid of ROOT_CONFIG VS APP_CONFIG disambiguation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -17,7 +17,6 @@ package com.intellij.compiler.ant;
|
||||
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.compiler.actions.GenerateAntBuildAction;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -52,7 +51,7 @@ public class GenerateAntApplication {
|
||||
try {
|
||||
logMessage(0, "Starting app... ");
|
||||
application.doNotSave();
|
||||
application.load(PathManager.getOptionsPath());
|
||||
application.load();
|
||||
logMessageLn(0, "done");
|
||||
|
||||
GenerateAntApplication.this.run();
|
||||
|
||||
@@ -66,8 +66,8 @@ class ApplicationStoreImpl(private val application: ApplicationImpl, pathMacroMa
|
||||
}
|
||||
|
||||
try {
|
||||
val configPath = expandMacros(StoragePathMacros.ROOT_CONFIG)
|
||||
if (configPath == StoragePathMacros.ROOT_CONFIG) {
|
||||
val configPath = expandMacros(ROOT_CONFIG)
|
||||
if (configPath == ROOT_CONFIG) {
|
||||
LOG.warn("Macros ROOT_CONFIG is not defined")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@ package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.ide.impl.ProjectUtil
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.components.ComponentManager
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.SettingsSavingComponent
|
||||
import com.intellij.openapi.components.impl.stores.StateStorageManager
|
||||
import com.intellij.openapi.components.stateStore
|
||||
import com.intellij.openapi.options.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.SmartList
|
||||
@@ -26,6 +29,8 @@ import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.lang.CompoundRuntimeException
|
||||
import java.io.File
|
||||
|
||||
val ROOT_CONFIG: String = "\$ROOT_CONFIG$"
|
||||
|
||||
public abstract class SchemeManagerFactoryBase : SchemesManagerFactory(), SettingsSavingComponent {
|
||||
private val managers = ContainerUtil.createLockFreeCopyOnWriteList<SchemeManagerImpl<Scheme, ExternalizableScheme>>()
|
||||
|
||||
@@ -72,7 +77,7 @@ private class ApplicationSchemeManagerFactory : SchemeManagerFactoryBase() {
|
||||
override val componentManager: ComponentManager
|
||||
get() = ApplicationManager.getApplication()
|
||||
|
||||
override fun pathToFile(path: String, storageManager: StateStorageManager) = File(storageManager.expandMacros("${StoragePathMacros.ROOT_CONFIG}/$path"))
|
||||
override fun pathToFile(path: String, storageManager: StateStorageManager) = File(storageManager.expandMacros("$ROOT_CONFIG/$path"))
|
||||
}
|
||||
|
||||
private class ProjectSchemeManagerFactory(private val project: Project) : SchemeManagerFactoryBase() {
|
||||
|
||||
@@ -21,6 +21,9 @@ import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class SchemesManagerFactory {
|
||||
/**
|
||||
* directoryName — like "keymaps".
|
||||
*/
|
||||
@NotNull
|
||||
public abstract <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String directoryName,
|
||||
@NotNull SchemeProcessor<E> processor,
|
||||
|
||||
@@ -46,6 +46,11 @@ public class MockApplicationEx extends MockApplication implements ApplicationEx
|
||||
public void load(String path) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() throws IOException {
|
||||
load(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoaded() {
|
||||
return true;
|
||||
|
||||
@@ -33,10 +33,12 @@ public interface ApplicationEx extends Application {
|
||||
/**
|
||||
* Loads the application configuration from the specified path
|
||||
*
|
||||
* @param optionsPath Path to /config folder
|
||||
* @param configPath Path to /config folder
|
||||
* @throws IOException
|
||||
*/
|
||||
void load(@Nullable String optionsPath) throws IOException;
|
||||
void load(@Nullable String configPath) throws IOException;
|
||||
|
||||
void load() throws IOException;
|
||||
|
||||
boolean isLoaded();
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@ public class ExportSettingsAction extends AnAction implements DumbAware {
|
||||
String expandedPath = storageManager.expandMacros(stateAnnotation.additionalExportFile());
|
||||
additionalExportFile = new File(expandedPath);
|
||||
if (!additionalExportFile.exists()) {
|
||||
//noinspection deprecation
|
||||
additionalExportFile = new File(storageManager.expandMacros(StoragePathMacros.ROOT_CONFIG) + '/' + expandedPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,8 +178,7 @@ public class IdeaApplication {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
app.load(PathManager.getOptionsPath());
|
||||
ApplicationManagerEx.getApplicationEx().load();
|
||||
myLoaded = true;
|
||||
|
||||
myStarter.main(myArgs);
|
||||
|
||||
+9
-5
@@ -452,11 +452,12 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(@Nullable String optionsPath) throws IOException {
|
||||
load(PathManager.getConfigPath(), optionsPath == null ? PathManager.getOptionsPath() : optionsPath);
|
||||
public void load() throws IOException {
|
||||
load(null);
|
||||
}
|
||||
|
||||
public void load(@NotNull final String configPath, @NotNull final String optionsPath) throws IOException {
|
||||
@Override
|
||||
public void load(@Nullable final String configPath) throws IOException {
|
||||
AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Loading application components");
|
||||
try {
|
||||
long t = System.currentTimeMillis();
|
||||
@@ -472,8 +473,11 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
getPicoContainer().getComponentInstance(ServiceManagerImpl.class);
|
||||
|
||||
StateStorageManager storageManager = ComponentsPackage.getStateStore(ApplicationImpl.this).getStateStorageManager();
|
||||
storageManager.addMacro(StoragePathMacros.APP_CONFIG, optionsPath);
|
||||
storageManager.addMacro(StoragePathMacros.ROOT_CONFIG, configPath);
|
||||
|
||||
String effectiveConfigPath = configPath == null ? PathManager.getConfigPath() : configPath;
|
||||
//noinspection deprecation
|
||||
storageManager.addMacro(StoragePathMacros.ROOT_CONFIG, effectiveConfigPath);
|
||||
storageManager.addMacro(StoragePathMacros.APP_CONFIG, effectiveConfigPath + "/options");
|
||||
|
||||
for (ApplicationLoadListener listener : ApplicationLoadListener.EP_NAME.getExtensions()) {
|
||||
try {
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -31,13 +31,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @since 5/2/12 12:57 PM
|
||||
*/
|
||||
public class StoragePathMacros {
|
||||
/**
|
||||
* Points to the application-level settings root directory.
|
||||
*/
|
||||
@NonNls @NotNull public static final String ROOT_CONFIG = "$ROOT_CONFIG$";
|
||||
@Deprecated @NotNull public static final String ROOT_CONFIG = "$ROOT_CONFIG$";
|
||||
|
||||
/**
|
||||
* Points to {@link #ROOT_CONFIG}/options by default. Should be used to store single files and {@link #ROOT_CONFIG} to store subdirectories with many files.
|
||||
* Points to the application-level options root directory.
|
||||
*/
|
||||
@NonNls @NotNull public static final String APP_CONFIG = "$APP_CONFIG$";
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@ public class IdeaTestApplication extends CommandLineApplication implements Dispo
|
||||
return myDataContext == null ? null : myDataContext.getData(dataId);
|
||||
}
|
||||
|
||||
public static synchronized IdeaTestApplication getInstance() {
|
||||
return getInstance(null);
|
||||
}
|
||||
|
||||
public static synchronized IdeaTestApplication getInstance(@Nullable final String configPath) {
|
||||
if (ourInstance == null) {
|
||||
PlatformTestCase.doAutodetectPlatformPrefix();
|
||||
|
||||
@@ -166,7 +166,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
|
||||
@NotNull
|
||||
public static IdeaTestApplication initApplication() {
|
||||
ourApplication = IdeaTestApplication.getInstance(null);
|
||||
ourApplication = IdeaTestApplication.getInstance();
|
||||
return ourApplication;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ class HeavyIdeaTestFixtureImpl extends BaseFixture implements HeavyIdeaTestFixtu
|
||||
}
|
||||
|
||||
private void initApplication() throws Exception {
|
||||
myApplication = IdeaTestApplication.getInstance(null);
|
||||
myApplication = IdeaTestApplication.getInstance();
|
||||
myApplication.setDataProvider(new MyDataProvider());
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class GitCucumberWorld {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Throwable {
|
||||
IdeaTestApplication.getInstance(null);
|
||||
IdeaTestApplication.getInstance();
|
||||
|
||||
myTestName = createTestName();
|
||||
myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(myTestName).getFixture();
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -153,7 +153,7 @@ public abstract class GradleImportingTestCase extends ExternalSystemImportingTes
|
||||
}
|
||||
});
|
||||
|
||||
roots.add(PathManager.getOptionsPath());
|
||||
roots.add(PathManager.getConfigPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
VfsRootAccess.allowRootAccess(PathManager.getOptionsPath());
|
||||
VfsRootAccess.allowRootAccess(PathManager.getConfigPath());
|
||||
super.setUp();
|
||||
myGlobalSettingsFile =
|
||||
MavenWorkspaceSettingsComponent.getInstance(myProject).getSettings().generalSettings.getEffectiveGlobalSettingsIoFile();
|
||||
@@ -86,7 +86,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
|
||||
if (myGlobalSettingsFile != null) {
|
||||
VfsRootAccess.disallowRootAccess(myGlobalSettingsFile.getAbsolutePath());
|
||||
}
|
||||
VfsRootAccess.disallowRootAccess(PathManager.getOptionsPath());
|
||||
VfsRootAccess.disallowRootAccess(PathManager.getConfigPath());
|
||||
Messages.setTestDialog(TestDialog.DEFAULT);
|
||||
removeFromLocalRepository("test");
|
||||
FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<description>Embedded Terminal</description>
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
|
||||
<resource-bundle>messages.TerminalBundle</resource-bundle>
|
||||
<xi:include href="/META-INF/terminal.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<applicationService serviceInterface="com.intellij.remoteServer.impl.runtime.log.CloudTerminalProvider"
|
||||
serviceImplementation="org.jetbrains.plugins.terminal.cloud.CloudTerminalProviderImpl"
|
||||
overrides="true"/>
|
||||
|
||||
<applicationService serviceImplementation="org.jetbrains.plugins.terminal.TerminalOptionsProvider"/>
|
||||
</extensions>
|
||||
|
||||
<project-components>
|
||||
@@ -18,11 +20,4 @@
|
||||
<implementation-class>org.jetbrains.plugins.terminal.TerminalView</implementation-class>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
<application-components>
|
||||
<component>
|
||||
<interface-class>org.jetbrains.plugins.terminal.TerminalOptionsProvider</interface-class>
|
||||
<implementation-class>org.jetbrains.plugins.terminal.TerminalOptionsProvider</implementation-class>
|
||||
</component>
|
||||
</application-components>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
exportable.TerminalOptionsProvider.presentable.name=Terminal
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -15,11 +15,8 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.terminal;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -28,16 +25,13 @@ import java.io.File;
|
||||
*/
|
||||
@State(
|
||||
name = "TerminalOptionsProvider",
|
||||
storages = {
|
||||
@Storage(
|
||||
file = StoragePathMacros.APP_CONFIG + "/terminal.xml"
|
||||
)}
|
||||
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/terminal.xml")
|
||||
)
|
||||
public class TerminalOptionsProvider implements PersistentStateComponent<TerminalOptionsProvider.State>, ExportableApplicationComponent {
|
||||
public class TerminalOptionsProvider implements PersistentStateComponent<TerminalOptionsProvider.State> {
|
||||
private State myState = new State();
|
||||
|
||||
public static TerminalOptionsProvider getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(TerminalOptionsProvider.class);
|
||||
return ServiceManager.getService(TerminalOptionsProvider.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,31 +140,5 @@ public class TerminalOptionsProvider implements PersistentStateComponent<Termina
|
||||
public void setPasteOnMiddleMouseButton(boolean pasteOnMiddleMouseButton) {
|
||||
myState.myPasteOnMiddleMouseButton = pasteOnMiddleMouseButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public File[] getExportFiles() {
|
||||
return new File[]{new File(PathManager.getOptionsPath() + File.separatorChar + "terminal.xml")};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableName() {
|
||||
return "TerminalOptions";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "TerminalOptionsProvider";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user