mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
pull out doSave() method from ComponentManagerImpl
This commit is contained in:
+1
-1
@@ -1214,7 +1214,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
public void _saveSettings() { // public for testing purposes
|
||||
if (mySaveSettingsIsInProgress.compareAndSet(false, true)) {
|
||||
try {
|
||||
doSave();
|
||||
StoreUtil.doSave(getStateStore());
|
||||
}
|
||||
catch (final Throwable ex) {
|
||||
if (isUnitTestMode()) {
|
||||
|
||||
+1
-14
@@ -708,20 +708,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
}
|
||||
}
|
||||
|
||||
protected void doSave() throws IOException {
|
||||
IComponentStore.SaveSession session = null;
|
||||
try {
|
||||
session = getStateStore().startSave();
|
||||
session.save();
|
||||
}
|
||||
finally {
|
||||
if (session != null) {
|
||||
session.finishSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
public final int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
*/
|
||||
package com.intellij.openapi.components.impl.stores;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class StoreUtil {
|
||||
private StoreUtil() {
|
||||
}
|
||||
|
||||
public static void doSave(IComponentStore stateStore) throws IOException {
|
||||
IComponentStore.SaveSession session = null;
|
||||
try {
|
||||
session = stateStore.startSave();
|
||||
session.save();
|
||||
}
|
||||
finally {
|
||||
if (session != null) {
|
||||
session.finishSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.components.impl.ComponentManagerImpl;
|
||||
import com.intellij.openapi.components.impl.ProjectPathMacroManager;
|
||||
import com.intellij.openapi.components.impl.stores.IComponentStore;
|
||||
import com.intellij.openapi.components.impl.stores.IProjectStore;
|
||||
import com.intellij.openapi.components.impl.stores.StoreUtil;
|
||||
import com.intellij.openapi.components.impl.stores.UnknownMacroNotification;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -304,7 +305,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
|
||||
}
|
||||
}
|
||||
|
||||
doSave();
|
||||
StoreUtil.doSave(getStateStore());
|
||||
}
|
||||
catch (IComponentStore.SaveCancelledException e) {
|
||||
LOG.info(e);
|
||||
|
||||
Reference in New Issue
Block a user