import java.util.LinkedList;
import java.util.Queue;
+@SomeQueue
public abstract class AbstractTaskQueue<T> {
private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.progress.AbstractTaskQueue");
/**
* @author yole
*/
+@SomeQueue
public class BackgroundTaskQueue {
private final Project myProject;
private final Queue<Task> myQueue = new LinkedList<Task>();
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
+@SomeQueue
public class ProgressManagerQueue extends AbstractTaskQueue<Runnable> {
private final ProgressManager myProgressManager;
private final Task.Backgroundable myTask;
--- /dev/null
+/*
+ * 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.progress;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.SOURCE)
+@Target({ElementType.TYPE})
+public @interface SomeQueue {
+}
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.VcsRoot;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
public class DirtBuilder implements DirtBuilderReader {
private final VcsGuess myGuess;
- private final List<FilePathUnderVcs> myFiles;
- private final List<FilePathUnderVcs> myDirs;
+ private final Set<FilePathUnderVcs> myFiles;
+ private final Set<FilePathUnderVcs> myDirs;
private boolean myEverythingDirty;
public DirtBuilder(final VcsGuess guess) {
myGuess = guess;
- myDirs = new ArrayList<FilePathUnderVcs>();
- myFiles = new ArrayList<FilePathUnderVcs>();
+ myDirs = new HashSet<FilePathUnderVcs>();
+ myFiles = new HashSet<FilePathUnderVcs>();
myEverythingDirty = false;
}
public DirtBuilder(final DirtBuilder builder) {
myGuess = builder.myGuess;
- myDirs = new ArrayList<FilePathUnderVcs>(builder.myDirs);
- myFiles = new ArrayList<FilePathUnderVcs>(builder.myFiles);
+ myDirs = new HashSet<FilePathUnderVcs>(builder.myDirs);
+ myFiles = new HashSet<FilePathUnderVcs>(builder.myFiles);
myEverythingDirty = builder.myEverythingDirty;
}
return myEverythingDirty;
}
- public List<FilePathUnderVcs> getFilesForVcs() {
+ public Collection<FilePathUnderVcs> getFilesForVcs() {
return myFiles;
}
- public List<FilePathUnderVcs> getDirsForVcs() {
+ public Collection<FilePathUnderVcs> getDirsForVcs() {
return myDirs;
}
*/
package com.intellij.openapi.vcs.changes;
-import java.util.List;
+import java.util.Collection;
public interface DirtBuilderReader {
boolean isEverythingDirty();
- List<FilePathUnderVcs> getFilesForVcs();
- List<FilePathUnderVcs> getDirsForVcs();
+ Collection<FilePathUnderVcs> getFilesForVcs();
+ Collection<FilePathUnderVcs> getDirsForVcs();
boolean isEmpty();
}
*/
package com.intellij.openapi.vcs.changes;
-import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vcs.AbstractVcs;
-import com.intellij.openapi.vcs.VcsRoot;
+import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
+import com.intellij.openapi.vcs.VcsRoot;
public class FilePathUnderVcs {
private final FilePath myPath;
public AbstractVcs getVcs() {
return myVcs;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ FilePathUnderVcs that = (FilePathUnderVcs)o;
+
+ if (myPath != null ? !myPath.equals(that.myPath) : that.myPath != null) return false;
+ if (myVcs != null ? ! Comparing.equal(myVcs.getName(), that.myVcs.getName()) : that.myVcs != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = myPath != null ? myPath.hashCode() : 0;
+ result = 31 * result + (myVcs != null ? myVcs.getName().hashCode() : 0);
+ return result;
+ }
}
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.progress.SomeQueue;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
import com.intellij.util.Consumer;
* 2. if checker returns TRUE -> those whose timestamp is older than required
*
*/
+@SomeQueue
public class LazyRefreshingSelfQueue<T> {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.LazyRefreshingSelfQueue");
import com.intellij.openapi.vcs.impl.DefaultVcsRootPolicy;
import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
public class Scopes {
private final Project myProject;
markEverythingDirty();
return;
}
- final List<FilePathUnderVcs> dirs = dirt.getDirsForVcs();
+ final Collection<FilePathUnderVcs> dirs = dirt.getDirsForVcs();
for (FilePathUnderVcs dir : dirs) {
getScope(dir.getVcs()).addDirtyDirRecursively(dir.getPath());
}
- final List<FilePathUnderVcs> files = dirt.getFilesForVcs();
+ final Collection<FilePathUnderVcs> files = dirt.getFilesForVcs();
for (FilePathUnderVcs file : files) {
getScope(file.getVcs()).addDirtyFile(file.getPath());
}
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.SomeQueue;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
* Tries to zip several update requests into one (if starts and see several requests in the queue)
* own inner synchronization
*/
+@SomeQueue
public class UpdateRequestsQueue {
private final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.UpdateRequestsQueue");
private final Project myProject;
package org.jetbrains.idea.svn;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.SomeQueue;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
* - if request had been submitted while refresh action was in progress, new refresh action is initiated right after first refresh action finishes
*
*/
+@SomeQueue
public class RequestsMerger {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.svn.RequestsMerger");
private static final int ourDelay = 300;
*/
package org.jetbrains.idea.svn.history;
+import com.intellij.openapi.progress.SomeQueue;
import com.intellij.util.Alarm;
+@SomeQueue
public class ZipperUpdater {
private final Alarm myAlarm;
private boolean myRaised;