mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.compiler;
|
||||
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
@@ -21,6 +7,7 @@ import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.ServiceKt;
|
||||
import com.intellij.openapi.components.impl.stores.IComponentStore;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
@@ -52,21 +39,22 @@ public class CompilerTestUtil {
|
||||
|
||||
@TestOnly
|
||||
public static void saveApplicationSettings() {
|
||||
IComponentStore store = getApplicationStore();
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
doSaveComponent((PersistentStateComponent<?>)ProjectJdkTable.getInstance());
|
||||
doSaveComponent((PersistentStateComponent<?>)FileTypeManager.getInstance());
|
||||
doSaveComponent((PersistentStateComponent<?>)PathMacros.getInstance());
|
||||
store.saveApplicationComponent((PersistentStateComponent<?>)ProjectJdkTable.getInstance());
|
||||
store.saveApplicationComponent((PersistentStateComponent<?>)FileTypeManager.getInstance());
|
||||
store.saveApplicationComponent((PersistentStateComponent<?>)PathMacros.getInstance());
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static IComponentStore getApplicationStore() {
|
||||
return ServiceKt.getStateStore(ApplicationManager.getApplication());
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void saveApplicationComponent(@NotNull PersistentStateComponent<?> appComponent) {
|
||||
EdtTestUtil.runInEdtAndWait(() -> doSaveComponent(appComponent));
|
||||
}
|
||||
|
||||
private static void doSaveComponent(@NotNull PersistentStateComponent<?> component) {
|
||||
//noinspection TestOnlyProblems
|
||||
ServiceKt.getStateStore(ApplicationManager.getApplication()).saveApplicationComponent(component);
|
||||
EdtTestUtil.runInEdtAndWait(() -> getApplicationStore().saveApplicationComponent(appComponent));
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
private val LOG = logger<StateStorageBase<*>>()
|
||||
|
||||
abstract class StateStorageBase<T : Any> : StateStorage {
|
||||
private var mySavingDisabled = false
|
||||
private var isSavingDisabled = false
|
||||
|
||||
protected val storageDataRef: AtomicReference<T> = AtomicReference()
|
||||
|
||||
@@ -55,17 +55,17 @@ abstract class StateStorageBase<T : Any> : StateStorage {
|
||||
|
||||
fun disableSaving() {
|
||||
LOG.debug { "Disabled saving for ${toString()}" }
|
||||
mySavingDisabled = true
|
||||
isSavingDisabled = true
|
||||
}
|
||||
|
||||
fun enableSaving() {
|
||||
LOG.debug { "Enabled saving ${toString()}" }
|
||||
mySavingDisabled = false
|
||||
isSavingDisabled = false
|
||||
}
|
||||
|
||||
protected fun checkIsSavingDisabled(): Boolean {
|
||||
LOG.debug { "Saving disabled for ${toString()}" }
|
||||
return mySavingDisabled
|
||||
return isSavingDisabled
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-15
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.components;
|
||||
|
||||
import org.jdom.Element;
|
||||
@@ -65,6 +51,8 @@ public interface PathMacroSubstitutor {
|
||||
*/
|
||||
void collapsePaths(@NotNull Element element, boolean recursively);
|
||||
|
||||
|
||||
|
||||
@Contract("null -> null; !null -> !null")
|
||||
default String collapsePathsRecursively(@Nullable String text) {
|
||||
return collapsePath(text, true);
|
||||
|
||||
Reference in New Issue
Block a user