diff options
Diffstat (limited to 'platform/vcs-impl/src/com/intellij/openapi/vcs/changes')
6 files changed, 27 insertions, 14 deletions
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java index 070a4e95587a..fe20806a8ed4 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java @@ -49,7 +49,7 @@ public abstract class AbstractRefreshablePanel<T> implements RefreshablePanel<Ch private final DetailsPanel myDetailsPanel; private final GenericDetailsLoader<Ticket, T> myDetailsLoader; private final BackgroundTaskQueue myQueue; - private boolean myDisposed; + private volatile boolean myDisposed; protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) { myQueue = queue; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesFragmentedDiffPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesFragmentedDiffPanel.java index 025795eb08ed..731634b85080 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesFragmentedDiffPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesFragmentedDiffPanel.java @@ -549,7 +549,7 @@ public class ChangesFragmentedDiffPanel implements Disposable { } private static final int[] ourMarks = {1,2,4,8,-1}; - public static final Hashtable<Integer,JLabel> LABELS = new Hashtable<Integer, JLabel>(); + public static final Hashtable<Integer, JComponent> LABELS = new Hashtable<Integer, JComponent>(); public static final int ALL_VALUE = 5; static { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java index 77dd9b3f42b3..ce6ca72ab996 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java @@ -218,8 +218,8 @@ public class FragmentedDiffRequestFromChange { final List<BeforeAfter<TextRange>> result = new ArrayList<BeforeAfter<TextRange>>(); if (myRanges == null || myRanges.isEmpty()) return Collections.emptyList(); for (Range range : myRanges) { - final TextRange before = new TextRange(range.getUOffset1(), range.getUOffset2()); - final TextRange after = new TextRange(range.getOffset1(), range.getOffset2()); + final TextRange before = new TextRange(range.getVcsLine1(), range.getVcsLine2()); + final TextRange after = new TextRange(range.getLine1(), range.getLine2()); result.add(new BeforeAfter<TextRange>(before, after)); } return result; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java index 2da25f6e92c1..6619b98ea5e9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java @@ -44,6 +44,7 @@ import com.intellij.util.Consumer; import com.intellij.util.MessageBusUtil; import com.intellij.util.NotNullFunction; import com.intellij.util.containers.ConcurrentHashMap; +import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; @@ -772,16 +773,21 @@ public class CommittedChangesCache implements PersistentStateComponent<Committed } public void processUpdatedFiles(final UpdatedFiles updatedFiles) { + processUpdatedFiles(updatedFiles, null); + } + + public void processUpdatedFiles(final UpdatedFiles updatedFiles, + @Nullable final Consumer<List<CommittedChangeList>> incomingChangesConsumer) { final Runnable task = new Runnable() { @Override public void run() { debug("Processing updated files"); final Collection<ChangesCacheFile> caches = myCachesHolder.getAllCaches(); + myPendingUpdateCount += caches.size(); for(final ChangesCacheFile cache: caches) { - myPendingUpdateCount++; try { if (cache.isEmpty()) { - pendingUpdateProcessed(); + pendingUpdateProcessed(incomingChangesConsumer); continue; } debug("Processing updated files in " + cache.getLocation()); @@ -789,12 +795,12 @@ public class CommittedChangesCache implements PersistentStateComponent<Committed if (needRefresh) { debug("Found unaccounted files, requesting refresh"); // todo do we need double-queueing here??? - processUpdatedFilesAfterRefresh(cache, updatedFiles); + processUpdatedFilesAfterRefresh(cache, updatedFiles, incomingChangesConsumer); } else { debug("Clearing cached incoming changelists"); myCachedIncomingChangeLists = null; - pendingUpdateProcessed(); + pendingUpdateProcessed(incomingChangesConsumer); } } catch (IOException e) { @@ -806,15 +812,20 @@ public class CommittedChangesCache implements PersistentStateComponent<Committed myTaskQueue.run(task); } - private void pendingUpdateProcessed() { + private void pendingUpdateProcessed(@Nullable Consumer<List<CommittedChangeList>> incomingChangesConsumer) { myPendingUpdateCount--; if (myPendingUpdateCount == 0) { notifyIncomingChangesUpdated(myNewIncomingChanges); + if (incomingChangesConsumer != null) { + incomingChangesConsumer.consume(ContainerUtil.newArrayList(myNewIncomingChanges)); + } myNewIncomingChanges.clear(); } } - private void processUpdatedFilesAfterRefresh(final ChangesCacheFile cache, final UpdatedFiles updatedFiles) { + private void processUpdatedFilesAfterRefresh(final ChangesCacheFile cache, + final UpdatedFiles updatedFiles, + @Nullable final Consumer<List<CommittedChangeList>> incomingChangesConsumer) { refreshCacheAsync(cache, false, new RefreshResultConsumer() { @Override public void receivedChanges(final List<CommittedChangeList> committedChangeLists) { @@ -833,7 +844,7 @@ public class CommittedChangesCache implements PersistentStateComponent<Committed debug("Clearing cached incoming changelists"); myCachedIncomingChangeLists = null; } - pendingUpdateProcessed(); + pendingUpdateProcessed(incomingChangesConsumer); } catch (IOException e) { LOG.error(e); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java index 7d4156873d7c..b7a42218e3e6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java @@ -150,7 +150,7 @@ public class ChangesBrowserNode<T> extends DefaultMutableTreeNode { public <T> List<T> getAllObjectsUnder(final Class<T> clazz) { List<T> changes = new ArrayList<T>(); - final Enumeration enumeration = depthFirstEnumeration(); + final Enumeration enumeration = preorderEnumeration(); while (enumeration.hasMoreElements()) { ChangesBrowserNode child = (ChangesBrowserNode)enumeration.nextElement(); final Object value = child.getUserObject(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesModuleGroupingPolicy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesModuleGroupingPolicy.java index 2ed36d79947f..1efc7b44d66b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesModuleGroupingPolicy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesModuleGroupingPolicy.java @@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; @@ -55,8 +56,9 @@ public class ChangesModuleGroupingPolicy implements ChangesGroupingPolicy { if (vFile == null) { vFile = LocalFileSystem.getInstance().findFileByIoFile(new File(node.getPath())); } - if (vFile != null && Comparing.equal(vFile, index.getContentRootForFile(vFile))) { - Module module = index.getModuleForFile(vFile); + boolean hideExcludedFiles = Registry.is("ide.hide.excluded.files"); + if (vFile != null && Comparing.equal(vFile, index.getContentRootForFile(vFile, hideExcludedFiles))) { + Module module = index.getModuleForFile(vFile, hideExcludedFiles); return getNodeForModule(module, rootNode); } return null; |