mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
Generated
+2
@@ -21,6 +21,8 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" filepath="$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" filepath="$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/copyright/copyright.iml" filepath="$PROJECT_DIR$/plugins/copyright/copyright.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/core-api/core-api.iml" filepath="$PROJECT_DIR$/platform/core-api/core-api.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/core-impl/core-impl.iml" filepath="$PROJECT_DIR$/platform/core-impl/core-impl.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" filepath="$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" group="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);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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<String,String> options = new HashMap<String, String>();
|
||||
|
||||
@Transient
|
||||
public IdeaPluginDescriptor pluginDescriptor;
|
||||
public PluginDescriptor pluginDescriptor;
|
||||
|
||||
@Transient
|
||||
public ClassLoader getClassLoader() {
|
||||
@@ -59,11 +59,6 @@ public interface ComponentManager extends UserDataHolder, Disposable {
|
||||
*/
|
||||
<T> T getComponent(Class<T> interfaceClass, T defaultImplementationIfAbsent);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getComponents} instead.
|
||||
*/
|
||||
@NotNull Class[] getComponentInterfaces();
|
||||
|
||||
/**
|
||||
* Checks whether there is a component with the specified interface class.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="core-api" exported="" />
|
||||
<orderEntry type="library" name="picocontainer" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
+3
-7
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
-3
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
%include ../community/platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
|
||||
+6
-9
@@ -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;
|
||||
}
|
||||
|
||||
+4
-3
@@ -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<SaveSession> myModuleSaveSessions = new ArrayList<SaveSession>();
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -57,24 +57,7 @@ public interface StateStorage {
|
||||
List<IFile> 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);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-7
@@ -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<ApplicationListener> 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" +
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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;
|
||||
|
||||
|
||||
+19
-56
@@ -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<String, String> options) {
|
||||
return !isTrue(options, "internal") || ApplicationManagerEx.getApplicationEx().isInternal();
|
||||
return !isTrue(options, "internal") || ApplicationManager.getApplication().isInternal();
|
||||
}
|
||||
|
||||
private static boolean isTrue(Map<String, String> 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<Class, Object> myInterfaceToLockMap = new HashMap<Class, Object>();
|
||||
private final Map<Class, Class> myInterfaceToClassMap = new HashMap<Class, Class>();
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
+3
-5
@@ -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<Pair<VirtualFile, StateStorage>> changedFiles, final Collection<String> notReloadableComponents) throws StateStorage.StateStorageException, IOException {
|
||||
public boolean reload(final Set<Pair<VirtualFile, StateStorage>> changedFiles, final Collection<String> notReloadableComponents) throws
|
||||
StateStorageException, IOException {
|
||||
|
||||
final SaveSession saveSession = startSave();
|
||||
final Set<String> componentNames = saveSession.analyzeExternalChanges(changedFiles);
|
||||
|
||||
+3
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -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 <T> Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent<T> 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<Pair<VirtualFile, StateStorage>> changedFiles, @NotNull final Set<String> componentNames)
|
||||
throws StateStorage.StateStorageException {
|
||||
throws StateStorageException {
|
||||
for (Pair<VirtualFile, StateStorage> pair : changedFiles) {
|
||||
assert pair != null;
|
||||
final StateStorage storage = pair.second;
|
||||
|
||||
+3
-2
@@ -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<IFile> getAllStorageFilesToSave() throws StateStorage.StateStorageException {
|
||||
public List<IFile> getAllStorageFilesToSave() throws StateStorageException {
|
||||
List<IFile> result = new ArrayList<IFile>();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
+7
-7
@@ -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<IFile> getAllStorageFilesToSave() throws StateStorage.StateStorageException {
|
||||
public List<IFile> 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();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -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> T deserializeState(@Nullable Element stateElement, Class <T> stateClass, @Nullable T mergeInto) throws StateStorage.StateStorageException {
|
||||
static <T> T deserializeState(@Nullable Element stateElement, Class <T> 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 {
|
||||
|
||||
+1
@@ -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;
|
||||
|
||||
+1
-4
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+3
-1
@@ -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<Pair<VirtualFile, StateStorage>> changedFiles, final Collection<String> notReloadableComponents) throws StateStorage.StateStorageException, IOException;
|
||||
boolean reload(final Set<Pair<VirtualFile, StateStorage>> changedFiles, final Collection<String> notReloadableComponents) throws
|
||||
StateStorageException, IOException;
|
||||
}
|
||||
|
||||
+2
-1
@@ -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<String> componentNames);
|
||||
|
||||
|
||||
void load() throws IOException, StateStorage.StateStorageException;
|
||||
void load() throws IOException, StateStorageException;
|
||||
boolean isSaving();
|
||||
|
||||
StateStorageManager getStateStorageManager();
|
||||
|
||||
+3
-2
@@ -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<Pair<VirtualFile,StateStorage>> changedFiles) throws StateStorage.StateStorageException, IOException;
|
||||
boolean reload(final Set<Pair<VirtualFile,StateStorage>> 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();
|
||||
|
||||
+2
-5
@@ -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();
|
||||
|
||||
|
||||
+6
-5
@@ -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<IFile> getAllStorageFilesToSave(final boolean includingSubStructures) throws IOException {
|
||||
@@ -633,7 +633,8 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected <T> Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent<T> persistentStateComponent, final StateStorageOperation operation) throws StateStorage.StateStorageException {
|
||||
protected <T> Storage[] getComponentStorageSpecs(@NotNull final PersistentStateComponent<T> 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<Pair<VirtualFile, StateStorage>> changedFiles) throws IOException, StateStorage.StateStorageException {
|
||||
public boolean reload(final Set<Pair<VirtualFile, StateStorage>> changedFiles) throws IOException, StateStorageException {
|
||||
final SaveSession saveSession = startSave();
|
||||
|
||||
final Set<String> componentNames;
|
||||
|
||||
+7
-6
@@ -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<String> analyzeExternalChanges(Set<Pair<VirtualFile, StateStorage>> files);
|
||||
|
||||
List<IFile> getAllStorageFilesToSave() throws StateStorage.StateStorageException;
|
||||
List<IFile> getAllStorageFilesToSave() throws StateStorageException;
|
||||
List<IFile> getAllStorageFiles();
|
||||
void save() throws StateStorage.StateStorageException;
|
||||
void save() throws StateStorageException;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -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<IFile> getAllStorageFilesToSave() throws StateStorage.StateStorageException {
|
||||
public List<IFile> 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();
|
||||
|
||||
+7
-6
@@ -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<IOException> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+10
-9
@@ -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<Boolean> 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"));
|
||||
}
|
||||
|
||||
+10
-5
@@ -44,10 +44,7 @@ public class PlaybackCallFacade {
|
||||
public static AsyncResult<String> 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<String>("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<String> openProject(final PlaybackContext context, String path) {
|
||||
final AsyncResult<String> result = new AsyncResult<String>();
|
||||
final ProjectManager pm = ProjectManager.getInstance();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PlaybackCommand> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-8
@@ -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());
|
||||
|
||||
+7
-8
@@ -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() {
|
||||
|
||||
+3
-3
@@ -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) {
|
||||
|
||||
+5
-4
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
+11
-13
@@ -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<String>)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<String>() {
|
||||
@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;
|
||||
}
|
||||
|
||||
+4
-6
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -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();
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -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();
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -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;
|
||||
|
||||
+4
-6
@@ -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();
|
||||
}
|
||||
|
||||
+42
@@ -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();
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<orderEntry type="module" module-name="community-resources" scope="RUNTIME" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="Mocks" level="project" />
|
||||
<orderEntry type="module" module-name="spellchecker" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="relaxng" scope="RUNTIME" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
+2
-2
@@ -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<BinaryType extends FilePatch> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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<Project> 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);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
+7
-2
@@ -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<VcsException>() {
|
||||
@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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -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<VcsException> myErrorCallback;
|
||||
|
||||
protected AbstractVcsDataProvider(CvsEnvironment environment) {
|
||||
myEnvironment = environment;
|
||||
}
|
||||
|
||||
public void fillContentFor(final GetContentCallback callback) {
|
||||
public void fillContentFor(final GetContentCallback callback, Consumer<VcsException> 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<VcsException> errors = cvsHandler.getErrorsExceptAborted();
|
||||
if (!errors.isEmpty()) {
|
||||
myErrorCallback.consume(errors.get(0));
|
||||
}
|
||||
}
|
||||
callback.finished();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<VcsException> 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<VcsException> 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+5
-2
@@ -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<VcsException> errorCallback) {}
|
||||
|
||||
@Override
|
||||
public RemoteResourceDataProvider getChildrenDataProvider() {
|
||||
@@ -26,7 +29,7 @@ public interface RemoteResourceDataProvider {
|
||||
}
|
||||
};
|
||||
|
||||
void fillContentFor(GetContentCallback callback);
|
||||
void fillContentFor(GetContentCallback callback, Consumer<VcsException> errorCallback);
|
||||
|
||||
RemoteResourceDataProvider getChildrenDataProvider();
|
||||
}
|
||||
|
||||
@@ -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<VcsException> 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);
|
||||
|
||||
+8
-2
@@ -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<VcsException>() {
|
||||
@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) {
|
||||
|
||||
+3
-3
@@ -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 <caret>{
|
||||
|
||||
doOptimizeImports();
|
||||
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
|
||||
((DocumentEx)myFixture.getEditor().getDocument()).stripTrailingSpaces(false);
|
||||
TrailingSpacesStripper.stripIfNotCurrentLine(myFixture.getEditor().getDocument(), false);
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.groovy");
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user