myEventDispatcher = EventDispatcher.create(HeavyProcessListener.class);
private HeavyProcessLatch() {
@@ -43,13 +45,21 @@ public class HeavyProcessLatch {
processStarted("");
}
- public void processStarted(@NotNull String operationName) {
- myHeavyProcesses.push(operationName);
+ @NotNull
+ public AccessToken processStarted(@NotNull final String operationName) {
+ myHeavyProcesses.add(operationName);
myEventDispatcher.getMulticaster().processStarted();
+ return new AccessToken() {
+ @Override
+ public void finish() {
+ myHeavyProcesses.remove(operationName);
+ }
+ };
}
+ @Deprecated // use processStarted(String)
public void processFinished() {
- myHeavyProcesses.pop();
+ myHeavyProcesses.remove("");
myEventDispatcher.getMulticaster().processFinished();
}
@@ -59,7 +69,7 @@ public class HeavyProcessLatch {
public String getRunningOperationName() {
synchronized (myHeavyProcesses) {
- return myHeavyProcesses.isEmpty() ? null : myHeavyProcesses.peek();
+ return myHeavyProcesses.isEmpty() ? null : myHeavyProcesses.iterator().next();
}
}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java
index 67e04f2f5241..619c6c460603 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsApplicationSettings.java
@@ -19,7 +19,7 @@ import com.intellij.openapi.components.*;
import com.intellij.util.xmlb.XmlSerializerUtil;
/**
- * We don't use roaming type PER_PLATFORM — path macros is enough ($USER_HOME$/Dropbox for example)
+ * We don't use roaming type PER_PLATFORM - path macros is enough ($USER_HOME$/Dropbox for example)
*/
@State(
name = "VcsApplicationSettings",
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CompareWithSelectedRevisionAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CompareWithSelectedRevisionAction.java
index 2fb5b60e0d39..a4acd1d4864b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CompareWithSelectedRevisionAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CompareWithSelectedRevisionAction.java
@@ -28,10 +28,7 @@ import com.intellij.openapi.vcs.diff.DiffProvider;
import com.intellij.openapi.vcs.history.*;
import com.intellij.openapi.vcs.impl.VcsBackgroundableActions;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.ui.IdeBorderFactory;
-import com.intellij.ui.ScrollPaneFactory;
-import com.intellij.ui.SpeedSearchBase;
-import com.intellij.ui.TableUtil;
+import com.intellij.ui.*;
import com.intellij.ui.dualView.TreeTableView;
import com.intellij.ui.table.TableView;
import com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns;
@@ -322,10 +319,12 @@ public class CompareWithSelectedRevisionAction extends AbstractVcsAction {
JPanel jPanel = new JPanel(new BorderLayout());
final JScrollPane textScrollPane = ScrollPaneFactory.createScrollPane(textArea);
- textScrollPane.setBorder(IdeBorderFactory.createTitledBorder(VcsBundle.message("border.selected.revision.commit.message"), false
- ));
- jPanel.add(textScrollPane, BorderLayout.SOUTH);
-
+ // text on title border has some problems if text font size is bigger than expected.
+ final JLabel commentLabel = new JLabel(VcsBundle.message("border.selected.revision.commit.message"));
+ jPanel.add(commentLabel, BorderLayout.NORTH);
+ commentLabel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.LEFT | SideBorder.BOTTOM));
+ textScrollPane.setBorder(null);
+ jPanel.add(textScrollPane, BorderLayout.CENTER);
jPanel.setPreferredSize(new Dimension(300, 100));
return jPanel;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderEx.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderEx.java
new file mode 100644
index 000000000000..093cbf45185c
--- /dev/null
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderEx.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2009 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.history;
+
+import com.intellij.openapi.vcs.CalledInBackground;
+import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.vcs.VcsException;
+import org.jetbrains.annotations.Nullable;
+
+public interface VcsHistoryProviderEx extends VcsHistoryProvider {
+ @Nullable
+ @CalledInBackground
+ VcsFileRevision getLastRevision(FilePath filePath) throws VcsException;
+}
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 45f550271825..6886dd5098d8 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
@@ -16,6 +16,7 @@
package com.intellij.openapi.vcs.impl;
import com.intellij.icons.AllIcons;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ProjectComponent;
@@ -33,6 +34,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectEx;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.startup.StartupManager;
+import com.intellij.openapi.ui.SimpleToolWindowPanel;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
@@ -57,6 +59,7 @@ import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
+import com.intellij.openapi.wm.ex.ToolWindowEx;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;
@@ -238,6 +241,9 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true);
myContentManager = toolWindow.getContentManager();
toolWindow.setIcon(AllIcons.Toolwindows.VcsSmallTab);
+ DefaultActionGroup gearActions = new DefaultActionGroup();
+ gearActions.addAction(SimpleToolWindowPanel.createToggleToolbarAction(myProject, toolWindow)).setAsSecondary(true);
+ ((ToolWindowEx)toolWindow).setAdditionalGearActions(gearActions);
toolWindow.installWatcher(myContentManager);
}
else {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
index 855abaaad74e..0d2fcb000d22 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -123,7 +123,7 @@ public class XLineBreakpointImpl extends XBreak
if (markupModel == null) {
markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), false);
if (markupModel != null) {
- // renderersChanged false — we don't change gutter size
+ // renderersChanged false - we don't change gutter size
markupModel.fireAttributesChanged(highlighter, false);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
index 6804679e7da3..58aa30fe2d84 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
@@ -66,6 +66,7 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor {
if (myOldNode != null && index != -1) {
myWatchesView.addWatchExpression(myOldNode.getExpression(), index, false);
}
+ getTree().setSelectionRow(index);
}
@Override
@@ -77,6 +78,7 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor {
if (!XDebuggerUtilImpl.isEmptyExpression(expression) && index != -1) {
myWatchesView.addWatchExpression(expression, index, false);
}
+ getTree().setSelectionRow(index);
}
@Override
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java
index 2e4e168b8d84..1421426809c5 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java
@@ -106,6 +106,7 @@ public class WatchesRootNode extends XDebuggerTreeNode {
}
private void replaceNode(final WatchNode oldNode, final WatchNode newNode) {
+ int[] selectedRows = getTree().getSelectionRows();
for (int i = 0; i < myChildren.size(); i++) {
WatchNode child = myChildren.get(i);
if (child == oldNode) {
@@ -118,6 +119,7 @@ public class WatchesRootNode extends XDebuggerTreeNode {
else {
fireNodeStructureChanged(newNode);
}
+ getTree().setSelectionRows(selectedRows);
return;
}
}
diff --git a/plugins/devkit/src/references/extensions/ExtensionPointDocumentationProvider.java b/plugins/devkit/src/references/extensions/ExtensionPointDocumentationProvider.java
index 2ce1c27e6e38..3ac1702a1567 100644
--- a/plugins/devkit/src/references/extensions/ExtensionPointDocumentationProvider.java
+++ b/plugins/devkit/src/references/extensions/ExtensionPointDocumentationProvider.java
@@ -61,7 +61,7 @@ public class ExtensionPointDocumentationProvider extends DocumentationProviderEx
(epPrefix == null ? "" : " " + epPrefix) +
"
" +
"" + extensionPoint.getEffectiveName() + "" +
- " [" + epDeclarationFile.getName() + "]
" +
+ " (" + epDeclarationFile.getName() + ")
" +
epClassText.toString();
}
diff --git a/plugins/devkit/testSources/references/extensions/ExtensionPointDocumentationProviderTest.java b/plugins/devkit/testSources/references/extensions/ExtensionPointDocumentationProviderTest.java
index a9c16ec0335a..94214e5b6e50 100644
--- a/plugins/devkit/testSources/references/extensions/ExtensionPointDocumentationProviderTest.java
+++ b/plugins/devkit/testSources/references/extensions/ExtensionPointDocumentationProviderTest.java
@@ -21,8 +21,7 @@ public class ExtensionPointDocumentationProviderTest extends LightCodeInsightFix
DocumentationProvider provider = DocumentationManager.getProviderFromElement(docElement);
String epDefinition = "[" + myModule.getName() + "] foo
" +
- "bar " +
- "[extensionPointDocumentation.xml]
" +
+ "bar (extensionPointDocumentation.xml)
" +
"MyExtensionPoint";
assertEquals(epDefinition,
diff --git a/plugins/git4idea/src/git4idea/actions/GitMergeAction.java b/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
index c2e172525307..6a730eac7e83 100644
--- a/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
+++ b/plugins/git4idea/src/git4idea/actions/GitMergeAction.java
@@ -18,6 +18,7 @@ package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.history.Label;
import com.intellij.history.LocalHistory;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
@@ -86,7 +87,7 @@ abstract class GitMergeAction extends GitRepositoryAction {
final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
new GitUntrackedFilesOverwrittenByOperationDetector(selectedRoot);
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitCommandResult result = git.runCommand(new Computable() {
@Override
@@ -109,7 +110,7 @@ abstract class GitMergeAction extends GitRepositoryAction {
handleResult(result, project, localChangesDetector, untrackedFilesDetector, repository, currentRev, affectedRoots, beforeLabel);
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java b/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
index 3edd559a8e51..b36055c118ab 100644
--- a/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
+++ b/plugins/git4idea/src/git4idea/actions/GitRebaseAbort.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.VcsException;
@@ -75,12 +76,12 @@ public class GitRebaseAbort extends GitRepositoryAction {
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.REBASE);
h.setStdoutSuppressed(false);
h.addParameters("--abort");
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, getActionName(), h.printableCommandLine());
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
diff --git a/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java b/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
index 95246459fc1d..19de14769081 100644
--- a/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
+++ b/plugins/git4idea/src/git4idea/actions/GitRebaseActionBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.VcsException;
@@ -65,7 +66,7 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
task.executeInBackground(false, new GitTaskResultHandlerAdapter() {
@Override
protected void run(GitTaskResult taskResult) {
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
editor.close();
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
@@ -74,7 +75,7 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
notifyAboutErrorResult(taskResult, resultListener, exceptions, project);
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
});
diff --git a/plugins/git4idea/src/git4idea/actions/GitResetHead.java b/plugins/git4idea/src/git4idea/actions/GitResetHead.java
index 0aa7180fba92..3a739d0e473f 100644
--- a/plugins/git4idea/src/git4idea/actions/GitResetHead.java
+++ b/plugins/git4idea/src/git4idea/actions/GitResetHead.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
@@ -57,12 +58,12 @@ public class GitResetHead extends GitRepositoryAction {
}
GitLineHandler h = d.handler();
affectedRoots.add(d.getGitRoot());
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
manager.updateRepository(d.getGitRoot());
diff --git a/plugins/git4idea/src/git4idea/actions/GitStash.java b/plugins/git4idea/src/git4idea/actions/GitStash.java
index 20fd525929ea..b5a4892a30fd 100644
--- a/plugins/git4idea/src/git4idea/actions/GitStash.java
+++ b/plugins/git4idea/src/git4idea/actions/GitStash.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.actions;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
@@ -54,12 +55,12 @@ public class GitStash extends GitRepositoryAction {
VirtualFile root = d.getGitRoot();
affectedRoots.add(root);
final GitLineHandler h = d.handler();
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
}
diff --git a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
index 5e0a10c039ee..8327a614725c 100644
--- a/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitCheckoutOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.branch;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
@@ -65,7 +66,7 @@ class GitCheckoutOperation extends GitBranchOperation {
protected void execute() {
saveAllDocuments();
boolean fatalErrorHappened = false;
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
while (hasMoreRepositories() && !fatalErrorHappened) {
final GitRepository repository = next();
@@ -104,7 +105,7 @@ class GitCheckoutOperation extends GitBranchOperation {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
if (!fatalErrorHappened) {
diff --git a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
index db92107629cf..5a0d6a031f98 100644
--- a/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitMergeOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package git4idea.branch;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
@@ -73,7 +74,7 @@ class GitMergeOperation extends GitBranchOperation {
saveAllDocuments();
boolean fatalErrorHappened = false;
int alreadyUpToDateRepositories = 0;
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
while (hasMoreRepositories() && !fatalErrorHappened) {
final GitRepository repository = next();
@@ -147,7 +148,7 @@ class GitMergeOperation extends GitBranchOperation {
restoreLocalChanges();
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
}
diff --git a/plugins/git4idea/src/git4idea/changes/GitCommittedChangeListProvider.java b/plugins/git4idea/src/git4idea/changes/GitCommittedChangeListProvider.java
index 31e731f44937..f34279bdf6dd 100644
--- a/plugins/git4idea/src/git4idea/changes/GitCommittedChangeListProvider.java
+++ b/plugins/git4idea/src/git4idea/changes/GitCommittedChangeListProvider.java
@@ -207,7 +207,7 @@ public class GitCommittedChangeListProvider implements CommittedChangesProvider<
}
}
final String afterTime = "--after=" + GitUtil.gitTime(gitCommit.getDate());
- final List history = GitHistoryUtils.history(myProject, filePath, null, afterTime);
+ final List history = GitHistoryUtils.history(myProject, filePath, (VirtualFile)null, afterTime);
if (history.isEmpty()) {
return new Pair(commit, filePath);
}
diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
index 4e3c3183cf16..77196722f24a 100644
--- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
+++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPicker.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package git4idea.cherrypick;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
@@ -90,7 +91,7 @@ public class GitCherryPicker {
public void cherryPick(@NotNull Map> commitsInRoots) {
List successfulCommits = ContainerUtil.newArrayList();
List alreadyPicked = ContainerUtil.newArrayList();
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
for (Map.Entry> entry : commitsInRoots.entrySet()) {
GitRepository repository = entry.getKey();
@@ -103,7 +104,7 @@ public class GitCherryPicker {
notifyResult(successfulCommits, alreadyPicked);
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
}
diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryProvider.java b/plugins/git4idea/src/git4idea/history/GitHistoryProvider.java
index 7550f804fb21..0d4942f2add2 100644
--- a/plugins/git4idea/src/git4idea/history/GitHistoryProvider.java
+++ b/plugins/git4idea/src/git4idea/history/GitHistoryProvider.java
@@ -52,7 +52,7 @@ import java.util.List;
/**
* Git history provider implementation
*/
-public class GitHistoryProvider implements VcsHistoryProvider, VcsCacheableHistorySessionFactory,
+public class GitHistoryProvider implements VcsHistoryProviderEx, VcsCacheableHistorySessionFactory,
VcsBaseRevisionAdviser {
private static final Logger log = Logger.getInstance(GitHistoryProvider.class.getName());
@@ -139,6 +139,14 @@ public class GitHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto
};
}
+ @Nullable
+ @Override
+ public VcsFileRevision getLastRevision(FilePath filePath) throws VcsException {
+ List history = GitHistoryUtils.history(myProject, filePath, "--max-count=1");
+ if (history == null || history.isEmpty()) return null;
+ return history.get(0);
+ }
+
@Override
public boolean getBaseVersionContent(FilePath filePath,
Processor processor,
diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
index 1337735820ac..1c310492059d 100644
--- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
+++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
@@ -650,9 +650,9 @@ public class GitHistoryUtils {
* @return the list of the revisions
* @throws VcsException if there is problem with running git
*/
- public static List history(final Project project, final FilePath path) throws VcsException {
+ public static List history(final Project project, final FilePath path, String... parameters) throws VcsException {
final VirtualFile root = GitUtil.getGitRoot(path);
- return history(project, path, root);
+ return history(project, path, root, parameters);
}
/**
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
index d44988c48aac..75e28742b965 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.rebase;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -91,8 +92,8 @@ public class GitRebaser {
rebaseTask.setProgressAnalyzer(new GitStandardProgressAnalyzer());
final AtomicReference updateResult = new AtomicReference();
final AtomicBoolean failure = new AtomicBoolean();
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
- DvcsUtil.workingTreeChangeStarted(myProject);
rebaseTask.executeInBackground(true, new GitTaskResultHandlerAdapter() {
@Override
protected void onSuccess() {
@@ -118,7 +119,7 @@ public class GitRebaser {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
return updateResult.get();
}
@@ -146,7 +147,7 @@ public class GitRebaser {
* @return true if rebase successfully finished.
*/
public boolean continueRebase(@NotNull Collection rebasingRoots) {
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
boolean success = true;
for (VirtualFile root : rebasingRoots) {
@@ -155,7 +156,7 @@ public class GitRebaser {
return success;
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
}
diff --git a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
index 528a9e1277f3..802137737c89 100644
--- a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
+++ b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java
@@ -17,6 +17,7 @@ package git4idea.reset;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.dvcs.repo.RepositoryUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -76,7 +77,7 @@ public class GitResetOperation {
public void execute() {
saveAllDocuments();
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
Map results = ContainerUtil.newHashMap();
try {
for (Map.Entry entry : myCommits.entrySet()) {
@@ -99,7 +100,7 @@ public class GitResetOperation {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
notifyResult(results);
}
diff --git a/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java b/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
index 87b256db62d6..ea4570ce30e9 100644
--- a/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
+++ b/plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package git4idea.rollback;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.lifecycle.PeriodicalTasksCloser;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
@@ -142,7 +143,7 @@ public class GitRollbackEnvironment implements RollbackEnvironment {
}
}
// revert files from HEAD
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
for (Map.Entry> entry : toRevert.entrySet()) {
listener.accept(entry.getValue());
@@ -155,7 +156,7 @@ public class GitRollbackEnvironment implements RollbackEnvironment {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject,token);
}
LocalFileSystem lfs = LocalFileSystem.getInstance();
HashSet filesToRefresh = new HashSet();
diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
index 18f1f5ea6d5a..93278d15ee21 100644
--- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
+++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -20,6 +20,7 @@ import com.intellij.dvcs.DvcsUtil;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ServiceManager;
@@ -357,7 +358,7 @@ public class GitUnstashDialog extends DialogWrapper {
h.addLineListener(untrackedFilesDetector);
h.addLineListener(localChangesDetector);
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
final Ref result = Ref.create();
ProgressManager.getInstance().run(new Task.Modal(h.project(), GitBundle.getString("unstash.unstashing"), false) {
@@ -384,7 +385,7 @@ public class GitUnstashDialog extends DialogWrapper {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
super.doOKAction();
}
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
index c7423b2a2112..636ad2c920c2 100644
--- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
+++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package git4idea.update;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.EmptyProgressIndicator;
@@ -133,12 +134,12 @@ public class GitUpdateProcess {
GitComplexProcess.Operation updateOperation = new GitComplexProcess.Operation() {
@Override public void run(ContinuationContext continuationContext) {
- DvcsUtil.workingTreeChangeStarted(myProject);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
myResult = updateImpl(updateMethod, continuationContext);
}
finally {
- DvcsUtil.workingTreeChangeFinished(myProject);
+ DvcsUtil.workingTreeChangeFinished(myProject, token);
}
}
};
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
index 7b7bfabf73c8..3efd666d3ed7 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.github;
import com.intellij.dvcs.DvcsUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -229,18 +230,22 @@ public class GithubRebaseAction extends DumbAwareAction {
@NotNull final ProgressIndicator indicator) {
final Git git = ServiceManager.getService(project, Git.class);
final GitPlatformFacade facade = ServiceManager.getService(project, GitPlatformFacade.class);
- DvcsUtil.workingTreeChangeStarted(project);
- GitPreservingProcess process =
- new GitPreservingProcess(project, facade, git, Collections.singletonList(gitRepository), "Rebasing", "upstream/master", indicator,
- new Runnable() {
- @Override
- public void run() {
- doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
+ try {
+ GitPreservingProcess process =
+ new GitPreservingProcess(project, facade, git, Collections.singletonList(gitRepository), "Rebasing", "upstream/master", indicator,
+ new Runnable() {
+ @Override
+ public void run() {
+ doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
+ }
}
- }
- );
- process.execute();
- DvcsUtil.workingTreeChangeFinished(project);
+ );
+ process.execute();
+ }
+ finally {
+ DvcsUtil.workingTreeChangeFinished(project, token);
+ }
}
private static void doRebaseCurrentBranch(@NotNull final Project project,
diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
index c9b213db4358..47e090f94c14 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
@@ -18,7 +18,6 @@ package org.jetbrains.plugins.github.ui;
import com.intellij.CommonBundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
@@ -151,8 +150,13 @@ public class GithubCreatePullRequestDialog extends DialogWrapper {
});
myPanel.setForks(myWorker.getForks());
- myPanel.setSelectedFork(myProjectSettings.getCreatePullRequestDefaultRepo());
- myPanel.setSelectedBranch(myProjectSettings.getCreatePullRequestDefaultBranch());
+
+ GithubFullPath defaultRepo = myProjectSettings.getCreatePullRequestDefaultRepo();
+ String defaultBranch = myProjectSettings.getCreatePullRequestDefaultBranch();
+ myPanel.setSelectedFork(defaultRepo);
+ if (defaultBranch != null) { // do not rewrite default value of Fork.getDefaultBranch() by null
+ myPanel.setSelectedBranch(defaultBranch);
+ }
setTitle("Create Pull Request - " + myWorker.getCurrentBranch());
init();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java
index dbbc4333a02d..74972e6165e1 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java
@@ -77,11 +77,11 @@ public class GroovyPositionManager implements PositionManager {
List locations = getDebugProcess().getVirtualMachineProxy().versionHigher("1.4")
? type.locationsOfLine(DebugProcess.JAVA_STRATUM, null, line)
: type.locationsOfLine(line);
- if (locations == null || locations.isEmpty()) throw new NoDataException();
+ if (locations == null || locations.isEmpty()) throw NoDataException.INSTANCE;
return locations;
}
catch (AbsentInformationException e) {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
}
@@ -112,7 +112,7 @@ public class GroovyPositionManager implements PositionManager {
private static void checkGroovyFile(@NotNull SourcePosition position) throws NoDataException {
if (!(position.getFile() instanceof GroovyFileBase)) {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
}
@@ -127,7 +127,7 @@ public class GroovyPositionManager implements PositionManager {
qName = findEnclosingName(position);
- if (qName == null) throw new NoDataException();
+ if (qName == null) throw NoDataException.INSTANCE;
ClassPrepareRequestor waitRequestor = new ClassPrepareRequestor() {
@Override
public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) {
@@ -205,13 +205,13 @@ public class GroovyPositionManager implements PositionManager {
@Override
public SourcePosition getSourcePosition(final Location location) throws NoDataException {
- if (location == null) throw new NoDataException();
+ if (location == null) throw NoDataException.INSTANCE;
PsiFile psiFile = getPsiFileByLocation(getDebugProcess().getProject(), location);
- if (psiFile == null) throw new NoDataException();
+ if (psiFile == null) throw NoDataException.INSTANCE;
int lineNumber = calcLineIndex(location);
- if (lineNumber < 0) throw new NoDataException();
+ if (lineNumber < 0) throw NoDataException.INSTANCE;
return SourcePosition.createFromLine(psiFile, lineNumber);
}
@@ -323,7 +323,7 @@ public class GroovyPositionManager implements PositionManager {
}
});
- if (result == null) throw new NoDataException();
+ if (result == null) throw NoDataException.INSTANCE;
return result;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/springloaded/SpringLoadedPositionManager.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/springloaded/SpringLoadedPositionManager.java
index 6adf50e75094..378c15695fd9 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/springloaded/SpringLoadedPositionManager.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/springloaded/SpringLoadedPositionManager.java
@@ -62,7 +62,7 @@ public class SpringLoadedPositionManager implements PositionManager {
@Override
public SourcePosition getSourcePosition(@Nullable Location location) throws NoDataException {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
@NotNull
@@ -74,7 +74,7 @@ public class SpringLoadedPositionManager implements PositionManager {
AccessToken accessToken = ReadAction.start();
try {
className = findEnclosingName(classPosition);
- if (className == null) throw new NoDataException();
+ if (className == null) throw NoDataException.INSTANCE;
line = classPosition.getLine();
}
@@ -83,7 +83,7 @@ public class SpringLoadedPositionManager implements PositionManager {
}
List referenceTypes = myDebugProcess.getVirtualMachineProxy().classesByName(className);
- if (referenceTypes.isEmpty()) throw new NoDataException();
+ if (referenceTypes.isEmpty()) throw NoDataException.INSTANCE;
Set res = new HashSet();
@@ -92,7 +92,7 @@ public class SpringLoadedPositionManager implements PositionManager {
}
if (res.isEmpty()) {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
return new ArrayList(res);
@@ -101,7 +101,7 @@ public class SpringLoadedPositionManager implements PositionManager {
@NotNull
@Override
public List locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) throws NoDataException {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
@Nullable
@@ -164,7 +164,7 @@ public class SpringLoadedPositionManager implements PositionManager {
public ClassPrepareRequest createPrepareRequest(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) throws NoDataException {
String className = getOuterClassName(position);
if (className == null) {
- throw new NoDataException();
+ throw NoDataException.INSTANCE;
}
return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, className + "*");
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgMergeCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgMergeCommand.java
index 16c8b7fe0a8b..0a428a9d759e 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgMergeCommand.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgMergeCommand.java
@@ -13,6 +13,7 @@
package org.zmlx.hg4idea.command;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -50,7 +51,7 @@ public class HgMergeCommand {
arguments.add("--rev");
arguments.add(revision);
}
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
final HgCommandResult result =
commandExecutor.executeInCurrentThread(repo, "merge", arguments);
@@ -58,7 +59,7 @@ public class HgMergeCommand {
return result;
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRebaseCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRebaseCommand.java
index 05a5ebda6d7a..25d174cfcaf0 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRebaseCommand.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRebaseCommand.java
@@ -13,6 +13,7 @@
package org.zmlx.hg4idea.command;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
@@ -50,7 +51,7 @@ public class HgRebaseCommand {
@Nullable
private HgCommandResult performRebase(@NotNull String... args) {
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
HgCommandResult result =
new HgCommandExecutor(project)
@@ -60,7 +61,7 @@ public class HgRebaseCommand {
return result;
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java
index 0be4e1602b1e..4e8c06a680dd 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgUpdateCommand.java
@@ -13,6 +13,7 @@
package org.zmlx.hg4idea.command;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
@@ -75,7 +76,7 @@ public class HgUpdateCommand {
final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
executor.setShowOutput(true);
HgCommandResult result;
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
result =
executor.executeInCurrentThread(repo, "update", arguments);
@@ -89,7 +90,7 @@ public class HgUpdateCommand {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
project.getMessageBus().syncPublisher(HgVcs.BRANCH_TOPIC).update(project, null);
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgRollbackEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgRollbackEnvironment.java
index 958bac8ef515..3b536c2fecb7 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgRollbackEnvironment.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgRollbackEnvironment.java
@@ -13,6 +13,7 @@
package org.zmlx.hg4idea.provider;
import com.intellij.dvcs.DvcsUtil;
+import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.FilePath;
@@ -71,7 +72,7 @@ public class HgRollbackEnvironment implements RollbackEnvironment {
}
}
}
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
revert(filePaths);
for (FilePath file : toDelete) {
@@ -92,18 +93,18 @@ public class HgRollbackEnvironment implements RollbackEnvironment {
}
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
public void rollbackMissingFileDeletion(List files,
List exceptions, RollbackProgressListener listener) {
- DvcsUtil.workingTreeChangeStarted(project);
+ AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
revert(files);
}
finally {
- DvcsUtil.workingTreeChangeFinished(project);
+ DvcsUtil.workingTreeChangeFinished(project, token);
}
}
diff --git a/plugins/junit/src/com/intellij/execution/junit/TestObject.java b/plugins/junit/src/com/intellij/execution/junit/TestObject.java
index eb9de875c346..896a1aa24020 100644
--- a/plugins/junit/src/com/intellij/execution/junit/TestObject.java
+++ b/plugins/junit/src/com/intellij/execution/junit/TestObject.java
@@ -48,7 +48,9 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkType;
+import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
import com.intellij.openapi.roots.ModuleRootManager;
@@ -60,9 +62,13 @@ import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.GlobalSearchScopesCore;
import com.intellij.refactoring.listeners.RefactoringElementListener;
+import com.intellij.rt.execution.CommandLineWrapper;
import com.intellij.rt.execution.junit.IDEAJUnitListener;
import com.intellij.rt.execution.junit.JUnitStarter;
import com.intellij.util.Function;
@@ -422,7 +428,29 @@ public abstract class TestObject implements JavaCommandLine {
final String workingDirectory = myConfiguration.getWorkingDirectory();
return JUnitConfiguration.TEST_PACKAGE.equals(myConfiguration.getPersistentData().TEST_OBJECT) &&
myConfiguration.getPersistentData().getScope() != TestSearchScope.SINGLE_MODULE &&
- ("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$").equals(workingDirectory);
+ ("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$").equals(workingDirectory) &&
+ spansMultipleModules();
+ }
+
+ private boolean spansMultipleModules() {
+ final String qualifiedName = myConfiguration.getPackage();
+ if (qualifiedName != null) {
+ final Project project = myConfiguration.getProject();
+ final PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(qualifiedName);
+ if (aPackage != null) {
+ final TestSearchScope scope = myConfiguration.getPersistentData().getScope();
+ if (scope != null) {
+ final SourceScope sourceScope = scope.getSourceScope(myConfiguration);
+ if (sourceScope != null) {
+ final GlobalSearchScope configurationSearchScope = GlobalSearchScopesCore.projectTestScope(project).intersectWith(
+ sourceScope.getGlobalSearchScope());
+ final PsiDirectory[] directories = aPackage.getDirectories(configurationSearchScope);
+ return directories.length > 1;
+ }
+ }
+ }
+ }
+ return false;
}
private void appendForkInfo(Executor executor) throws ExecutionException {
@@ -452,12 +480,22 @@ public abstract class TestObject implements JavaCommandLine {
final File tempFile = FileUtil.createTempFile("command.line", "", true);
final PrintWriter writer = new PrintWriter(tempFile, CharsetToolkit.UTF8);
try {
+ if (JdkUtil.useDynamicClasspath(myConfiguration.getProject())) {
+ String classpath = PathUtil.getJarPathForClass(CommandLineWrapper.class);
+ final String utilRtPath = PathUtil.getJarPathForClass(StringUtilRt.class);
+ if (!classpath.equals(utilRtPath)) {
+ classpath += File.pathSeparator + utilRtPath;
+ }
+ writer.println(classpath);
+ }
+ else {
+ writer.println("");
+ }
+
writer.println(((JavaSdkType)jdk.getSdkType()).getVMExecutablePath(jdk));
for (String vmParameter : javaParameters.getVMParametersList().getList()) {
writer.println(vmParameter);
}
- writer.println("-classpath");
- writer.println(javaParameters.getClassPath().getPathsString());
}
finally {
writer.close();
@@ -524,6 +562,9 @@ public abstract class TestObject implements JavaCommandLine {
JUnitStarter.printClassesList(testNames, packageName, category, myTempFile);
if (perModule != null && perModule.size() > 1) {
+ final String classpath = myConfiguration.getPersistentData().getScope() == TestSearchScope.WHOLE_PROJECT
+ ? null : myJavaParameters.getClassPath().getPathsString();
+
final PrintWriter wWriter = new PrintWriter(myWorkingDirsFile, CharsetToolkit.UTF8);
try {
wWriter.println(packageName);
@@ -531,11 +572,16 @@ public abstract class TestObject implements JavaCommandLine {
final String moduleDir = PathMacroUtil.getModuleDir(module.getModuleFilePath());
wWriter.println(moduleDir);
- final JavaParameters parameters = new JavaParameters();
- JavaParametersUtil.configureModule(module, parameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS,
- myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null);
- configureAdditionalClasspath(parameters);
- wWriter.println(parameters.getClassPath().getPathsString());
+ if (classpath == null) {
+ final JavaParameters parameters = new JavaParameters();
+ configureAdditionalClasspath(parameters);
+ JavaParametersUtil.configureModule(module, parameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS,
+ myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null);
+ wWriter.println(parameters.getClassPath().getPathsString());
+ } else {
+ wWriter.println(classpath);
+ }
+
final List classNames = perModule.get(module);
wWriter.println(classNames.size());
for (String className : classNames) {
diff --git a/plugins/junit_rt/src/com/intellij/rt/execution/junit/JUnitForkedStarter.java b/plugins/junit_rt/src/com/intellij/rt/execution/junit/JUnitForkedStarter.java
index e79ab8e677b3..6b58cd009b87 100644
--- a/plugins/junit_rt/src/com/intellij/rt/execution/junit/JUnitForkedStarter.java
+++ b/plugins/junit_rt/src/com/intellij/rt/execution/junit/JUnitForkedStarter.java
@@ -15,6 +15,7 @@
*/
package com.intellij.rt.execution.junit;
+import com.intellij.rt.execution.CommandLineWrapper;
import com.intellij.rt.execution.junit.segments.SegmentedOutputStream;
import java.io.*;
@@ -76,6 +77,7 @@ public class JUnitForkedStarter {
String path) throws Exception {
final List parameters = new ArrayList();
final BufferedReader bufferedReader = new BufferedReader(new FileReader(path));
+ final String dynamicClasspath = bufferedReader.readLine();
try {
String line;
while ((line = bufferedReader.readLine()) != null) {
@@ -99,7 +101,7 @@ public class JUnitForkedStarter {
if (workingDirsPath == null || new File(workingDirsPath).length() == 0) {
final List children = testRunner.getChildTests(description);
final boolean forkTillMethod = forkMode.equalsIgnoreCase("method");
- result = processChildren(isJUnit4, listeners, out, err, parameters, testRunner, children, 0, forkTillMethod, null, System.getProperty("java.class.path"));
+ result = processChildren(isJUnit4, listeners, out, err, parameters, testRunner, children, 0, forkTillMethod, null, System.getProperty("java.class.path"), dynamicClasspath);
} else {
final BufferedReader perDirReader = new BufferedReader(new FileReader(workingDirsPath));
try {
@@ -129,7 +131,7 @@ public class JUnitForkedStarter {
JUnitStarter.printClassesList(classNames, packageName + ", working directory: \'" + workingDir + "\'", "", tempFile);
childResult =
runChild(isJUnit4, listeners, out, err, parameters, "@" + tempFile.getAbsolutePath(), dir,
- String.valueOf(testRunner.getRegistry().getKnownObject(rootDescriptor) - 1), classpath);
+ String.valueOf(testRunner.getRegistry().getKnownObject(rootDescriptor) - 1), classpath, dynamicClasspath);
} else {
final List children = new ArrayList(testRunner.getChildTests(description));
for (Iterator iterator = children.iterator(); iterator.hasNext(); ) {
@@ -138,7 +140,7 @@ public class JUnitForkedStarter {
}
}
final boolean forkTillMethod = forkMode.equalsIgnoreCase("method");
- childResult = processChildren(isJUnit4, listeners, out, err, parameters, testRunner, children, result, forkTillMethod, dir, classpath);
+ childResult = processChildren(isJUnit4, listeners, out, err, parameters, testRunner, children, result, forkTillMethod, dir, classpath, dynamicClasspath);
}
result = Math.min(childResult, result);
}
@@ -180,7 +182,7 @@ public class JUnitForkedStarter {
IdeaTestRunner testRunner,
List children,
int result,
- boolean forkTillMethod, File workingDir, String classpath) throws IOException, InterruptedException {
+ boolean forkTillMethod, File workingDir, String classpath, String dynamicClasspath) throws IOException, InterruptedException {
for (int i = 0, argsLength = children.size(); i < argsLength; i++) {
final Object child = children.get(i);
final List childTests = testRunner.getChildTests(child);
@@ -188,11 +190,11 @@ public class JUnitForkedStarter {
if (childTests.isEmpty() || !forkTillMethod) {
final int startIndex = testRunner.getRegistry().getKnownObject(child);
childResult =
- runChild(isJUnit4, listeners, out, err, parameters, testRunner.getStartDescription(child), workingDir, String.valueOf(startIndex), classpath);
+ runChild(isJUnit4, listeners, out, err, parameters, testRunner.getStartDescription(child), workingDir, String.valueOf(startIndex), classpath, dynamicClasspath);
}
else {
childResult =
- processChildren(isJUnit4, listeners, out, err, parameters, testRunner, childTests, result, forkTillMethod, workingDir, classpath);
+ processChildren(isJUnit4, listeners, out, err, parameters, testRunner, childTests, result, forkTillMethod, workingDir, classpath, dynamicClasspath);
}
result = Math.min(childResult, result);
}
@@ -207,7 +209,8 @@ public class JUnitForkedStarter {
String description,
File workingDir,
String startIndex,
- String classpath) throws IOException, InterruptedException {
+ String classpath,
+ String dynamicClasspath) throws IOException, InterruptedException {
//noinspection SSBasedInspection
final File tempFile = File.createTempFile("fork", "test");
final String testOutputPath = tempFile.getAbsolutePath();
@@ -215,7 +218,39 @@ public class JUnitForkedStarter {
final ProcessBuilder builder = new ProcessBuilder();
builder.add(parameters);
builder.add("-classpath");
- builder.add(classpath);
+ if (dynamicClasspath.length() > 0) {
+ try {
+ final File classpathFile = File.createTempFile("classpath", null);
+ classpathFile.deleteOnExit();
+ final PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(classpathFile), "UTF-8"));
+ try {
+ int idx = 0;
+ while (idx < classpath.length()) {
+ final int endIdx = classpath.indexOf(File.pathSeparator, idx);
+ if (endIdx < 0) {
+ writer.println(classpath.substring(idx));
+ break;
+ }
+ writer.println(classpath.substring(idx, endIdx));
+ idx = endIdx + File.pathSeparator.length();
+ }
+ }
+ finally {
+ writer.close();
+ }
+
+ builder.add(dynamicClasspath);
+ builder.add(CommandLineWrapper.class.getName());
+ builder.add(classpathFile.getAbsolutePath());
+ }
+ catch (Throwable e) {
+ builder.add(classpath);
+ }
+ }
+ else {
+ builder.add(classpath);
+ }
+
builder.add(JUnitForkedStarter.class.getName());
builder.add(testOutputPath);
builder.add(startIndex);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java
index 5cf6d6db4389..72a1539efcf4 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnApplicationSettings.java
@@ -18,7 +18,6 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
@@ -44,7 +43,6 @@ public class SvnApplicationSettings implements PersistentStateComponent myCheckoutURLs = new ArrayList();
public List myTypedURLs = new ArrayList();
public String mySvnCommandLine = "svn";
- public String myExecutableLocale = SvnConfigurable.EN_US_LOCALE;
}
private ConfigurationBean myConfigurationBean;
@@ -67,24 +65,15 @@ public class SvnApplicationSettings implements PersistentStateComponentEmulates the behavior when Subversion commands are executed directly from the terminal (in the interactive mode).
\
This is required to handle password/passphrase prompts for svn+ssh repositories, and trust invalid server certificates for https repositories.