Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Eugene Kudelevsky
2010-11-08 15:05:52 +03:00
23 changed files with 87 additions and 64 deletions
@@ -23,6 +23,8 @@ import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public interface PopupComponent {
@@ -144,6 +146,14 @@ public interface PopupComponent {
public void hide(boolean dispose) {
myPopup.hide();
Window wnd = getWindow();
if (wnd instanceof JWindow) {
JRootPane rootPane = ((JWindow)wnd).getRootPane();
if (rootPane != null) {
ReflectionUtil.resetField(rootPane, "clientProperties");
}
}
}
public void show() {
@@ -37,7 +37,7 @@ public abstract class GitReference implements Comparable<GitReference> {
* @param name the used name
*/
public GitReference(@NotNull String name) {
myName = name;
myName = new String(name);
}
/**
+1 -1
View File
@@ -76,7 +76,7 @@ public class GitTag extends GitReference {
if (line.length() == 0) {
continue;
}
tags.add(line);
tags.add(new String(line));
}
}
+1 -1
View File
@@ -713,7 +713,7 @@ public class GitUtil {
if (file == null || path.length == 0) return null;
VirtualFile current = file;
final List<VirtualFile> backTrace = new LinkedList<VirtualFile>();
final List<VirtualFile> backTrace = new ArrayList<VirtualFile>();
int idx = path.length - 1;
while (current != null) {
if (SystemInfo.isFileSystemCaseSensitive ? current.getName().equals(path[idx]) : current.getName().equalsIgnoreCase(path[idx])) {
@@ -35,7 +35,10 @@ import git4idea.i18n.GitBundle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Base class for actions that affect the entire git repository.
@@ -45,7 +48,7 @@ public abstract class GitRepositoryAction extends DumbAwareAction {
/**
* The task delayed until end of the primary action. These tasks happen after repository refresh.
*/
final LinkedList<TransactionRunnable> myDelayedTasks = new LinkedList<TransactionRunnable>();
final List<TransactionRunnable> myDelayedTasks = new ArrayList<TransactionRunnable>();
/**
* {@inheritDoc}
@@ -122,7 +122,7 @@ public class GitChangeUtils {
}
public static Collection<String> parseDiffForPaths(final String rootPath, final StringScanner s) throws VcsException {
final Collection<String> result = new LinkedList<String>();
final Collection<String> result = new ArrayList<String>();
while (s.hasMoreData()) {
if (s.isEol()) {
@@ -98,7 +98,7 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider<Co
final Collection<U> result = new ArrayList<U>(revisions);
for (Iterator<U> iterator = result.iterator(); iterator.hasNext();) {
final U t = iterator.next();
final LinkedList<String> branches = new LinkedList<String>();
final List<String> branches = new ArrayList<String>();
// we do not use passed revision convertor since it returns just recent commit on repo
final VcsRevisionNumber revision = GitHistoryUtils.getCurrentRevision(myProject, filePatchConvertor.convert(t), null);
if (revision == null) continue; // will be true for new files; they are anyway outgoing
@@ -48,7 +48,7 @@ public abstract class GitHandler {
protected final GitCommand myCommand;
private final HashSet<Integer> myIgnoredErrorCodes = new HashSet<Integer>(); // Error codes that are ignored for the handler
private final List<VcsException> myErrors = Collections.synchronizedList(new LinkedList<VcsException>());
private final List<VcsException> myErrors = Collections.synchronizedList(new ArrayList<VcsException>());
private static final Logger log = Logger.getInstance(GitHandler.class.getName());
final GeneralCommandLine myCommandLine;
@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
@@ -161,10 +161,10 @@ class GitLogParser {
line = infoAndPath[0];
if (infoAndPath.length > 1) {
// taking the last element, thus avoiding possible blank line
final List<String> nameAndPathSplit = new LinkedList<String>(Arrays.asList(infoAndPath[infoAndPath.length-1].split("[\\s]")));
final List<String> nameAndPathSplit = new ArrayList<String>(Arrays.asList(infoAndPath[infoAndPath.length - 1].split("[\\s]")));
// not relying that separator is tab => so splitting by any whitespace.
// Then removing blank (or whitespace) lines which could appear by this splitting:
for (Iterator<String> it = nameAndPathSplit.iterator(); it.hasNext(); ) {
for (Iterator<String> it = nameAndPathSplit.iterator(); it.hasNext();) {
if (it.next().trim().isEmpty()) {
it.remove();
}
@@ -70,15 +70,19 @@ class GitLogRecord {
return res;
}
private String lookup(GitLogParser.GitLogOption key) {
return shortBuffer(myOptions.get(key));
}
// trivial access methods
String getHash() { return myOptions.get(HASH); }
String getShortHash() { return myOptions.get(SHORT_HASH); }
String getAuthorName() { return myOptions.get(AUTHOR_NAME); }
String getAuthorEmail() { return myOptions.get(AUTHOR_EMAIL); }
String getCommitterName() { return myOptions.get(COMMITTER_NAME); }
String getCommitterEmail() { return myOptions.get(COMMITTER_EMAIL); }
String getSubject() { return myOptions.get(SUBJECT); }
String getBody() { return myOptions.get(BODY); }
String getHash() { return lookup(HASH); }
String getShortHash() { return lookup(SHORT_HASH); }
String getAuthorName() { return lookup(AUTHOR_NAME); }
String getAuthorEmail() { return lookup(AUTHOR_EMAIL); }
String getCommitterName() { return lookup(COMMITTER_NAME); }
String getCommitterEmail() { return lookup(COMMITTER_EMAIL); }
String getSubject() { return lookup(SUBJECT); }
String getBody() { return lookup(BODY); }
// access methods with some formatting or conversion
@@ -101,11 +105,11 @@ class GitLogRecord {
}
String[] getParentsShortHashes() {
return myOptions.get(SHORT_PARENTS).split(" ");
return lookup(SHORT_PARENTS).split(" ");
}
String[] getParentsHashes() {
return myOptions.get(PARENTS).split(" ");
return lookup(PARENTS).split(" ");
}
/**
@@ -117,17 +121,17 @@ class GitLogRecord {
Pair<List<String>, List<String>> getTagsAndBranches(Collection<String> allBranchesSet) {
final String decorate = myOptions.get(REF_NAMES);
final String[] refNames = parseRefNames(decorate);
final List<String> tags = refNames.length > 0 ? new LinkedList<String>() : Collections.<String>emptyList();
final List<String> branches = refNames.length > 0 ? new LinkedList<String>() : Collections.<String>emptyList();
final List<String> tags = refNames.length > 0 ? new ArrayList<String>() : Collections.<String>emptyList();
final List<String> branches = refNames.length > 0 ? new ArrayList<String>() : Collections.<String>emptyList();
for (String refName : refNames) {
if (allBranchesSet.contains(refName)) {
// also some gits can return ref name twice (like (HEAD, HEAD), so check we will show it only once)
if (!branches.contains(refName)) {
branches.add(refName);
branches.add(shortBuffer(refName));
}
} else {
if (!tags.contains(refName)) {
tags.add(refName);
tags.add(shortBuffer(refName));
}
}
}
@@ -142,4 +146,8 @@ class GitLogRecord {
return refs.split(", ");
}
private static String shortBuffer(String raw) {
return new String(raw);
}
}
@@ -174,7 +174,7 @@ public class GitUsersComponent {
private boolean myStartReached;
private UsersData() {
myUsers = new LinkedList<String>();
myUsers = new ArrayList<String>();
final long now = System.currentTimeMillis();
myCloserDate = new UpdatedReference<Long>(now);
myEarlierDate = new UpdatedReference<Long>(now + 1);
@@ -327,7 +327,7 @@ public class GitUsersComponent {
final long earlierUpdate = in.readLong();
data.setEarlierDate(new UpdatedReference<Long>(earlierDate, earlierUpdate));
final List<String> users = new LinkedList<String>();
final List<String> users = new ArrayList<String>();
final int size = in.readInt();
for (int i = 0; i < size; i++) {
users.add(in.readUTF());
@@ -36,7 +36,7 @@ public class ChangesFilter {
private MemoryFilter myResult;
protected Merger() {
myFilters = new LinkedList<MemoryFilter>();
myFilters = new ArrayList<MemoryFilter>();
}
protected abstract boolean acceptImpl(MemoryFilter filter);
@@ -81,7 +81,7 @@ public class ChangesFilter {
final Merger[] mergers = {new UsersMerger()};
if (filters.isEmpty()) return Collections.emptyList();
final List<MemoryFilter> result = new LinkedList<MemoryFilter>();
final List<MemoryFilter> result = new ArrayList<MemoryFilter>();
for (Filter filter : filters) {
boolean taken = false;
for (Merger combiner : mergers) {
@@ -361,7 +361,7 @@ public class ChangesFilter {
// todo optimization here
public boolean addPath(final VirtualFile vf) {
final Collection<VirtualFile> filesWeAlreadyHave = myMap.values();
final Collection<VirtualFile> childrenToRemove = new LinkedList<VirtualFile>();
final Collection<VirtualFile> childrenToRemove = new ArrayList<VirtualFile>();
for (VirtualFile current : filesWeAlreadyHave) {
if (current.equals(vf)) return false; // doesnt add exact same
if (VfsUtil.isAncestor(vf, current, false)) {
@@ -51,10 +51,10 @@ public class CherryPicker {
myListsCache = listsCache;
myAccess = access;
myExceptions = new LinkedList<VcsException>();
myWarnings = new LinkedList<VcsException>();
myExceptions = new ArrayList<VcsException>();
myWarnings = new ArrayList<VcsException>();
myDirtyFiles = new LinkedList<FilePath>();
myDirtyFiles = new ArrayList<FilePath>();
myMessagesInOrder = new ArrayList<String>(hashes.size());
myFilesToMove = new HashMap<String, Collection<FilePath>>();
}
@@ -30,7 +30,7 @@ public class GitLogHelper {
@NotNull
public Portion loadPortion(final Collection<String> startingPoints, final Date beforePoint, final Date afterPoint,
final Collection<ChangesFilter.Filter> filtersIn, int maxCnt, List<String> branches) throws VcsException {
final Collection<ChangesFilter.Filter> filters = new LinkedList<ChangesFilter.Filter>(filtersIn);
final Collection<ChangesFilter.Filter> filters = new ArrayList<ChangesFilter.Filter>(filtersIn);
if (beforePoint != null) {
filters.add(new ChangesFilter.BeforeDate(new Date(beforePoint.getTime() - 1)));
}
@@ -114,7 +114,7 @@ public class GitLogTree implements GitTreeViewI {
myMainSplitter.setDividerWidth(3);
myFiltersSplitter.setDividerWidth(3);
myInitWaiters = new LinkedList<Runnable>();
myInitWaiters = new ArrayList<Runnable>();
myCommitsList = new JBList();
myController.init();
}
@@ -1547,7 +1547,7 @@ public class GitLogTree implements GitTreeViewI {
if (wasEmpty) {
myFiltering.addFilter(myFilter);
} else {
final List<StructureNode> toRemove = new LinkedList<StructureNode>();
final List<StructureNode> toRemove = new ArrayList<StructureNode>();
for (StructureNode child : getChildren()) {
final VirtualFile file = child.getFile();
if (! myFilter.containsFile(file)) {
@@ -1657,7 +1657,7 @@ public class GitLogTree implements GitTreeViewI {
myText = text;
myType = type;
myIcon = icon;
myChildren = myAllowsChildren ? new LinkedList<Child>() : Collections.<Child>emptyList();
myChildren = myAllowsChildren ? new ArrayList<Child>() : Collections.<Child>emptyList();
myDescriptor = new PresentableNodeDescriptor(myProject, myParent == null ? null : myParent.getDescriptor()) {
@Override
public PresentableNodeDescriptor getChildToHighlightAt(int index) {
@@ -34,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Alarm;
import com.intellij.util.Consumer;
import com.intellij.util.Processor;
import com.intellij.util.SmartList;
import com.intellij.util.containers.SLRUCache;
import git4idea.GitVcs;
import git4idea.changes.GitChangeUtils;
@@ -158,8 +159,8 @@ class GitTreeController implements ManageGitTreeView {
private void loadCommitsUsingMemoryAndNativeFilters(final Collection<String> startingPoints, final Pair<Date, SHAHash> beforePoint,
final Date afterPoint, final Collection<ChangesFilter.Filter> filters, final int maxCnt) throws VcsException {
assert maxCnt > 0;
final List<ChangesFilter.MemoryFilter> memoryFilters = new LinkedList<ChangesFilter.MemoryFilter>();
final List<ChangesFilter.Filter> commandFilters = new LinkedList<ChangesFilter.Filter>();
final List<ChangesFilter.MemoryFilter> memoryFilters = new SmartList<ChangesFilter.MemoryFilter>();
final List<ChangesFilter.Filter> commandFilters = new SmartList<ChangesFilter.Filter>();
for (ChangesFilter.Filter filter : filters) {
final ChangesFilter.CommandParametersFilter commandFilter = filter.getCommandParametersFilter();
if (commandFilter == null) {
@@ -319,8 +320,8 @@ class GitTreeController implements ManageGitTreeView {
}
private void loadTagsNBranches() {
final List<String> branches = new LinkedList<String>();
final List<String> tags = new LinkedList<String>();
final List<String> branches = new ArrayList<String>();
final List<String> tags = new ArrayList<String>();
try {
myAccess.loadAllBranches(branches);
@@ -381,7 +382,7 @@ class GitTreeController implements ManageGitTreeView {
myAlarm.addRequest(new Runnable() {
public void run() {
// start from beginning
final List<Pair<Date, SHAHash>> wayList = new LinkedList<Pair<Date, SHAHash>>();
final List<Pair<Date, SHAHash>> wayList = new SmartList<Pair<Date, SHAHash>>();
while (true) {
final Pair<Date, SHAHash> startFrom = wayList.isEmpty() ? null : wayList.get(wayList.size() - 1);
@@ -438,7 +439,7 @@ class GitTreeController implements ManageGitTreeView {
final Application application = ApplicationManager.getApplication();
myAlarm.addRequest(new Runnable() {
public void run() {
final List<CommittedChangeList> loaded = new LinkedList<CommittedChangeList>();
final List<CommittedChangeList> loaded = new ArrayList<CommittedChangeList>();
final Set<Long> requested = new HashSet<Long>(hashes.size());
for (SHAHash hash : hashes) {
requested.add(GitChangeUtils.longForSHAHash(hash.getValue()));
@@ -483,11 +484,11 @@ class GitTreeController implements ManageGitTreeView {
}
public List<String> getAllBranchesOrdered() {
return new ArrayList<String>(myBranches.get());
return Collections.unmodifiableList(myBranches.get());
}
public List<String> getAllTagsOrdered() {
return new ArrayList<String>(myTags.get());
return Collections.unmodifiableList(myTags.get());
}
public boolean isInitialized() {
@@ -566,7 +567,7 @@ class GitTreeController implements ManageGitTreeView {
myLock = new Object();
myStartingPoints = new HashSet<String>();
myFilters = new HashSet<ChangesFilter.Filter>();
myContinuationPoints = new LinkedList<Pair<Date, SHAHash>>();
myContinuationPoints = new SmartList<Pair<Date, SHAHash>>();
}
public boolean isDirty() {
@@ -50,7 +50,7 @@ public class LowLevelAccessImpl implements LowLevelAccess {
@NotNull final Collection<String> endPoints,
@NotNull final Collection<ChangesFilter.Filter> filters,
int useMaxCnt) throws VcsException {
final List<String> parameters = new LinkedList<String>();
final List<String> parameters = new ArrayList<String>();
if (useMaxCnt > 0) {
parameters.add("--max-count=" + useMaxCnt);
}
@@ -76,7 +76,7 @@ public class LowLevelAccessImpl implements LowLevelAccess {
public Runnable loadHashesWithParents(final @NotNull Collection<String> startingPoints, @NotNull final Collection<ChangesFilter.Filter> filters,
final Consumer<CommitHashPlusParents> consumer) throws VcsException {
final List<String> parameters = new LinkedList<String>();
final List<String> parameters = new ArrayList<String>();
for (ChangesFilter.Filter filter : filters) {
filter.getCommandParametersFilter().applyToCommandLine(parameters);
}
@@ -101,7 +101,7 @@ public class LowLevelAccessImpl implements LowLevelAccess {
public void loadCommits(final Collection<String> startingPoints, final Date beforePoint, final Date afterPoint,
final Collection<ChangesFilter.Filter> filtersIn, final Consumer<GitCommit> consumer,
int maxCnt, List<String> branches) throws VcsException {
final Collection<ChangesFilter.Filter> filters = new LinkedList<ChangesFilter.Filter>(filtersIn);
final Collection<ChangesFilter.Filter> filters = new ArrayList<ChangesFilter.Filter>(filtersIn);
if (beforePoint != null) {
filters.add(new ChangesFilter.BeforeDate(new Date(beforePoint.getTime() - 1)));
}
@@ -136,7 +136,7 @@ public class LowLevelAccessImpl implements LowLevelAccess {
@NotNull final Consumer<GitCommit> consumer, final Collection<String> branches, int useMaxCnt)
throws VcsException {
final List<String> parameters = new LinkedList<String>();
final List<String> parameters = new ArrayList<String>();
if (useMaxCnt > 0) {
parameters.add("--max-count=" + (useMaxCnt + 1));
}
@@ -166,14 +166,14 @@ public class LowLevelAccessImpl implements LowLevelAccess {
}
public Collection<String> getBranchesWithCommit(final SHAHash hash) throws VcsException {
final List<String> result = new LinkedList<String>();
final List<String> result = new ArrayList<String>();
GitBranch.listAsStrings(myProject, myRoot, false, true, result, hash.getValue());
GitBranch.listAsStrings(myProject, myRoot, true, false, result, hash.getValue());
return result;
}
public Collection<String> getTagsWithCommit(final SHAHash hash) throws VcsException {
final List<String> result = new LinkedList<String>();
final List<String> result = new ArrayList<String>();
GitTag.listAsStrings(myProject, myRoot, result, hash.getValue());
return result;
}
@@ -49,10 +49,10 @@ public class Portion implements AsynchConsumer<GitCommit> {
myNameToHash = new HashMap<String, SHAHash>();
myHolder = new HashMap<String, Integer>();
myOrdered = new LinkedList<GitCommit>();
myOrdered = new ArrayList<GitCommit>();
myRoots = new LinkedList<GitCommit>();
myLeafs = new LinkedList<GitCommit>();
myRoots = new ArrayList<GitCommit>();
myLeafs = new ArrayList<GitCommit>();
myOrphanMap = new MultiMap<String, GitCommit>();
myUsers = new HashSet<String>();
@@ -160,7 +160,7 @@ public class LoaderImpl implements Loader {
myTreeComposite.clearMembers();
final List<LoaderBase> endOfTheList = new LinkedList<LoaderBase>();
final List<LoaderBase> endOfTheList = new ArrayList<LoaderBase>();
final Consumer<CommitHashPlusParents> consumer = createCommitsHolderConsumer(drawHierarchy);
final RefreshingCommitsPackConsumer listConsumer = new RefreshingCommitsPackConsumer(current, consumer);
@@ -44,7 +44,7 @@ public class TreeSkeletonImpl implements TreeSkeleton {
assert (size2Power < 16) && (wireEventsIdxSize2Power < 16) && (size2Power > 1) && (wireEventsIdxSize2Power > 1);
myList = new BigArray<Commit>(size2Power);
myWireEvents = new LinkedList<WireEvent>(); // todo can use another structure, a list of arrays?
myWireEvents = new ArrayList<WireEvent>(); // todo can use another structure, a list of arrays?
myWiresIndex = new WiresIndex(wireEventsIdxSize2Power);
myAsCommitList = new ReadonlyList<Commit>() {
@Override
@@ -26,7 +26,7 @@ import git4idea.i18n.GitBundle;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
/**
@@ -68,7 +68,7 @@ public class CurrentBranchDialog extends DialogWrapper {
/**
* The branches to merge
*/
private final List<GitBranch> myBranches = new LinkedList<GitBranch>();
private final List<GitBranch> myBranches = new ArrayList<GitBranch>();
/**
* The repository tracked for the current branch
*/
@@ -31,7 +31,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -341,10 +342,10 @@ public class GitIgnoreTracker {
*/
private void checkExcludeFile(VirtualFile file) {
String path = file.getPath();
LinkedList<VirtualFile> toDirty = null;
List<VirtualFile> toDirty = null;
synchronized (myExcludeFiles) {
if (myExcludeFilesPaths.contains(path)) {
toDirty = new LinkedList<VirtualFile>();
toDirty = new ArrayList<VirtualFile>();
for (Map.Entry<VirtualFile, String> entry : myExcludeFiles.entrySet()) {
if (path.equals(entry.getValue())) {
toDirty.add(entry.getKey());
@@ -158,7 +158,7 @@ public class SSHConfig {
host.myPort = parseInt(argument);
}
else if ("PreferredAuthentications".equalsIgnoreCase(keyword)) {
final LinkedList<String> list = parseList(argument);
final List<String> list = parseList(argument);
list.retainAll(ALLOWED_METHODS);
if (!list.isEmpty()) {
host.myPreferredMethods = Collections.unmodifiableList(list);
@@ -254,8 +254,8 @@ public class SSHConfig {
return "yes".equals(value);
}
private static LinkedList<String> parseList(final String arg) {
LinkedList<String> values = new LinkedList<String>();
private static List<String> parseList(final String arg) {
List<String> values = new ArrayList<String>();
for (String a : arg.split("[ \t,]+")) {
if (a.length() == 0) {
continue;