Skip to content

Commit 7198479

Browse files
authored
Fix PluginException caused by JavaFX deprecation in IntelliJ 2020.2 issue (#5001)
* Fix JavaFX deprecated in IntelliJ 2020.2 issue * Fix format * Fix build break caused by symbol JobViewPanel not found * Remove unused javafx context
1 parent a38b8d1 commit 7198479

File tree

8 files changed

+49
-75
lines changed

8 files changed

+49
-75
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ intellij_version=IC-2020.2
55
dep_plugins=org.intellij.scala:2020.2.14
66
applicationinsights.key=57cc111a-36a8-44b3-b044-25d293b8b77c
77
updateVersionRange=true
8-
patchPluginXmlSinceBuild=202.6397.20
8+
patchPluginXmlSinceBuild=202.6397.94

PluginsAndFeatures/azure-toolkit-for-intellij/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</change-notes>
4343

4444
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
45-
<idea-version since-build="202.6397.20" until-build="202.*"/>
45+
<idea-version since-build="202.6397.94" until-build="202.*"/>
4646
<resource-bundle>com.microsoft.azure.toolkit.operation.titles</resource-bundle>
4747
<resource-bundle>com.microsoft.intellij.ui.messages.messages</resource-bundle>
4848
<resource-bundle>com.microsoft.intellij.hdinsight.messages.messages</resource-bundle>

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/jobs/framework/JobViewEditor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.intellij.openapi.project.Project;
1313
import com.intellij.openapi.util.Key;
1414
import com.intellij.openapi.vfs.VirtualFile;
15-
import com.microsoft.azure.hdinsight.spark.jobs.framework.JobViewPanel;
1615
import com.microsoft.azuretools.telemetry.AppInsightsClient;
1716
import com.microsoft.azuretools.telemetry.TelemetryConstants;
1817
import com.microsoft.azuretools.telemetrywrapper.EventType;
@@ -44,7 +43,7 @@ public JobViewEditor(@NotNull final Project project, @NotNull final VirtualFile
4443
myProvider = provider;
4544
myVirtualFile = file;
4645
uuid = file.getUserData(JobViewEditorProvider.JOB_VIEW_UUID);
47-
myComponent = new JobViewPanel(PluginUtil.getPluginRootDirectory(), uuid);
46+
myComponent = new JobViewPanel(PluginUtil.getPluginRootDirectory(), uuid).getComponent();
4847
AppInsightsClient.create(HDInsightBundle.message("HDInsightSparkJobview"), null);
4948
EventUtil.logEvent(EventType.info, TelemetryConstants.HDINSIGHT,
5049
HDInsightBundle.message("HDInsightSparkJobview"), null);
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
package com.microsoft.azure.hdinsight.jobs.framework
6+
7+
import com.intellij.ui.jcef.JBCefApp
8+
import com.intellij.ui.jcef.JBCefBrowser
9+
import com.microsoft.azure.hdinsight.spark.jobs.JobViewHttpServer
10+
import java.awt.BorderLayout
11+
import javax.swing.JComponent
12+
import javax.swing.JPanel
13+
14+
class JobViewPanel(private val rootPath: String, private val clusterName: String) {
15+
private val QUERY_TEMPLATE = "?clusterName=%s&port=%s"
16+
private val myComponent: JComponent
17+
18+
init {
19+
val url = String.format("file:///%s/com.microsoft.hdinsight/hdinsight/job/html/index.html", rootPath)
20+
/*
21+
// for debug only
22+
final String ideaSystemPath = System.getProperty("idea.system.path");
23+
if(!StringHelper.isNullOrWhiteSpace(ideaSystemPath) && ideaSystemPath.contains("idea-sandbox")) {
24+
final String workFolder = System.getProperty("user.dir");
25+
final String path = "Utils/hdinsight-node-common/resources/htmlResources/hdinsight/job/html/index.html";
26+
url = String.format("file:///%s/%s", workFolder, path);
27+
}
28+
*/
29+
val queryString = String.format(QUERY_TEMPLATE, clusterName, JobViewHttpServer.getPort())
30+
val webUrl = url + queryString
31+
32+
if (!JBCefApp.isSupported()) {
33+
throw RuntimeException("JCEF is not enabled in current IDE. Please follow the instruction to enable JCEF first. https://youtrack.jetbrains" +
34+
".com/issue/IDEA-231833#focus=streamItem-27-3993099.0-0")
35+
}
36+
37+
val panel = JPanel(BorderLayout())
38+
panel.add(JBCefBrowser(webUrl).component)
39+
myComponent = panel
40+
}
41+
42+
val component: JComponent
43+
get() = myComponent
44+
}

Utils/hdinsight-node-common/resources/htmlResources/hdinsight/job/html/sparkjobview.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ function getBasicInfoFromUrl() {
141141

142142
spark.sourceType = spark.queriresMap['sourcetype'] === undefined ? "intellij" : "eclipse";
143143
spark.clusterName = spark.queriresMap['clusterName'];
144-
spark.engineType = spark.queriresMap['engineType'];
145144
spark.queryPort = spark.queriresMap['port'];
146145
spark.localhost = 'http://localhost:{0}'.format(spark.queryPort);
147146

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/common/JobViewManager.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55

66
package com.microsoft.azure.hdinsight.common;
77

8+
import com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail;
89
import com.microsoft.azure.hdinsight.sdk.rest.spark.Application;
910
import com.microsoft.azure.hdinsight.spark.jobs.ApplicationKey;
10-
import com.microsoft.azure.hdinsight.spark.jobs.framework.JobViewPanel;
11-
import com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail;
1211
import com.microsoft.azuretools.azurecommons.helpers.NotNull;
1312
import com.microsoft.azuretools.azurecommons.helpers.Nullable;
14-
import javafx.util.Pair;
1513

16-
import java.util.HashMap;
1714
import java.util.List;
1815
import java.util.Map;
1916
import java.util.concurrent.ConcurrentHashMap;

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/jobs/framework/JobViewPanel.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARTIFACTS_DIR=artifacts
22
INJECT_INTELLIJ_VERSION=true
3-
IJ_VERSION_MAJOR_BUILD=202.6397.20
3+
IJ_VERSION_MAJOR_BUILD=202.6397.94
44
IJ_VERSION_MAJOR=2020.2
55
IJ_VERSION_MINOR=
66
IJ_SCALA_VERSION_LATEST=2020.2.14

0 commit comments

Comments
 (0)