advanced settings: calendar fix

This commit is contained in:
honfika@gmail.com
2015-11-25 07:23:11 +01:00
parent 7eb2713bd6
commit f6e201583e
3 changed files with 43 additions and 8 deletions

View File

@@ -262,6 +262,7 @@ public class Configuration {
public static final ConfigurationItem<HashMap<String, SwfSpecificConfiguration>> swfSpecificConfigs = null;
@ConfigurationDefaultCalendar(0)
public static final ConfigurationItem<Calendar> lastUpdatesCheckDate = null;
@ConfigurationDefaultInt(1000)
@@ -741,12 +742,6 @@ public class Configuration {
}
//limit paralel threads?
//int processorCount = Runtime.getRuntime().availableProcessors();
if (lastUpdatesCheckDate.get() == null) {
GregorianCalendar mingc = new GregorianCalendar();
mingc.setTime(new Date(Long.MIN_VALUE));
lastUpdatesCheckDate.set(mingc);
}
}
@SuppressWarnings("unchecked")
@@ -817,6 +812,12 @@ public class Configuration {
if (aDouble != null) {
defaultValue = aDouble.value();
}
ConfigurationDefaultCalendar aCalendar = field.getAnnotation(ConfigurationDefaultCalendar.class);
if (aCalendar != null) {
GregorianCalendar mingc = new GregorianCalendar();
mingc.setTime(new Date(aCalendar.value()));
defaultValue = mingc;
}
return defaultValue;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ConfigurationDefaultCalendar {
long value();
}