2222
2323package com .microsoft .azure .hdinsight .spark .ui ;
2424
25+ import com .intellij .icons .AllIcons ;
26+ import com .intellij .ide .BrowserUtil ;
2527import com .intellij .openapi .fileChooser .FileChooser ;
2628import com .intellij .openapi .fileChooser .FileChooserDescriptor ;
2729import com .intellij .openapi .ui .TextFieldWithBrowseButton ;
30+ import com .intellij .openapi .ui .popup .IconButton ;
2831import com .intellij .openapi .vfs .VirtualFile ;
2932import com .intellij .ui .DocumentAdapter ;
33+ import com .intellij .ui .InplaceButton ;
3034import com .intellij .util .ui .JBUI ;
3135import com .microsoft .azure .hdinsight .common .CallBack ;
3236import com .microsoft .azure .hdinsight .common .ClusterManagerEx ;
37+ import com .microsoft .azure .hdinsight .common .Docs ;
3338import com .microsoft .azure .hdinsight .sdk .cluster .IClusterDetail ;
3439import com .microsoft .azure .hdinsight .sdk .common .HDIException ;
3540import com .microsoft .azure .hdinsight .spark .common .SparkBatchDebugSession ;
4550import javax .swing .event .DocumentListener ;
4651import java .awt .*;
4752import java .io .File ;
53+ import java .util .Locale ;
4854import java .util .concurrent .TimeUnit ;
4955
5056import static com .microsoft .azure .hdinsight .spark .common .SparkSubmitAdvancedConfigModel .SSHAuthType .UseKeyFile ;
@@ -62,6 +68,10 @@ public class SparkSubmissionAdvancedConfigDialog extends JDialog{
6268 this .advancedConfigModel = advancedConfigModel ;
6369
6470 this .updateCallBack = updateCallBack ;
71+
72+ // FIXME!!! Since the Intellij has no locale setting, just set en-us here.
73+ this .helpUrl = new Docs (Locale .US ).getDocUrlByTopic (Docs .TOPIC_CONNECT_HADOOP_LINUX_USING_SSH );
74+
6575 this .sshCheckSubject = PublishSubject .create ();
6676 this .inputListener = new DocumentAdapter () {
6777 @ Override
@@ -118,6 +128,7 @@ public SparkSubmitAdvancedConfigModel getAdvancedConfigModel() {
118128
119129 private SparkSubmitModel submitModel ;
120130 private SparkSubmitAdvancedConfigModel advancedConfigModel ;
131+ private String helpUrl ;
121132
122133 private final int margin = 12 ;
123134
@@ -135,6 +146,9 @@ public SparkSubmitAdvancedConfigModel getAdvancedConfigModel() {
135146 JButton cancelButton ;
136147 BackgroundTaskIndicator checkSshCertIndicator ;
137148 DocumentListener inputListener ;
149+ IconButton helpButton ;
150+ JPanel helpPanel ;
151+ JPanel operationPanel ;
138152
139153 private PublishSubject <String > sshCheckSubject ;
140154 private Subscription sshCheckSubscription ;
@@ -228,7 +242,7 @@ private void addMainPanel() {
228242 }
229243
230244 private void addOperationPanel () {
231- JPanel operationPanel = new JPanel ();
245+ operationPanel = new JPanel ();
232246 operationPanel .setLayout (new FlowLayout ());
233247
234248 okButton = new JButton ("Ok" );
@@ -239,8 +253,16 @@ private void addOperationPanel() {
239253
240254 getRootPane ().setDefaultButton (cancelButton );
241255
256+ helpPanel = new JPanel ();
257+ helpPanel .setLayout (new BoxLayout (helpPanel , BoxLayout .LINE_AXIS ));
258+
259+ helpButton = new IconButton ("Help about connection to HDInsight using SSH" , AllIcons .Actions .Help );
242260 checkSshCertIndicator = new BackgroundTaskIndicator ("Verify SSH Authentication..." );
243- add (checkSshCertIndicator ,
261+
262+ helpPanel .add (new InplaceButton (helpButton , e -> BrowserUtil .browse (this .helpUrl )));
263+ helpPanel .add (checkSshCertIndicator );
264+
265+ add (helpPanel ,
244266 new GridBagConstraints (0 , ++displayLayoutCurrentRow ,
245267 0 , 1 ,
246268 1 , 0 ,
0 commit comments