File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed
PluginsAndFeatures/azure-toolkit-for-intellij
azure-intellij-plugin-lib/src/main
java/com/microsoft/azure/toolkit/intellij/common/preload
azure-sdk-reference-book/src/main/java/com/microsoft/azure/toolkit/intellij/azuresdk Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) Microsoft Corporation. All rights reserved.
3+ * Licensed under the MIT License. See License.txt in the project root for license information.
4+ */
5+
6+ package com .microsoft .azure .toolkit .intellij .common .preload ;
7+
8+ import com .intellij .openapi .application .ApplicationManager ;
9+ import com .intellij .openapi .application .PreloadingActivity ;
10+ import com .intellij .openapi .progress .ProgressIndicator ;
11+ import com .microsoft .azure .toolkit .lib .common .cache .Preloader ;
12+ import lombok .extern .java .Log ;
13+
14+ @ Log
15+ public class AzurePreloadingActivity extends PreloadingActivity {
16+
17+ @ Override
18+ public void preload (@ org .jetbrains .annotations .NotNull final ProgressIndicator indicator ) {
19+ // Using progress manager as azure task manager is not initialized
20+ ApplicationManager .getApplication ().executeOnPooledThread (Preloader ::load );
21+ }
22+ }
Original file line number Diff line number Diff line change 22 <extensionPoints >
33 </extensionPoints >
44 <extensions defaultExtensionNs =" com.intellij" >
5+ <preloadingActivity implementation =" com.microsoft.azure.toolkit.intellij.common.preload.AzurePreloadingActivity" />
56 </extensions >
67 <actions >
78 </actions >
Original file line number Diff line number Diff line change 3737import org .apache .commons .lang3 .StringUtils ;
3838import org .jetbrains .annotations .NotNull ;
3939
40- import javax .annotation .Nonnull ;
4140import javax .swing .*;
4241import javax .swing .tree .DefaultMutableTreeNode ;
4342import javax .swing .tree .DefaultTreeModel ;
@@ -96,7 +95,7 @@ private void filter(final String text) {
9695 this .loadData (this .services , filters );
9796 }
9897
99- public void refresh (Boolean ... force ) {
98+ public void refresh (boolean ... force ) {
10099 try {
101100 this .services = AzureSdkLibraryService .loadAzureSdkServices (force );
102101 this .filter .debounce ();
@@ -175,7 +174,7 @@ public final void actionPerformed(@NotNull final AnActionEvent e) {
175174 this .loading = true ;
176175 ActivityTracker .getInstance ().inc ();
177176 AzureTaskManager .getInstance ().runLater (() -> {
178- AzureSdkTreePanel .this .reload ( );
177+ AzureSdkTreePanel .this .refresh ( true );
179178 this .loading = false ;
180179 });
181180 }
Original file line number Diff line number Diff line change 1212import com .fasterxml .jackson .dataformat .yaml .YAMLMapper ;
1313import com .microsoft .azure .toolkit .intellij .azuresdk .model .AzureSdkServiceEntity ;
1414import com .microsoft .azure .toolkit .lib .common .cache .Cacheable ;
15+ import com .microsoft .azure .toolkit .lib .common .cache .Preload ;
1516
1617import java .io .IOException ;
1718import java .net .URL ;
@@ -21,6 +22,7 @@ public class AzureSdkLibraryService {
2122 private static final ObjectMapper mapper = new YAMLMapper ().configure (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES , false );
2223 private static final String SDK_METADATA_URL = "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/spring/spring-reference.yml" ;
2324
25+ @ Preload
2426 @ Cacheable (value = "sdk-services" , condition = "!(force&&force[0])" )
2527 public static List <AzureSdkServiceEntity > loadAzureSdkServices (boolean ... force ) throws IOException {
2628 final URL destination = new URL (SDK_METADATA_URL );
You can’t perform that action at this time.
0 commit comments