Signed-off-by: pengzhile <pengzhile@gmail.com>
pull/8/head
pengzhile 4 years ago
parent 1d10d496b3
commit fb52ae238c

@ -4,7 +4,7 @@ plugins {
}
group 'io.zhile.research.intellij'
version '2.0.1'
version '2.0.2'
sourceCompatibility = 1.7
targetCompatibility = 1.7
@ -29,6 +29,8 @@ intellij {
patchPluginXml {
changeNotes """<pre>
Release v2.0.2
1. sync prefs manually
Release v2.0.1
1. add option: Reset Automatically
Release v2.0.0

@ -29,7 +29,7 @@ public class Resetter {
private static final String DEVICE_ID_KEY = DEFAULT_VENDOR + ".device_id";
private static final String IDE_EVAL_PREFIX = DEFAULT_VENDOR + "/" + Constants.IDE_NAME_LOWER + "/" + Constants.IDE_HASH;
private static final String EVAL_KEY = "evlsprt";
private static final String AUTO_RESET_KEY = Constants.PLUGIN_PREFS_PREFIX + ".auto_reset";
private static final String AUTO_RESET_KEY = Constants.PLUGIN_PREFS_PREFIX + ".auto_reset." + Constants.IDE_NAME_LOWER + "." + Constants.IDE_HASH;
private static final PropertiesComponentImpl PROPS = (PropertiesComponentImpl) PropertiesComponent.getInstance();
@ -145,6 +145,8 @@ public class Resetter {
} else {
Prefs.remove(key);
}
syncPrefs();
break;
case PROPERTY:
PROPS.unsetValue(key);
@ -158,6 +160,15 @@ public class Resetter {
public static void setAutoReset(boolean isAutoReset) {
Prefs.putBoolean(AUTO_RESET_KEY, isAutoReset);
syncPrefs();
}
public static void syncPrefs() {
try {
Preferences.userRoot().sync();
} catch (BackingStoreException e) {
NotificationHelper.showError(null, "Flush preferences failed!");
}
}
protected static File getSharedFile(String fileName) {

@ -25,12 +25,13 @@ public class ResetTimer {
public static void resetLastResetTime() {
Prefs.putLong(RESET_KEY, System.currentTimeMillis());
Resetter.syncPrefs();
}
public static String getLastResetTimeStr() {
long lastResetTime = getLastResetTime();
return lastResetTime > 0 ? DateTime.getStringFromTimestamp(lastResetTime) : "not yet";
return lastResetTime > 0 ? DateTime.getStringFromTimestamp(lastResetTime) : "Not yet";
}
public void start(final AnAction resetAction) {

@ -34,7 +34,7 @@
<component id="3e8db" class="javax.swing.JCheckBox" binding="chkResetAuto">
<constraints/>
<properties>
<text value="Reset Automatically (per 25days)"/>
<text value="Reset Automatically (per 25 days)"/>
</properties>
</component>
<component id="382d3" class="javax.swing.JButton" binding="btnReload">

Loading…
Cancel
Save