Skip to content

Commit

Permalink
refac and use property to set license check fast mode
Browse files Browse the repository at this point in the history
property instead of env var, because env var may not be accessible by running process: only a limited set of env vars are copied to child process running the IDE. Properties are set via IDE directly (Help > Edit Custom Properties)
  • Loading branch information
jonathanlermitage committed Dec 26, 2023
1 parent 7e1a875 commit 7a014f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -29,9 +29,9 @@
/**
* Check licence periodically.
*/
public class LicCheckIDEActivity implements ProjectActivity {
public class ExtraIconsLicenseCheckIDEActivity implements ProjectActivity {

private static final @NonNls Logger LOGGER = Logger.getInstance(LicCheckIDEActivity.class);
private static final @NonNls Logger LOGGER = Logger.getInstance(ExtraIconsLicenseCheckIDEActivity.class);

private static final ResourceBundle i18n = I18nUtils.getResourceBundle();

Expand All @@ -51,7 +51,7 @@ public Object execute(@NotNull Project project, @NotNull Continuation<? super Un
int check_delay_1 = 60_000; // 1 min
int check_delay_2 = 3_600_000; // 1 hr
int check_period = 3 * 3_600_000; // 3 hrs
if ("true".equals(System.getenv("EXTRA_ICONS_TEST_MODE"))) {
if ("true".equals(System.getProperty("extra.icons.license.check.fast", "false"))) {
check_delay_1 = 3_000; // 3 sec
check_delay_2 = 30_000; // 30 sec
check_period = 180_000; // 3 min
Expand Down Expand Up @@ -105,7 +105,7 @@ public void run() {
}

private ExtraIconsPluginType findInstalledPluginType() {
PluginDescriptor pluginDesc = PluginManager.getPluginByClass(LicCheckIDEActivity.class);
PluginDescriptor pluginDesc = PluginManager.getPluginByClass(ExtraIconsLicenseCheckIDEActivity.class);
if (pluginDesc == null) {
LOGGER.warn("Failed to find installed Extra Icons plugin by class, will list all installed plugins and try to find it");
Set<String> registeredIds = PluginId.getRegisteredIds().stream()
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Expand Up @@ -116,7 +116,7 @@
id="ExtraIcons_VFSChangesListenersProjectActivity"
order="last, after ExtraIcons_EnablerServicesProjectActivity"/>
<!-- Check plugin's license activation -->
<backgroundPostStartupActivity implementation="lermitage.intellij.extra.icons.activity.LicCheckIDEActivity"
<backgroundPostStartupActivity implementation="lermitage.intellij.extra.icons.activity.ExtraIconsLicenseCheckIDEActivity"
id="ExtraIcons_LicCheckProjectActivity"
order="last"/>
</extensions>
Expand Down

0 comments on commit 7a014f6

Please sign in to comment.