From b18d5d128c16b207031e0193e3c41785e339714b Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 26 Jul 2012 19:11:38 +0400 Subject: [PATCH 1/3] deprecation explained --- .../resolve/reference/ReferenceProvidersRegistry.java | 7 +++++++ .../com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java b/platform/core-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java index 2fbfbbcd7783..b39cb226ff2c 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java @@ -45,11 +45,18 @@ public abstract class ReferenceProvidersRegistry { public abstract PsiReferenceRegistrar getRegistrar(Language language); + /** + * @see #getReferencesFromProviders(com.intellij.psi.PsiElement) + */ @Deprecated public static PsiReference[] getReferencesFromProviders(PsiElement context, @NotNull Class clazz) { return getReferencesFromProviders(context, PsiReferenceService.Hints.NO_HINTS); } + public static PsiReference[] getReferencesFromProviders(PsiElement context) { + return getReferencesFromProviders(context, PsiReferenceService.Hints.NO_HINTS); + } + public static PsiReference[] getReferencesFromProviders(PsiElement context, @NotNull PsiReferenceService.Hints hints) { ProgressIndicatorProvider.checkCanceled(); assert context.isValid() : "Invalid context: " + context; diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java index 231c82998227..3ac95f0d9e68 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java @@ -238,7 +238,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { }; } - final PsiReference[] referencesFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlDoctype.class); + final PsiReference[] referencesFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this); return ArrayUtil.mergeArrays( uriRefs != null? uriRefs: PsiReference.EMPTY_ARRAY, From 5093e455af497e0aaa413e91c45af3820fe74749 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 27 Jul 2012 15:39:30 +0400 Subject: [PATCH 2/3] cleanup --- .../psi/impl/java/stubs/impl/PsiParameterListStubImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterListStubImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterListStubImpl.java index c750138d6aaa..e6f29b2db092 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterListStubImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterListStubImpl.java @@ -32,8 +32,6 @@ public class PsiParameterListStubImpl extends StubBase impleme @SuppressWarnings({"HardCodedStringLiteral"}) public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("PsiParameterListStub"); - return builder.toString(); + return "PsiParameterListStub"; } } \ No newline at end of file From e5186fc498dd8b89a95886fc737bfdc3f112d282 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Fri, 27 Jul 2012 15:52:11 +0400 Subject: [PATCH 3/3] [git] Fix "Show Diff", "Show Diff with Local", "Compare with Branch" for directories Pass the directory itself (otherwise the diff is calculated for the whole repository). --- .../branch/GitBranchOperationsProcessor.java | 2 +- .../src/git4idea/changes/GitChangeUtils.java | 5 +++-- .../history/GitDiffFromHistoryHandler.java | 14 ++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java b/plugins/git4idea/src/git4idea/branch/GitBranchOperationsProcessor.java index 0b76583eb7af..c8c354d1738f 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(), "HEAD", branchName); + return GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), "HEAD", branchName, null); } 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 3347e3b2a6d9..d6e9f92de9b2 100644 --- a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java +++ b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java @@ -413,7 +413,8 @@ public class GitChangeUtils { @NotNull public static Collection getDiff(@NotNull Project project, @NotNull VirtualFile root, - @NotNull String oldRevision, @Nullable String newRevision) throws VcsException { + @NotNull String oldRevision, @Nullable String newRevision, + @Nullable Collection dirtyPaths) throws VcsException { String range; GitRevisionNumber newRev; if (newRevision == null) { @@ -425,7 +426,7 @@ public class GitChangeUtils { range = oldRevision + ".." + newRevision; newRev = loadRevision(project, root, newRevision); } - String output = getDiffOutput(project, root, range, null); + String output = getDiffOutput(project, root, range, dirtyPaths); Collection changes = new ArrayList(); parseChanges(project, root, newRev, loadRevision(project, root, oldRevision), output, changes, Collections.emptySet()); diff --git a/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java b/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java index fe44b1cdd4b5..f73337d5266c 100644 --- a/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java +++ b/plugins/git4idea/src/git4idea/history/GitDiffFromHistoryHandler.java @@ -32,7 +32,10 @@ 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.*; +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; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.awt.RelativePoint; @@ -52,6 +55,7 @@ import org.jetbrains.annotations.Nullable; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -118,7 +122,7 @@ public class GitDiffFromHistoryHandler implements DiffFromHistoryHandler { 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>() { + calculateDiffInBackground(repository, path, hash1, hash2, new Consumer>() { @Override public void consume(List changes) { showDirDiffDialog(path, hash1, hash2, changes); @@ -135,14 +139,16 @@ public class GitDiffFromHistoryHandler implements DiffFromHistoryHandler { return repository; } - private void calculateDiffInBackground(@NotNull final GitRepository repository, final String hash1, @Nullable final String hash2, + private void calculateDiffInBackground(@NotNull final GitRepository repository, @NotNull final FilePath path, + @NotNull 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 { - myChanges = new ArrayList(GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), hash1, hash2)); + myChanges = new ArrayList(GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), hash1, hash2, + Collections.singletonList(path))); } catch (VcsException e) { showError(e, "Error during requesting diff for directory");