@@ -750,7 +750,7 @@ export class TunnelPanel extends ViewPane {
750
750
static readonly TITLE : ILocalizedString = nls . localize2 ( 'remote.tunnel' , "Ports" ) ;
751
751
752
752
private panelContainer : HTMLElement | undefined ;
753
- private table ! : WorkbenchTable < ITunnelItem > ;
753
+ private table : WorkbenchTable < ITunnelItem > | undefined ;
754
754
private readonly tableDisposables : DisposableStore = this . _register ( new DisposableStore ( ) ) ;
755
755
private tunnelTypeContext : IContextKey < TunnelType > ;
756
756
private tunnelCloseableContext : IContextKey < boolean > ;
@@ -830,7 +830,7 @@ export class TunnelPanel extends ViewPane {
830
830
updateActions ( ) ;
831
831
this . registerPrivacyActions ( ) ;
832
832
this . createTable ( ) ;
833
- this . table . layout ( this . height , this . width ) ;
833
+ this . table ? .layout ( this . height , this . width ) ;
834
834
}
835
835
} ) ) ;
836
836
}
@@ -913,7 +913,7 @@ export class TunnelPanel extends ViewPane {
913
913
this . tableDisposables . add ( this . table . onDidFocus ( ( ) => this . tunnelViewFocusContext . set ( true ) ) ) ;
914
914
this . tableDisposables . add ( this . table . onDidBlur ( ( ) => this . tunnelViewFocusContext . set ( false ) ) ) ;
915
915
916
- const rerender = ( ) => this . table . splice ( 0 , Number . POSITIVE_INFINITY , this . viewModel . all ) ;
916
+ const rerender = ( ) => this . table ? .splice ( 0 , Number . POSITIVE_INFINITY , this . viewModel . all ) ;
917
917
918
918
rerender ( ) ;
919
919
let lastPortCount = this . portCount ;
@@ -927,7 +927,7 @@ export class TunnelPanel extends ViewPane {
927
927
} ) ) ;
928
928
929
929
this . tableDisposables . add ( this . table . onMouseClick ( e => {
930
- if ( this . hasOpenLinkModifier ( e . browserEvent ) ) {
930
+ if ( this . hasOpenLinkModifier ( e . browserEvent ) && this . table ) {
931
931
const selection = this . table . getSelectedElements ( ) ;
932
932
if ( ( selection . length === 0 ) ||
933
933
( ( selection . length === 1 ) && ( selection [ 0 ] === e . element ) ) ) {
@@ -959,11 +959,11 @@ export class TunnelPanel extends ViewPane {
959
959
widgetContainer . classList . add ( 'highlight' ) ;
960
960
if ( ! e ) {
961
961
// When we are in editing mode for a new forward, rather than updating an existing one we need to reveal the input box since it might be out of view.
962
- this . table . reveal ( this . table . indexOf ( this . viewModel . input ) ) ;
962
+ this . table ? .reveal ( this . table . indexOf ( this . viewModel . input ) ) ;
963
963
}
964
964
} else {
965
965
if ( e && ( e . tunnel . tunnelType !== TunnelType . Add ) ) {
966
- this . table . setFocus ( this . lastFocus ) ;
966
+ this . table ? .setFocus ( this . lastFocus ) ;
967
967
}
968
968
this . focus ( ) ;
969
969
}
@@ -983,7 +983,7 @@ export class TunnelPanel extends ViewPane {
983
983
984
984
override focus ( ) : void {
985
985
super . focus ( ) ;
986
- this . table . domFocus ( ) ;
986
+ this . table ? .domFocus ( ) ;
987
987
}
988
988
989
989
private onFocusChanged ( event : ITableEvent < ITunnelItem > ) {
@@ -1045,7 +1045,7 @@ export class TunnelPanel extends ViewPane {
1045
1045
const node : TunnelItem | undefined = event . element ;
1046
1046
1047
1047
if ( node ) {
1048
- this . table . setFocus ( [ this . table . indexOf ( node ) ] ) ;
1048
+ this . table ? .setFocus ( [ this . table . indexOf ( node ) ] ) ;
1049
1049
this . tunnelTypeContext . set ( node . tunnelType ) ;
1050
1050
this . tunnelCloseableContext . set ( ! ! node . closeable ) ;
1051
1051
this . tunnelPrivacyContext . set ( node . privacy . id ) ;
@@ -1062,7 +1062,7 @@ export class TunnelPanel extends ViewPane {
1062
1062
this . contextMenuService . showContextMenu ( {
1063
1063
menuId : MenuId . TunnelContext ,
1064
1064
menuActionOptions : { shouldForwardArgs : true } ,
1065
- contextKeyService : this . table . contextKeyService ,
1065
+ contextKeyService : this . table ? .contextKeyService ,
1066
1066
getAnchor : ( ) => event . anchor ,
1067
1067
getActionViewItem : ( action ) => {
1068
1068
const keybinding = this . keybindingService . lookupKeybinding ( action . id ) ;
@@ -1073,7 +1073,7 @@ export class TunnelPanel extends ViewPane {
1073
1073
} ,
1074
1074
onHide : ( wasCancelled ?: boolean ) => {
1075
1075
if ( wasCancelled ) {
1076
- this . table . domFocus ( ) ;
1076
+ this . table ? .domFocus ( ) ;
1077
1077
}
1078
1078
} ,
1079
1079
getActionsContext : ( ) => node ?. strip ( ) ,
@@ -1093,7 +1093,7 @@ export class TunnelPanel extends ViewPane {
1093
1093
this . height = height ;
1094
1094
this . width = width ;
1095
1095
super . layoutBody ( height , width ) ;
1096
- this . table . layout ( height , width ) ;
1096
+ this . table ? .layout ( height , width ) ;
1097
1097
}
1098
1098
}
1099
1099
0 commit comments