diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java index dac48586b70d..ce30701f95e5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ComponentStoreImpl.java @@ -320,15 +320,10 @@ public abstract class ComponentStoreImpl implements IComponentStore { } assert storages.length > 0; - final Class defaultClass = - StorageAnnotationsDefaultValues.NullStateStorageChooser.class; - final Class storageChooserClass = stateSpec.storageChooser(); - final StateStorageChooser> defaultStateStorageChooser = getDefaultStateStorageChooser(); - assert storageChooserClass != defaultClass || defaultStateStorageChooser != null : "State chooser not specified for: " + - persistentStateComponent.getClass(); - - if (storageChooserClass == defaultClass) { + if (storageChooserClass == StateStorageChooser.class) { + StateStorageChooser> defaultStateStorageChooser = getDefaultStateStorageChooser(); + assert defaultStateStorageChooser != null : "State chooser not specified for: " + persistentStateComponent.getClass(); return defaultStateStorageChooser.selectStorages(storages, persistentStateComponent, operation); } else if (storageChooserClass == LastStorageChooserForWrite.class) { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java index c4c801c735dc..66a6aec7ad21 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStoreImpl.java @@ -680,12 +680,12 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject @Override public Class storageClass() { - return StorageAnnotationsDefaultValues.NullStateStorage.class; + return StateStorage.class; } @Override public Class stateSplitter() { - return StorageAnnotationsDefaultValues.NullStateSplitter.class; + return StateSplitter.class; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java index 6c136c3d7c5c..0f420e6c527f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java @@ -176,19 +176,19 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di @Nullable private StateStorage createStateStorage(Storage storageSpec) throws StateStorageException { - if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) { + if (!storageSpec.storageClass().equals(StateStorage.class)) { String key = UUID.randomUUID().toString(); ((MutablePicoContainer)myPicoContainer).registerComponentImplementation(key, storageSpec.storageClass()); return (StateStorage)myPicoContainer.getComponentInstance(key); } - if (!storageSpec.stateSplitter().equals(StorageAnnotationsDefaultValues.NullStateSplitter.class)) { + if (!storageSpec.stateSplitter().equals(StateSplitter.class)) { return createDirectoryStateStorage(storageSpec.file(), storageSpec.stateSplitter()); } return createFileStateStorage(storageSpec.file()); } private static String getStorageSpecId(Storage storageSpec) { - if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) { + if (!storageSpec.storageClass().equals(StateStorage.class)) { return storageSpec.storageClass().getName(); } else { diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/State.java b/platform/projectModel-api/src/com/intellij/openapi/components/State.java index 5b234d133e40..191e0294305b 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/components/State.java +++ b/platform/projectModel-api/src/com/intellij/openapi/components/State.java @@ -32,7 +32,7 @@ public @interface State { Storage[] storages(); - Class storageChooser() default StorageAnnotationsDefaultValues.NullStateStorageChooser.class; + Class storageChooser() default StateStorageChooser.class; boolean reloadable() default true; -} \ No newline at end of file +} diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/Storage.java b/platform/projectModel-api/src/com/intellij/openapi/components/Storage.java index e10b97755d3a..d01f1f89f1f7 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/components/Storage.java +++ b/platform/projectModel-api/src/com/intellij/openapi/components/Storage.java @@ -28,6 +28,6 @@ public @interface Storage { @NonNls String file() default ""; StorageScheme scheme() default StorageScheme.DEFAULT; - Class storageClass() default StorageAnnotationsDefaultValues.NullStateStorage.class; - Class stateSplitter() default StorageAnnotationsDefaultValues.NullStateSplitter.class; + Class storageClass() default StateStorage.class; + Class stateSplitter() default StateSplitter.class; } diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/StorageAnnotationsDefaultValues.java b/platform/projectModel-api/src/com/intellij/openapi/components/StorageAnnotationsDefaultValues.java deleted file mode 100644 index 5105105c4eb4..000000000000 --- a/platform/projectModel-api/src/com/intellij/openapi/components/StorageAnnotationsDefaultValues.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2000-2012 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; - -import com.intellij.openapi.util.Pair; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Set; - -public interface StorageAnnotationsDefaultValues { - class NullStateStorage implements StateStorage { - @Override - @Nullable - public T getState(final Object component, final String componentName, Class stateClass, @Nullable T mergeInto) - throws StateStorageException { - throw new UnsupportedOperationException("Method getState is not supported in " + getClass()); - } - - @Override - public boolean hasState(final Object component, final String componentName, final Class aClass, final boolean reloadData) throws StateStorageException { - throw new UnsupportedOperationException("Method hasState not implemented in " + getClass()); - } - - public void save() throws StateStorageException { - throw new UnsupportedOperationException("Method save is not supported in " + getClass()); - } - - @Override - @NotNull - public ExternalizationSession startExternalization() { - throw new UnsupportedOperationException("Method startExternalization not implemented in " + getClass()); - } - - @Override - @NotNull - public SaveSession startSave(@NotNull ExternalizationSession externalizationSession) { - throw new UnsupportedOperationException("Method startSave not implemented in " + getClass()); - } - - @Override - public void finishSave(@NotNull SaveSession saveSession) { - throw new UnsupportedOperationException("Method finishSave not implemented in " + getClass()); - } - - @Override - public void reload(@NotNull final Set changedComponents) throws StateStorageException { - throw new UnsupportedOperationException("Method reload not implemented in " + getClass()); - } - - } - - class NullStateStorageChooser implements StateStorageChooser { - @Override - public Storage[] selectStorages(Storage[] storages, Object component, final StateStorageOperation operation) { - throw new UnsupportedOperationException("Method selectStorages is not supported in " + getClass()); - } - } - - class NullStateSplitter implements StateSplitter { - @Override - public List> splitState(Element e) { - throw new UnsupportedOperationException("Method splitState not implemented in " + getClass()); - } - - @Override - public void mergeStatesInto(final Element target, final Element[] elements) { - throw new UnsupportedOperationException("Method mergeStatesInto not implemented in " + getClass()); - } - } -}