mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-95898 Gradle based projects should offer Auto-Import as Maven projects do
Remove unnecessary use change ttl processing
This commit is contained in:
-16
@@ -24,12 +24,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class AbstractGradleUserProjectChange<T extends AbstractGradleUserProjectChange> implements GradleUserProjectChange<T> {
|
||||
|
||||
private long myTimestamp;
|
||||
|
||||
protected AbstractGradleUserProjectChange() {
|
||||
myTimestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -41,14 +35,4 @@ public abstract class AbstractGradleUserProjectChange<T extends AbstractGradleUs
|
||||
public void loadState(T state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimestamp() {
|
||||
return myTimestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimestamp(long timestamp) {
|
||||
myTimestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
-10
@@ -31,14 +31,4 @@ import org.jetbrains.annotations.NotNull;
|
||||
public interface GradleUserProjectChange<T extends GradleUserProjectChange> extends PersistentStateComponent<T>, Comparable<T> {
|
||||
|
||||
void invite(@NotNull GradleUserProjectChangeVisitor visitor);
|
||||
|
||||
/**
|
||||
* @return timestamp of the last known point when current change was not outdated. This information is useful
|
||||
* if we want to return a change if it was inactive for a while (e.g. a user temporarily added a module and after
|
||||
* that project files are re-written on update from VCS. We don't want to keep the change forever then)
|
||||
*/
|
||||
long getTimestamp();
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration") // Used by IJ serialization
|
||||
void setTimestamp(long timestamp);
|
||||
}
|
||||
|
||||
+1
-4
@@ -137,10 +137,7 @@ public class GradleUserProjectChangesCalculator {
|
||||
public void filterOutdatedChanges() {
|
||||
Set<GradleUserProjectChange> changes = ContainerUtilRt.newHashSet(mySettings.getUserProjectChanges());
|
||||
for (GradleUserProjectChange change : mySettings.getUserProjectChanges()) {
|
||||
if (isUpToDate(change)) {
|
||||
change.setTimestamp(System.currentTimeMillis());
|
||||
}
|
||||
else {
|
||||
if (!isUpToDate(change)) {
|
||||
changes.remove(change);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.jetbrains.plugins.gradle.config;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -14,7 +13,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@@ -26,8 +24,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
@State(name = "GradleLocalSettings", storages = {@Storage(file = StoragePathMacros.WORKSPACE_FILE)} )
|
||||
public class GradleLocalSettings implements PersistentStateComponent<GradleLocalSettings> {
|
||||
|
||||
private static final long USER_CHANGE_TTL_MS = SystemProperties.getIntProperty("gradle.user.change.ttl", (int)TimeUnit.DAYS.toMillis(7));
|
||||
|
||||
private static final boolean PRESERVE_EXPAND_STATE = !SystemProperties.getBooleanProperty("gradle.forget.expand.nodes.state", false);
|
||||
|
||||
/** Holds changes confirmed by the end-user. */
|
||||
@@ -57,20 +53,6 @@ public class GradleLocalSettings implements PersistentStateComponent<GradleLocal
|
||||
@Override
|
||||
public void loadState(GradleLocalSettings state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
Set<GradleUserProjectChange> activeChange = ContainerUtilRt.newHashSet();
|
||||
boolean update = false;
|
||||
long now = System.currentTimeMillis();
|
||||
for (GradleUserProjectChange change : getUserProjectChanges()) {
|
||||
if (now - change.getTimestamp() > USER_CHANGE_TTL_MS) {
|
||||
update = true;
|
||||
}
|
||||
else {
|
||||
activeChange.add(change);
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
setUserProjectChanges(activeChange);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
|
||||
Reference in New Issue
Block a user