This commit is contained in:
Alexey Kudravtsev
2017-11-20 16:32:24 +03:00
parent 2fdfe63169
commit b195c7bb9d
4 changed files with 15 additions and 21 deletions
@@ -19,6 +19,7 @@ import com.intellij.execution.configuration.RunConfigurationExtensionsManager;
import com.intellij.execution.configurations.RunConfigurationBase;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.NotNull;
public class JavaRunConfigurationExtensionManager extends RunConfigurationExtensionsManager<RunConfigurationBase, RunConfigurationExtension> {
private static final Logger LOG = Logger.getInstance(RunConfigurationExtension.class);
@@ -40,11 +41,13 @@ public class JavaRunConfigurationExtensionManager extends RunConfigurationExtens
}
}
@NotNull
@Override
protected String getIdAttrName() {
return "name";
}
@NotNull
@Override
protected String getExtensionRootAttr() {
return "extension";
@@ -41,9 +41,7 @@ public class ComponentSerializationUtil {
if (element != null) {
Class<S> stateClass = getStateClass(configuration.getClass());
@SuppressWarnings("unchecked") S state = stateClass.equals(Element.class) ? (S)element : XmlSerializer.deserialize(element, stateClass);
if (state != null) {
configuration.loadState(state);
}
configuration.loadState(state);
}
}
}
@@ -31,10 +31,7 @@ import com.intellij.vcs.log.VcsUser;
import com.intellij.vcs.log.impl.VcsStatusDescriptor.MergedStatusInfo;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/**
@@ -163,7 +160,7 @@ public abstract class VcsChangesLazilyParsedDetails extends VcsCommitMetadataImp
if (getParents().size() <= 1) return changes;
// each merge change knows about all changes to parents
List<Change> wrappedChanges = ContainerUtil.newArrayList();
List<Change> wrappedChanges = new ArrayList<>(statuses.size());
for (int i = 0; i < statuses.size(); i++) {
wrappedChanges.add(new MyMergedChange(changes.get(i), statuses.get(i)));
}
@@ -244,7 +241,7 @@ public abstract class VcsChangesLazilyParsedDetails extends VcsCommitMetadataImp
@NotNull private final MergedStatusInfo<S> myStatusInfo;
@NotNull private final Supplier<List<Change>> mySourceChanges;
public MyMergedChange(@NotNull Change change, @NotNull MergedStatusInfo<S> statusInfo) {
MyMergedChange(@NotNull Change change, @NotNull MergedStatusInfo<S> statusInfo) {
super(change);
myStatusInfo = statusInfo;
mySourceChanges = Suppliers.memoize(() -> {
@@ -272,8 +269,7 @@ public abstract class VcsChangesLazilyParsedDetails extends VcsCommitMetadataImp
@NotNull private final Collection<Change> myMergedChanges;
@NotNull private final List<Collection<Change>> myChanges;
public ParsedChanges(@NotNull Collection<Change> mergedChanges,
@NotNull List<Collection<Change>> changes) {
ParsedChanges(@NotNull Collection<Change> mergedChanges, @NotNull List<Collection<Change>> changes) {
myMergedChanges = mergedChanges;
myChanges = changes;
}
+7 -10
View File
@@ -62,13 +62,8 @@ public final class GitCommit extends VcsChangesLazilyParsedDetails {
return false; // need to know the value from git.config to give correct answer
case REGISTRY:
Changes changes = myChanges.get();
int estimate;
if (changes instanceof UnparsedChanges) {
estimate = ((UnparsedChanges)changes).getRenameLimitEstimate();
}
else {
estimate = getRenameLimitEstimate();
}
int estimate =
changes instanceof UnparsedChanges ? ((UnparsedChanges)changes).getRenameLimitEstimate() : getRenameLimitEstimate();
return estimate <= Registry.intValue("git.diff.renameLimit");
}
return true;
@@ -101,6 +96,7 @@ public final class GitCommit extends VcsChangesLazilyParsedDetails {
super(project, changesOutput, new GitChangesDescriptor());
}
@Override
@NotNull
protected String absolutePath(@NotNull String path) {
try {
@@ -121,7 +117,7 @@ public final class GitCommit extends VcsChangesLazilyParsedDetails {
return GitChangesParser.parse(myProject, getRoot(), changes, getId().asString(), new Date(getCommitTime()), parentHash);
}
public int getRenameLimitEstimate() {
int getRenameLimitEstimate() {
int size = 0;
for (List<GitLogStatusInfo> changesWithParent : myChangesOutput) {
int sources = 0;
@@ -149,7 +145,7 @@ public final class GitCommit extends VcsChangesLazilyParsedDetails {
}
@NotNull
private GitChangeType getType(@NotNull Change.Type type) {
private static GitChangeType getType(@NotNull Change.Type type) {
switch (type) {
case MODIFICATION:
return GitChangeType.MODIFIED;
@@ -189,10 +185,11 @@ public final class GitCommit extends VcsChangesLazilyParsedDetails {
case COPIED:
case RENAMED:
return Change.Type.MOVED;
default:
case UNRESOLVED:
LOG.error("Unsupported status info " + info);
throw new RuntimeException(info.toString());
}
return null;
}
}
}