>();
diff --git a/platform/platform-resources-en/src/tips/SearchInSettings.html b/platform/platform-resources-en/src/tips/SearchInSettings.html
index b9a158bd277a..2858bdfdc42e 100644
--- a/platform/platform-resources-en/src/tips/SearchInSettings.html
+++ b/platform/platform-resources-en/src/tips/SearchInSettings.html
@@ -5,7 +5,7 @@
| You can quickly find a setting you need in the Settings dialog, without browsing through the numerous options.
Just type some characters that to your opinion exist in the option description, and the list of settings will reduce to the
matching ones. Select the desired entry, and see the setting that contains the entered characters highlighted:
- 
+ 
|
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
index 4679f4bf0eb2..d38a17eb4605 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
@@ -25,7 +25,10 @@ import com.intellij.codeInsight.completion.CompletionType;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.codeInsight.daemon.impl.*;
+import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
+import com.intellij.codeInsight.daemon.impl.HighlightInfo;
+import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
+import com.intellij.codeInsight.daemon.impl.ShowIntentionsPass;
import com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl;
import com.intellij.codeInsight.highlighting.actions.HighlightUsagesAction;
import com.intellij.codeInsight.intention.IntentionAction;
@@ -70,7 +73,7 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.DumbServiceImpl;
+import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
@@ -1307,9 +1310,10 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
}
public static void ensureIndexesUpToDate(Project project) {
- FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
- FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
- assertTrue(!DumbServiceImpl.getInstance(project).isDumb());
+ if (!DumbService.isDumb(project)) {
+ FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
+ FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
+ }
}
@Override
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java
index a23bd2747fc5..5e735f8dd554 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java
@@ -32,6 +32,7 @@ import com.intellij.openapi.vcs.diff.RevisionSelector;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsHistoryProvider;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
+import com.intellij.openapi.vcs.impl.IllegalStateProxy;
import com.intellij.openapi.vcs.merge.MergeProvider;
import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
import com.intellij.openapi.vcs.update.UpdateEnvironment;
@@ -61,6 +62,10 @@ public abstract class AbstractVcs extends S
private VcsShowSettingOption myUpdateOption;
private VcsShowSettingOption myStatusOption;
+ private CheckinEnvironment myCheckinEnvironment;
+ private UpdateEnvironment myUpdateEnvironment;
+ private RollbackEnvironment myRollbackEnvironment;
+
public AbstractVcs(final Project project, final String name) {
super(project);
@@ -124,23 +129,43 @@ public abstract class AbstractVcs extends S
}
/**
+ * creates the object for performing checkin / commit / submit operations.
+ */
+ @Nullable
+ protected CheckinEnvironment createCheckinEnvironment() {
+ return IllegalStateProxy.create(CheckinEnvironment.class);
+ }
+
+ /**
+ * !!! concrete VCS should define {@link #createCheckinEnvironment} method
+ * this method wraps created environment with a listener
+ *
* Returns the interface for performing checkin / commit / submit operations.
*
* @return the checkin interface, or null if checkins are not supported by the VCS.
*/
@Nullable
public CheckinEnvironment getCheckinEnvironment() {
- return null;
+ return myCheckinEnvironment;
}
/**
* Returns the interface for performing revert / rollback operations.
+ */
+ @Nullable
+ protected RollbackEnvironment createRollbackEnvironment() {
+ return IllegalStateProxy.create(RollbackEnvironment.class);
+ }
+
+ /**
+ * !!! concrete VCS should define {@link #createRollbackEnvironment()} method
+ * this method wraps created environment with a listener
*
* @return the rollback interface, or null if rollbacks are not supported by the VCS.
*/
@Nullable
public RollbackEnvironment getRollbackEnvironment() {
- return null;
+ return myRollbackEnvironment;
}
@Nullable
@@ -159,12 +184,21 @@ public abstract class AbstractVcs extends S
/**
* Returns the interface for performing update/sync operations.
+ */
+ @Nullable
+ protected UpdateEnvironment createUpdateEnvironment() {
+ return IllegalStateProxy.create(UpdateEnvironment.class);
+ }
+
+ /**
+ * !!! concrete VCS should define {@link #createUpdateEnvironment()} method
+ * this method wraps created environment with a listener
*
* @return the update interface, or null if the updates are not supported by the VCS.
*/
@Nullable
public UpdateEnvironment getUpdateEnvironment() {
- return null;
+ return myUpdateEnvironment;
}
/**
@@ -494,5 +528,20 @@ public abstract class AbstractVcs extends S
@CalledInAwt
public void generalPreConfigurationStep() {
}
+
+ public void setCheckinEnvironment(CheckinEnvironment checkinEnvironment) {
+ if (myCheckinEnvironment != null) throw new IllegalStateException("Attempt to redefine checkin environment");
+ myCheckinEnvironment = checkinEnvironment;
+ }
+
+ public void setUpdateEnvironment(UpdateEnvironment updateEnvironment) {
+ if (myUpdateEnvironment != null) throw new IllegalStateException("Attempt to redefine update environment");
+ myUpdateEnvironment = updateEnvironment;
+ }
+
+ public void setRollbackEnvironment(RollbackEnvironment rollbackEnvironment) {
+ if (myRollbackEnvironment != null) throw new IllegalStateException("Attempt to redefine rollback environment");
+ myRollbackEnvironment = rollbackEnvironment;
+ }
}
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/telemetry/InspectionRunListener.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ForwardingListener.java
similarity index 52%
rename from plugins/InspectionGadgets/src/com/siyeh/ig/telemetry/InspectionRunListener.java
rename to platform/vcs-api/src/com/intellij/openapi/vcs/ForwardingListener.java
index 6356215b623e..120111989b12 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/telemetry/InspectionRunListener.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ForwardingListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
+ * Copyright 2000-2010 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.
@@ -13,9 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.siyeh.ig.telemetry;
+package com.intellij.openapi.vcs;
-public interface InspectionRunListener{
-
- void reportRun(String inspectionID, long runTime);
+import com.intellij.openapi.util.Pair;
+import com.intellij.util.Consumer;
+
+/**
+* @author irengrig
+* Date: 12/21/10
+* Time: 2:15 PM
+*/
+public class ForwardingListener implements Consumer>> {
+ private final T myT;
+
+ public ForwardingListener(T t) {
+ myT = t;
+ }
+
+ @Override
+ public void consume(Pair> vcsKeyConsumerPair) {
+ vcsKeyConsumerPair.getSecond().consume(myT);
+ }
}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ProjectLevelVcsManager.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ProjectLevelVcsManager.java
index f85e747459de..2218aa571c56 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/ProjectLevelVcsManager.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ProjectLevelVcsManager.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory;
import com.intellij.openapi.vcs.impl.VcsDescriptor;
+import com.intellij.openapi.vcs.impl.VcsEnvironmentsProxyCreator;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
@@ -275,4 +276,7 @@ public abstract class ProjectLevelVcsManager {
public abstract CheckoutProvider.Listener getCompositeCheckoutListener();
public static Topic VCS_CONFIGURATION_CHANGED = Topic.create("VCS configuration changed", VcsListener.class);
+
+ public abstract VcsEventsListenerManager getVcsEventsListenerManager();
+ protected abstract VcsEnvironmentsProxyCreator getProxyCreator();
}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsActiveEnvironmentsProxy.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsActiveEnvironmentsProxy.java
new file mode 100644
index 000000000000..c031ea0bf8b1
--- /dev/null
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsActiveEnvironmentsProxy.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2000-2010 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.vcs;
+
+import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
+import com.intellij.openapi.vcs.impl.IllegalStateProxy;
+import com.intellij.openapi.vcs.impl.VcsEnvironmentsProxyCreator;
+import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
+import com.intellij.openapi.vcs.update.UpdateEnvironment;
+
+/**
+ * @author irengrig
+ * Date: 12/17/10
+ * Time: 12:46 PM
+ */
+public class VcsActiveEnvironmentsProxy {
+ private VcsActiveEnvironmentsProxy() {
+ }
+
+ public static AbstractVcs proxyVcs(final AbstractVcs vcs) {
+ final ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(vcs.getProject());
+ final VcsEnvironmentsProxyCreator proxyCreator = manager.getProxyCreator();
+ if (proxyCreator == null) return vcs;
+
+ final VcsKey key = vcs.getKeyInstanceMethod();
+ final CheckinEnvironment checkinEnvironment = vcs.createCheckinEnvironment();
+ final UpdateEnvironment updateEnvironment = vcs.createUpdateEnvironment();
+ final RollbackEnvironment rollbackEnvironment = vcs.createRollbackEnvironment();
+
+ if (checkinEnvironment != null && checkinEnvironment.equals(IllegalStateProxy.IDENTITY) ||
+ updateEnvironment != null && updateEnvironment.equals(IllegalStateProxy.IDENTITY) ||
+ rollbackEnvironment != null && rollbackEnvironment.equals(IllegalStateProxy.IDENTITY)) {
+ return vcs;
+ } else {
+ final CheckinEnvironment proxedCheckin = proxyCreator.proxyCheckin(key, checkinEnvironment);
+ final UpdateEnvironment proxedUpdate = proxyCreator.proxyUpdate(key, updateEnvironment);
+ final RollbackEnvironment proxedRollback = proxyCreator.proxyRollback(key, rollbackEnvironment);
+ vcs.setCheckinEnvironment(proxedCheckin);
+ vcs.setUpdateEnvironment(proxedUpdate);
+ vcs.setRollbackEnvironment(proxedRollback);
+ return vcs;
+ }
+ }
+}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsEventsListenerManager.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsEventsListenerManager.java
new file mode 100644
index 000000000000..562625a814df
--- /dev/null
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsEventsListenerManager.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2010 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.vcs;
+
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
+import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
+import com.intellij.openapi.vcs.update.UpdateEnvironment;
+import com.intellij.util.Consumer;
+
+/**
+ * @author irengrig
+ * Date: 12/15/10
+ * Time: 5:42 PM
+ */
+public interface VcsEventsListenerManager {
+ void removeCheckin(final Object key);
+ void removeUpdate(final Object key);
+ void removeRollback(final Object key);
+
+ Object addCheckin(Consumer>> consumer);
+ Object addUpdate(Consumer>> consumer);
+ Object addRollback(Consumer>> consumer);
+}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/impl/IllegalStateProxy.java b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/IllegalStateProxy.java
new file mode 100644
index 000000000000..e4ecd49463f8
--- /dev/null
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/IllegalStateProxy.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2010 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.vcs.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author irengrig
+ * Date: 12/17/10
+ * Time: 2:21 PM
+ */
+public class IllegalStateProxy {
+ public static final Object IDENTITY = new Object();
+
+ private static final InvocationHandler HANDLER = new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if ("equals".equals(method.getName())) {
+ return IDENTITY.equals(args[0]);
+ }
+ throw new IllegalStateException();
+ }
+ };
+
+ private IllegalStateProxy() {
+ }
+
+ public static T create(final Class clazz) {
+ return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, HANDLER);
+ }
+}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/impl/VcsEnvironmentsProxyCreator.java b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/VcsEnvironmentsProxyCreator.java
new file mode 100644
index 000000000000..eea5ff2dde86
--- /dev/null
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/VcsEnvironmentsProxyCreator.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2010 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.vcs.impl;
+
+import com.intellij.openapi.vcs.VcsKey;
+import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
+import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
+import com.intellij.openapi.vcs.update.UpdateEnvironment;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author irengrig
+ * Date: 12/17/10
+ * Time: 5:34 PM
+ */
+public interface VcsEnvironmentsProxyCreator {
+ @Nullable
+ CheckinEnvironment proxyCheckin(VcsKey key, CheckinEnvironment environment);
+
+ @Nullable
+ UpdateEnvironment proxyUpdate(VcsKey key, UpdateEnvironment environment);
+
+ @Nullable
+ RollbackEnvironment proxyRollback(VcsKey key, RollbackEnvironment environment);
+}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
index 1a16670fa137..1d6e08c8209e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
@@ -232,7 +232,7 @@ public class ChangeListWorker implements ChangeListsWriteOperations {
}
public boolean addChangeToList(@NotNull final String name, final Change change, final VcsKey vcsKey) {
- LOG.debug("[addChangeToList] name: " + name + " change: " + ChangesUtil.getFilePath(change).getPath() + " vcs: " +
+ LOG.info("[addChangeToList] name: " + name + " change: " + ChangesUtil.getFilePath(change).getPath() + " vcs: " +
(vcsKey == null ? null : vcsKey.getName()));
final LocalChangeList changeList = myMap.get(name);
if (changeList != null) {
@@ -243,16 +243,16 @@ public class ChangeListWorker implements ChangeListsWriteOperations {
}
public void addChangeToCorrespondingList(final Change change, final VcsKey vcsKey) {
- final String path = LOG.isDebugEnabled() ? ChangesUtil.getFilePath(change).getPath() : "";
- LOG.debug("[addChangeToCorrespondingList] for change " + path + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
+ final String path = ChangesUtil.getFilePath(change).getPath();
+ LOG.info("[addChangeToCorrespondingList] for change " + path + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
assert myDefault != null;
for (LocalChangeList list : myMap.values()) {
if (list.isDefault()) {
- LOG.debug("[addChangeToCorrespondingList] skip default list: " + list.getName() + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
+ LOG.info("[addChangeToCorrespondingList] skip default list: " + list.getName() + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
continue;
}
if (((LocalChangeListImpl) list).processChange(change)) {
- LOG.debug("[addChangeToCorrespondingList] matched: " + list.getName() + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
+ LOG.info("[addChangeToCorrespondingList] matched: " + list.getName() + " type: " + change.getType() + " have before revision: " + (change.getBeforeRevision() != null));
myIdx.changeAdded(change, vcsKey);
return;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
index 1cfc7eea25e4..933e45d00b28 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
@@ -66,11 +66,11 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
public void processChangeInList(final Change change, @Nullable final ChangeList changeList, final VcsKey vcsKey) {
checkIfDisposed();
- LOG.debug("[processChangeInList-1] entering, cl name: " + ((changeList == null) ? null: changeList.getName()) +
+ LOG.info("[processChangeInList-1] entering, cl name: " + ((changeList == null) ? null: changeList.getName()) +
" change: " + ChangesUtil.getFilePath(change).getPath());
final String fileName = ChangesUtil.getFilePath(change).getName();
if (FileTypeManager.getInstance().isFileIgnored(fileName)) {
- LOG.debug("[processChangeInList-1] file type ignored");
+ LOG.info("[processChangeInList-1] file type ignored");
return;
}
@@ -78,14 +78,14 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
public void run() {
if (ChangeListManagerImpl.isUnder(change, myScope)) {
if (changeList != null) {
- LOG.debug("[processChangeInList-1] to add change to cl");
+ LOG.info("[processChangeInList-1] to add change to cl");
myChangeListWorker.addChangeToList(changeList.getName(), change, vcsKey);
} else {
- LOG.debug("[processChangeInList-1] to add to corresponding list");
+ LOG.info("[processChangeInList-1] to add to corresponding list");
myChangeListWorker.addChangeToCorrespondingList(change, vcsKey);
}
} else {
- LOG.debug("[processChangeInList-1] not under scope");
+ LOG.info("[processChangeInList-1] not under scope");
}
}
});
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java
index 88a13a480b15..345dd7a69631 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ProjectLevelVcsManagerEx.java
@@ -50,4 +50,4 @@ public abstract class ProjectLevelVcsManagerEx extends ProjectLevelVcsManager {
public abstract void fireDirectoryMappingsChanged();
public abstract String haveDefaultMapping();
-}
\ No newline at end of file
+}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
index ee3866ea4bd3..3ec1fd720d1b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
@@ -53,7 +53,6 @@ import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;
import com.intellij.util.ContentsUtil;
-import com.intellij.util.EventDispatcher;
import com.intellij.util.Icons;
import com.intellij.util.Processor;
import com.intellij.util.containers.Convertor;
@@ -105,6 +104,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
private final Map myBackgroundableActionHandlerMap;
private final List> myPendingOutput = new ArrayList>();
+ private VcsEventsListenerManagerImpl myVcsEventListenerManager;
public ProjectLevelVcsManagerImpl(Project project, final FileStatusManager manager, MessageBus messageBus) {
myProject = project;
@@ -118,6 +118,10 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
myInitialization = new VcsInitialization(myProject);
myMappings = new NewMappings(myProject, myMessageBus, this, manager);
myMappingsToRoots = new MappingsToRoots(myMappings, myProject);
+
+ if (! myProject.isDefault()) {
+ myVcsEventListenerManager = new VcsEventsListenerManagerImpl();
+ }
}
public void initComponent() {
@@ -660,6 +664,11 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
return new CompositeCheckoutListener(myProject);
}
+ @Override
+ public VcsEventsListenerManager getVcsEventsListenerManager() {
+ return myVcsEventListenerManager;
+ }
+
public void fireDirectoryMappingsChanged() {
if (myProject.isOpen() && (! myProject.isDisposed())) {
myMappings.mappingsChanged();
@@ -670,6 +679,11 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
return myMappings.haveDefaultMapping();
}
+ @Override
+ protected VcsEnvironmentsProxyCreator getProxyCreator() {
+ return myVcsEventListenerManager;
+ }
+
public BackgroundableActionEnabledHandler getBackgroundableActionHandler(final VcsBackgroundableActions action) {
ApplicationManager.getApplication().assertIsDispatchThread();
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEP.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEP.java
index e20cd188f0e5..3e7a18770404 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEP.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEP.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
+import com.intellij.openapi.vcs.VcsActiveEnvironmentsProxy;
import com.intellij.util.xmlb.annotations.Attribute;
/**
@@ -56,7 +57,7 @@ public class VcsEP extends AbstractExtensionPointBean {
return myVcs;
}
}
- myVcs = instantiate(vcsClass, project.getPicoContainer());
+ myVcs = VcsActiveEnvironmentsProxy.proxyVcs((AbstractVcs)instantiate(vcsClass, project.getPicoContainer()));
}
catch(Exception e) {
LOG.error(e);
@@ -69,4 +70,4 @@ public class VcsEP extends AbstractExtensionPointBean {
public VcsDescriptor createDescriptor() {
return new VcsDescriptor(administrativeAreaName, displayName, name);
}
-}
\ No newline at end of file
+}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEventsListenerManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEventsListenerManagerImpl.java
new file mode 100644
index 000000000000..b60861caa698
--- /dev/null
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsEventsListenerManagerImpl.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2000-2010 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.vcs.impl;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.vcs.VcsEventsListenerManager;
+import com.intellij.openapi.vcs.VcsKey;
+import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
+import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
+import com.intellij.openapi.vcs.update.UpdateEnvironment;
+import com.intellij.util.Consumer;
+import com.intellij.util.EventDispatcher;
+import org.jetbrains.annotations.Nullable;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author irengrig
+ * Date: 12/15/10
+ * Time: 5:50 PM
+ */
+public class VcsEventsListenerManagerImpl implements VcsEventsListenerManager, VcsEnvironmentsProxyCreator {
+ private final Wrapper myCheckinWrapper;
+ private final Wrapper myUpdateWrapper;
+ private final Wrapper myRollbackWrapper;
+
+ public VcsEventsListenerManagerImpl() {
+ myCheckinWrapper = new Wrapper(CheckinEnvironment.class);
+ myUpdateWrapper = new Wrapper(UpdateEnvironment.class);
+ myRollbackWrapper = new Wrapper(RollbackEnvironment.class);
+ }
+
+ @Override
+ public Object addCheckin(final Consumer>> consumer) {
+ return myCheckinWrapper.add(consumer);
+ }
+
+ @Override
+ public Object addUpdate(final Consumer>> consumer) {
+ return myUpdateWrapper.add(consumer);
+ }
+
+ @Override
+ public Object addRollback(final Consumer>> consumer) {
+ return myRollbackWrapper.add(consumer);
+ }
+
+ @Override
+ public void removeCheckin(Object key) {
+ myCheckinWrapper.remove(key);
+ }
+
+ @Override
+ public void removeUpdate(Object key) {
+ myUpdateWrapper.remove(key);
+ }
+
+ @Override
+ public void removeRollback(Object key) {
+ myRollbackWrapper.remove(key);
+ }
+
+ @Nullable
+ @Override
+ public CheckinEnvironment proxyCheckin(final VcsKey key, final CheckinEnvironment environment) {
+ return myCheckinWrapper.createProxy(key, environment);
+ }
+
+ @Nullable
+ @Override
+ public UpdateEnvironment proxyUpdate(final VcsKey key, final UpdateEnvironment environment) {
+ return myUpdateWrapper.createProxy(key, environment);
+ }
+
+ @Nullable
+ @Override
+ public RollbackEnvironment proxyRollback(final VcsKey key, final RollbackEnvironment environment) {
+ return myRollbackWrapper.createProxy(key, environment);
+ }
+
+ private static class Wrapper {
+ private final Map