@theia/core 1.18.0 → 1.21.0-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +3 -2
  2. package/lib/browser/about-dialog.d.ts.map +1 -1
  3. package/lib/browser/about-dialog.js +1 -1
  4. package/lib/browser/about-dialog.js.map +1 -1
  5. package/lib/browser/authentication-service.d.ts.map +1 -1
  6. package/lib/browser/authentication-service.js +1 -1
  7. package/lib/browser/authentication-service.js.map +1 -1
  8. package/lib/browser/color-registry.d.ts +3 -69
  9. package/lib/browser/color-registry.d.ts.map +1 -1
  10. package/lib/browser/color-registry.js +13 -27
  11. package/lib/browser/color-registry.js.map +1 -1
  12. package/lib/browser/common-frontend-contribution.d.ts +7 -13
  13. package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
  14. package/lib/browser/common-frontend-contribution.js +213 -250
  15. package/lib/browser/common-frontend-contribution.js.map +1 -1
  16. package/lib/browser/core-preferences.d.ts +1 -0
  17. package/lib/browser/core-preferences.d.ts.map +1 -1
  18. package/lib/browser/core-preferences.js +29 -19
  19. package/lib/browser/core-preferences.js.map +1 -1
  20. package/lib/browser/dialogs.d.ts +6 -0
  21. package/lib/browser/dialogs.d.ts.map +1 -1
  22. package/lib/browser/dialogs.js +10 -3
  23. package/lib/browser/dialogs.js.map +1 -1
  24. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  25. package/lib/browser/frontend-application-module.js +9 -5
  26. package/lib/browser/frontend-application-module.js.map +1 -1
  27. package/lib/browser/frontend-application.d.ts +6 -0
  28. package/lib/browser/frontend-application.d.ts.map +1 -1
  29. package/lib/browser/frontend-application.js +13 -0
  30. package/lib/browser/frontend-application.js.map +1 -1
  31. package/lib/browser/index.d.ts +1 -0
  32. package/lib/browser/index.d.ts.map +1 -1
  33. package/lib/browser/index.js +1 -0
  34. package/lib/browser/index.js.map +1 -1
  35. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.d.ts.map +1 -1
  36. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +16 -11
  37. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js.map +1 -1
  38. package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts +1 -1
  39. package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts.map +1 -1
  40. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js +6 -4
  41. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js.map +1 -1
  42. package/lib/browser/keyboard/keys.d.ts +2 -251
  43. package/lib/browser/keyboard/keys.d.ts.map +1 -1
  44. package/lib/browser/keyboard/keys.js +12 -614
  45. package/lib/browser/keyboard/keys.js.map +1 -1
  46. package/lib/browser/menu/browser-context-menu-renderer.d.ts +1 -1
  47. package/lib/browser/menu/browser-context-menu-renderer.d.ts.map +1 -1
  48. package/lib/browser/menu/browser-menu-plugin.d.ts +3 -0
  49. package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
  50. package/lib/browser/menu/browser-menu-plugin.js +24 -4
  51. package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
  52. package/lib/browser/messaging/ws-connection-provider.d.ts +3 -3
  53. package/lib/browser/messaging/ws-connection-provider.d.ts.map +1 -1
  54. package/lib/browser/messaging/ws-connection-provider.js +14 -4
  55. package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
  56. package/lib/browser/{nls.d.ts → nls-loader.d.ts} +1 -6
  57. package/lib/browser/nls-loader.d.ts.map +1 -0
  58. package/lib/browser/nls-loader.js +29 -0
  59. package/lib/browser/nls-loader.js.map +1 -0
  60. package/lib/browser/preferences/preference-provider.d.ts +0 -2
  61. package/lib/browser/preferences/preference-provider.d.ts.map +1 -1
  62. package/lib/browser/preferences/preference-provider.js +1 -5
  63. package/lib/browser/preferences/preference-provider.js.map +1 -1
  64. package/lib/browser/preferences/preference-service.spec.js +0 -3
  65. package/lib/browser/preferences/preference-service.spec.js.map +1 -1
  66. package/lib/browser/progress-status-bar-item.d.ts +1 -2
  67. package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
  68. package/lib/browser/progress-status-bar-item.js.map +1 -1
  69. package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts.map +1 -1
  70. package/lib/browser/quick-input/quick-command-frontend-contribution.js +2 -1
  71. package/lib/browser/quick-input/quick-command-frontend-contribution.js.map +1 -1
  72. package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
  73. package/lib/browser/quick-input/quick-command-service.js +2 -2
  74. package/lib/browser/quick-input/quick-command-service.js.map +1 -1
  75. package/lib/browser/quick-input/quick-input-service.d.ts +1 -201
  76. package/lib/browser/quick-input/quick-input-service.d.ts.map +1 -1
  77. package/lib/browser/quick-input/quick-input-service.js +11 -93
  78. package/lib/browser/quick-input/quick-input-service.js.map +1 -1
  79. package/lib/browser/quick-input/quick-view-service.d.ts +1 -2
  80. package/lib/browser/quick-input/quick-view-service.d.ts.map +1 -1
  81. package/lib/browser/quick-input/quick-view-service.js.map +1 -1
  82. package/lib/browser/shell/application-shell.d.ts +10 -8
  83. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  84. package/lib/browser/shell/application-shell.js +11 -19
  85. package/lib/browser/shell/application-shell.js.map +1 -1
  86. package/lib/browser/shell/current-widget-command-adapter.d.ts +39 -0
  87. package/lib/browser/shell/current-widget-command-adapter.d.ts.map +1 -0
  88. package/lib/browser/shell/current-widget-command-adapter.js +42 -0
  89. package/lib/browser/shell/current-widget-command-adapter.js.map +1 -0
  90. package/lib/browser/shell/shell-layout-restorer.d.ts.map +1 -1
  91. package/lib/browser/shell/shell-layout-restorer.js +5 -3
  92. package/lib/browser/shell/shell-layout-restorer.js.map +1 -1
  93. package/lib/browser/shell/tab-bar-decorator.d.ts +1 -1
  94. package/lib/browser/shell/tab-bar-decorator.d.ts.map +1 -1
  95. package/lib/browser/shell/tab-bar-decorator.js.map +1 -1
  96. package/lib/browser/shell/tab-bar-toolbar.d.ts.map +1 -1
  97. package/lib/browser/shell/tab-bar-toolbar.js +2 -1
  98. package/lib/browser/shell/tab-bar-toolbar.js.map +1 -1
  99. package/lib/browser/shell/tab-bars.d.ts +22 -3
  100. package/lib/browser/shell/tab-bars.d.ts.map +1 -1
  101. package/lib/browser/shell/tab-bars.js +129 -10
  102. package/lib/browser/shell/tab-bars.js.map +1 -1
  103. package/lib/browser/storage-service.spec.js +1 -1
  104. package/lib/browser/storage-service.spec.js.map +1 -1
  105. package/lib/browser/theming.d.ts +5 -14
  106. package/lib/browser/theming.d.ts.map +1 -1
  107. package/lib/browser/theming.js +14 -0
  108. package/lib/browser/theming.js.map +1 -1
  109. package/lib/browser/tooltip-service.d.ts +52 -0
  110. package/lib/browser/tooltip-service.d.ts.map +1 -0
  111. package/lib/browser/tooltip-service.js +89 -0
  112. package/lib/browser/tooltip-service.js.map +1 -0
  113. package/lib/browser/tree/tree-model.d.ts.map +1 -1
  114. package/lib/browser/view-container.d.ts +55 -14
  115. package/lib/browser/view-container.d.ts.map +1 -1
  116. package/lib/browser/view-container.js +284 -66
  117. package/lib/browser/view-container.js.map +1 -1
  118. package/lib/browser/window/default-window-service.js +2 -2
  119. package/lib/browser/window/default-window-service.js.map +1 -1
  120. package/lib/browser/window/window-service.d.ts +1 -7
  121. package/lib/browser/window/window-service.d.ts.map +1 -1
  122. package/lib/browser/window/window-service.js +1 -5
  123. package/lib/browser/window/window-service.js.map +1 -1
  124. package/lib/browser/window-contribution.d.ts.map +1 -1
  125. package/lib/browser/window-contribution.js +2 -2
  126. package/lib/browser/window-contribution.js.map +1 -1
  127. package/lib/common/color.d.ts +84 -0
  128. package/lib/common/color.d.ts.map +1 -0
  129. package/lib/common/color.js +44 -0
  130. package/lib/common/color.js.map +1 -0
  131. package/lib/common/command.d.ts +1 -0
  132. package/lib/common/command.d.ts.map +1 -1
  133. package/lib/common/command.js +5 -2
  134. package/lib/common/command.js.map +1 -1
  135. package/lib/common/i18n/localization.d.ts +14 -0
  136. package/lib/common/i18n/localization.d.ts.map +1 -1
  137. package/lib/common/i18n/localization.js +54 -1
  138. package/lib/common/i18n/localization.js.map +1 -1
  139. package/lib/common/index.d.ts +1 -0
  140. package/lib/common/index.d.ts.map +1 -1
  141. package/lib/common/index.js +1 -0
  142. package/lib/common/index.js.map +1 -1
  143. package/lib/common/keys.d.ts +269 -0
  144. package/lib/common/keys.d.ts.map +1 -0
  145. package/lib/common/keys.js +634 -0
  146. package/lib/common/keys.js.map +1 -0
  147. package/lib/common/messaging/abstract-connection-provider.d.ts +1 -1
  148. package/lib/common/messaging/abstract-connection-provider.d.ts.map +1 -1
  149. package/lib/common/messaging/abstract-connection-provider.js +3 -1
  150. package/lib/common/messaging/abstract-connection-provider.js.map +1 -1
  151. package/lib/common/messaging/proxy-factory.js +1 -1
  152. package/lib/common/messaging/proxy-factory.js.map +1 -1
  153. package/lib/common/nls.d.ts +28 -0
  154. package/lib/common/nls.d.ts.map +1 -0
  155. package/lib/common/nls.js +91 -0
  156. package/lib/common/nls.js.map +1 -0
  157. package/lib/common/path.d.ts +6 -0
  158. package/lib/common/path.d.ts.map +1 -1
  159. package/lib/common/path.js +16 -4
  160. package/lib/common/path.js.map +1 -1
  161. package/lib/common/path.spec.js +12 -0
  162. package/lib/common/path.spec.js.map +1 -1
  163. package/lib/common/promise-util.d.ts +5 -2
  164. package/lib/common/promise-util.d.ts.map +1 -1
  165. package/lib/common/promise-util.js +16 -1
  166. package/lib/common/promise-util.js.map +1 -1
  167. package/lib/common/promise-util.spec.d.ts +2 -0
  168. package/lib/common/promise-util.spec.d.ts.map +1 -0
  169. package/lib/common/promise-util.spec.js +42 -0
  170. package/lib/common/promise-util.spec.js.map +1 -0
  171. package/lib/common/quick-pick-service.d.ts +219 -1
  172. package/lib/common/quick-pick-service.d.ts.map +1 -1
  173. package/lib/common/quick-pick-service.js +108 -1
  174. package/lib/common/quick-pick-service.js.map +1 -1
  175. package/lib/common/theme.d.ts +30 -0
  176. package/lib/common/theme.d.ts.map +1 -0
  177. package/lib/common/theme.js +18 -0
  178. package/lib/common/theme.js.map +1 -0
  179. package/lib/common/window.d.ts +29 -0
  180. package/lib/common/window.d.ts.map +1 -0
  181. package/lib/common/window.js +23 -0
  182. package/lib/common/window.js.map +1 -0
  183. package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +9 -5
  184. package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
  185. package/lib/electron-browser/menu/electron-context-menu-renderer.js +40 -15
  186. package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
  187. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -8
  188. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
  189. package/lib/electron-browser/menu/electron-main-menu-factory.js +10 -17
  190. package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
  191. package/lib/electron-browser/menu/electron-menu-contribution.d.ts +15 -7
  192. package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
  193. package/lib/electron-browser/menu/electron-menu-contribution.js +112 -42
  194. package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
  195. package/lib/electron-browser/window/electron-window-preferences.d.ts +1 -0
  196. package/lib/electron-browser/window/electron-window-preferences.d.ts.map +1 -1
  197. package/lib/electron-browser/window/electron-window-preferences.js +12 -1
  198. package/lib/electron-browser/window/electron-window-preferences.js.map +1 -1
  199. package/lib/electron-browser/window/electron-window-service.d.ts +1 -1
  200. package/lib/electron-browser/window/electron-window-service.d.ts.map +1 -1
  201. package/lib/electron-common/electron-main-window-service.d.ts +1 -1
  202. package/lib/electron-common/electron-main-window-service.d.ts.map +1 -1
  203. package/lib/electron-common/electron-main-window-service.js.map +1 -1
  204. package/lib/electron-common/messaging/electron-messages.d.ts +20 -0
  205. package/lib/electron-common/messaging/electron-messages.d.ts.map +1 -0
  206. package/lib/electron-common/messaging/electron-messages.js +23 -0
  207. package/lib/electron-common/messaging/electron-messages.js.map +1 -0
  208. package/lib/electron-main/electron-main-application.d.ts +16 -0
  209. package/lib/electron-main/electron-main-application.d.ts.map +1 -1
  210. package/lib/electron-main/electron-main-application.js +91 -25
  211. package/lib/electron-main/electron-main-application.js.map +1 -1
  212. package/lib/electron-main/electron-main-window-service-impl.d.ts +1 -1
  213. package/lib/electron-main/electron-main-window-service-impl.d.ts.map +1 -1
  214. package/lib/electron-main/electron-main-window-service-impl.js.map +1 -1
  215. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +1 -1
  216. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts.map +1 -1
  217. package/lib/electron-main/messaging/electron-messaging-contribution.js +1 -2
  218. package/lib/electron-main/messaging/electron-messaging-contribution.js.map +1 -1
  219. package/package.json +7 -5
  220. package/shared/@theia/application-package/lib/api.d.ts +1 -0
  221. package/shared/@theia/application-package/lib/api.js +1 -0
  222. package/src/browser/about-dialog.tsx +2 -2
  223. package/src/browser/authentication-service.ts +1 -2
  224. package/src/browser/color-registry.ts +3 -85
  225. package/src/browser/common-frontend-contribution.ts +179 -232
  226. package/src/browser/core-preferences.ts +32 -19
  227. package/src/browser/dialogs.ts +10 -3
  228. package/src/browser/frontend-application-module.ts +10 -5
  229. package/src/browser/frontend-application.ts +13 -0
  230. package/src/browser/index.ts +1 -0
  231. package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +16 -11
  232. package/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts +10 -4
  233. package/src/browser/keyboard/keys.ts +2 -675
  234. package/src/browser/menu/browser-context-menu-renderer.ts +1 -1
  235. package/src/browser/menu/browser-menu-plugin.ts +25 -5
  236. package/src/browser/messaging/ws-connection-provider.ts +13 -4
  237. package/src/browser/nls-loader.ts +26 -0
  238. package/src/browser/preferences/preference-provider.ts +1 -5
  239. package/src/browser/preferences/preference-service.spec.ts +0 -3
  240. package/src/browser/progress-status-bar-item.ts +1 -2
  241. package/src/browser/quick-input/quick-command-frontend-contribution.ts +2 -2
  242. package/src/browser/quick-input/quick-command-service.ts +2 -2
  243. package/src/browser/quick-input/quick-input-service.ts +1 -278
  244. package/src/browser/quick-input/quick-view-service.ts +1 -2
  245. package/src/browser/shell/application-shell.ts +21 -25
  246. package/src/browser/shell/current-widget-command-adapter.ts +57 -0
  247. package/src/browser/shell/shell-layout-restorer.ts +4 -3
  248. package/src/browser/shell/tab-bar-decorator.ts +1 -1
  249. package/src/browser/shell/tab-bar-toolbar.tsx +3 -1
  250. package/src/browser/shell/tab-bars.ts +133 -13
  251. package/src/browser/storage-service.spec.ts +1 -1
  252. package/src/browser/style/index.css +5 -0
  253. package/src/browser/style/sidepanel.css +8 -2
  254. package/src/browser/style/tabs.css +30 -0
  255. package/src/browser/style/tooltip.css +28 -0
  256. package/src/browser/style/view-container.css +9 -9
  257. package/src/browser/theming.ts +6 -17
  258. package/src/browser/tooltip-service.tsx +98 -0
  259. package/src/browser/tree/tree-model.ts +1 -1
  260. package/src/browser/view-container.ts +312 -80
  261. package/src/browser/window/default-window-service.ts +2 -2
  262. package/src/browser/window/window-service.ts +1 -9
  263. package/src/browser/window-contribution.ts +2 -2
  264. package/src/common/color.ts +100 -0
  265. package/src/common/command.ts +11 -2
  266. package/src/common/i18n/localization.ts +54 -0
  267. package/src/common/i18n/nls.metadata.json +20421 -0
  268. package/src/common/index.ts +1 -0
  269. package/src/common/keys.ts +693 -0
  270. package/src/common/messaging/abstract-connection-provider.ts +3 -1
  271. package/src/common/messaging/proxy-factory.ts +1 -1
  272. package/src/common/nls.ts +104 -0
  273. package/src/common/path.spec.ts +15 -0
  274. package/src/common/path.ts +16 -4
  275. package/src/common/promise-util.spec.ts +41 -0
  276. package/src/common/promise-util.ts +23 -4
  277. package/src/common/quick-pick-service.ts +299 -4
  278. package/src/common/theme.ts +32 -0
  279. package/src/common/window.ts +30 -0
  280. package/src/electron-browser/menu/electron-context-menu-renderer.ts +38 -16
  281. package/src/electron-browser/menu/electron-main-menu-factory.ts +10 -15
  282. package/src/electron-browser/menu/electron-menu-contribution.ts +129 -39
  283. package/src/electron-browser/menu/electron-menu-style.css +84 -0
  284. package/src/electron-browser/window/electron-window-preferences.ts +13 -1
  285. package/src/electron-browser/window/electron-window-service.ts +1 -1
  286. package/src/electron-common/electron-main-window-service.ts +1 -2
  287. package/src/electron-common/messaging/electron-messages.ts +20 -0
  288. package/src/electron-main/electron-main-application.ts +107 -24
  289. package/src/electron-main/electron-main-window-service-impl.ts +1 -2
  290. package/src/electron-main/messaging/electron-messaging-contribution.ts +1 -2
  291. package/lib/browser/nls.d.ts.map +0 -1
  292. package/lib/browser/nls.js +0 -64
  293. package/lib/browser/nls.js.map +0 -1
  294. package/src/browser/nls.ts +0 -65
@@ -18,7 +18,6 @@
18
18
 
19
19
  import debounce = require('lodash.debounce');
20
20
  import { injectable, inject, optional } from 'inversify';
21
- import { TabBar, Widget } from '@phosphor/widgets';
22
21
  import { MAIN_MENU_BAR, SETTINGS_MENU, MenuContribution, MenuModelRegistry, ACCOUNTS_MENU } from '../common/menu';
23
22
  import { KeybindingContribution, KeybindingRegistry } from './keybinding';
24
23
  import { FrontendApplication, FrontendApplicationContribution } from './frontend-application';
@@ -28,7 +27,7 @@ import { SelectionService } from '../common/selection-service';
28
27
  import { MessageService } from '../common/message-service';
29
28
  import { OpenerService, open } from '../browser/opener-service';
30
29
  import { ApplicationShell } from './shell/application-shell';
31
- import { SHELL_TABBAR_CONTEXT_MENU } from './shell/tab-bars';
30
+ import { SHELL_TABBAR_CONTEXT_CLOSE, SHELL_TABBAR_CONTEXT_COPY, SHELL_TABBAR_CONTEXT_SPLIT } from './shell/tab-bars';
32
31
  import { AboutDialog } from './about-dialog';
33
32
  import * as browser from './browser';
34
33
  import URI from '../common/uri';
@@ -51,10 +50,11 @@ import { EncodingRegistry } from './encoding-registry';
51
50
  import { UTF8 } from '../common/encodings';
52
51
  import { EnvVariablesServer } from '../common/env-variables';
53
52
  import { AuthenticationService } from './authentication-service';
54
- import { FormatType } from './saveable';
53
+ import { FormatType, Saveable } from './saveable';
55
54
  import { QuickInputService, QuickPick, QuickPickItem } from './quick-input';
56
55
  import { AsyncLocalizationProvider } from '../common/i18n/localization';
57
- import { nls } from './nls';
56
+ import { nls } from '../common/nls';
57
+ import { CurrentWidgetCommandAdapter } from './shell/current-widget-command-adapter';
58
58
 
59
59
  export namespace CommonMenus {
60
60
 
@@ -90,197 +90,206 @@ export namespace CommonMenus {
90
90
 
91
91
  export namespace CommonCommands {
92
92
 
93
- const FILE_CATEGORY = 'File';
94
- const VIEW_CATEGORY = 'View';
93
+ export const FILE_CATEGORY = 'File';
94
+ export const VIEW_CATEGORY = 'View';
95
+ export const PREFERENCES_CATEGORY = 'Preferences';
96
+ export const FILE_CATEGORY_KEY = nls.getDefaultKey(FILE_CATEGORY);
97
+ export const VIEW_CATEGORY_KEY = nls.getDefaultKey(VIEW_CATEGORY);
98
+ export const PREFERENCES_CATEGORY_KEY = nls.getDefaultKey(PREFERENCES_CATEGORY);
95
99
 
96
100
  export const OPEN: Command = {
97
101
  id: 'core.open',
98
102
  };
99
103
 
100
- export const CUT: Command = {
104
+ export const CUT = Command.toDefaultLocalizedCommand({
101
105
  id: 'core.cut',
102
106
  label: 'Cut'
103
- };
104
- export const COPY: Command = {
107
+ });
108
+ export const COPY = Command.toDefaultLocalizedCommand({
105
109
  id: 'core.copy',
106
110
  label: 'Copy'
107
- };
108
- export const PASTE: Command = {
111
+ });
112
+ export const PASTE = Command.toDefaultLocalizedCommand({
109
113
  id: 'core.paste',
110
114
  label: 'Paste'
111
- };
115
+ });
112
116
 
113
- export const COPY_PATH: Command = {
117
+ export const COPY_PATH = Command.toDefaultLocalizedCommand({
114
118
  id: 'core.copy.path',
115
119
  label: 'Copy Path'
116
- };
120
+ });
117
121
 
118
- export const UNDO: Command = {
122
+ export const UNDO = Command.toDefaultLocalizedCommand({
119
123
  id: 'core.undo',
120
124
  label: 'Undo'
121
- };
122
- export const REDO: Command = {
125
+ });
126
+ export const REDO = Command.toDefaultLocalizedCommand({
123
127
  id: 'core.redo',
124
128
  label: 'Redo'
125
- };
126
- export const SELECT_ALL: Command = {
129
+ });
130
+ export const SELECT_ALL = Command.toDefaultLocalizedCommand({
127
131
  id: 'core.selectAll',
128
132
  label: 'Select All'
129
- };
133
+ });
130
134
 
131
- export const FIND: Command = {
135
+ export const FIND = Command.toDefaultLocalizedCommand({
132
136
  id: 'core.find',
133
137
  label: 'Find'
134
- };
135
- export const REPLACE: Command = {
138
+ });
139
+ export const REPLACE = Command.toDefaultLocalizedCommand({
136
140
  id: 'core.replace',
137
141
  label: 'Replace'
138
- };
142
+ });
139
143
 
140
- export const NEXT_TAB: Command = {
144
+ export const NEXT_TAB = Command.toDefaultLocalizedCommand({
141
145
  id: 'core.nextTab',
142
146
  category: VIEW_CATEGORY,
143
- label: 'Switch to Next Tab'
144
- };
145
- export const PREVIOUS_TAB: Command = {
147
+ label: 'Show Next Tab'
148
+ });
149
+ export const PREVIOUS_TAB = Command.toDefaultLocalizedCommand({
146
150
  id: 'core.previousTab',
147
151
  category: VIEW_CATEGORY,
148
- label: 'Switch to Previous Tab'
149
- };
150
- export const NEXT_TAB_IN_GROUP: Command = {
152
+ label: 'Show Previous Tab'
153
+ });
154
+ export const NEXT_TAB_IN_GROUP = Command.toLocalizedCommand({
151
155
  id: 'core.nextTabInGroup',
152
156
  category: VIEW_CATEGORY,
153
157
  label: 'Switch to Next Tab in Group'
154
- };
155
- export const PREVIOUS_TAB_IN_GROUP: Command = {
158
+ }, 'theia/core/common/showNextTabInGroup', VIEW_CATEGORY_KEY);
159
+ export const PREVIOUS_TAB_IN_GROUP = Command.toLocalizedCommand({
156
160
  id: 'core.previousTabInGroup',
157
161
  category: VIEW_CATEGORY,
158
162
  label: 'Switch to Previous Tab in Group'
159
- };
160
- export const NEXT_TAB_GROUP: Command = {
163
+ }, 'theia/core/common/showPreviousTabInGroup', VIEW_CATEGORY_KEY);
164
+ export const NEXT_TAB_GROUP = Command.toLocalizedCommand({
161
165
  id: 'core.nextTabGroup',
162
166
  category: VIEW_CATEGORY,
163
167
  label: 'Switch to Next Tab Group'
164
- };
165
- export const PREVIOUS_TAB_GROUP: Command = {
168
+ }, 'theia/core/common/showNextTabGroup', VIEW_CATEGORY_KEY);
169
+ export const PREVIOUS_TAB_GROUP = Command.toLocalizedCommand({
166
170
  id: 'core.previousTabBar',
167
171
  category: VIEW_CATEGORY,
168
172
  label: 'Switch to Previous Tab Group'
169
- };
170
- export const CLOSE_TAB: Command = {
173
+ }, 'theia/core/common/showPreviousTabGroup', VIEW_CATEGORY_KEY);
174
+ export const CLOSE_TAB = Command.toLocalizedCommand({
171
175
  id: 'core.close.tab',
172
176
  category: VIEW_CATEGORY,
173
177
  label: 'Close Tab'
174
- };
175
- export const CLOSE_OTHER_TABS: Command = {
178
+ }, 'theia/core/common/closeTab', VIEW_CATEGORY_KEY);
179
+ export const CLOSE_OTHER_TABS = Command.toLocalizedCommand({
176
180
  id: 'core.close.other.tabs',
177
181
  category: VIEW_CATEGORY,
178
182
  label: 'Close Other Tabs'
179
- };
180
- export const CLOSE_RIGHT_TABS: Command = {
183
+ }, 'theia/core/common/closeOthers', VIEW_CATEGORY_KEY);
184
+ export const CLOSE_SAVED_TABS = Command.toDefaultLocalizedCommand({
185
+ id: 'workbench.action.closeUnmodifiedEditors',
186
+ category: VIEW_CATEGORY,
187
+ label: 'Close Saved Editors in Group',
188
+ });
189
+ export const CLOSE_RIGHT_TABS = Command.toLocalizedCommand({
181
190
  id: 'core.close.right.tabs',
182
191
  category: VIEW_CATEGORY,
183
192
  label: 'Close Tabs to the Right'
184
- };
185
- export const CLOSE_ALL_TABS: Command = {
193
+ }, 'theia/core/common/closeRight', VIEW_CATEGORY_KEY);
194
+ export const CLOSE_ALL_TABS = Command.toLocalizedCommand({
186
195
  id: 'core.close.all.tabs',
187
196
  category: VIEW_CATEGORY,
188
197
  label: 'Close All Tabs'
189
- };
190
- export const CLOSE_MAIN_TAB: Command = {
198
+ }, 'theia/core/common/closeAll', VIEW_CATEGORY_KEY);
199
+ export const CLOSE_MAIN_TAB = Command.toLocalizedCommand({
191
200
  id: 'core.close.main.tab',
192
201
  category: VIEW_CATEGORY,
193
202
  label: 'Close Tab in Main Area'
194
- };
195
- export const CLOSE_OTHER_MAIN_TABS: Command = {
203
+ }, 'theia/core/common/closeTabMain', VIEW_CATEGORY_KEY);
204
+ export const CLOSE_OTHER_MAIN_TABS = Command.toLocalizedCommand({
196
205
  id: 'core.close.other.main.tabs',
197
206
  category: VIEW_CATEGORY,
198
207
  label: 'Close Other Tabs in Main Area'
199
- };
200
- export const CLOSE_ALL_MAIN_TABS: Command = {
208
+ }, 'theia/core/common/closeOtherTabMain', VIEW_CATEGORY_KEY);
209
+ export const CLOSE_ALL_MAIN_TABS = Command.toLocalizedCommand({
201
210
  id: 'core.close.all.main.tabs',
202
211
  category: VIEW_CATEGORY,
203
212
  label: 'Close All Tabs in Main Area'
204
- };
205
- export const COLLAPSE_PANEL: Command = {
213
+ }, 'theia/core/common/closeAllTabMain', VIEW_CATEGORY_KEY);
214
+ export const COLLAPSE_PANEL = Command.toLocalizedCommand({
206
215
  id: 'core.collapse.tab',
207
216
  category: VIEW_CATEGORY,
208
217
  label: 'Collapse Side Panel'
209
- };
210
- export const COLLAPSE_ALL_PANELS: Command = {
218
+ }, 'theia/core/common/collapseTab', VIEW_CATEGORY_KEY);
219
+ export const COLLAPSE_ALL_PANELS = Command.toLocalizedCommand({
211
220
  id: 'core.collapse.all.tabs',
212
221
  category: VIEW_CATEGORY,
213
222
  label: 'Collapse All Side Panels'
214
- };
215
- export const TOGGLE_BOTTOM_PANEL: Command = {
223
+ }, 'theia/core/common/collapseAllTabs', VIEW_CATEGORY_KEY);
224
+ export const TOGGLE_BOTTOM_PANEL = Command.toLocalizedCommand({
216
225
  id: 'core.toggle.bottom.panel',
217
226
  category: VIEW_CATEGORY,
218
227
  label: 'Toggle Bottom Panel'
219
- };
220
- export const TOGGLE_STATUS_BAR: Command = {
228
+ }, 'theia/core/common/collapseBottomPanel', VIEW_CATEGORY_KEY);
229
+ export const TOGGLE_STATUS_BAR = Command.toDefaultLocalizedCommand({
221
230
  id: 'workbench.action.toggleStatusbarVisibility',
222
231
  category: VIEW_CATEGORY,
223
232
  label: 'Toggle Status Bar Visibility'
224
- };
225
- export const TOGGLE_MAXIMIZED: Command = {
233
+ });
234
+ export const TOGGLE_MAXIMIZED = Command.toLocalizedCommand({
226
235
  id: 'core.toggleMaximized',
227
236
  category: VIEW_CATEGORY,
228
237
  label: 'Toggle Maximized'
229
- };
230
- export const OPEN_VIEW: Command = {
238
+ }, 'theia/core/common/toggleMaximized', VIEW_CATEGORY_KEY);
239
+ export const OPEN_VIEW = Command.toDefaultLocalizedCommand({
231
240
  id: 'core.openView',
232
241
  category: VIEW_CATEGORY,
233
242
  label: 'Open View...'
234
- };
243
+ });
235
244
 
236
- export const SAVE: Command = {
245
+ export const SAVE = Command.toDefaultLocalizedCommand({
237
246
  id: 'core.save',
238
247
  category: FILE_CATEGORY,
239
248
  label: 'Save',
240
- };
241
- export const SAVE_WITHOUT_FORMATTING: Command = {
249
+ });
250
+ export const SAVE_WITHOUT_FORMATTING = Command.toDefaultLocalizedCommand({
242
251
  id: 'core.saveWithoutFormatting',
243
252
  category: FILE_CATEGORY,
244
253
  label: 'Save without Formatting',
245
- };
246
- export const SAVE_ALL: Command = {
254
+ });
255
+ export const SAVE_ALL = Command.toDefaultLocalizedCommand({
247
256
  id: 'core.saveAll',
248
257
  category: FILE_CATEGORY,
249
258
  label: 'Save All',
250
- };
259
+ });
251
260
 
252
- export const AUTO_SAVE: Command = {
261
+ export const AUTO_SAVE = Command.toDefaultLocalizedCommand({
253
262
  id: 'textEditor.commands.autosave',
254
263
  category: FILE_CATEGORY,
255
264
  label: 'Auto Save',
256
- };
265
+ });
257
266
 
258
- export const ABOUT_COMMAND: Command = {
267
+ export const ABOUT_COMMAND = Command.toDefaultLocalizedCommand({
259
268
  id: 'core.about',
260
269
  label: 'About'
261
- };
270
+ });
262
271
 
263
- export const OPEN_PREFERENCES: Command = {
272
+ export const OPEN_PREFERENCES = Command.toDefaultLocalizedCommand({
264
273
  id: 'preferences:open',
265
- category: 'Settings',
266
- label: 'Open Preferences',
267
- };
274
+ category: PREFERENCES_CATEGORY,
275
+ label: 'Open Settings (UI)',
276
+ });
268
277
 
269
- export const SELECT_COLOR_THEME: Command = {
278
+ export const SELECT_COLOR_THEME = Command.toDefaultLocalizedCommand({
270
279
  id: 'workbench.action.selectTheme',
271
280
  label: 'Color Theme',
272
- category: 'Preferences'
273
- };
274
- export const SELECT_ICON_THEME: Command = {
281
+ category: PREFERENCES_CATEGORY
282
+ });
283
+ export const SELECT_ICON_THEME = Command.toDefaultLocalizedCommand({
275
284
  id: 'workbench.action.selectIconTheme',
276
285
  label: 'File Icon Theme',
277
- category: 'Preferences'
278
- };
286
+ category: PREFERENCES_CATEGORY
287
+ });
279
288
 
280
- export const CONFIGURE_DISPLAY_LANGUAGE = Command.toLocalizedCommand({
289
+ export const CONFIGURE_DISPLAY_LANGUAGE = Command.toDefaultLocalizedCommand({
281
290
  id: 'workbench.action.configureLanguage',
282
291
  label: 'Configure Display Language'
283
- }, 'vscode/localizationsActions/configureLocale');
292
+ });
284
293
 
285
294
  }
286
295
 
@@ -370,14 +379,14 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
370
379
  app.shell.leftPanelHandler.addBottomMenu({
371
380
  id: 'settings-menu',
372
381
  iconClass: 'codicon codicon-settings-gear',
373
- title: 'Settings',
382
+ title: nls.localizeByDefault(CommonCommands.PREFERENCES_CATEGORY),
374
383
  menuPath: SETTINGS_MENU,
375
384
  order: 0,
376
385
  });
377
386
  const accountsMenu = {
378
387
  id: 'accounts-menu',
379
388
  iconClass: 'codicon codicon-person',
380
- title: 'Accounts',
389
+ title: nls.localizeByDefault('Accounts'),
381
390
  menuPath: ACCOUNTS_MENU,
382
391
  order: 1,
383
392
  };
@@ -442,7 +451,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
442
451
  this.shell.leftPanelHandler.addTopMenu({
443
452
  id: mainMenuId,
444
453
  iconClass: 'codicon codicon-menu',
445
- title: 'Application Menu',
454
+ title: nls.localizeByDefault('Application Menu'),
446
455
  menuPath: ['menubar'],
447
456
  order: 0,
448
457
  });
@@ -475,10 +484,10 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
475
484
  }
476
485
 
477
486
  registerMenus(registry: MenuModelRegistry): void {
478
- registry.registerSubmenu(CommonMenus.FILE, 'File');
479
- registry.registerSubmenu(CommonMenus.EDIT, 'Edit');
480
- registry.registerSubmenu(CommonMenus.VIEW, 'View');
481
- registry.registerSubmenu(CommonMenus.HELP, 'Help');
487
+ registry.registerSubmenu(CommonMenus.FILE, nls.localizeByDefault('File'));
488
+ registry.registerSubmenu(CommonMenus.EDIT, nls.localizeByDefault('Edit'));
489
+ registry.registerSubmenu(CommonMenus.VIEW, nls.localizeByDefault('View'));
490
+ registry.registerSubmenu(CommonMenus.HELP, nls.localizeByDefault('Help'));
482
491
 
483
492
  registry.registerMenuAction(CommonMenus.FILE_SAVE, {
484
493
  commandId: CommonCommands.SAVE.id
@@ -491,7 +500,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
491
500
  commandId: CommonCommands.AUTO_SAVE.id
492
501
  });
493
502
 
494
- registry.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, 'Settings');
503
+ registry.registerSubmenu(CommonMenus.FILE_SETTINGS_SUBMENU, nls.localizeByDefault(CommonCommands.PREFERENCES_CATEGORY));
495
504
 
496
505
  registry.registerMenuAction(CommonMenus.EDIT_UNDO, {
497
506
  commandId: CommonCommands.UNDO.id,
@@ -542,39 +551,49 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
542
551
  order: '2'
543
552
  });
544
553
 
545
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
554
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, {
546
555
  commandId: CommonCommands.CLOSE_TAB.id,
547
- label: 'Close',
556
+ label: nls.localizeByDefault('Close'),
548
557
  order: '0'
549
558
  });
550
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
559
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, {
551
560
  commandId: CommonCommands.CLOSE_OTHER_TABS.id,
552
- label: 'Close Others',
561
+ label: nls.localizeByDefault('Close Others'),
553
562
  order: '1'
554
563
  });
555
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
564
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, {
556
565
  commandId: CommonCommands.CLOSE_RIGHT_TABS.id,
557
- label: 'Close to the Right',
566
+ label: nls.localizeByDefault('Close to the Right'),
558
567
  order: '2'
559
568
  });
560
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
569
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, {
570
+ commandId: CommonCommands.CLOSE_SAVED_TABS.id,
571
+ label: nls.localizeByDefault('Close Saved'),
572
+ order: '3',
573
+ });
574
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_CLOSE, {
561
575
  commandId: CommonCommands.CLOSE_ALL_TABS.id,
562
- label: 'Close All',
563
- order: '3'
576
+ label: nls.localizeByDefault('Close All'),
577
+ order: '4'
564
578
  });
565
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
579
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
566
580
  commandId: CommonCommands.COLLAPSE_PANEL.id,
567
- label: 'Collapse',
568
- order: '4'
581
+ label: CommonCommands.COLLAPSE_PANEL.label,
582
+ order: '5'
569
583
  });
570
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_MENU, {
584
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
571
585
  commandId: CommonCommands.TOGGLE_MAXIMIZED.id,
572
- label: 'Toggle Maximized',
573
- order: '5'
586
+ label: CommonCommands.TOGGLE_MAXIMIZED.label,
587
+ order: '6'
588
+ });
589
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_COPY, {
590
+ commandId: CommonCommands.COPY_PATH.id,
591
+ label: CommonCommands.COPY_PATH.label,
592
+ order: '1',
574
593
  });
575
594
  registry.registerMenuAction(CommonMenus.HELP, {
576
595
  commandId: CommonCommands.ABOUT_COMMAND.id,
577
- label: 'About',
596
+ label: CommonCommands.ABOUT_COMMAND.label,
578
597
  order: '9'
579
598
  });
580
599
 
@@ -629,6 +648,8 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
629
648
  }
630
649
  });
631
650
  commandRegistry.registerCommand(CommonCommands.COPY_PATH, UriAwareCommandHandler.MultiSelect(this.selectionService, {
651
+ isVisible: uris => Array.isArray(uris) && uris.some(uri => uri instanceof URI),
652
+ isEnabled: uris => Array.isArray(uris) && uris.some(uri => uri instanceof URI),
632
653
  execute: async uris => {
633
654
  if (uris.length) {
634
655
  const lineDelimiter = isWindows ? '\r\n' : '\n';
@@ -681,62 +702,45 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
681
702
  isEnabled: () => this.shell.previousTabBar() !== undefined,
682
703
  execute: () => this.shell.activatePreviousTabBar()
683
704
  });
684
- commandRegistry.registerCommand(CommonCommands.CLOSE_TAB, {
685
- isEnabled: (event?: Event) => {
686
- const tabBar = this.shell.findTabBar(event);
687
- if (!tabBar) {
688
- return false;
689
- }
690
- const currentTitle = this.shell.findTitle(tabBar, event);
691
- return currentTitle !== undefined && currentTitle.closable;
692
- },
693
- execute: (event?: Event) => {
694
- const tabBar = this.shell.findTabBar(event)!;
695
- const currentTitle = this.shell.findTitle(tabBar, event);
696
- this.shell.closeTabs(tabBar, title => title === currentTitle);
697
- }
698
- });
699
- commandRegistry.registerCommand(CommonCommands.CLOSE_OTHER_TABS, {
700
- isEnabled: (event?: Event) => {
701
- const tabBar = this.shell.findTabBar(event);
702
- if (!tabBar) {
703
- return false;
704
- }
705
- const currentTitle = this.shell.findTitle(tabBar, event);
706
- return tabBar.titles.some(title => title !== currentTitle && title.closable);
707
- },
708
- execute: (event?: Event) => {
709
- const tabBar = this.shell.findTabBar(event)!;
710
- const currentTitle = this.shell.findTitle(tabBar, event);
711
- this.shell.closeTabs(tabBar, title => title !== currentTitle && title.closable);
712
- }
713
- });
714
- commandRegistry.registerCommand(CommonCommands.CLOSE_RIGHT_TABS, {
715
- isEnabled: (event?: Event) => {
716
- const tabBar = this.shell.findTabBar(event);
717
- if (!tabBar) {
718
- return false;
719
- }
720
- const currentIndex = this.findTitleIndex(tabBar, event);
721
- return tabBar.titles.some((title, index) => index > currentIndex && title.closable);
722
- },
723
- isVisible: (event?: Event) => {
724
- const area = this.findTabArea(event);
705
+ commandRegistry.registerCommand(CommonCommands.CLOSE_TAB, new CurrentWidgetCommandAdapter(this.shell, {
706
+ isEnabled: title => Boolean(title?.closable),
707
+ execute: (title, tabBar) => tabBar && this.shell.closeTabs(tabBar, candidate => candidate === title),
708
+ }));
709
+ commandRegistry.registerCommand(CommonCommands.CLOSE_OTHER_TABS, new CurrentWidgetCommandAdapter(this.shell, {
710
+ isEnabled: (title, tabbar) => Boolean(tabbar?.titles.some(candidate => candidate !== title && candidate.closable)),
711
+ execute: (title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate !== title && candidate.closable),
712
+ }));
713
+ commandRegistry.registerCommand(CommonCommands.CLOSE_SAVED_TABS, new CurrentWidgetCommandAdapter(this.shell, {
714
+ isEnabled: (_title, tabbar) => Boolean(tabbar?.titles.some(candidate => candidate.closable && !Saveable.isDirty(candidate.owner))),
715
+ execute: (_title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate.closable && !Saveable.isDirty(candidate.owner)),
716
+ }));
717
+ commandRegistry.registerCommand(CommonCommands.CLOSE_RIGHT_TABS, new CurrentWidgetCommandAdapter(this.shell, {
718
+ isEnabled: (title, tabbar) => {
719
+ let targetSeen = false;
720
+ return Boolean(tabbar?.titles.some(candidate => {
721
+ if (targetSeen && candidate.closable) { return true; };
722
+ if (candidate === title) { targetSeen = true; };
723
+ }));
724
+ },
725
+ isVisible: (_title, tabbar) => {
726
+ const area = (tabbar && this.shell.getAreaFor(tabbar)) ?? this.shell.currentTabArea;
725
727
  return area !== undefined && area !== 'left' && area !== 'right';
726
728
  },
727
- execute: (event?: Event) => {
728
- const tabBar = this.shell.findTabBar(event)!;
729
- const currentIndex = this.findTitleIndex(tabBar, event);
730
- this.shell.closeTabs(tabBar, (title, index) => index > currentIndex && title.closable);
729
+ execute: (title, tabbar) => {
730
+ if (tabbar) {
731
+ let targetSeen = false;
732
+ this.shell.closeTabs(tabbar, candidate => {
733
+ if (targetSeen && candidate.closable) { return true; };
734
+ if (candidate === title) { targetSeen = true; };
735
+ return false;
736
+ });
737
+ }
731
738
  }
732
- });
733
- commandRegistry.registerCommand(CommonCommands.CLOSE_ALL_TABS, {
734
- isEnabled: (event?: Event) => {
735
- const tabBar = this.shell.findTabBar(event);
736
- return tabBar !== undefined && tabBar.titles.some(title => title.closable);
737
- },
738
- execute: (event?: Event) => this.shell.closeTabs(this.shell.findTabBar(event)!, title => title.closable)
739
- });
739
+ }));
740
+ commandRegistry.registerCommand(CommonCommands.CLOSE_ALL_TABS, new CurrentWidgetCommandAdapter(this.shell, {
741
+ isEnabled: (_title, tabbar) => Boolean(tabbar?.titles.some(title => title.closable)),
742
+ execute: (_title, tabbar) => tabbar && this.shell.closeTabs(tabbar, candidate => candidate.closable),
743
+ }));
740
744
  commandRegistry.registerCommand(CommonCommands.CLOSE_MAIN_TAB, {
741
745
  isEnabled: () => {
742
746
  const currentWidget = this.shell.getCurrentWidget('main');
@@ -759,11 +763,11 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
759
763
  isEnabled: () => this.shell.mainAreaTabBars.some(tb => tb.titles.some(title => title.closable)),
760
764
  execute: () => this.shell.closeTabs('main', title => title.closable)
761
765
  });
762
- commandRegistry.registerCommand(CommonCommands.COLLAPSE_PANEL, {
763
- isEnabled: (event?: Event) => ApplicationShell.isSideArea(this.findTabArea(event)),
764
- isVisible: (event?: Event) => ApplicationShell.isSideArea(this.findTabArea(event)),
765
- execute: (event?: Event) => this.shell.collapsePanel(this.findTabArea(event)!)
766
- });
766
+ commandRegistry.registerCommand(CommonCommands.COLLAPSE_PANEL, new CurrentWidgetCommandAdapter(this.shell, {
767
+ isEnabled: (_title, tabbar) => Boolean(tabbar && ApplicationShell.isSideArea(this.shell.getAreaFor(tabbar))),
768
+ isVisible: (_title, tabbar) => Boolean(tabbar && ApplicationShell.isSideArea(this.shell.getAreaFor(tabbar))),
769
+ execute: (_title, tabbar) => tabbar && this.shell.collapsePanel(this.shell.getAreaFor(tabbar)!)
770
+ }));
767
771
  commandRegistry.registerCommand(CommonCommands.COLLAPSE_ALL_PANELS, {
768
772
  execute: () => {
769
773
  this.shell.collapsePanel('left');
@@ -784,11 +788,11 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
784
788
  commandRegistry.registerCommand(CommonCommands.TOGGLE_STATUS_BAR, {
785
789
  execute: () => this.preferenceService.updateValue('workbench.statusBar.visible', !this.preferences['workbench.statusBar.visible'])
786
790
  });
787
- commandRegistry.registerCommand(CommonCommands.TOGGLE_MAXIMIZED, {
788
- isEnabled: (event?: Event) => this.canToggleMaximized(event),
789
- isVisible: (event?: Event) => this.canToggleMaximized(event),
790
- execute: (event?: Event) => this.toggleMaximized(event)
791
- });
791
+ commandRegistry.registerCommand(CommonCommands.TOGGLE_MAXIMIZED, new CurrentWidgetCommandAdapter(this.shell, {
792
+ isEnabled: title => Boolean(title?.owner && this.shell.canToggleMaximized(title?.owner)),
793
+ isVisible: title => Boolean(title?.owner && this.shell.canToggleMaximized(title?.owner)),
794
+ execute: title => title?.owner && this.shell.toggleMaximized(title?.owner),
795
+ }));
792
796
 
793
797
  commandRegistry.registerCommand(CommonCommands.SAVE, {
794
798
  execute: () => this.shell.save({ formatType: FormatType.ON })
@@ -819,63 +823,6 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
819
823
  });
820
824
  }
821
825
 
822
- private findTabArea(event?: Event): ApplicationShell.Area | undefined {
823
- const tabBar = this.shell.findTabBar(event);
824
- if (tabBar) {
825
- return this.shell.getAreaFor(tabBar);
826
- }
827
- return this.shell.currentTabArea;
828
- }
829
-
830
- /**
831
- * Finds the index of the selected title from the tab-bar.
832
- * @param tabBar: used for providing an array of titles.
833
- * @returns the index of the selected title if it is available in the tab-bar, else returns the index of currently-selected title.
834
- */
835
- private findTitleIndex(tabBar: TabBar<Widget>, event?: Event): number {
836
- if (event) {
837
- const targetTitle = this.shell.findTitle(tabBar, event);
838
- return targetTitle ? tabBar.titles.indexOf(targetTitle) : tabBar.currentIndex;
839
- }
840
- return tabBar.currentIndex;
841
- }
842
-
843
- private canToggleMaximized(event?: Event): boolean {
844
- if (event?.target instanceof HTMLElement) {
845
- const widget = this.shell.findWidgetForElement(event.target);
846
- if (widget) {
847
- return this.shell.mainPanel.contains(widget) || this.shell.bottomPanel.contains(widget);
848
- }
849
- }
850
- return this.shell.canToggleMaximized();
851
- }
852
-
853
- /**
854
- * Maximize the bottom or the main dockpanel based on the widget.
855
- * @param event used to find the selected widget.
856
- */
857
- private toggleMaximized(event?: Event): void {
858
- if (event?.target instanceof HTMLElement) {
859
- const widget = this.shell.findWidgetForElement(event.target);
860
- if (widget) {
861
- if (this.shell.mainPanel.contains(widget)) {
862
- this.shell.mainPanel.toggleMaximized();
863
- } else if (this.shell.bottomPanel.contains(widget)) {
864
- this.shell.bottomPanel.toggleMaximized();
865
- }
866
- if (widget instanceof TabBar) {
867
- // reveals the widget when maximized.
868
- const title = this.shell.findTitle(widget, event);
869
- if (title) {
870
- this.shell.revealWidget(title.owner.id);
871
- }
872
- }
873
- }
874
- } else {
875
- this.shell.toggleMaximized();
876
- }
877
- }
878
-
879
826
  private isElectron(): boolean {
880
827
  return environment.electron.is();
881
828
  }
@@ -1072,7 +1019,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
1072
1019
 
1073
1020
  this.quickInputService?.showQuickPick(items,
1074
1021
  {
1075
- placeholder: 'Select File Icon Theme',
1022
+ placeholder: nls.localizeByDefault('Select File Icon Theme'),
1076
1023
  activeItem: items.find(item => item.id === resetTo),
1077
1024
  onDidChangeSelection: (quickPick: QuickPick<QuickPickItem>, selectedItems: Array<QuickPickItem>) => {
1078
1025
  resetTo = undefined;
@@ -1111,7 +1058,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
1111
1058
  const items = [...itemsByTheme.light, ...itemsByTheme.dark, ...itemsByTheme.hc];
1112
1059
  this.quickInputService?.showQuickPick(items,
1113
1060
  {
1114
- placeholder: 'Select Color Theme (Up/Down Keys to Preview)',
1061
+ placeholder: nls.localizeByDefault('Select Color Theme (Up/Down Keys to Preview)'),
1115
1062
  activeItem: items.find((item: QuickPickItem) => item.id === resetTo),
1116
1063
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1117
1064
  onDidChangeSelection: (quickPick: any, selectedItems: Array<QuickPickItem>) => {