diff --git a/platform/lang-api/src/com/intellij/psi/search/scope/NonProjectFilesScope.java b/platform/lang-api/src/com/intellij/psi/search/scope/NonProjectFilesScope.java index 4615be75f74f..b0d1c3142d1f 100644 --- a/platform/lang-api/src/com/intellij/psi/search/scope/NonProjectFilesScope.java +++ b/platform/lang-api/src/com/intellij/psi/search/scope/NonProjectFilesScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -40,6 +40,7 @@ public class NonProjectFilesScope extends NamedScope { super(NAME, new AbstractPackageSet("NonProject") { public boolean contains(VirtualFile file, NamedScopesHolder holder) { if (file == null) return true; + if (file.getFileSystem() != LocalFileSystem.getInstance()) return true; if (isInsideProjectContent(holder.getProject(), file)) return false; return !ProjectScope.getProjectScope(holder.getProject()).contains(file); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index ad93627383ed..60d6788c32e3 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -346,6 +346,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr myFontSizeSlider.setSnapToTicks(true); UIUtil.setSliderIsFilled(myFontSizeSlider, true); result.add(myFontSizeSlider); + result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1)); myFontSizeSlider.addChangeListener(new ChangeListener() { @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java index 36b50d88b113..e37f1971b422 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java @@ -182,12 +182,14 @@ public class DocumentationManager extends DockablePopupManager 220 && color.getRed() > 220 && color.getGreen() > 220) return color; final float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); - return Color.getHSBColor(hsb[0], 0.4f *hsb[1], hsb[2]); + return Color.getHSBColor(hsb[0], 0.6f *hsb[1], hsb[2]); } private static int shift(int colorComponent, double d) { diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 631cb227fac3..d271a48e1e76 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -947,7 +947,7 @@ public class UIUtil { } public static boolean isFullRowSelectionLAF() { - return isUnderNimbusLookAndFeel() || isUnderQuaquaLookAndFeel() || isUnderDarcula(); + return isUnderNimbusLookAndFeel() || isUnderQuaquaLookAndFeel(); } public static boolean isUnderNativeMacLookAndFeel() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java index 68dee6a11e81..ca14240cb1e3 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java @@ -139,7 +139,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { } }; - private final DualViewColumnInfo REVISION = + private final VcsColumnInfo REVISION = new VcsColumnInfo(VcsBundle.message("column.name.revision.version")) { protected VcsRevisionNumber getDataOf(VcsFileRevision object) { return object.getRevisionNumber(); @@ -162,7 +162,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { }; - private final DualViewColumnInfo DATE = new VcsColumnInfo(VcsBundle.message("column.name.revision.date")) { + private final VcsColumnInfo DATE = new VcsColumnInfo(VcsBundle.message("column.name.revision.date")) { protected String getDataOf(VcsFileRevision object) { Date date = object.getRevisionDate(); if (date == null) return ""; @@ -216,7 +216,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { private static final TableCellRenderer AUTHOR_RENDERER = new AuthorCellRenderer(); - private final DualViewColumnInfo AUTHOR = new VcsColumnInfo(VcsBundle.message("column.name.revision.list.author")) { + private final VcsColumnInfo AUTHOR = new VcsColumnInfo(VcsBundle.message("column.name.revision.list.author")) { protected String getDataOf(VcsFileRevision object) { VcsFileRevision rev = object; if (object instanceof TreeNodeOnVcsRevision) { @@ -540,20 +540,50 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { refreshRevisionsOrder(); HistoryAsTreeProvider treeHistoryProvider = session.getHistoryAsTreeProvider(); + List revisionList = myHistorySession.getRevisionList(); + updateMaxStringValues(revisionList); if (treeHistoryProvider != null) { myDualView.setRoot(new TreeNodeOnVcsRevision(null, - treeHistoryProvider.createTreeOn(myHistorySession.getRevisionList())), myTargetSelection); + treeHistoryProvider.createTreeOn(revisionList)), myTargetSelection); } else { myDualView.setRoot(new TreeNodeOnVcsRevision(null, - wrapWithTreeElements(myHistorySession.getRevisionList())), myTargetSelection); + wrapWithTreeElements(revisionList)), myTargetSelection); } + updateMaxStringValues(revisionList); myDualView.getFlatView().updateColumnSizes(); myDualView.expandAll(); myDualView.repaint(); } + private void updateMaxStringValues(@NotNull List list) { + int maxAuthorWidth = getStringWidth(AUTHOR.getMaxStringValue()); + int maxRevisionWidth = getStringWidth(REVISION.getMaxStringValue()); + int maxDateWidth = getStringWidth(DATE.getMaxStringValue()); + for (VcsFileRevision revision : list) { + int authorWidth = getStringWidth(revision.getAuthor()); + int revWidth = getStringWidth(REVISION.valueOf(revision)); + int dateWidth = getStringWidth(DATE.getDataOf(revision)); + if (authorWidth > maxAuthorWidth) { + AUTHOR.setMaxStringValue(revision.getAuthor()); + } + if (revWidth > maxRevisionWidth) { + REVISION.setMaxStringValue(REVISION.valueOf(revision)); + } + if (dateWidth > maxDateWidth) { + DATE.setMaxStringValue(DATE.getDataOf(revision)); + } + } + } + + private int getStringWidth(@Nullable String string) { + if (string == null) { + return 0; + } + return myDualView.getFontMetrics(myDualView.getFont()).stringWidth(string); + } + protected void addActionsTo(DefaultActionGroup group) { addToGroup(false, group); } @@ -875,11 +905,9 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { if (selection.size() != 1) return; if (ChangeListManager.getInstance(myVcs.getProject()).isFreezedWithNotification(null)) return; final VcsRevisionNumber currentRevisionNumber = myHistorySession.getCurrentRevisionNumber(); - if (currentRevisionNumber != null) { - VcsHistoryUtil.showDifferencesInBackground(myVcs.getProject(), myFilePath, - getFirstSelectedRevision(), - new CurrentRevision(myFilePath.getVirtualFile(), currentRevisionNumber), - true); + VcsFileRevision selectedRevision = getFirstSelectedRevision(); + if (currentRevisionNumber != null && selectedRevision != null) { + myDiffHandler.showDiff(myFilePath, selectedRevision, new CurrentRevision(myFilePath.getVirtualFile(), currentRevisionNumber)); } } @@ -916,9 +944,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { @Override public boolean isEnabled() { - if (!super.isEnabled()) return false; - if (!myHistorySession.isContentAvailable(getFirstSelectedRevision())) return false; - return true; + return super.isEnabled() && myHistorySession.isContentAvailable(getFirstSelectedRevision()) && !myFilePath.isDirectory(); } protected void executeAction(AnActionEvent e) { @@ -1417,8 +1443,13 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { } } - abstract static class VcsColumnInfo extends DualViewColumnInfo - implements Comparator { + private abstract static class VcsColumnInfo + extends DualViewColumnInfo + implements Comparator + { + + @Nullable private String myMaxStringValue; + public VcsColumnInfo(String name) { super(name); } @@ -1453,6 +1484,16 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { return true; } + @Nullable + @Override + public String getMaxStringValue() { + return myMaxStringValue; + } + + public void setMaxStringValue(@Nullable String maxStringValue) { + myMaxStringValue = maxStringValue; + } + } private class MyColumnWrapper extends DualViewColumnInfo { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java index 0cf2c513dd97..3fba542ae1e6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java @@ -27,6 +27,7 @@ import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.FilePath; @@ -213,9 +214,10 @@ public class VcsHistoryUtil { public void run(@NotNull ProgressIndicator indicator) { VcsFileRevision left = revision1; VcsFileRevision right = revision2; - if (findOlderNewer && compare(revision1, revision2) > 0) { - left = revision2; - right = revision1; + if (findOlderNewer) { + Pair pair = sortRevisions(revision1, revision2); + left = pair.first; + right = pair.second; } try { @@ -244,4 +246,19 @@ public class VcsHistoryUtil { }.queue(); } + /** + * Compares the given revisions and returns a pair of them, where the first one is older, and second is newer. + */ + @NotNull + public static Pair sortRevisions(@NotNull VcsFileRevision revision1, + @NotNull VcsFileRevision revision2) { + VcsFileRevision left = revision1; + VcsFileRevision right = revision2; + if (compare(revision1, revision2) > 0) { + left = revision2; + right = revision1; + } + return Pair.create(left, right); + } + } diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java b/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java index 03aefdeee6a5..0b76583eb7af 100644 --- a/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java +++ b/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java @@ -405,7 +405,7 @@ public final class GitBranchOperationsProcessor { @NotNull private static Collection loadTotalDiff(@NotNull GitRepository repository, @NotNull String branchName) { try { - return GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), null, branchName, null); + return GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), "HEAD", branchName); } catch (VcsException e) { // we treat it as critical and report an error diff --git a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java index c0080c347893..3347e3b2a6d9 100644 --- a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java +++ b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java @@ -413,13 +413,22 @@ public class GitChangeUtils { @NotNull public static Collection getDiff(@NotNull Project project, @NotNull VirtualFile root, - @Nullable String firstRevision, @NotNull String nextRevision, - @Nullable Collection dirtyPaths) throws VcsException { + @NotNull String oldRevision, @Nullable String newRevision) throws VcsException { + String range; + GitRevisionNumber newRev; + if (newRevision == null) { + // it is current revision + range = oldRevision; + newRev = null; + } + else { + range = oldRevision + ".." + newRevision; + newRev = loadRevision(project, root, newRevision); + } + String output = getDiffOutput(project, root, range, null); + Collection changes = new ArrayList(); - String range = firstRevision == null ? nextRevision : firstRevision + ".." + nextRevision; - String output = getDiffOutput(project, root, range, dirtyPaths); - GitRevisionNumber thisRevision = firstRevision == null ? null : loadRevision(project, root, firstRevision); - parseChanges(project, root, thisRevision, loadRevision(project, root, nextRevision), output, changes, Collections.emptySet()); + parseChanges(project, root, newRev, loadRevision(project, root, oldRevision), output, changes, Collections.emptySet()); return changes; } diff --git a/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java b/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java index 410131c760d8..25992ef252d8 100644 --- a/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java +++ b/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java @@ -22,12 +22,17 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.DialogBuilder; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.ListPopup; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; +import com.intellij.openapi.vcs.changes.Change; +import com.intellij.openapi.vcs.changes.ui.ChangesBrowser; +import com.intellij.openapi.vcs.history.CurrentRevision; import com.intellij.openapi.vcs.history.DiffFromHistoryHandler; import com.intellij.openapi.vcs.history.VcsFileRevision; import com.intellij.openapi.vcs.history.VcsHistoryUtil; @@ -35,14 +40,17 @@ import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.awt.RelativePoint; import com.intellij.util.ArrayUtil; +import com.intellij.util.Consumer; import git4idea.GitFileRevision; import git4idea.GitRevisionNumber; import git4idea.GitUtil; +import git4idea.changes.GitChangeUtils; import git4idea.commands.Git; import git4idea.commands.GitCommandResult; import git4idea.repo.GitRepository; import git4idea.repo.GitRepositoryManager; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -92,34 +100,132 @@ class GitDiffFromHistoryHandler implements DiffFromHistoryHandler { private void doShowDiff(@NotNull FilePath filePath, @NotNull VcsFileRevision revision1, @NotNull VcsFileRevision revision2, boolean autoSort) { - VcsHistoryUtil.showDifferencesInBackground(myProject, filePath, revision1, revision2, autoSort); + if (!filePath.isDirectory()) { + VcsHistoryUtil.showDifferencesInBackground(myProject, filePath, revision1, revision2, autoSort); + } + else if (revision2 instanceof CurrentRevision) { + GitFileRevision left = (GitFileRevision)revision1; + showDiffForDirectory(filePath, left.getHash(), null); + } + else { + GitFileRevision left = (GitFileRevision)revision1; + GitFileRevision right = (GitFileRevision)revision2; + if (autoSort) { + Pair pair = VcsHistoryUtil.sortRevisions(revision1, revision2); + left = (GitFileRevision)pair.first; + right = (GitFileRevision)pair.second; + } + showDiffForDirectory(filePath, left.getHash(), right.getHash()); + } } - private void showDiffForMergeCommit(@NotNull final AnActionEvent event, @NotNull final FilePath filePath, @NotNull final GitFileRevision rev, - @NotNull final Collection parents) { - final AtomicBoolean fileTouched = new AtomicBoolean(); - new Task.Backgroundable(myProject, "Retrieving revision changes", false) { - @Override public void run(@NotNull ProgressIndicator indicator) { + private void showDiffForDirectory(@NotNull final FilePath path, @NotNull final String hash1, @Nullable final String hash2) { + GitRepository repository = getRepository(path); + calculateDiffInBackground(repository, hash1, hash2, new Consumer>() { + @Override + public void consume(List changes) { + showDirDiffDialog(path, hash1, hash2, changes); + } + }); + } + + @NotNull + private GitRepository getRepository(@NotNull FilePath path) { + VirtualFile file = path.getVirtualFile(); + LOG.assertTrue(file != null, "VirtualFile can't be null for " + path); // we clicked on a file and asked its history => VF must exist. + GitRepository repository = myRepositoryManager.getRepositoryForFile(file); + LOG.assertTrue(repository != null, "Repository is null for " + file); + return repository; + } + + private void calculateDiffInBackground(@NotNull final GitRepository repository, final String hash1, @Nullable final String hash2, + final Consumer> successHandler) { + new Task.Backgroundable(myProject, "Comparing revisions...") { + private List myChanges; + @Override + public void run(@NotNull ProgressIndicator indicator) { try { - fileTouched.set(wasFileTouched(rev, filePath)); + myChanges = new ArrayList(GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), hash1, hash2)); } catch (VcsException e) { - LOG.info("Error happened while executing git show " + rev + ":" + filePath, e); - VcsBalloonProblemNotifier.showOverVersionControlView(GitDiffFromHistoryHandler.this.myProject, e.getMessage(), MessageType.ERROR); + showError(e, "Error during requesting diff for directory"); } } @Override public void onSuccess() { - if (fileTouched.get()) { + successHandler.consume(myChanges); + } + }.queue(); + } + + private void showDirDiffDialog(@NotNull FilePath path, @NotNull String hash1, @Nullable String hash2, @NotNull List diff) { + DialogBuilder dialogBuilder = new DialogBuilder(myProject); + String title; + if (hash2 != null) { + title = String.format("%s diff in %s..%s", path.getName(), GitUtil.getShortHash(hash1), GitUtil.getShortHash(hash2)); + } + else { + title = String.format("%s diff from %s", path.getName(), GitUtil.getShortHash(hash1)); + } + dialogBuilder.setTitle(title); + dialogBuilder.setActionDescriptors(new DialogBuilder.ActionDescriptor[] { new DialogBuilder.CloseDialogAction()}); + final ChangesBrowser changesBrowser = new ChangesBrowser(myProject, null, diff, null, false, true, + null, ChangesBrowser.MyUseCase.COMMITTED_CHANGES, null); + changesBrowser.setChangesToDisplay(diff); + dialogBuilder.setCenterPanel(changesBrowser); + dialogBuilder.show(); + } + + private void showDiffForMergeCommit(@NotNull final AnActionEvent event, @NotNull final FilePath filePath, + @NotNull final GitFileRevision rev, @NotNull final Collection parents) { + + final Consumer afterTouchCheck = new Consumer() { + @Override + public void consume(Boolean wasTouched) { + if (wasTouched) { String message = filePath.getName() + " did not change in this merge commit"; VcsBalloonProblemNotifier.showOverVersionControlView(GitDiffFromHistoryHandler.this.myProject, message, MessageType.INFO); } showPopup(event, rev, filePath, parents); } + }; + + if (filePath.isDirectory()) { // for directories don't check if the file was modified in the merge commit + afterTouchCheck.consume(false); + } + else { + checkIfFileWasTouchedInBackground(filePath, rev, afterTouchCheck); + } + } + + private void checkIfFileWasTouchedInBackground(@NotNull final FilePath filePath, @NotNull final GitFileRevision rev, + @NotNull final Consumer afterTouchCheck) { + new Task.Backgroundable(myProject, "Loading changes...", false) { + private final AtomicBoolean fileTouched = new AtomicBoolean(); + + @Override public void run(@NotNull ProgressIndicator indicator) { + try { + fileTouched.set(wasFileTouched(rev, filePath)); + } + catch (VcsException e) { + String logMessage = "Error happened while executing git show " + rev + ":" + filePath; + showError(e, logMessage); + } + } + + @Override + public void onSuccess() { + afterTouchCheck.consume(fileTouched.get()); + } }.queue(); } + private void showError(VcsException e, String logMessage) { + LOG.info(logMessage, e); + VcsBalloonProblemNotifier.showOverVersionControlView(this.myProject, e.getMessage(), MessageType.ERROR); + } + private void showPopup(@NotNull AnActionEvent event, @NotNull GitFileRevision rev, @NotNull FilePath filePath, @NotNull Collection parents) { ActionGroup parentActions = createActionGroup(rev, filePath, parents); @@ -175,10 +281,7 @@ class GitDiffFromHistoryHandler implements DiffFromHistoryHandler { } private boolean wasFileTouched(@NotNull GitFileRevision rev, @NotNull FilePath path) throws VcsException { - VirtualFile file = path.getVirtualFile(); - LOG.assertTrue(file != null, "VirtualFile can't be null for " + path); // we clicked on a file and asked its history => VF must exist. - GitRepository repository = myRepositoryManager.getRepositoryForFile(file); - LOG.assertTrue(repository != null, "Repository is null for " + file); + GitRepository repository = getRepository(path); GitCommandResult result = myGit.show(repository, rev + ":" + path); if (result.success()) { return isFilePresentInOutput(repository, path, result.getOutput()); @@ -216,9 +319,5 @@ class GitDiffFromHistoryHandler implements DiffFromHistoryHandler { doShowDiff(myFilePath, makeRevisionFromHash(myFilePath, myParentRevision), myRevision, false); } - @Override - public void update(AnActionEvent e) { - - } } } diff --git a/plugins/git4idea/src/git4idea/push/GitPushDialog.java b/plugins/git4idea/src/git4idea/push/GitPushDialog.java index bb460d6c0d70..c4172595676b 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushDialog.java +++ b/plugins/git4idea/src/git4idea/push/GitPushDialog.java @@ -31,14 +31,14 @@ import git4idea.branch.GitBranchUtil; import git4idea.history.browser.GitCommit; import git4idea.repo.GitRemote; import git4idea.repo.GitRepository; +import git4idea.repo.GitRepositoryManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.List; import java.util.concurrent.atomic.AtomicReference; /** @@ -50,6 +50,7 @@ public class GitPushDialog extends DialogWrapper { private static final String DEFAULT_REMOTE = "origin"; private Project myProject; + private final GitRepositoryManager myRepositoryManager; private final GitPusher myPusher; private final GitPushLog myListPanel; private GitCommitsByRepoAndBranch myGitCommitsToPush; @@ -66,8 +67,9 @@ public class GitPushDialog extends DialogWrapper { super(project); myProject = project; myPusher = new GitPusher(myProject, new EmptyProgressIndicator()); + myRepositoryManager = GitUtil.getRepositoryManager(myProject); - myRepositories = GitUtil.getRepositoryManager(myProject).getRepositories(); + myRepositories = getRepositoriesWithRemotes(); myLoadingPanel = new JBLoadingPanel(new BorderLayout(), this.getDisposable()); @@ -89,6 +91,17 @@ public class GitPushDialog extends DialogWrapper { setTitle("Git Push"); } + @NotNull + private List getRepositoriesWithRemotes() { + List repositories = new ArrayList(); + for (GitRepository repository : myRepositoryManager.getRepositories()) { + if (!repository.getRemotes().isEmpty()) { + repositories.add(repository); + } + } + return repositories; + } + @Override protected JComponent createCenterPanel() { JPanel optionsPanel = new JPanel(new BorderLayout()); diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskUiTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskUiTest.java index d99e2a51a984..d55cdacd97b0 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskUiTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskUiTest.java @@ -22,7 +22,6 @@ import com.intellij.tasks.actions.SwitchTaskCombo; import com.intellij.tasks.config.TaskSettings; import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.TestActionEvent; -import com.intellij.testFramework.UsefulTestCase; import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase; /** @@ -31,10 +30,6 @@ import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase; */ public class TaskUiTest extends CodeInsightFixtureTestCase { - public TaskUiTest() { - PlatformTestCase.initPlatformPrefix(UsefulTestCase.IDEA_MARKER_CLASS, "PlatformLangXml"); - } - public void testTaskComboVisible() throws Exception { TaskManager manager = TaskManager.getManager(getProject()); @@ -76,4 +71,8 @@ public class TaskUiTest extends CodeInsightFixtureTestCase { return event.getPresentation(); } + @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors") + public TaskUiTest() { + PlatformTestCase.initPlatformLangPrefix(); + } }