Skip to content

Commit c74f4a9

Browse files
committed
Fix the HDInsightLoader uninitialized issue on Eclipse Mac/Linux
Sometime, the Azure Explorer is lazy initialized, which caused HDInsightLoader not set. Signed-off-by: Wei Zhang <[email protected]>
1 parent 9d2792e commit c74f4a9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.azureexplorer/src/com/microsoft/azuretools/azureexplorer/Activator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public void start(BundleContext context) throws Exception {
6262
super.start(context);
6363
plugin = this;
6464
DefaultLoader.setUiHelper(new UIHelperImpl());
65-
HDInsightLoader.setHHDInsightHelper(new com.microsoft.azuretools.azureexplorer.helpers.HDInsightHelperImpl());
65+
com.microsoft.azuretools.azureexplorer.helpers.HDInsightHelperImpl.initHDInsightLoader();
66+
6667
Node.setNode2Actions(NodeActionsMap.node2Actions);
6768
// ServiceExplorerView serviceExplorerView = (ServiceExplorerView) PlatformUI
6869
// .getWorkbench().getActiveWorkbenchWindow()

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.azureexplorer/src/com/microsoft/azuretools/azureexplorer/helpers/HDInsightHelperImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.osgi.framework.BundleException;
3333

3434
import com.microsoft.azure.hdinsight.common.HDInsightHelper;
35+
import com.microsoft.azure.hdinsight.common.HDInsightLoader;
3536
import com.microsoft.azure.hdinsight.common.JobViewManager;
3637
import com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail;
3738
import com.microsoft.azuretools.azurecommons.helpers.NotNull;
@@ -108,4 +109,10 @@ public boolean isIntelliJPlugin() {
108109
public boolean isOptIn() {
109110
return isOptIn;
110111
}
112+
113+
public static synchronized void initHDInsightLoader() {
114+
if (HDInsightLoader.getHDInsightHelper() == null) {
115+
HDInsightLoader.setHHDInsightHelper(new com.microsoft.azuretools.azureexplorer.helpers.HDInsightHelperImpl());
116+
}
117+
}
111118
}

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.hdinsight/src/com/microsoft/azuretools/hdinsight/Activator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.osgi.framework.BundleContext;
2727

2828
import com.microsoft.tooling.msservices.components.DefaultLoader;
29+
import com.microsoft.azure.hdinsight.common.HDInsightLoader;
2930
import com.microsoft.azuretools.azurecommons.helpers.StringHelper;
3031
import com.microsoft.azuretools.telemetry.AppInsightsClient;
3132
import com.microsoft.azuretools.hdinsight.util.HDInsightJobViewUtils;
@@ -55,6 +56,9 @@ public Activator() {
5556
public void start(BundleContext context) throws Exception {
5657
super.start(context);
5758
plugin = this;
59+
60+
com.microsoft.azuretools.azureexplorer.helpers.HDInsightHelperImpl.initHDInsightLoader();
61+
5862
String enabledProperty = DefaultLoader.getIdeHelper().getProperty(Messages.HDInsightFeatureEnabled);
5963
if(StringHelper.isNullOrWhiteSpace(enabledProperty)) {
6064
AppInsightsClient.create(Messages.HDInsightFeatureEnabled, context.getBundle().getVersion().toString());

0 commit comments

Comments
 (0)