diff --git a/.idea/modules.xml b/.idea/modules.xml
index d1d0900691a6..7b60fc36ba80 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -21,6 +21,8 @@
+
+
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java
index 9df55fdaa25f..272dd780211b 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateJavadocTest.java
@@ -4,7 +4,7 @@ import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
-import com.intellij.openapi.editor.impl.DocumentImpl;
+import com.intellij.openapi.fileEditor.impl.TrailingSpacesStripper;
import com.intellij.testFramework.PlatformTestCase;
/**
@@ -29,6 +29,6 @@ public class GenerateJavadocTest extends CodeInsightTestCase {
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER);
actionHandler.execute(myEditor, DataManager.getInstance().getDataContext());
- ((DocumentImpl)myEditor.getDocument()).stripTrailingSpaces();
+ TrailingSpacesStripper.stripIfNotCurrentLine(myEditor.getDocument(), false);
}
}
diff --git a/platform/platform-api/src/com/intellij/diagnostic/PluginException.java b/platform/core-api/src/com/intellij/diagnostic/PluginException.java
similarity index 100%
rename from platform/platform-api/src/com/intellij/diagnostic/PluginException.java
rename to platform/core-api/src/com/intellij/diagnostic/PluginException.java
diff --git a/platform/platform-api/src/com/intellij/openapi/components/ComponentConfig.java b/platform/core-api/src/com/intellij/openapi/components/ComponentConfig.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/openapi/components/ComponentConfig.java
rename to platform/core-api/src/com/intellij/openapi/components/ComponentConfig.java
index 28776cc09bc2..b69a9d59b4d7 100644
--- a/platform/platform-api/src/com/intellij/openapi/components/ComponentConfig.java
+++ b/platform/core-api/src/com/intellij/openapi/components/ComponentConfig.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.components;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
+import com.intellij.openapi.extensions.PluginDescriptor;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Tag;
@@ -46,7 +46,7 @@ public class ComponentConfig {
public Map options = new HashMap();
@Transient
- public IdeaPluginDescriptor pluginDescriptor;
+ public PluginDescriptor pluginDescriptor;
@Transient
public ClassLoader getClassLoader() {
diff --git a/platform/core-api/src/com/intellij/openapi/components/ComponentManager.java b/platform/core-api/src/com/intellij/openapi/components/ComponentManager.java
index e5dc27c889e8..d4bb5c5a85bb 100644
--- a/platform/core-api/src/com/intellij/openapi/components/ComponentManager.java
+++ b/platform/core-api/src/com/intellij/openapi/components/ComponentManager.java
@@ -59,11 +59,6 @@ public interface ComponentManager extends UserDataHolder, Disposable {
*/
T getComponent(Class interfaceClass, T defaultImplementationIfAbsent);
- /**
- * @deprecated Use {@link #getComponents} instead.
- */
- @NotNull Class[] getComponentInterfaces();
-
/**
* Checks whether there is a component with the specified interface class.
*
diff --git a/platform/platform-api/src/com/intellij/openapi/components/ComponentManagerConfig.java b/platform/core-api/src/com/intellij/openapi/components/ComponentManagerConfig.java
similarity index 100%
rename from platform/platform-api/src/com/intellij/openapi/components/ComponentManagerConfig.java
rename to platform/core-api/src/com/intellij/openapi/components/ComponentManagerConfig.java
diff --git a/platform/core-api/src/com/intellij/openapi/components/StateStorageException.java b/platform/core-api/src/com/intellij/openapi/components/StateStorageException.java
new file mode 100644
index 000000000000..ee5c492553db
--- /dev/null
+++ b/platform/core-api/src/com/intellij/openapi/components/StateStorageException.java
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+public class StateStorageException extends RuntimeException {
+ public StateStorageException() {
+ }
+
+ public StateStorageException(final String message) {
+ super(message);
+ }
+
+ public StateStorageException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public StateStorageException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/progress/ProgressIndicator.java b/platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java
similarity index 100%
rename from platform/platform-api/src/com/intellij/openapi/progress/ProgressIndicator.java
rename to platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java
diff --git a/platform/core-impl/core-impl.iml b/platform/core-impl/core-impl.iml
index caff682b4a06..c3a5463d78ce 100644
--- a/platform/core-impl/core-impl.iml
+++ b/platform/core-impl/core-impl.iml
@@ -8,6 +8,7 @@
+
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java b/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java
similarity index 77%
rename from platform/platform-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java
rename to platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java
index 351589fb4850..1cec0321d88c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java
+++ b/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java
@@ -15,13 +15,9 @@
*/
package com.intellij.openapi.components.ex;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
-import com.intellij.notification.Notification;
import com.intellij.openapi.components.ComponentConfig;
import com.intellij.openapi.components.ComponentManager;
-import com.intellij.openapi.components.impl.stores.IComponentStore;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
+import com.intellij.openapi.extensions.PluginDescriptor;
import java.util.Map;
@@ -40,7 +36,7 @@ public interface ComponentManagerEx extends ComponentManager {
void registerComponent(Class interfaceClass, Class implementationClass, Map options);
void registerComponent(ComponentConfig config);
- void registerComponent(ComponentConfig config, IdeaPluginDescriptor pluginDescriptor);
+ void registerComponent(ComponentConfig config, PluginDescriptor pluginDescriptor);
- IComponentStore getComponentStore();
+ void initializeComponent(Object component, boolean service);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/CachingComponentAdapter.java b/platform/core-impl/src/com/intellij/openapi/components/impl/CachingComponentAdapter.java
similarity index 100%
rename from platform/platform-impl/src/com/intellij/openapi/components/impl/CachingComponentAdapter.java
rename to platform/core-impl/src/com/intellij/openapi/components/impl/CachingComponentAdapter.java
diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
index 459a6a352aa9..d9e8f075f95e 100644
--- a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
+++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
@@ -138,7 +138,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
boolean markAsNeedsStrippingLater = false;
CharSequence text = myText.getCharArray();
- RangeMarker caretMarker = caretOffset < 0 ? null : createRangeMarker(caretOffset, caretOffset);
+ RangeMarker caretMarker = caretOffset < 0 || caretOffset > getTextLength() ? null : createRangeMarker(caretOffset, caretOffset);
try {
for (int line = 0; line < myLineSet.getLineCount(); line++) {
if (inChangedLinesOnly && !myLineSet.isModified(line)) continue;
diff --git a/platform/funcTests/project1/module1/scripts/selectInProjectView.ijs b/platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
similarity index 68%
rename from platform/funcTests/project1/module1/scripts/selectInProjectView.ijs
rename to platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
index 41326593a7d1..def6ee85a2c6 100644
--- a/platform/funcTests/project1/module1/scripts/selectInProjectView.ijs
+++ b/platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
@@ -1,6 +1,3 @@
-%% Features tested:
-%% - typahead in the "Goto class" dialog
-%% - select in an unitialized project view pane (project, packages)
%action CloseProject
%call openProjectClone(../community/platform/funcTests/project1)
%action GotoClass
diff --git a/platform/funcTests/project1/module1/scripts/suite.ijs b/platform/funcTests/project1/module1/scripts/suite.ijs
new file mode 100644
index 000000000000..28ddd799dc1b
--- /dev/null
+++ b/platform/funcTests/project1/module1/scripts/suite.ijs
@@ -0,0 +1 @@
+%include ../community/platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java
index f3bd4332d481..74bf0470155a 100644
--- a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java
@@ -17,10 +17,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.components.PathMacroManager;
-import com.intellij.openapi.components.PathMacroSubstitutor;
-import com.intellij.openapi.components.StateStorage;
-import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.components.impl.ComponentManagerImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
@@ -68,7 +65,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
}
@Override
- public void load() throws IOException, StateStorage.StateStorageException {
+ public void load() throws IOException, StateStorageException {
super.load();
final ModuleFileData storageData = getMainStorageData();
@@ -92,7 +89,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
}
}
- public ModuleFileData getMainStorageData() throws StateStorage.StateStorageException {
+ public ModuleFileData getMainStorageData() throws StateStorageException {
return (ModuleFileData)super.getMainStorageData();
}
@@ -208,7 +205,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
try {
getMainStorageData().setOption(optionName, optionValue);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.error(e);
}
}
@@ -217,7 +214,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
try {
getMainStorageData().clearOption(optionName);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.error(e);
}
}
@@ -226,7 +223,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
try {
return getMainStorageData().getOptionValue(optionName);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.error(e);
return null;
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ProjectWithModulesStoreImpl.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ProjectWithModulesStoreImpl.java
index bf7cc7e516cb..f2903d34448e 100644
--- a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ProjectWithModulesStoreImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ProjectWithModulesStoreImpl.java
@@ -17,6 +17,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -76,21 +77,21 @@ public class ProjectWithModulesStoreImpl extends ProjectStoreImpl {
return moduleManager.getModules();
}
- protected SaveSessionImpl createSaveSession() throws StateStorage.StateStorageException {
+ protected SaveSessionImpl createSaveSession() throws StateStorageException {
return new ProjectWithModulesSaveSession();
}
private class ProjectWithModulesSaveSession extends ProjectSaveSession {
List myModuleSaveSessions = new ArrayList();
- public ProjectWithModulesSaveSession() throws StateStorage.StateStorageException {
+ public ProjectWithModulesSaveSession() throws StateStorageException {
try {
for (Module module : getPersistentModules()) {
myModuleSaveSessions.add(((ModuleImpl)module).getStateStore().startSave());
}
}
catch (IOException e) {
- throw new StateStorage.StateStorageException(e.getMessage());
+ throw new StateStorageException(e.getMessage());
}
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java
index 76f9a6c44645..58adea10b78f 100644
--- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java
@@ -19,10 +19,12 @@ package com.intellij.openapi.module.impl;
import com.intellij.ide.highlighter.ModuleFileType;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
+import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.components.impl.ComponentManagerImpl;
import com.intellij.openapi.components.impl.ModulePathMacroManager;
import com.intellij.openapi.components.impl.stores.IComponentStore;
import com.intellij.openapi.components.impl.stores.IModuleStore;
+import com.intellij.openapi.components.impl.stores.IProjectStore;
import com.intellij.openapi.components.impl.stores.ModuleStoreImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.AreaInstance;
@@ -40,7 +42,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.PathUtil;
-import com.intellij.util.containers.ConcurrentFactoryMap;
import com.intellij.util.containers.StripedLockConcurrentHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -75,6 +76,8 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
private String myName;
+ private IModuleStore myComponentStore;
+
public ModuleImpl(String filePath, Project project) {
super(project);
@@ -85,16 +88,24 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
init(filePath);
}
- protected void boostrapPicoContainer() {
+ protected void bootstrapPicoContainer() {
Extensions.instantiateArea(PluginManager.AREA_IDEA_MODULE, this, (AreaInstance)getParentComponentManager());
- super.boostrapPicoContainer();
+ super.bootstrapPicoContainer();
getPicoContainer().registerComponentImplementation(IComponentStore.class, ModuleStoreImpl.class);
getPicoContainer().registerComponentImplementation(ModulePathMacroManager.class);
}
@NotNull
- public IModuleStore getStateStore() {
- return (IModuleStore)super.getStateStore();
+ public synchronized IModuleStore getStateStore() {
+ if (myComponentStore == null) {
+ myComponentStore = (IModuleStore)getPicoContainer().getComponentInstance(IComponentStore.class);
+ }
+ return myComponentStore;
+ }
+
+ @Override
+ public void initializeComponent(Object component, boolean service) {
+ getStateStore().initComponent(component, service);
}
private void init(String filePath) {
@@ -168,6 +179,7 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
isModuleAdded = false;
disposeComponents();
Extensions.disposeArea(this);
+ myComponentStore = null;
super.dispose();
}
@@ -309,6 +321,11 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
return Extensions.getArea(this).getExtensionPoint(extensionPointName).getExtensions();
}
+ @Override
+ protected boolean logSlowComponents() {
+ return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
+ }
+
private class MyVirtualFileListener extends VirtualFileAdapter {
public void propertyChanged(VirtualFilePropertyEvent event) {
if (!isModuleAdded) return;
diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java
index b626c8141747..4bc2d0496d0e 100644
--- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleManagerImpl.java
@@ -261,7 +261,7 @@ public class ModuleManagerImpl extends ModuleManager implements ProjectComponent
catch (final ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
errors.add(ModuleLoadingErrorDescription.create(moduleWithNameAlreadyExists.getMessage(), modulePath, ModuleManagerImpl.this));
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
errors.add(ModuleLoadingErrorDescription.create(ProjectBundle.message("module.cannot.load.error", modulePath.getPath(), e.getMessage()),
modulePath, ModuleManagerImpl.this));
}
@@ -723,13 +723,13 @@ public class ModuleManagerImpl extends ModuleManager implements ProjectComponent
try {
return loadModuleInternal(filePath);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw new IOException(ProjectBundle.message("module.corrupted.file.error", FileUtil.toSystemDependentName(filePath), e.getMessage()));
}
}
private Module loadModuleInternal(String filePath) throws ModuleWithNameAlreadyExists,
- IOException, StateStorage.StateStorageException {
+ IOException, StateStorageException {
final File moduleFile = new File(filePath);
filePath = resolveShortWindowsName(filePath);
diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java
index 6ef958dfbf59..934b00982e0b 100644
--- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java
+++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java
@@ -19,6 +19,7 @@ package com.intellij.openapi.roots.impl.storage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
diff --git a/platform/platform-api/src/com/intellij/openapi/components/StateStorage.java b/platform/platform-api/src/com/intellij/openapi/components/StateStorage.java
index 67e9973b344c..91ecc8faa203 100644
--- a/platform/platform-api/src/com/intellij/openapi/components/StateStorage.java
+++ b/platform/platform-api/src/com/intellij/openapi/components/StateStorage.java
@@ -57,24 +57,7 @@ public interface StateStorage {
List getAllStorageFiles();
}
- class StateStorageException extends RuntimeException {
- public StateStorageException() {
- }
-
- public StateStorageException(final String message) {
- super(message);
- }
-
- public StateStorageException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public StateStorageException(final Throwable cause) {
- super(cause);
- }
- }
-
- interface Listener {
+ interface Listener {
void storageFileChanged(final VirtualFileEvent event, final StateStorage storage);
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
index 3f7807894a64..dd5de4c51805 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
@@ -29,7 +29,7 @@ import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.RoamingType;
-import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.impl.ApplicationPathMacroManager;
import com.intellij.openapi.components.impl.ComponentManagerImpl;
import com.intellij.openapi.components.impl.stores.*;
@@ -86,6 +86,8 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
private final EventDispatcher myDispatcher = EventDispatcher.create(ApplicationListener.class);
+ private IApplicationStore myComponentStore;
+
private boolean myTestModeFlag;
private final boolean myHeadlessMode;
private final boolean myCommandLineMode;
@@ -163,16 +165,23 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
}
};
- protected void boostrapPicoContainer() {
- super.boostrapPicoContainer();
+ protected void bootstrapPicoContainer() {
+ super.bootstrapPicoContainer();
getPicoContainer().registerComponentImplementation(IComponentStore.class, StoresFactory.getApplicationStoreClass());
getPicoContainer().registerComponentImplementation(ApplicationPathMacroManager.class);
}
- @Override
@NotNull
public synchronized IApplicationStore getStateStore() {
- return (IApplicationStore)super.getStateStore();
+ if (myComponentStore == null) {
+ myComponentStore = (IApplicationStore)getPicoContainer().getComponentInstance(IComponentStore.class);
+ }
+ return myComponentStore;
+ }
+
+ @Override
+ public void initializeComponent(Object component, boolean service) {
+ getStateStore().initComponent(component, service);
}
public ApplicationImpl(boolean isInternal,
@@ -499,7 +508,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
try {
getStateStore().load();
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw new IOException(e.getMessage());
}
finally {
@@ -554,6 +563,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
disposeComponents();
ourThreadExecutorsService.shutdownNow();
+ myComponentStore = null;
super.dispose();
}
@@ -1214,7 +1224,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()) {
@@ -1319,6 +1329,11 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
return false;
}
+ @Override
+ protected boolean logSlowComponents() {
+ return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
+ }
+
@Override
public String toString() {
return "Application" +
diff --git a/platform/platform-impl/src/com/intellij/openapi/command/impl/DummyProject.java b/platform/platform-impl/src/com/intellij/openapi/command/impl/DummyProject.java
index d4c68497096a..c8587a70e4c3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/command/impl/DummyProject.java
+++ b/platform/platform-impl/src/com/intellij/openapi/command/impl/DummyProject.java
@@ -97,11 +97,6 @@ public class DummyProject extends UserDataHolderBase implements Project {
return null;
}
- @NotNull
- public Class[] getComponentInterfaces() {
- return ArrayUtil.EMPTY_CLASS_ARRAY;
- }
-
public boolean hasComponent(@NotNull Class interfaceClass) {
return false;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/components/ServiceDescriptor.java b/platform/platform-impl/src/com/intellij/openapi/components/ServiceDescriptor.java
similarity index 100%
rename from platform/platform-api/src/com/intellij/openapi/components/ServiceDescriptor.java
rename to platform/platform-impl/src/com/intellij/openapi/components/ServiceDescriptor.java
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java
index 888a8b9cb8ec..23522e16b531 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java
@@ -15,8 +15,8 @@
*/
package com.intellij.openapi.components.impl;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.openapi.components.ComponentConfig;
+import com.intellij.openapi.extensions.PluginDescriptor;
class ComponentManagerConfigurator {
private final ComponentManagerImpl myComponentManager;
@@ -25,13 +25,13 @@ class ComponentManagerConfigurator {
myComponentManager = componentManager;
}
- private void loadConfiguration(final ComponentConfig[] configs, final boolean defaultProject, final IdeaPluginDescriptor descriptor) {
+ private void loadConfiguration(final ComponentConfig[] configs, final boolean defaultProject, final PluginDescriptor descriptor) {
for (ComponentConfig config : configs) {
loadSingleConfig(defaultProject, config, descriptor);
}
}
- private void loadSingleConfig(final boolean defaultProject, final ComponentConfig config, final IdeaPluginDescriptor descriptor) {
+ private void loadSingleConfig(final boolean defaultProject, final ComponentConfig config, final PluginDescriptor descriptor) {
if (defaultProject && config.skipForDefaultProject) return;
if (!myComponentManager.isComponentSuitable(config.options)) return;
@@ -39,7 +39,7 @@ class ComponentManagerConfigurator {
}
public void loadComponentsConfiguration(final ComponentConfig[] components,
- final IdeaPluginDescriptor descriptor,
+ final PluginDescriptor descriptor,
final boolean defaultProject) {
if (components == null) return;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java
index 7f661943cc81..50334de4c46f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java
@@ -16,14 +16,11 @@
package com.intellij.openapi.components.impl;
import com.intellij.diagnostic.PluginException;
-import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ex.ApplicationManagerEx;
-import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.ex.ComponentManagerEx;
-import com.intellij.openapi.components.impl.stores.IComponentStore;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.PluginDescriptor;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
@@ -46,7 +43,6 @@ import org.picocontainer.*;
import org.picocontainer.defaults.CachingComponentAdapter;
import org.picocontainer.defaults.ConstructorInjectionComponentAdapter;
-import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +66,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
private final ComponentManagerConfigurator myConfigurator = new ComponentManagerConfigurator(this);
private final ComponentManager myParentComponentManager;
- private IComponentStore myComponentStore;
private Boolean myHeadless;
private ComponentsRegistry myComponentsRegistry = new ComponentsRegistry();
private boolean myHaveProgressManager = false;
@@ -82,7 +77,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
protected ComponentManagerImpl(ComponentManager parentComponentManager) {
myParentComponentManager = parentComponentManager;
- boostrapPicoContainer();
+ bootstrapPicoContainer();
}
//todo[mike] there are several init* methods. Make it just 1
@@ -90,21 +85,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
initComponents();
}
-
- @NotNull
- public synchronized IComponentStore getStateStore() {
- if (myComponentStore == null) {
- assert myPicoContainer != null;
- myComponentStore = (IComponentStore)myPicoContainer.getComponentInstance(IComponentStore.class);
- }
- return myComponentStore;
- }
-
- public IComponentStore getComponentStore() {
- return getStateStore();
- }
-
-
public MessageBus getMessageBus() {
assert !myDisposeCompleted && !myDisposed : "Already disposed";
assert myMessageBus != null : "Not initialized yet";
@@ -127,7 +107,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
try {
createComponent(componentInterface);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw e;
}
catch (ProcessCanceledException e) {
@@ -241,12 +221,12 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
}
try {
- getStateStore().initComponent(component, false);
+ initializeComponent(component, false);
if (component instanceof BaseComponent) {
((BaseComponent)component).initComponent();
}
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw e;
}
catch (ProcessCanceledException e) {
@@ -257,6 +237,9 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
}
}
+ public void initializeComponent(Object component, boolean service) {
+ }
+
protected void handleInitComponentError(final Throwable ex, final boolean fatal, final String componentClassName) {
LOG.error(ex);
@@ -279,7 +262,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
}
@SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext"})
- public synchronized void registerComponent(final ComponentConfig config, final IdeaPluginDescriptor pluginDescriptor) {
+ public synchronized void registerComponent(final ComponentConfig config, final PluginDescriptor pluginDescriptor) {
if (isHeadless()) {
String headlessImplClass = config.headlessImplementationClass;
if (headlessImplClass != null) {
@@ -299,13 +282,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
myComponentsRegistry.registerComponent(config);
}
- /** @Deprecated */
- @NotNull
- public synchronized Class[] getComponentInterfaces() {
- LOG.warn("Deprecated method usage: getComponentInterfaces", new Throwable());
- return myComponentsRegistry.getComponentInterfaces();
- }
-
public synchronized boolean hasComponent(@NotNull Class interfaceClass) {
return myComponentsRegistry.containsInterface(interfaceClass);
}
@@ -353,7 +329,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
}
protected boolean isComponentSuitable(Map options) {
- return !isTrue(options, "internal") || ApplicationManagerEx.getApplicationEx().isInternal();
+ return !isTrue(options, "internal") || ApplicationManager.getApplication().isInternal();
}
private static boolean isTrue(Map options, @NonNls final String option) {
@@ -371,7 +347,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
myInitializedComponents.clear();
myComponentsRegistry = null;
- myComponentStore = null;
myPicoContainer = null;
}
@@ -390,11 +365,11 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
getComponents();
}
- protected void loadComponentsConfiguration(ComponentConfig[] components, @Nullable final IdeaPluginDescriptor descriptor, final boolean defaultProject) {
+ protected void loadComponentsConfiguration(ComponentConfig[] components, @Nullable final PluginDescriptor descriptor, final boolean defaultProject) {
myConfigurator.loadComponentsConfiguration(components, descriptor, defaultProject);
}
- protected void boostrapPicoContainer() {
+ protected void bootstrapPicoContainer() {
myPicoContainer = createPicoContainer();
myMessageBus = MessageBusFactory.newMessageBus(this, myParentComponentManager == null ? null : myParentComponentManager.getMessageBus());
@@ -455,6 +430,10 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
}
}
+ protected boolean logSlowComponents() {
+ return LOG.isDebugEnabled();
+ }
+
private class ComponentsRegistry {
private final Map myInterfaceToLockMap = new HashMap();
private final Map myInterfaceToClassMap = new HashMap();
@@ -679,12 +658,9 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
long endTime = System.nanoTime();
long ms = (endTime - startTime) / 1000000;
if (ms > 10) {
- if (ApplicationInfoImpl.getShadowInstance().isEAP()) {
+ if (logSlowComponents()) {
LOG.info(componentInstance.getClass().getName() + " initialized in " + ms + " ms");
}
- else if (LOG.isDebugEnabled()) {
- LOG.debug(componentInstance.getClass().getName() + " initialized in " + ms + " ms");
- }
}
myInitializing = false;
myInitialized = true;
@@ -693,7 +669,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
catch (ProcessCanceledException e) {
throw e;
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw e;
}
catch (Throwable t) {
@@ -708,20 +684,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();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java
index 9947fa6f2676..84c4c7f22e7e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -161,7 +161,7 @@ public class ServiceManagerImpl implements BaseComponent {
Disposer.register(myComponentManager, (Disposable)serviceInstance);
}
- myComponentManager.getComponentStore().initComponent(serviceInstance, true);
+ myComponentManager.initializeComponent(serviceInstance, true);
return serviceInstance;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java
index 8e1d32738595..afd2be56dbf3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java
@@ -18,10 +18,7 @@ package com.intellij.openapi.components.impl.stores;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.impl.ApplicationImpl;
-import com.intellij.openapi.components.PathMacroManager;
-import com.intellij.openapi.components.StateStorage;
-import com.intellij.openapi.components.StateStorageOperation;
-import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.NamedJDOMExternalizable;
import com.intellij.openapi.util.Pair;
@@ -98,7 +95,8 @@ class ApplicationStoreImpl extends ComponentStoreImpl implements IApplicationSto
myStateStorageManager.addMacro(CONFIG_MACRO, configPath);
}
- public boolean reload(final Set> changedFiles, final Collection notReloadableComponents) throws StateStorage.StateStorageException, IOException {
+ public boolean reload(final Set> changedFiles, final Collection notReloadableComponents) throws
+ StateStorageException, IOException {
final SaveSession saveSession = startSave();
final Set componentNames = saveSession.analyzeExternalChanges(changedFiles);
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java
index ef8d09903f05..f14d4144cc5e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java
@@ -15,10 +15,7 @@
*/
package com.intellij.openapi.components.impl.stores;
-import com.intellij.openapi.components.ComponentManager;
-import com.intellij.openapi.components.PathMacroManager;
-import com.intellij.openapi.components.PathMacroSubstitutor;
-import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import org.jdom.Element;
@@ -108,11 +105,11 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl {
return ourConversionProblemsStorage;
}
- public void load() throws IOException, StateStorage.StateStorageException {
+ public void load() throws IOException, StateStorageException {
getMainStorageData(); //load it
}
- public BaseStorageData getMainStorageData() throws StateStorage.StateStorageException {
+ public BaseStorageData getMainStorageData() throws StateStorageException {
return (BaseStorageData) getMainStorage().getStorageData(false);
}
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 53f000696561..8529d20c069a 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
@@ -50,14 +50,14 @@ abstract class ComponentStoreImpl implements IComponentStore {
@Deprecated
@Nullable
- private StateStorage getStateStorage(@NotNull final Storage storageSpec) throws StateStorage.StateStorageException {
+ private StateStorage getStateStorage(@NotNull final Storage storageSpec) throws StateStorageException {
return getStateStorageManager().getStateStorage(storageSpec);
}
@Deprecated
@Nullable
private StateStorage getOldStorage(final Object component, final String componentName, final StateStorageOperation operation)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
return getStateStorageManager().getOldStorage(component, componentName, operation);
}
@@ -133,13 +133,13 @@ abstract class ComponentStoreImpl implements IComponentStore {
mySession = session;
return mySession;
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.info(e);
throw new IOException(e.getMessage());
}
}
- protected SaveSessionImpl createSaveSession() throws StateStorage.StateStorageException {
+ protected SaveSessionImpl createSaveSession() throws StateStorageException {
return new SaveSessionImpl();
}
@@ -216,7 +216,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
@Nullable
private static Element getJdomState(final Object component, final String componentName, @NotNull final StateStorage defaultsStorage)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
ComponentRoamingManager roamingManager = ComponentRoamingManager.getInstance();
if (!roamingManager.typeSpecified(componentName)) {
if (component instanceof RoamingTypeDisabled) {
@@ -354,7 +354,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
@NotNull
protected Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent persistentStateComponent,
- final StateStorageOperation operation) throws StateStorage.StateStorageException {
+ final StateStorageOperation operation) throws StateStorageException {
final State stateSpec = getStateSpec(persistentStateComponent);
final Storage[] storages = stateSpec.storages();
@@ -382,10 +382,10 @@ abstract class ComponentStoreImpl implements IComponentStore {
return storageChooser.selectStorages(storages, persistentStateComponent, operation);
}
catch (InstantiationException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
catch (IllegalAccessException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
}
}
@@ -410,7 +410,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
try {
return myStorageManagerSaveSession.getAllStorageFilesToSave();
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw new IOException(e.getMessage());
}
}
@@ -424,7 +424,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
try {
settingsSavingComponent.save();
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.info(e);
throw new IOException(e.getMessage());
}
@@ -435,7 +435,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
myStorageManagerSaveSession.save();
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.info(e);
throw new IOException(e.getMessage());
}
@@ -465,7 +465,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
}
}
- protected void commit() throws StateStorage.StateStorageException {
+ protected void commit() throws StateStorageException {
final StateStorageManager storageManager = getStateStorageManager();
final StateStorageManager.ExternalizationSession session = storageManager.startExternalization();
@@ -520,7 +520,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
}
protected void doReload(final Set> changedFiles, @NotNull final Set componentNames)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
for (Pair pair : changedFiles) {
assert pair != null;
final StateStorage storage = pair.second;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/CompoundSaveSession.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/CompoundSaveSession.java
index 0127948aaf38..0c20859283e1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/CompoundSaveSession.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/CompoundSaveSession.java
@@ -16,6 +16,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.util.io.fs.IFile;
import java.util.*;
@@ -34,7 +35,7 @@ public class CompoundSaveSession {
}
}
- public List getAllStorageFilesToSave() throws StateStorage.StateStorageException {
+ public List getAllStorageFilesToSave() throws StateStorageException {
List result = new ArrayList();
for (StateStorage stateStorage : mySaveSessions.keySet()) {
@@ -46,7 +47,7 @@ public class CompoundSaveSession {
return result;
}
- public void save() throws StateStorage.StateStorageException {
+ public void save() throws StateStorageException {
for (StateStorage.SaveSession saveSession : mySaveSessions.values()) {
saveSession.save();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java
index c71993d6a4e5..7c807f5ffed9 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java
@@ -115,7 +115,7 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
}
@Nullable
- public StateStorage getStateStorage(@NotNull Storage storageSpec) throws StateStorage.StateStorageException {
+ public StateStorage getStateStorage(@NotNull Storage storageSpec) throws StateStorageException {
return storage;
}
@@ -145,7 +145,7 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
@Nullable
public StateStorage getOldStorage(Object component, final String componentName, final StateStorageOperation operation)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
return storage;
}
@@ -174,7 +174,7 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
throw new UnsupportedOperationException("Method getLocation not implemented in " + getClass());
}
- public void load() throws IOException, StateStorage.StateStorageException {
+ public void load() throws IOException, StateStorageException {
if (myElement == null) return;
super.load();
}
@@ -187,11 +187,11 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
}
public void setState(@NotNull final Storage[] storageSpecs, final Object component, final String componentName, final Object state)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
externalizationSession.setState(component, componentName, state, null);
}
- public void setStateInOldStorage(final Object component, final String componentName, final Object state) throws StateStorage.StateStorageException {
+ public void setStateInOldStorage(final Object component, final String componentName, final Object state) throws StateStorageException {
externalizationSession.setState(component, componentName, state, null);
}
}
@@ -209,7 +209,7 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
throw new UnsupportedOperationException("Method analyzeExternalChanges not implemented in " + getClass());
}
- public List getAllStorageFilesToSave() throws StateStorage.StateStorageException {
+ public List getAllStorageFilesToSave() throws StateStorageException {
return Collections.emptyList();
}
@@ -217,7 +217,7 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl {
return Collections.emptyList();
}
- public void save() throws StateStorage.StateStorageException {
+ public void save() throws StateStorageException {
saveSession.save();
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java
index f184b563dede..fc1d4b07d9cc 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultStateSerializer.java
@@ -15,7 +15,7 @@
*/
package com.intellij.openapi.components.impl.stores;
-import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StorageId;
import com.intellij.openapi.diagnostic.Logger;
@@ -85,7 +85,7 @@ class DefaultStateSerializer {
@SuppressWarnings({"unchecked"})
@Nullable
- static T deserializeState(@Nullable Element stateElement, Class stateClass, @Nullable T mergeInto) throws StateStorage.StateStorageException {
+ static T deserializeState(@Nullable Element stateElement, Class stateClass, @Nullable T mergeInto) throws StateStorageException {
if (stateElement == null) return mergeInto;
if (stateClass.equals(Element.class)) {
@@ -104,14 +104,14 @@ class DefaultStateSerializer {
return t;
}
catch (InvalidDataException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
}
catch (InstantiationException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
catch (IllegalAccessException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
}
else {
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java
index dad6fa8f16eb..6a8b428f9950 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java
@@ -18,6 +18,7 @@ package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.application.ex.DecodeDefaultsUtil;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.util.xmlb.JDOMXIncluder;
import org.jdom.Document;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
index db1c2c86f317..5ab67f2fc460 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java
@@ -17,10 +17,7 @@ package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.components.StateSplitter;
-import com.intellij.openapi.components.StateStorage;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.util.Disposer;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java
index 6b35851db4c1..920866041d26 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java
@@ -16,7 +16,6 @@
package com.intellij.openapi.components.impl.stores;
-import com.intellij.Patches;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
@@ -24,6 +23,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.StreamProvider;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IApplicationStore.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IApplicationStore.java
index bcaea669d586..22059a0fbc34 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IApplicationStore.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IApplicationStore.java
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.components.impl.stores;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.components.StateStorage;
import com.intellij.openapi.util.Pair;
@@ -30,5 +31,6 @@ public interface IApplicationStore extends IComponentStore {
void setConfigPath(final String configPath);
- boolean reload(final Set> changedFiles, final Collection notReloadableComponents) throws StateStorage.StateStorageException, IOException;
+ boolean reload(final Set> changedFiles, final Collection notReloadableComponents) throws
+ StateStorageException, IOException;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java
index be980a36e5da..30ff783c2cb6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java
@@ -16,6 +16,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.io.fs.IFile;
@@ -33,7 +34,7 @@ public interface IComponentStore {
boolean isReloadPossible(Set componentNames);
- void load() throws IOException, StateStorage.StateStorageException;
+ void load() throws IOException, StateStorageException;
boolean isSaving();
StateStorageManager getStateStorageManager();
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java
index 895e573afa80..376c64a10ff1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java
@@ -16,6 +16,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.StorageScheme;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.project.impl.ProjectImpl;
@@ -53,10 +54,10 @@ public interface IProjectStore extends IComponentStore {
@Nullable
String getPresentableUrl();
- boolean reload(final Set> changedFiles) throws StateStorage.StateStorageException, IOException;
+ boolean reload(final Set> changedFiles) throws StateStorageException, IOException;
//------ This methods should be got rid of
- void loadProject() throws IOException, JDOMException, InvalidDataException, StateStorage.StateStorageException;
+ void loadProject() throws IOException, JDOMException, InvalidDataException, StateStorageException;
@Nullable
VirtualFile getProjectFile();
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStateStorageManager.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStateStorageManager.java
index 4b72c2a10575..8cbd48677e8f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStateStorageManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ProjectStateStorageManager.java
@@ -16,10 +16,7 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.components.ComponentConfig;
-import com.intellij.openapi.components.StateStorage;
-import com.intellij.openapi.components.StateStorageOperation;
-import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
+import com.intellij.openapi.components.*;
import com.intellij.openapi.project.impl.ProjectImpl;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -50,7 +47,7 @@ class ProjectStateStorageManager extends StateStorageManagerImpl {
}
protected String getOldStorageSpec(Object component, final String componentName, final StateStorageOperation operation) throws
- StateStorage.StateStorageException {
+ StateStorageException {
final ComponentConfig config = myProject.getConfig(component.getClass());
assert config != null : "Couldn't find old storage for " + component.getClass().getName();
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 a54164576936..fc45c3d4d4b1 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
@@ -341,7 +341,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
}
}
- public void loadProject() throws IOException, JDOMException, InvalidDataException, StateStorage.StateStorageException {
+ public void loadProject() throws IOException, JDOMException, InvalidDataException, StateStorageException {
//load();
myProject.init();
}
@@ -466,13 +466,13 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
}
}
- protected SaveSessionImpl createSaveSession() throws StateStorage.StateStorageException {
+ protected SaveSessionImpl createSaveSession() throws StateStorageException {
return new ProjectSaveSession();
}
protected class ProjectSaveSession extends SaveSessionImpl {
- ProjectSaveSession() throws StateStorage.StateStorageException {
+ ProjectSaveSession() throws StateStorageException {
}
public List getAllStorageFilesToSave(final boolean includingSubStructures) throws IOException {
@@ -633,7 +633,8 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
}
@NotNull
- protected Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent persistentStateComponent, final StateStorageOperation operation) throws StateStorage.StateStorageException {
+ protected Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent persistentStateComponent, final StateStorageOperation operation) throws
+ StateStorageException {
Storage[] result = super.getComponentStorageSpecs(persistentStateComponent, operation);
if (operation == StateStorageOperation.READ) {
@@ -676,7 +677,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
}
}
- public boolean reload(final Set> changedFiles) throws IOException, StateStorage.StateStorageException {
+ public boolean reload(final Set> changedFiles) throws IOException, StateStorageException {
final SaveSession saveSession = startSave();
final Set componentNames;
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManager.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManager.java
index 0616086ded86..87ec54eb2a3e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManager.java
@@ -36,7 +36,7 @@ public interface StateStorageManager {
TrackingPathMacroSubstitutor getMacroSubstitutor();
@Nullable
- StateStorage getStateStorage(@NotNull Storage storageSpec) throws StateStorage.StateStorageException;
+ StateStorage getStateStorage(@NotNull Storage storageSpec) throws StateStorageException;
@Nullable
StateStorage getFileStateStorage(String fileName);
@@ -50,7 +50,8 @@ public interface StateStorageManager {
void finishSave(SaveSession saveSession);
@Nullable
- StateStorage getOldStorage(Object component, final String componentName, final StateStorageOperation operation) throws StateStorage.StateStorageException;
+ StateStorage getOldStorage(Object component, final String componentName, final StateStorageOperation operation) throws
+ StateStorageException;
@Nullable
String expandMacroses(String file);
@@ -65,8 +66,8 @@ public interface StateStorageManager {
interface ExternalizationSession {
- void setState(@NotNull Storage[] storageSpecs, Object component, final String componentName, Object state) throws StateStorage.StateStorageException;
- void setStateInOldStorage(Object component, final String componentName, Object state) throws StateStorage.StateStorageException;
+ void setState(@NotNull Storage[] storageSpecs, Object component, final String componentName, Object state) throws StateStorageException;
+ void setStateInOldStorage(Object component, final String componentName, Object state) throws StateStorageException;
}
interface SaveSession {
@@ -74,8 +75,8 @@ public interface StateStorageManager {
@Nullable
Set analyzeExternalChanges(Set> files);
- List getAllStorageFilesToSave() throws StateStorage.StateStorageException;
+ List getAllStorageFilesToSave() throws StateStorageException;
List getAllStorageFiles();
- void save() throws StateStorage.StateStorageException;
+ void save() throws StateStorageException;
}
}
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 103065cd8eaa..c30837efe7a9 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
@@ -95,13 +95,13 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
@Nullable
- public StateStorage getStateStorage(@NotNull final Storage storageSpec) throws StateStorage.StateStorageException {
+ public StateStorage getStateStorage(@NotNull final Storage storageSpec) throws StateStorageException {
final String key = getStorageSpecId(storageSpec);
return getStateStorage(storageSpec, key);
}
@Nullable
- private StateStorage getStateStorage(final Storage storageSpec, final String key) throws StateStorage.StateStorageException {
+ private StateStorage getStateStorage(final Storage storageSpec, final String key) throws StateStorageException {
if (myStorages.get(key) == null) {
final StateStorage stateStorage = createStateStorage(storageSpec);
putStorageToMap(key, stateStorage);
@@ -213,7 +213,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
@Nullable
- private StateStorage createStateStorage(final Storage storageSpec) throws StateStorage.StateStorageException {
+ private StateStorage createStateStorage(final Storage storageSpec) throws StateStorageException {
if (!storageSpec.storageClass().equals(StorageAnnotationsDefaultValues.NullStateStorage.class)) {
final String key = UUID.randomUUID().toString();
((MutablePicoContainer)myPicoContainer).registerComponentImplementation(key, storageSpec.storageClass());
@@ -243,7 +243,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
@Nullable
private StateStorage createDirectoryStateStorage(final String file, final Class extends StateSplitter> splitterClass)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
final String expandedFile = expandMacroses(file);
if (expandedFile == null) {
myStorages.put(file, null);
@@ -256,10 +256,10 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
splitter = splitterClass.newInstance();
}
catch (InstantiationException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
catch (IllegalAccessException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
return new DirectoryBasedStorage(myPathMacroSubstitutor, expandedFile, splitter, this, myPicoContainer);
@@ -450,7 +450,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
CompoundExternalizationSession myCompoundExternalizationSession = new CompoundExternalizationSession();
public void setState(@NotNull final Storage[] storageSpecs, final Object component, final String componentName, final Object state)
- throws StateStorage.StateStorageException {
+ throws StateStorageException {
assert mySession == this;
for (Storage storageSpec : storageSpecs) {
@@ -462,7 +462,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
}
- public void setStateInOldStorage(Object component, final String componentName, Object state) throws StateStorage.StateStorageException {
+ public void setStateInOldStorage(Object component, final String componentName, Object state) throws StateStorageException {
assert mySession == this;
StateStorage stateStorage = getOldStorage(component, componentName, StateStorageOperation.WRITE);
if (stateStorage != null) {
@@ -472,12 +472,13 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
}
@Nullable
- public StateStorage getOldStorage(Object component, final String componentName, final StateStorageOperation operation) throws StateStorage.StateStorageException {
+ public StateStorage getOldStorage(Object component, final String componentName, final StateStorageOperation operation) throws
+ StateStorageException {
return getFileStateStorage(getOldStorageSpec(component, componentName, operation));
}
protected abstract String getOldStorageSpec(Object component, final String componentName, final StateStorageOperation operation)
- throws StateStorage.StateStorageException;
+ throws StateStorageException;
protected class MySaveSession implements SaveSession {
CompoundSaveSession myCompoundSaveSession;
@@ -495,7 +496,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
myCompoundSaveSession = new CompoundSaveSession(externalizationSession.myCompoundExternalizationSession);
}
- public List getAllStorageFilesToSave() throws StateStorage.StateStorageException {
+ public List getAllStorageFilesToSave() throws StateStorageException {
assert mySession == this;
return myCompoundSaveSession.getAllStorageFilesToSave();
}
@@ -504,7 +505,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di
return myCompoundSaveSession.getAllStorageFiles();
}
- public void save() throws StateStorage.StateStorageException {
+ public void save() throws StateStorageException {
assert mySession == this;
myCompoundSaveSession.save();
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
index 208cfbff866e..7a86a03e5c44 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.components.RoamingType;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.DocumentRunnable;
@@ -89,7 +90,7 @@ public class StorageUtil {
}
}
- static void save(final IFile file, final Parent element, final Object requestor) throws StateStorage.StateStorageException {
+ static void save(final IFile file, final Parent element, final Object requestor) throws StateStorageException {
final String filePath = file.getCanonicalPath();
try {
final Ref refIOException = Ref.create(null);
@@ -122,11 +123,11 @@ public class StorageUtil {
}
});
if (refIOException.get() != null) {
- throw new StateStorage.StateStorageException(refIOException.get());
+ throw new StateStorageException(refIOException.get());
}
}
catch (IOException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
}
@@ -164,12 +165,12 @@ public class StorageUtil {
}
@Deprecated
- public static byte[] printDocument(final Document document) throws StateStorage.StateStorageException {
+ public static byte[] printDocument(final Document document) throws StateStorageException {
try {
return printDocumentToString(document).getBytes(CharsetToolkit.UTF8);
}
catch (IOException e) {
- throw new StateStorage.StateStorageException(e);
+ throw new StateStorageException(e);
}
}
@@ -217,7 +218,7 @@ public class StorageUtil {
return printDocumentToString(document, SystemProperties.getLineSeparator());
}
- static String printElement(final Element element, final String lineSeparator) throws StateStorage.StateStorageException {
+ static String printElement(final Element element, final String lineSeparator) throws StateStorageException {
return JDOMUtil.writeElement(element, lineSeparator);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StoreUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StoreUtil.java
new file mode 100644
index 000000000000..61a3527314fd
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StoreUtil.java
@@ -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();
+ }
+ }
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java
index b8d7b72b8ecf..4b9d7324ba75 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/XmlElementStorage.java
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.components.impl.stores;
-import com.intellij.application.options.PathMacrosCollector;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.*;
import com.intellij.openapi.diagnostic.Logger;
diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
index 35d4bf031ac7..45813995db73 100644
--- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
@@ -26,15 +26,14 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
+import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.application.impl.PluginsFacade;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.components.StorageScheme;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
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.UnknownMacroNotification;
+import com.intellij.openapi.components.impl.stores.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
@@ -80,6 +79,8 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
private ProjectManagerImpl myManager;
+ private IProjectStore myComponentStore;
+
private MyProjectManagerListener myProjectManagerListener;
private final AtomicBoolean mySavingInProgress = new AtomicBoolean(false);
@@ -126,9 +127,9 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
}
}
- protected void boostrapPicoContainer() {
+ protected void bootstrapPicoContainer() {
Extensions.instantiateArea(PluginManager.AREA_IDEA_PROJECT, this, null);
- super.boostrapPicoContainer();
+ super.bootstrapPicoContainer();
final MutablePicoContainer picoContainer = getPicoContainer();
final ProjectStoreClassProvider projectStoreClassProvider = (ProjectStoreClassProvider)picoContainer.getComponentInstanceOfType(ProjectStoreClassProvider.class);
@@ -175,8 +176,16 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
}
@NotNull
- public IProjectStore getStateStore() {
- return (IProjectStore)super.getStateStore();
+ public synchronized IProjectStore getStateStore() {
+ if (myComponentStore == null) {
+ myComponentStore = (IProjectStore)getPicoContainer().getComponentInstance(IComponentStore.class);
+ }
+ return myComponentStore;
+ }
+
+ @Override
+ public void initializeComponent(Object component, boolean service) {
+ getStateStore().initComponent(component, service);
}
public boolean isOpen() {
@@ -304,7 +313,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
}
}
- doSave();
+ StoreUtil.doSave(getStateStore());
}
catch (IComponentStore.SaveCancelledException e) {
LOG.info(e);
@@ -347,6 +356,8 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
myManager = null;
myProjectManagerListener = null;
+ myComponentStore = null;
+
super.dispose();
if (!application.isDisposed()) {
@@ -476,6 +487,11 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
;
}
+ @Override
+ protected boolean logSlowComponents() {
+ return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
+ }
+
public static void dropUnableToSaveProjectNotification(@NotNull final Project project, final VirtualFile[] readOnlyFiles) {
final UnableToSaveProjectNotification[] notifications =
NotificationsManager.getNotificationsManager().getNotificationsOfType(UnableToSaveProjectNotification.class, project);
diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
index 9d165a3427c7..253832a6c7b4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.application.impl.ApplicationImpl;
import com.intellij.openapi.components.ExportableApplicationComponent;
import com.intellij.openapi.components.StateStorage;
+import com.intellij.openapi.components.StateStorageException;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.components.impl.stores.IComponentStore;
import com.intellij.openapi.components.impl.stores.IProjectStore;
@@ -268,7 +269,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
scheduleDispose(project);
throw e;
}
- catch (final StateStorage.StateStorageException e) {
+ catch (final StateStorageException e) {
scheduleDispose(project);
throw e;
}
@@ -292,13 +293,13 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
try {
return doLoadProject(filePath);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw new IOException(e.getMessage());
}
}
@Nullable
- private Project doLoadProject(String filePath) throws IOException, StateStorage.StateStorageException {
+ private Project doLoadProject(String filePath) throws IOException, StateStorageException {
filePath = canonicalize(filePath);
ProjectImpl project = null;
try {
@@ -342,7 +343,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
catch (IOException e) {
LOG.error(e);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
LOG.error(e);
}
}
@@ -458,7 +459,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
return project;
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
throw new IOException(e.getMessage());
}
}
@@ -471,7 +472,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
@Nullable
public Project loadProjectWithProgress(final String filePath, Ref canceled) throws IOException {
final IOException[] io = {null};
- final StateStorage.StateStorageException[] stateStorage = {null};
+ final StateStorageException[] stateStorage = {null};
if (filePath != null) {
refreshProjectFiles(filePath);
@@ -492,7 +493,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
io[0] = e;
return;
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
stateStorage[0] = e;
return;
}
@@ -614,7 +615,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
try {
reloadOk[0] = ((ApplicationImpl)app).getStateStore().reload(causes, components);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
Messages.showWarningDialog(ProjectBundle.message("project.reload.failed", e.getMessage()),
ProjectBundle.message("project.reload.failed.title"));
}
@@ -681,7 +682,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
LOG.debug("[RELOAD] Reloading project/components...");
reloadOk[0] = ((ProjectEx)project).getStateStore().reload(causes);
}
- catch (StateStorage.StateStorageException e) {
+ catch (StateStorageException e) {
Messages.showWarningDialog(ProjectBundle.message("project.reload.failed", e.getMessage()),
ProjectBundle.message("project.reload.failed.title"));
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCallFacade.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCallFacade.java
index e99feeb25ff2..59753324b9ab 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCallFacade.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCallFacade.java
@@ -44,10 +44,7 @@ public class PlaybackCallFacade {
public static AsyncResult openProjectClone(final PlaybackContext context, String path) {
try {
File parentDir = FileUtil.createTempDirectory("funcTest", "");
- File sourceDir = new File(path);
- if (!sourceDir.isAbsolute()) {
- sourceDir = new File(System.getProperty("work.dir"), path);
- }
+ File sourceDir = getFile(path);
FileUtil.copyDir(sourceDir, parentDir);
File projectDir = new File(parentDir, sourceDir.getName());
@@ -57,7 +54,15 @@ public class PlaybackCallFacade {
return new AsyncResult.Rejected("Cannot create temp directory for clone");
}
}
-
+
+ public static File getFile(String path) {
+ File sourceDir = new File(path);
+ if (!sourceDir.isAbsolute()) {
+ sourceDir = new File(System.getProperty("work.dir"), path);
+ }
+ return sourceDir;
+ }
+
public static AsyncResult openProject(final PlaybackContext context, String path) {
final AsyncResult result = new AsyncResult();
final ProjectManager pm = ProjectManager.getInstance();
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCommand.java
index 76b3f4b82711..c9b03186fab8 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackCommand.java
@@ -20,6 +20,6 @@ import com.intellij.openapi.util.ActionCallback;
import java.awt.*;
public interface PlaybackCommand {
- ActionCallback execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean useDirectActionCall);
+ ActionCallback execute(PlaybackContext context);
boolean canGoFurther();
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackContext.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackContext.java
index e7698e4cfe2d..2c576b487563 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackContext.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackContext.java
@@ -15,6 +15,8 @@
*/
package com.intellij.openapi.ui.playback;
+import java.awt.*;
+
/**
* Created by IntelliJ IDEA.
* User: kirillk
@@ -26,10 +28,14 @@ public class PlaybackContext {
private PlaybackRunner.StatusCallback myCallback;
private int myCurrentLine;
+ private Robot myRobot;
+ private boolean myUseDirectActionCall;
- public PlaybackContext(PlaybackRunner.StatusCallback callback, int currentLine) {
+ public PlaybackContext(PlaybackRunner.StatusCallback callback, int currentLine, Robot robot, boolean useDriectActionCall) {
myCallback = callback;
myCurrentLine = currentLine;
+ myRobot = robot;
+ myUseDirectActionCall = useDriectActionCall;
}
public PlaybackRunner.StatusCallback getCallback() {
@@ -39,4 +45,12 @@ public class PlaybackContext {
public int getCurrentLine() {
return myCurrentLine;
}
+
+ public Robot getRobot() {
+ return myRobot;
+ }
+
+ public boolean isUseDirectActionCall() {
+ return myUseDirectActionCall;
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
index d0567998c571..b882f4283cde 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
@@ -21,11 +21,13 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.playback.commands.*;
import com.intellij.openapi.ui.playback.commands.ActionCommand;
import com.intellij.openapi.util.ActionCallback;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.text.StringTokenizer;
import javax.swing.*;
import java.awt.*;
-import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
public class PlaybackRunner {
@@ -89,7 +91,7 @@ public class PlaybackRunner {
myActionCallback.setRejected();
return;
}
- final ActionCallback cmdCallback = cmd.execute(myCallback, myRobot, myUseDirectActionCall);
+ final ActionCallback cmdCallback = cmd.execute(new PlaybackContext(myCallback, cmdIndex, myRobot, myUseDirectActionCall));
cmdCallback.doWhenDone(new Runnable() {
public void run() {
if (cmd.canGoFurther()) {
@@ -113,12 +115,34 @@ public class PlaybackRunner {
}
private void parse() {
- final StringTokenizer tokens = new StringTokenizer(myScript, "\n");
- int line = 0;
+ includeScript(myScript, myCommands, 0);
+ }
+
+ private void includeScript(String scriptText, ArrayList commandList, int line) {
+ final StringTokenizer tokens = new StringTokenizer(scriptText, "\n");
while (tokens.hasMoreTokens()) {
final String eachLine = tokens.nextToken();
- final PlaybackCommand cmd = createCommand(eachLine, line++);
- myCommands.add(cmd);
+
+ String includeCmd = AbstractCommand.CMD_PREFIX + "include";
+ if (eachLine.startsWith(includeCmd)) {
+ File file = PlaybackCallFacade.getFile(eachLine.substring(includeCmd.length()).trim());
+ if (!file.exists()) {
+ commandList.add(new ErrorCommand("Cannot find file to include: " + file.getAbsolutePath(), line));
+ return;
+ }
+ try {
+ String include = FileUtil.loadFile(file);
+ myCommands.add(new PrintCommand(eachLine, line));
+ includeScript(include, commandList, 0);
+ }
+ catch (IOException e) {
+ commandList.add(new ErrorCommand("Error reading file: " + file.getAbsolutePath(), line));
+ return;
+ }
+ } else {
+ final PlaybackCommand cmd = createCommand(eachLine, line++);
+ commandList.add(cmd);
+ }
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java
index 2f467f140043..084bb441dcd2 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java
@@ -17,11 +17,10 @@ package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.playback.PlaybackCommand;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.ActionCallback;
-import java.awt.*;
-
public abstract class AbstractCommand implements PlaybackCommand {
public static String CMD_PREFIX = "%";
@@ -46,17 +45,17 @@ public abstract class AbstractCommand implements PlaybackCommand {
return true;
}
- public final ActionCallback execute(final PlaybackRunner.StatusCallback cb, final Robot robot, final boolean useDirectActionCall) {
+ public final ActionCallback execute(final PlaybackContext context) {
try {
- dumpCommand(cb);
+ dumpCommand(context.getCallback());
final ActionCallback result = new ActionCallback();
if (isAwtThread()) {
- _execute(cb, robot, useDirectActionCall).notify(result);
+ _execute(context).notify(result);
} else {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
- _execute(cb, robot, useDirectActionCall).notify(result);
+ _execute(context).notify(result);
}
});
}
@@ -64,7 +63,7 @@ public abstract class AbstractCommand implements PlaybackCommand {
return result;
}
catch (Exception e) {
- cb.error(e.getMessage(), getLine());
+ context.getCallback().error(e.getMessage(), getLine());
return new ActionCallback.Rejected();
}
}
@@ -73,7 +72,7 @@ public abstract class AbstractCommand implements PlaybackCommand {
return false;
}
- protected abstract ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall);
+ protected abstract ActionCallback _execute(PlaybackContext context);
public void dumpCommand(final PlaybackRunner.StatusCallback cb) {
cb.message(getText(), getLine());
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java
index 1a554a18a3b6..7546cfab772a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java
@@ -15,7 +15,7 @@
*/
package com.intellij.openapi.ui.playback.commands;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.actionSystem.AnAction;
@@ -25,7 +25,6 @@ import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.keymap.KeymapManager;
import javax.swing.*;
-import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
@@ -38,17 +37,17 @@ public class ActionCommand extends TypeCommand {
super(text, line);
}
- protected ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ protected ActionCallback _execute(PlaybackContext context) {
final String actionName = getText().substring(PREFIX.length()).trim();
final AnAction action = ActionManager.getInstance().getAction(actionName);
if (action == null) {
- dumpError(cb, "Unknown action: " + actionName);
+ dumpError(context.getCallback(), "Unknown action: " + actionName);
return new ActionCallback.Rejected();
}
- if (!directActionCall) {
+ if (!context.isUseDirectActionCall()) {
final Shortcut[] sc = KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionName);
KeyStroke stroke = null;
for (Shortcut each : sc) {
@@ -64,8 +63,8 @@ public class ActionCommand extends TypeCommand {
}
if (stroke != null) {
- cb.message("Invoking action via shortcut: " + stroke.toString(), getLine());
- type(robot, stroke);
+ context.getCallback().message("Invoking action via shortcut: " + stroke.toString(), getLine());
+ type(context.getRobot(), stroke);
return new ActionCallback.Done();
}
}
@@ -74,7 +73,7 @@ public class ActionCommand extends TypeCommand {
final ActionCallback result = new ActionCallback();
- robot.delay(Registry.intValue("actionSystem.playback.autodelay"));
+ context.getRobot().delay(Registry.intValue("actionSystem.playback.autodelay"));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ActionManager.getInstance().tryToExecute(action, input, null, null, false).doWhenProcessed(new Runnable() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java
index 10a938d963ab..f9f5e6204570 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AlphaNumericTypeCommand.java
@@ -16,8 +16,8 @@
package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.ui.TypingTarget;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.Nullable;
@@ -30,8 +30,8 @@ public class AlphaNumericTypeCommand extends TypeCommand {
super(text, line);
}
- public ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
- return type(robot, getText());
+ public ActionCallback _execute(PlaybackContext context) {
+ return type(context.getRobot(), getText());
}
protected ActionCallback type(final Robot robot, final String text) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AssertFocused.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AssertFocused.java
index 22c60e3f2ead..8fd5f0c2854c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AssertFocused.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AssertFocused.java
@@ -16,6 +16,7 @@
package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.ui.Queryable;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -31,7 +32,7 @@ public class AssertFocused extends AbstractCommand {
super(text, line);
}
- protected ActionCallback _execute(final PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ protected ActionCallback _execute(final PlaybackContext context) {
final ActionCallback result = new ActionCallback();
String text = getText().substring(PREFIX.length()).trim();
@@ -42,7 +43,7 @@ public class AssertFocused extends AbstractCommand {
for (String each : keyValue) {
final String[] eachPair = each.split("=");
if (eachPair.length != 2) {
- cb.error("Syntax error, must be comma-separated pairs key=value", getLine());
+ context.getCallback().error("Syntax error, must be comma-separated pairs key=value", getLine());
result.setRejected();
return result;
}
@@ -54,11 +55,11 @@ public class AssertFocused extends AbstractCommand {
IdeFocusManager.findInstance().doWhenFocusSettlesDown(new Runnable() {
public void run() {
try {
- doAssert(expected, cb);
+ doAssert(expected, context.getCallback());
result.setDone();
}
catch (AssertionError error) {
- cb.error("Assertion failed: " + error.getMessage(), getLine());
+ context.getCallback().error("Assertion failed: " + error.getMessage(), getLine());
result.setRejected();
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java
index e54524cf5aba..0d0fd5a85ba3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java
@@ -17,11 +17,9 @@ package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.ui.playback.PlaybackCallFacade;
import com.intellij.openapi.ui.playback.PlaybackContext;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.AsyncResult;
-import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -41,19 +39,19 @@ public class CallCommand extends AbstractCommand {
}
@Override
- protected ActionCallback _execute(final PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ protected ActionCallback _execute(final PlaybackContext context) {
final ActionCallback cmdResult = new ActionCallback();
final String cmd = getText().substring(PREFIX.length()).trim();
final int open = cmd.indexOf("(");
if (open == -1) {
- cb.error("( expected", getLine());
+ context.getCallback().error("( expected", getLine());
return new ActionCallback.Done();
}
final int close = cmd.lastIndexOf(")");
if (close == -1) {
- cb.error(") expected", getLine());
+ context.getCallback().error(") expected", getLine());
return new ActionCallback.Done();
}
@@ -71,12 +69,12 @@ public class CallCommand extends AbstractCommand {
try {
final Method m = PlaybackCallFacade.class.getMethod(methodName, types);
if (!m.getReturnType().isAssignableFrom(AsyncResult.class)) {
- cb.error("Method " + methodName + " must return AsyncResult object", getLine());
+ context.getCallback().error("Method " + methodName + " must return AsyncResult object", getLine());
return new ActionCallback.Rejected();
}
Object[] actualArgs = noArgs ? new Object[1] : new Object[args.length + 1];
- actualArgs[0] = new PlaybackContext(cb, getLine());
+ actualArgs[0] = new PlaybackContext(context.getCallback(), getLine(), context.getRobot(), context.isUseDirectActionCall());
for (int i = 1; i < actualArgs.length; i++) {
actualArgs[i] = args[i - 1];
}
@@ -84,7 +82,7 @@ public class CallCommand extends AbstractCommand {
AsyncResult result = (AsyncResult)m.invoke(null, actualArgs);
if (result == null) {
- cb.error("Method " + methodName + " must return AsyncResult object, but was null", getLine());
+ context.getCallback().error("Method " + methodName + " must return AsyncResult object, but was null", getLine());
return new ActionCallback.Done();
}
@@ -92,27 +90,27 @@ public class CallCommand extends AbstractCommand {
@Override
public void run(String s) {
if (s != null) {
- cb.message("[" + methodName + "] " + s, getLine());
+ context.getCallback().message("[" + methodName + "] " + s, getLine());
}
cmdResult.setDone();
}
}).doWhenRejected(new AsyncResult.Handler() {
@Override
public void run(String s) {
- cb.error("[" + methodName + "] " + s, getLine());
+ context.getCallback().error("[" + methodName + "] " + s, getLine());
cmdResult.setDone();
}
});
}
catch (NoSuchMethodException e) {
- cb.error("No method found in PlaybackCallFacade", getLine());
+ context.getCallback().error("No method found in PlaybackCallFacade", getLine());
}
catch (InvocationTargetException e) {
- cb.error("InvocationTargetException while executing command: " + cmd, getLine());
+ context.getCallback().error("InvocationTargetException while executing command: " + cmd, getLine());
}
catch (IllegalAccessException e) {
- cb.error("IllegalAccessException while executing command: " + cmd, getLine());
+ context.getCallback().error("IllegalAccessException while executing command: " + cmd, getLine());
}
return cmdResult;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java
index 101fb358d73c..71788151014f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java
@@ -15,10 +15,8 @@
*/
package com.intellij.openapi.ui.playback.commands;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
-
-import java.awt.*;
public class DelayCommand extends AbstractCommand {
public static String PREFIX = CMD_PREFIX + "delay";
@@ -27,15 +25,15 @@ public class DelayCommand extends AbstractCommand {
super(text, line);
}
- public ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ public ActionCallback _execute(PlaybackContext context) {
final String s = getText().substring(PREFIX.length()).trim();
try {
final Integer delay = Integer.valueOf(s);
- robot.delay(delay.intValue());
+ context.getRobot().delay(delay.intValue());
}
catch (NumberFormatException e) {
- dumpError(cb, "Invalid delay value: " + s);
+ dumpError(context.getCallback(), "Invalid delay value: " + s);
return new ActionCallback.Rejected();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java
index 870bfea344bb..b27654f19f04 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java
@@ -15,17 +15,15 @@
*/
package com.intellij.openapi.ui.playback.commands;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
-
-import java.awt.*;
public class EmptyCommand extends AbstractCommand {
public EmptyCommand(int line) {
super("", line);
}
- public ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ public ActionCallback _execute(PlaybackContext context) {
return new ActionCallback.Done();
}
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java
index 41e04f88ba69..f43df109c08a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java
@@ -15,10 +15,8 @@
*/
package com.intellij.openapi.ui.playback.commands;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
-
-import java.awt.*;
public class ErrorCommand extends AbstractCommand {
@@ -26,8 +24,8 @@ public class ErrorCommand extends AbstractCommand {
super(text, line);
}
- public ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
- dumpError(cb, getText());
+ public ActionCallback _execute(PlaybackContext context) {
+ dumpError(context.getCallback(), getText());
return new ActionCallback.Rejected();
}
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
index b0b8745fa3e4..05f0d23d6739 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
@@ -16,14 +16,12 @@
package com.intellij.openapi.ui.playback.commands;
import com.intellij.openapi.ui.TypingTarget;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.registry.Registry;
-import org.jetbrains.annotations.Nullable;
import java.awt.*;
-import java.awt.List;
import java.util.*;
public class KeyCodeTypeCommand extends AlphaNumericTypeCommand {
@@ -37,7 +35,7 @@ public class KeyCodeTypeCommand extends AlphaNumericTypeCommand {
}
@Override
- public ActionCallback _execute(final PlaybackRunner.StatusCallback cb, final Robot robot, boolean directActionCall) {
+ public ActionCallback _execute(final PlaybackContext context) {
String text = getText().substring(PREFIX.length()).trim();
int textDelim = text.indexOf(" ");
@@ -66,11 +64,11 @@ public class KeyCodeTypeCommand extends AlphaNumericTypeCommand {
}
}).doWhenRejected(new Runnable() {
public void run() {
- typeCodes(cb, robot, codes).notify(result);
+ typeCodes(context.getCallback(), context.getRobot(), codes).notify(result);
}
});
} else {
- typeCodes(cb, robot, codes).notify(result);
+ typeCodes(context.getCallback(), context.getRobot(), codes).notify(result);
}
return result;
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java
index c5bd853b1588..1849a8566956 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java
@@ -15,10 +15,8 @@
*/
package com.intellij.openapi.ui.playback.commands;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
-
-import java.awt.*;
public class KeyShortcutCommand extends TypeCommand {
@@ -29,14 +27,14 @@ public class KeyShortcutCommand extends TypeCommand {
super(text, line);
}
- public ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
+ public ActionCallback _execute(PlaybackContext context) {
final String one = getText().substring(PREFIX.length());
if (!one.endsWith(POSTFIX)) {
- dumpError(cb, "Expected " + "]");
+ dumpError(context.getCallback(), "Expected " + "]");
return new ActionCallback.Rejected();
}
- type(robot, getFromShortcut(one.substring(0, one.length() - 1).trim()));
+ type(context.getRobot(), getFromShortcut(one.substring(0, one.length() - 1).trim()));
return new ActionCallback.Done();
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java
new file mode 100644
index 000000000000..587ddf137438
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java
@@ -0,0 +1,42 @@
+/*
+ * 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.ui.playback.commands;
+
+import com.intellij.openapi.ui.playback.PlaybackContext;
+import com.intellij.openapi.util.ActionCallback;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: kirillk
+ * Date: 8/17/11
+ * Time: 1:12 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PrintCommand extends AbstractCommand {
+
+ private String myText;
+
+ public PrintCommand(String text, int line) {
+ super("", line);
+ myText = text;
+ }
+
+ @Override
+ protected ActionCallback _execute(PlaybackContext context) {
+ context.getCallback().message(myText, getLine());
+ return new ActionCallback.Done();
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java
index 467d3a633fc7..093251864700 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java
@@ -15,10 +15,8 @@
*/
package com.intellij.openapi.ui.playback.commands;
+import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.ui.playback.PlaybackRunner;
-
-import java.awt.*;
public class StopCommand extends AbstractCommand {
@@ -28,8 +26,8 @@ public class StopCommand extends AbstractCommand {
super(text, line);
}
- protected ActionCallback _execute(PlaybackRunner.StatusCallback cb, Robot robot, boolean directActionCall) {
- cb.message("Stopped", getLine());
+ protected ActionCallback _execute(PlaybackContext context) {
+ context.getCallback().message("Stopped", getLine());
return new ActionCallback.Done();
}
diff --git a/platform/testFramework/src/com/intellij/mock/MockComponentManager.java b/platform/testFramework/src/com/intellij/mock/MockComponentManager.java
index 8db57f7c60f0..c5983f89635d 100644
--- a/platform/testFramework/src/com/intellij/mock/MockComponentManager.java
+++ b/platform/testFramework/src/com/intellij/mock/MockComponentManager.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.UserDataHolderBase;
-import com.intellij.util.ArrayUtil;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusFactory;
import com.intellij.util.pico.IdeaPicoContainer;
@@ -90,12 +89,6 @@ public class MockComponentManager extends UserDataHolderBase implements Componen
return getComponent(interfaceClass);
}
- @Override
- @NotNull
- public Class[] getComponentInterfaces() {
- return ArrayUtil.EMPTY_CLASS_ARRAY;
- }
-
@Override
public boolean hasComponent(@NotNull Class interfaceClass) {
return false;
diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
index 7cc4887342bd..3b20d4d5939c 100644
--- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
@@ -33,6 +33,7 @@ import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
+import com.intellij.openapi.fileEditor.impl.TrailingSpacesStripper;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.util.io.FileUtil;
@@ -266,7 +267,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
if (ignoreTrailingSpaces) {
final Editor editor = myEditor;
- ((DocumentImpl) editor.getDocument()).stripTrailingSpaces();
+ TrailingSpacesStripper.stripIfNotCurrentLine(editor.getDocument(), false);
EditorUtil.fillVirtualSpaceUntilCaret(editor);
}
diff --git a/platform/testFramework/testFramework.iml b/platform/testFramework/testFramework.iml
index 5cdf90425796..bb333c9365c4 100644
--- a/platform/testFramework/testFramework.iml
+++ b/platform/testFramework/testFramework.iml
@@ -23,6 +23,7 @@
+
diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java
index 764a3f6f95a2..8e20a924497b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java
@@ -38,7 +38,7 @@ import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.patch.ApplyPatchAction;
-import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction;
+import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -384,7 +384,7 @@ public class PatchApplier {
showError(project, VcsBundle.message("patch.apply.partially.applied"), false);
} else if (ApplyPatchStatus.SUCCESS.equals(status)) {
final String message = VcsBundle.message("patch.apply.success.applied.text");
- AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(project);
+ VcsBalloonProblemNotifier.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(project);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
index e86ad72552d2..cca7926e64b0 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
@@ -37,7 +37,7 @@ import com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction;
import com.intellij.openapi.vcs.changes.committed.CommittedChangesCache;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vcs.checkin.CheckinHandler;
-import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction;
+import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vcs.update.RefreshVFsSynchronously;
import com.intellij.util.Consumer;
import com.intellij.util.NullableFunction;
@@ -136,7 +136,7 @@ public class CommitHelper {
text += ", " + failed + " " + StringUtil.pluralize("change", failed) + " failed to commit";
}
String content = StringUtil.isEmpty(myCommitMessage) ? text : text + ": " + myCommitMessage;
- AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(content, NotificationType.INFORMATION).notify( myProject);
+ VcsBalloonProblemNotifier.NOTIFICATION_GROUP.createNotification(content, NotificationType.INFORMATION).notify( myProject);
return new NotificationInfo("VCS Commit", "VCS Commit Finished", text, true);
}
};
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
index 5cb6b9b81318..598046bf27f1 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
@@ -15,13 +15,12 @@
*/
package com.intellij.openapi.vcs.ui;
+import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction;
-
-import java.util.Collection;
+import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
/**
* Shows a notification balloon over one of version control related tool windows: Changes View or Version Control View.
@@ -29,6 +28,8 @@ import java.util.Collection;
* Use the special method or supply additional parameter to the constructor to show the balloon over the Version Control View.
*/
public class VcsBalloonProblemNotifier implements Runnable {
+ public static final NotificationGroup
+ NOTIFICATION_GROUP = NotificationGroup.toolWindowGroup("Common Version Control Messages", ChangesViewContentManager.TOOLWINDOW_ID, true);
private final Project myProject;
private final String myMessage;
private final MessageType myMessageType;
@@ -65,20 +66,11 @@ public class VcsBalloonProblemNotifier implements Runnable {
showErrorAction.run();
}
else {
- ApplicationManager.getApplication().invokeLater(showErrorAction);
+ application.invokeLater(showErrorAction);
}
}
public void run() {
- final Collection projects;
- if (myProject != null) {
- doForProject(myProject);
- } else {
- doForProject(null);
- }
- }
-
- private void doForProject(final Project project) {
- AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(myMessage, myMessageType).notify(project);
+ NOTIFICATION_GROUP.createNotification(myMessage, myMessageType).notify(myProject);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java
index 5a1f110a94d0..c8977cfef03e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java
@@ -19,7 +19,6 @@ import com.intellij.history.Label;
import com.intellij.history.LocalHistory;
import com.intellij.history.LocalHistoryAction;
import com.intellij.ide.errorTreeView.HotfixData;
-import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
@@ -44,7 +43,6 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl;
import com.intellij.openapi.vcs.changes.committed.CommittedChangesAdapter;
import com.intellij.openapi.vcs.changes.committed.CommittedChangesCache;
import com.intellij.openapi.vcs.changes.committed.IntoSelfVirtualFileConvertor;
-import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
@@ -62,7 +60,6 @@ import java.io.File;
import java.util.*;
public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
- public static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.toolWindowGroup("Common Version Control Messages", ChangesViewContentManager.TOOLWINDOW_ID, true);
private final boolean myAlwaysVisible;
private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.update.AbstractCommonUpdateAction");
@@ -458,7 +455,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
if (text.length() > 0) {
log += ": " + text.toString();
}
- NOTIFICATION_GROUP.createNotification(log, NotificationType.INFORMATION).notify(myProject);
+ VcsBalloonProblemNotifier.NOTIFICATION_GROUP.createNotification(log, NotificationType.INFORMATION).notify(myProject);
return new NotificationInfo("VCS Update", title, log, true);
}
diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties
index 0aeb52672205..e9cc97929196 100644
--- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties
+++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/CvsBundle.properties
@@ -72,6 +72,7 @@ action.name.rollback.file.modification=Ro_llback Local Changes
operation.name.rollback.file.modification=Rollback Local Changes
message.error.rollback.failed=Rolling back for file {0} failed: {1}
operation.name.check.out.project=Check Out Project
+error.title.cvs.error=CVS Error
message.error.checkout=CVS Error: {0}
progress.text.processing=Processing {0}
operation.name.test.connection=Test Connection
@@ -101,6 +102,7 @@ dialog.title.select.path.to.external.rsh=Select Path to External Rsh
dialog.title.select.path.to.ssh.private.key=Select Path to Ssh Private Key
dialog.title.select.path.to.cvs.client=Select Path to CVS Client
dialog.description.select.path.to.cvs.client=Select path to CVS client
+error.title.invalid.cvs.root=Invalid CVS Root
error.message.timeout.error=Timeout error.
error.dialog.title.timeout.error=Timeout Error
error.message.unknown.host=Unknown host: {0}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/BrowseCvsRepositoryAction.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/BrowseCvsRepositoryAction.java
index dfd08e4b06db..5e0445a0de5b 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/BrowseCvsRepositoryAction.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/BrowseCvsRepositoryAction.java
@@ -89,10 +89,15 @@ public class BrowseCvsRepositoryAction extends AbstractAction implements DumbAwa
})) return;
super.onActionPerformed(context, tabbedWindow, successfully, handler);
if (successfully){
- Project project = context.getProject();
+ final Project project = context.getProject();
LOG.assertTrue(project != null);
LOG.assertTrue(mySelectedConfiguration != null);
- final BrowserPanel browserPanel = new BrowserPanel(mySelectedConfiguration, project);
+ final BrowserPanel browserPanel = new BrowserPanel(mySelectedConfiguration, project, new Consumer() {
+ @Override
+ public void consume(VcsException e) {
+ VcsBalloonProblemNotifier.showOverChangesView(project, e.getMessage(), MessageType.ERROR);
+ }
+ });
tabbedWindow.addTab(TITLE, browserPanel,
true, true, true, true, browserPanel.getActionGroup(), "cvs.browse");
tabbedWindow.ensureVisible(project);
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/application/CvsInfo.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/application/CvsInfo.java
index 1683c8e28596..0d88ce856658 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/application/CvsInfo.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/application/CvsInfo.java
@@ -26,7 +26,6 @@ import com.intellij.cvsSupport2.cvsIgnore.IgnoredFilesInfo;
import com.intellij.cvsSupport2.cvsIgnore.IgnoredFilesInfoImpl;
import com.intellij.cvsSupport2.errorHandling.ErrorRegistry;
import com.intellij.cvsSupport2.javacvsImpl.io.ReadWriteStatistics;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
@@ -293,12 +292,8 @@ public class CvsInfo {
}
public ThreeState silentLogin(boolean forceCheck) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- public void run() {
- new VcsBalloonProblemNotifier(project, CvsBundle.message("message.error.invalid.cvs.root", getCvsRootAsString()),
- MessageType.ERROR).run();
- }
- });
+ VcsBalloonProblemNotifier.showOverChangesView(
+ project, CvsBundle.message("message.error.invalid.cvs.root", getCvsRootAsString()), MessageType.ERROR);
return ThreeState.NO;
}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/AbstractVcsDataProvider.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/AbstractVcsDataProvider.java
index 7e119bef8ca5..9e9ce796fdf4 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/AbstractVcsDataProvider.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/AbstractVcsDataProvider.java
@@ -27,16 +27,21 @@ import com.intellij.cvsSupport2.cvsoperations.cvsContent.DirectoryContentProvide
import com.intellij.cvsSupport2.cvsoperations.cvsContent.GetDirectoriesListViaUpdateOperation;
import com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsListenerWithProgress;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.Consumer;
+import java.util.List;
+
public abstract class AbstractVcsDataProvider implements RemoteResourceDataProvider {
protected final CvsEnvironment myEnvironment;
+ private Consumer myErrorCallback;
protected AbstractVcsDataProvider(CvsEnvironment environment) {
myEnvironment = environment;
}
- public void fillContentFor(final GetContentCallback callback) {
+ public void fillContentFor(final GetContentCallback callback, Consumer errorCallback) {
+ myErrorCallback = errorCallback;
if (ApplicationManager.getApplication().isUnitTestMode()) {
executeCommand(createDirectoryContentProvider(callback.getElementPath()), callback);
} else {
@@ -72,7 +77,7 @@ public abstract class AbstractVcsDataProvider implements RemoteResourceDataProvi
}
}
- private static void executeCommand(final DirectoryContentProvider command, final GetContentCallback callback) {
+ private void executeCommand(final DirectoryContentProvider command, final GetContentCallback callback) {
final CvsOperationExecutor executor = new CvsOperationExecutor(false, callback.getProject(), callback.getModalityState());
executor.setIsQuietOperation(true);
@@ -83,6 +88,12 @@ public abstract class AbstractVcsDataProvider implements RemoteResourceDataProvi
executor.performActionSync(cvsHandler, new CvsOperationExecutorCallback() {
public void executionFinished(boolean successfully) {
+ if (!successfully) {
+ final List errors = cvsHandler.getErrorsExceptAborted();
+ if (!errors.isEmpty()) {
+ myErrorCallback.consume(errors.get(0));
+ }
+ }
callback.finished();
}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CvsTree.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CvsTree.java
index bd08cb924953..6f9622373661 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CvsTree.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CvsTree.java
@@ -23,9 +23,11 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vcs.VcsException;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TreeUIHelper;
import com.intellij.ui.treeStructure.Tree;
+import com.intellij.util.Consumer;
import com.intellij.util.ui.tree.TreeUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -48,6 +50,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
private CvsRootConfiguration myCvsRootConfiguration = null;
private final Observable mySelectionObservable = new AlwaysNotifiedObservable();
private final boolean myShowFiles;
+ private final Consumer myErrorCallback;
private final boolean myAllowRootSelection;
private final boolean myShowModules;
private final Project myProject;
@@ -56,13 +59,15 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
@NonNls public static final String SELECTION_CHANGED = "Selection Changed";
- public CvsTree(Project project, boolean allowRootSelection, int selectionMode, boolean showModules, boolean showFiles) {
+ public CvsTree(Project project, boolean allowRootSelection, int selectionMode, boolean showModules, boolean showFiles,
+ Consumer errorCallback) {
super(new BorderLayout());
myProject = project;
mySelectionMode = selectionMode;
myShowModules = showModules;
myAllowRootSelection = allowRootSelection;
myShowFiles = showFiles;
+ myErrorCallback = errorCallback;
setSize(500, 500);
addListener(myLoadingNodeManager);
}
@@ -187,7 +192,7 @@ public class CvsTree extends JPanel implements CvsTabbedWindow.DeactivateListene
application.executeOnPooledThread(new Runnable() {
public void run() {
final RemoteResourceDataProvider dataProvider = element.getDataProvider();
- dataProvider.fillContentFor(new MyGetContentCallback(element, modalityState, myProject));
+ dataProvider.fillContentFor(new MyGetContentCallback(element, modalityState, myProject), myErrorCallback);
}
});
}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/RemoteResourceDataProvider.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/RemoteResourceDataProvider.java
index ea2bcec22a8a..2c578179bc68 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/RemoteResourceDataProvider.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/RemoteResourceDataProvider.java
@@ -15,10 +15,13 @@
*/
package com.intellij.cvsSupport2.cvsBrowser;
+import com.intellij.openapi.vcs.VcsException;
+import com.intellij.util.Consumer;
+
public interface RemoteResourceDataProvider {
RemoteResourceDataProvider NOT_EXPANDABLE = new RemoteResourceDataProvider(){
- public void fillContentFor(GetContentCallback callback) {}
+ public void fillContentFor(GetContentCallback callback, Consumer errorCallback) {}
@Override
public RemoteResourceDataProvider getChildrenDataProvider() {
@@ -26,7 +29,7 @@ public interface RemoteResourceDataProvider {
}
};
- void fillContentFor(GetContentCallback callback);
+ void fillContentFor(GetContentCallback callback, Consumer errorCallback);
RemoteResourceDataProvider getChildrenDataProvider();
}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
index 0934e0d5fb63..fd22e2ddc81c 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
@@ -44,6 +44,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.TreeUIHelper;
+import com.intellij.util.Consumer;
import com.intellij.util.OpenSourceUtil;
import com.intellij.util.ui.tree.TreeUtil;
import org.jetbrains.annotations.Nullable;
@@ -62,12 +63,12 @@ public class BrowserPanel extends JPanel implements DataProvider, CvsTabbedWindo
private final CvsRootConfiguration myCvsRootConfiguration;
private final Project myProject;
- public BrowserPanel(CvsRootConfiguration configuration, Project project) {
+ public BrowserPanel(CvsRootConfiguration configuration, Project project, Consumer errorCallback) {
super(new BorderLayout(2, 0));
setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
myProject = project;
myCvsRootConfiguration = configuration;
- myTree = new CvsTree(project, false, TreeSelectionModel.SINGLE_TREE_SELECTION, true, true);
+ myTree = new CvsTree(project, false, TreeSelectionModel.SINGLE_TREE_SELECTION, true, true, errorCallback);
add(myTree, BorderLayout.CENTER);
myTree.init();
myTree.setCvsRootConfiguration(configuration);
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java
index 9acd7595af92..689653a3b6fd 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java
@@ -15,6 +15,7 @@
*/
package com.intellij.cvsSupport2.ui.experts;
+import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.cvsSupport2.connections.CvsRootException;
@@ -81,7 +82,7 @@ public class SelectCvsElementStep extends WizardStep {
final boolean logged = performer.loginAll(new ModalityContextImpl(ModalityState.current(), false), false);
return logged && errors.isNull();
} catch (CvsRootException e) {
- Messages.showErrorDialog(e.getMessage(), "Invalid CVS Root");
+ Messages.showErrorDialog(e.getMessage(), CvsBundle.message("error.title.invalid.cvs.root"));
return false;
}
}
@@ -113,7 +114,12 @@ public class SelectCvsElementStep extends WizardStep {
}
protected JComponent createComponent() {
- myCvsTree = new CvsTree(myProject, myAllowRootSelection, mySelectionMode, myShowModules, myShowFiles);
+ myCvsTree = new CvsTree(myProject, myAllowRootSelection, mySelectionMode, myShowModules, myShowFiles, new Consumer() {
+ @Override
+ public void consume(VcsException e) {
+ Messages.showErrorDialog(e.getMessage(), CvsBundle.message("error.title.cvs.error"));
+ }
+ });
myCvsTree.init();
myCvsTree.addSelectionObserver(new Observer() {
public void update(Observable o, Object arg) {
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/optimizeImports/OptimizeImportsTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/optimizeImports/OptimizeImportsTest.groovy
index 05f9195b169a..dffc2e9911e2 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/optimizeImports/OptimizeImportsTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/optimizeImports/OptimizeImportsTest.groovy
@@ -20,7 +20,7 @@ package org.jetbrains.plugins.groovy.refactoring.optimizeImports;
import com.intellij.codeInsight.CodeInsightSettings
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.command.CommandProcessor
-import com.intellij.openapi.editor.ex.DocumentEx
+import com.intellij.openapi.fileEditor.impl.TrailingSpacesStripper
import com.intellij.psi.codeStyle.CodeStyleSettings
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
import com.intellij.psi.impl.source.PostprocessReformattingAspect
@@ -30,7 +30,7 @@ import org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyAccessibilityInspe
import org.jetbrains.plugins.groovy.lang.editor.GroovyImportOptimizer
import org.jetbrains.plugins.groovy.util.TestUtils
- /**
+/**
* @author ilyas
*/
public class OptimizeImportsTest extends LightCodeInsightFixtureTestCase {
@@ -189,7 +189,7 @@ class Fooxx {
doOptimizeImports();
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
- ((DocumentEx)myFixture.getEditor().getDocument()).stripTrailingSpaces(false);
+ TrailingSpacesStripper.stripIfNotCurrentLine(myFixture.getEditor().getDocument(), false);
myFixture.checkResultByFile(getTestName(false) + "_after.groovy");
}
finally {