IDEA-51844 (CVS: provide some message if Import fails since user has no write access to selected repository)

This commit is contained in:
irengrig
2010-01-29 17:47:17 +03:00
parent 0d79a8f7fd
commit 325e8894df
2 changed files with 22 additions and 5 deletions
@@ -15,9 +15,8 @@
*/
package com.intellij.cvsSupport2.actions;
import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.actions.cvsContext.CvsContext;
import com.intellij.openapi.vcs.actions.VcsContext;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.cvsSupport2.config.ImportConfiguration;
import com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler;
import com.intellij.cvsSupport2.cvshandlers.CvsHandler;
@@ -26,8 +25,9 @@ import com.intellij.cvsSupport2.ui.CvsTabbedWindow;
import com.intellij.cvsSupport2.ui.experts.importToCvs.ImportWizard;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.actions.VcsContext;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.CvsBundle;
public class ImportAction extends ActionOnSelectedElement {
private ImportDetails myImportDetails;
@@ -37,7 +37,9 @@ import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.EditorSettings;
import com.intellij.openapi.progress.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
@@ -101,7 +103,7 @@ public class CvsOperationExecutor {
myResult.addAllErrors(handler.getErrorsExceptAborted());
myResult.addAllWarnings(handler.getWarnings());
handler.runComplitingActivities();
if (myProject != null && !myProject.isDisposed()) {
if ((myProject == null) || (myProject != null && !myProject.isDisposed())) {
showErrors(handler.getErrorsExceptAborted(), handler.getWarnings(), tabbedWindow);
}
}
@@ -208,7 +210,22 @@ public class CvsOperationExecutor {
final List<VcsException> warnings,
final CvsTabbedWindow tabbedWindow) {
if (!myShowErrors || myIsQuietOperation) return;
if (tabbedWindow == null) return;
if (tabbedWindow == null) {
final List<String> messages = new ArrayList<String>();
for (VcsException error : errors) {
if (! StringUtil.isEmptyOrSpaces(error.getMessage())) {
messages.add(error.getMessage());
}
}
for (VcsException error : warnings) {
if (! StringUtil.isEmptyOrSpaces(error.getMessage())) {
messages.add(error.getMessage());
}
}
final String errorMessage = StringUtil.join(messages, "\n");
Messages.showErrorDialog(errorMessage, "CVS error");
return;
}
if (errors.isEmpty() && warnings.isEmpty()) {
tabbedWindow.hideErrors();
}