@theia/output 1.45.0 → 1.46.0-next.72

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 (44) hide show
  1. package/README.md +33 -33
  2. package/lib/browser/output-channel.d.ts +125 -125
  3. package/lib/browser/output-channel.js +334 -334
  4. package/lib/browser/output-commands.d.ts +17 -17
  5. package/lib/browser/output-commands.js +84 -84
  6. package/lib/browser/output-context-menu.d.ts +11 -11
  7. package/lib/browser/output-context-menu.js +42 -42
  8. package/lib/browser/output-contribution.d.ts +29 -29
  9. package/lib/browser/output-contribution.js +284 -284
  10. package/lib/browser/output-editor-factory.d.ts +12 -12
  11. package/lib/browser/output-editor-factory.d.ts.map +1 -1
  12. package/lib/browser/output-editor-factory.js +79 -84
  13. package/lib/browser/output-editor-factory.js.map +1 -1
  14. package/lib/browser/output-editor-model-factory.d.ts +15 -15
  15. package/lib/browser/output-editor-model-factory.js +61 -61
  16. package/lib/browser/output-frontend-module.d.ts +3 -3
  17. package/lib/browser/output-frontend-module.js +50 -50
  18. package/lib/browser/output-preferences.d.ts +11 -11
  19. package/lib/browser/output-preferences.js +46 -46
  20. package/lib/browser/output-resource.d.ts +18 -18
  21. package/lib/browser/output-resource.js +54 -54
  22. package/lib/browser/output-toolbar-contribution.d.ts +21 -21
  23. package/lib/browser/output-toolbar-contribution.js +125 -125
  24. package/lib/browser/output-widget.d.ts +48 -48
  25. package/lib/browser/output-widget.js +248 -248
  26. package/lib/common/output-uri.d.ts +7 -7
  27. package/lib/common/output-uri.js +47 -47
  28. package/lib/common/output-uri.spec.d.ts +1 -1
  29. package/lib/common/output-uri.spec.js +50 -50
  30. package/package.json +7 -7
  31. package/src/browser/output-channel.ts +366 -366
  32. package/src/browser/output-commands.ts +100 -100
  33. package/src/browser/output-context-menu.ts +34 -34
  34. package/src/browser/output-contribution.ts +274 -274
  35. package/src/browser/output-editor-factory.ts +68 -74
  36. package/src/browser/output-editor-model-factory.ts +54 -54
  37. package/src/browser/output-frontend-module.ts +53 -53
  38. package/src/browser/output-preferences.ts +58 -58
  39. package/src/browser/output-resource.ts +65 -65
  40. package/src/browser/output-toolbar-contribution.tsx +116 -116
  41. package/src/browser/output-widget.ts +256 -256
  42. package/src/browser/style/output.css +31 -31
  43. package/src/common/output-uri.spec.ts +53 -53
  44. package/src/common/output-uri.ts +47 -47
@@ -1,116 +1,116 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Arm and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as React from '@theia/core/shared/react';
18
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
- import { Emitter } from '@theia/core/lib/common/event';
20
- import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
21
- import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
22
- import { OutputWidget } from './output-widget';
23
- import { OutputCommands } from './output-commands';
24
- import { OutputContribution } from './output-contribution';
25
- import { OutputChannelManager } from './output-channel';
26
- import { nls } from '@theia/core/lib/common/nls';
27
-
28
- @injectable()
29
- export class OutputToolbarContribution implements TabBarToolbarContribution {
30
-
31
- @inject(OutputChannelManager)
32
- protected readonly outputChannelManager: OutputChannelManager;
33
-
34
- @inject(OutputContribution)
35
- protected readonly outputContribution: OutputContribution;
36
-
37
- protected readonly onOutputWidgetStateChangedEmitter = new Emitter<void>();
38
- protected readonly onOutputWidgetStateChanged = this.onOutputWidgetStateChangedEmitter.event;
39
-
40
- protected readonly onChannelsChangedEmitter = new Emitter<void>();
41
- protected readonly onChannelsChanged = this.onChannelsChangedEmitter.event;
42
-
43
- @postConstruct()
44
- protected init(): void {
45
- this.outputContribution.widget.then(widget => {
46
- widget.onStateChanged(() => this.onOutputWidgetStateChangedEmitter.fire());
47
- });
48
- const fireChannelsChanged = () => this.onChannelsChangedEmitter.fire();
49
- this.outputChannelManager.onSelectedChannelChanged(fireChannelsChanged);
50
- this.outputChannelManager.onChannelAdded(fireChannelsChanged);
51
- this.outputChannelManager.onChannelDeleted(fireChannelsChanged);
52
- this.outputChannelManager.onChannelWasShown(fireChannelsChanged);
53
- this.outputChannelManager.onChannelWasHidden(fireChannelsChanged);
54
- }
55
-
56
- registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): void {
57
- toolbarRegistry.registerItem({
58
- id: 'channels',
59
- render: () => this.renderChannelSelector(),
60
- isVisible: widget => widget instanceof OutputWidget,
61
- onDidChange: this.onChannelsChanged
62
- });
63
- toolbarRegistry.registerItem({
64
- id: OutputCommands.CLEAR__WIDGET.id,
65
- command: OutputCommands.CLEAR__WIDGET.id,
66
- tooltip: nls.localizeByDefault('Clear Output'),
67
- priority: 1,
68
- });
69
- toolbarRegistry.registerItem({
70
- id: OutputCommands.LOCK__WIDGET.id,
71
- command: OutputCommands.LOCK__WIDGET.id,
72
- tooltip: nls.localizeByDefault('Turn Auto Scrolling Off'),
73
- onDidChange: this.onOutputWidgetStateChanged,
74
- priority: 2
75
- });
76
- toolbarRegistry.registerItem({
77
- id: OutputCommands.UNLOCK__WIDGET.id,
78
- command: OutputCommands.UNLOCK__WIDGET.id,
79
- tooltip: nls.localizeByDefault('Turn Auto Scrolling On'),
80
- onDidChange: this.onOutputWidgetStateChanged,
81
- priority: 2
82
- });
83
- }
84
-
85
- protected readonly NONE = '<no channels>';
86
- protected readonly OUTPUT_CHANNEL_LIST_ID = 'outputChannelList';
87
-
88
- protected renderChannelSelector(): React.ReactNode {
89
- const channelOptionElements: SelectOption[] = [];
90
- this.outputChannelManager.getVisibleChannels().forEach((channel, i) => {
91
- channelOptionElements.push({
92
- value: channel.name
93
- });
94
- });
95
- if (channelOptionElements.length === 0) {
96
- channelOptionElements.push({
97
- value: this.NONE
98
- });
99
- }
100
- return <div id={this.OUTPUT_CHANNEL_LIST_ID} key={this.OUTPUT_CHANNEL_LIST_ID}>
101
- <SelectComponent
102
- key={this.outputChannelManager.selectedChannel?.name}
103
- options={channelOptionElements}
104
- defaultValue={this.outputChannelManager.selectedChannel?.name}
105
- onChange={option => this.changeChannel(option)}
106
- />
107
- </div>;
108
- }
109
-
110
- protected changeChannel = (option: SelectOption) => {
111
- const channelName = option.value;
112
- if (channelName !== this.NONE && channelName) {
113
- this.outputChannelManager.getChannel(channelName).show();
114
- }
115
- };
116
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Arm and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import * as React from '@theia/core/shared/react';
18
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
+ import { Emitter } from '@theia/core/lib/common/event';
20
+ import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
21
+ import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
22
+ import { OutputWidget } from './output-widget';
23
+ import { OutputCommands } from './output-commands';
24
+ import { OutputContribution } from './output-contribution';
25
+ import { OutputChannelManager } from './output-channel';
26
+ import { nls } from '@theia/core/lib/common/nls';
27
+
28
+ @injectable()
29
+ export class OutputToolbarContribution implements TabBarToolbarContribution {
30
+
31
+ @inject(OutputChannelManager)
32
+ protected readonly outputChannelManager: OutputChannelManager;
33
+
34
+ @inject(OutputContribution)
35
+ protected readonly outputContribution: OutputContribution;
36
+
37
+ protected readonly onOutputWidgetStateChangedEmitter = new Emitter<void>();
38
+ protected readonly onOutputWidgetStateChanged = this.onOutputWidgetStateChangedEmitter.event;
39
+
40
+ protected readonly onChannelsChangedEmitter = new Emitter<void>();
41
+ protected readonly onChannelsChanged = this.onChannelsChangedEmitter.event;
42
+
43
+ @postConstruct()
44
+ protected init(): void {
45
+ this.outputContribution.widget.then(widget => {
46
+ widget.onStateChanged(() => this.onOutputWidgetStateChangedEmitter.fire());
47
+ });
48
+ const fireChannelsChanged = () => this.onChannelsChangedEmitter.fire();
49
+ this.outputChannelManager.onSelectedChannelChanged(fireChannelsChanged);
50
+ this.outputChannelManager.onChannelAdded(fireChannelsChanged);
51
+ this.outputChannelManager.onChannelDeleted(fireChannelsChanged);
52
+ this.outputChannelManager.onChannelWasShown(fireChannelsChanged);
53
+ this.outputChannelManager.onChannelWasHidden(fireChannelsChanged);
54
+ }
55
+
56
+ registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): void {
57
+ toolbarRegistry.registerItem({
58
+ id: 'channels',
59
+ render: () => this.renderChannelSelector(),
60
+ isVisible: widget => widget instanceof OutputWidget,
61
+ onDidChange: this.onChannelsChanged
62
+ });
63
+ toolbarRegistry.registerItem({
64
+ id: OutputCommands.CLEAR__WIDGET.id,
65
+ command: OutputCommands.CLEAR__WIDGET.id,
66
+ tooltip: nls.localizeByDefault('Clear Output'),
67
+ priority: 1,
68
+ });
69
+ toolbarRegistry.registerItem({
70
+ id: OutputCommands.LOCK__WIDGET.id,
71
+ command: OutputCommands.LOCK__WIDGET.id,
72
+ tooltip: nls.localizeByDefault('Turn Auto Scrolling Off'),
73
+ onDidChange: this.onOutputWidgetStateChanged,
74
+ priority: 2
75
+ });
76
+ toolbarRegistry.registerItem({
77
+ id: OutputCommands.UNLOCK__WIDGET.id,
78
+ command: OutputCommands.UNLOCK__WIDGET.id,
79
+ tooltip: nls.localizeByDefault('Turn Auto Scrolling On'),
80
+ onDidChange: this.onOutputWidgetStateChanged,
81
+ priority: 2
82
+ });
83
+ }
84
+
85
+ protected readonly NONE = '<no channels>';
86
+ protected readonly OUTPUT_CHANNEL_LIST_ID = 'outputChannelList';
87
+
88
+ protected renderChannelSelector(): React.ReactNode {
89
+ const channelOptionElements: SelectOption[] = [];
90
+ this.outputChannelManager.getVisibleChannels().forEach((channel, i) => {
91
+ channelOptionElements.push({
92
+ value: channel.name
93
+ });
94
+ });
95
+ if (channelOptionElements.length === 0) {
96
+ channelOptionElements.push({
97
+ value: this.NONE
98
+ });
99
+ }
100
+ return <div id={this.OUTPUT_CHANNEL_LIST_ID} key={this.OUTPUT_CHANNEL_LIST_ID}>
101
+ <SelectComponent
102
+ key={this.outputChannelManager.selectedChannel?.name}
103
+ options={channelOptionElements}
104
+ defaultValue={this.outputChannelManager.selectedChannel?.name}
105
+ onChange={option => this.changeChannel(option)}
106
+ />
107
+ </div>;
108
+ }
109
+
110
+ protected changeChannel = (option: SelectOption) => {
111
+ const channelName = option.value;
112
+ if (channelName !== this.NONE && channelName) {
113
+ this.outputChannelManager.getChannel(channelName).show();
114
+ }
115
+ };
116
+ }