@theia/scm 1.45.1 → 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.
- package/README.md +31 -31
- package/lib/browser/decorations/scm-decorations-service.d.ts +14 -14
- package/lib/browser/decorations/scm-decorations-service.js +101 -101
- package/lib/browser/decorations/scm-navigator-decorator.d.ts +25 -25
- package/lib/browser/decorations/scm-navigator-decorator.js +132 -132
- package/lib/browser/decorations/scm-tab-bar-decorator.d.ts +17 -17
- package/lib/browser/decorations/scm-tab-bar-decorator.js +93 -93
- package/lib/browser/dirty-diff/content-lines.d.ts +12 -12
- package/lib/browser/dirty-diff/content-lines.js +106 -106
- package/lib/browser/dirty-diff/content-lines.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/content-lines.spec.js +39 -39
- package/lib/browser/dirty-diff/diff-computer.d.ts +29 -29
- package/lib/browser/dirty-diff/diff-computer.js +102 -102
- package/lib/browser/dirty-diff/diff-computer.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/diff-computer.spec.js +315 -315
- package/lib/browser/dirty-diff/dirty-diff-decorator.d.ts +14 -14
- package/lib/browser/dirty-diff/dirty-diff-decorator.js +98 -98
- package/lib/browser/dirty-diff/dirty-diff-module.d.ts +3 -3
- package/lib/browser/dirty-diff/dirty-diff-module.js +24 -24
- package/lib/browser/scm-amend-component.d.ts +123 -123
- package/lib/browser/scm-amend-component.js +463 -463
- package/lib/browser/scm-amend-widget.d.ts +20 -20
- package/lib/browser/scm-amend-widget.js +101 -101
- package/lib/browser/scm-avatar-service.d.ts +3 -3
- package/lib/browser/scm-avatar-service.js +36 -36
- package/lib/browser/scm-commit-widget.d.ts +52 -52
- package/lib/browser/scm-commit-widget.js +199 -199
- package/lib/browser/scm-context-key-service.d.ts +10 -10
- package/lib/browser/scm-context-key-service.js +58 -58
- package/lib/browser/scm-contribution.d.ts +83 -83
- package/lib/browser/scm-contribution.js +356 -356
- package/lib/browser/scm-frontend-module.d.ts +6 -6
- package/lib/browser/scm-frontend-module.js +130 -130
- package/lib/browser/scm-groups-tree-model.d.ts +14 -14
- package/lib/browser/scm-groups-tree-model.js +97 -97
- package/lib/browser/scm-input.d.ts +53 -53
- package/lib/browser/scm-input.js +127 -127
- package/lib/browser/scm-layout-migrations.d.ts +9 -9
- package/lib/browser/scm-layout-migrations.js +79 -79
- package/lib/browser/scm-no-repository-widget.d.ts +8 -8
- package/lib/browser/scm-no-repository-widget.js +49 -49
- package/lib/browser/scm-preferences.d.ts +11 -11
- package/lib/browser/scm-preferences.js +51 -51
- package/lib/browser/scm-provider.d.ts +58 -58
- package/lib/browser/scm-provider.js +19 -19
- package/lib/browser/scm-quick-open-service.d.ts +11 -11
- package/lib/browser/scm-quick-open-service.js +73 -73
- package/lib/browser/scm-repository.d.ts +17 -17
- package/lib/browser/scm-repository.js +41 -41
- package/lib/browser/scm-service.d.ts +26 -26
- package/lib/browser/scm-service.js +108 -108
- package/lib/browser/scm-tree-label-provider.d.ts +7 -7
- package/lib/browser/scm-tree-label-provider.js +57 -57
- package/lib/browser/scm-tree-model.d.ts +74 -74
- package/lib/browser/scm-tree-model.js +351 -351
- package/lib/browser/scm-tree-widget.d.ts +208 -208
- package/lib/browser/scm-tree-widget.js +703 -703
- package/lib/browser/scm-widget.d.ts +40 -40
- package/lib/browser/scm-widget.js +218 -218
- package/package.json +6 -6
- package/src/browser/decorations/scm-decorations-service.ts +78 -78
- package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
- package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
- package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
- package/src/browser/dirty-diff/content-lines.ts +112 -112
- package/src/browser/dirty-diff/diff-computer.spec.ts +387 -387
- package/src/browser/dirty-diff/diff-computer.ts +129 -129
- package/src/browser/dirty-diff/dirty-diff-decorator.ts +107 -107
- package/src/browser/dirty-diff/dirty-diff-module.ts +24 -24
- package/src/browser/scm-amend-component.tsx +600 -600
- package/src/browser/scm-amend-widget.tsx +77 -77
- package/src/browser/scm-avatar-service.ts +27 -27
- package/src/browser/scm-commit-widget.tsx +215 -215
- package/src/browser/scm-context-key-service.ts +46 -46
- package/src/browser/scm-contribution.ts +361 -361
- package/src/browser/scm-frontend-module.ts +149 -149
- package/src/browser/scm-groups-tree-model.ts +78 -78
- package/src/browser/scm-input.ts +164 -164
- package/src/browser/scm-layout-migrations.ts +64 -64
- package/src/browser/scm-no-repository-widget.tsx +41 -41
- package/src/browser/scm-preferences.ts +63 -63
- package/src/browser/scm-provider.ts +91 -91
- package/src/browser/scm-quick-open-service.ts +48 -48
- package/src/browser/scm-repository.ts +52 -52
- package/src/browser/scm-service.ts +108 -108
- package/src/browser/scm-tree-label-provider.ts +44 -44
- package/src/browser/scm-tree-model.ts +405 -405
- package/src/browser/scm-tree-widget.tsx +838 -838
- package/src/browser/scm-widget.tsx +204 -204
- package/src/browser/style/dirty-diff-decorator.css +52 -52
- package/src/browser/style/dirty-diff.css +50 -50
- package/src/browser/style/index.css +271 -271
- package/src/browser/style/scm-amend-component.css +94 -94
- package/src/browser/style/scm.svg +4 -4
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. 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
|
-
/* eslint-disable no-null/no-null, @typescript-eslint/no-explicit-any */
|
|
18
|
-
|
|
19
|
-
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
20
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
21
|
-
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
22
|
-
import {
|
|
23
|
-
BaseWidget, Widget, StatefulWidget, Panel, PanelLayout, MessageLoop, CompositeTreeNode, SelectableTreeNode, ApplicationShell, NavigatableWidget,
|
|
24
|
-
} from '@theia/core/lib/browser';
|
|
25
|
-
import { ScmCommitWidget } from './scm-commit-widget';
|
|
26
|
-
import { ScmAmendWidget } from './scm-amend-widget';
|
|
27
|
-
import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
|
|
28
|
-
import { ScmService } from './scm-service';
|
|
29
|
-
import { ScmTreeWidget } from './scm-tree-widget';
|
|
30
|
-
import { ScmPreferences } from './scm-preferences';
|
|
31
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
32
|
-
|
|
33
|
-
@injectable()
|
|
34
|
-
export class ScmWidget extends BaseWidget implements StatefulWidget {
|
|
35
|
-
|
|
36
|
-
protected panel: Panel;
|
|
37
|
-
|
|
38
|
-
static ID = 'scm-view';
|
|
39
|
-
|
|
40
|
-
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
|
|
41
|
-
@inject(ScmService) protected readonly scmService: ScmService;
|
|
42
|
-
@inject(ScmCommitWidget) protected readonly commitWidget: ScmCommitWidget;
|
|
43
|
-
@inject(ScmTreeWidget) readonly resourceWidget: ScmTreeWidget;
|
|
44
|
-
@inject(ScmAmendWidget) protected readonly amendWidget: ScmAmendWidget;
|
|
45
|
-
@inject(ScmNoRepositoryWidget) readonly noRepositoryWidget: ScmNoRepositoryWidget;
|
|
46
|
-
@inject(ScmPreferences) protected readonly scmPreferences: ScmPreferences;
|
|
47
|
-
|
|
48
|
-
set viewMode(mode: 'tree' | 'list') {
|
|
49
|
-
this.resourceWidget.viewMode = mode;
|
|
50
|
-
}
|
|
51
|
-
get viewMode(): 'tree' | 'list' {
|
|
52
|
-
return this.resourceWidget.viewMode;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
constructor() {
|
|
56
|
-
super();
|
|
57
|
-
this.node.tabIndex = 0;
|
|
58
|
-
this.id = ScmWidget.ID;
|
|
59
|
-
this.addClass('theia-scm');
|
|
60
|
-
this.addClass('theia-scm-main-container');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@postConstruct()
|
|
64
|
-
protected init(): void {
|
|
65
|
-
const layout = new PanelLayout();
|
|
66
|
-
this.layout = layout;
|
|
67
|
-
this.panel = new Panel({
|
|
68
|
-
layout: new PanelLayout({
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
this.panel.node.tabIndex = -1;
|
|
72
|
-
this.panel.node.setAttribute('class', 'theia-scm-panel');
|
|
73
|
-
layout.addWidget(this.panel);
|
|
74
|
-
|
|
75
|
-
this.containerLayout.addWidget(this.commitWidget);
|
|
76
|
-
this.containerLayout.addWidget(this.resourceWidget);
|
|
77
|
-
this.containerLayout.addWidget(this.amendWidget);
|
|
78
|
-
this.containerLayout.addWidget(this.noRepositoryWidget);
|
|
79
|
-
|
|
80
|
-
this.refresh();
|
|
81
|
-
this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => this.refresh()));
|
|
82
|
-
this.updateViewMode(this.scmPreferences.get('scm.defaultViewMode'));
|
|
83
|
-
this.toDispose.push(this.scmPreferences.onPreferenceChanged(e => {
|
|
84
|
-
if (e.preferenceName === 'scm.defaultViewMode') {
|
|
85
|
-
this.updateViewMode(e.newValue);
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
this.toDispose.push(this.shell.onDidChangeCurrentWidget(({ newValue }) => {
|
|
89
|
-
const uri = NavigatableWidget.getUri(newValue || undefined);
|
|
90
|
-
if (uri) {
|
|
91
|
-
this.resourceWidget.selectNodeByUri(uri);
|
|
92
|
-
}
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get containerLayout(): PanelLayout {
|
|
98
|
-
return this.panel.layout as PanelLayout;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Updates the view mode based on the preference value.
|
|
103
|
-
* @param preference the view mode preference.
|
|
104
|
-
*/
|
|
105
|
-
protected updateViewMode(preference: 'tree' | 'list'): void {
|
|
106
|
-
this.viewMode = preference;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
protected readonly toDisposeOnRefresh = new DisposableCollection();
|
|
110
|
-
protected refresh(): void {
|
|
111
|
-
this.toDisposeOnRefresh.dispose();
|
|
112
|
-
this.toDispose.push(this.toDisposeOnRefresh);
|
|
113
|
-
const repository = this.scmService.selectedRepository;
|
|
114
|
-
this.title.label = repository ? repository.provider.label : nls.localize('theia/scm/noRepositoryFound', 'No repository found');
|
|
115
|
-
this.title.caption = this.title.label;
|
|
116
|
-
this.update();
|
|
117
|
-
if (repository) {
|
|
118
|
-
this.toDisposeOnRefresh.push(repository.onDidChange(() => this.update()));
|
|
119
|
-
// render synchronously to avoid cursor jumping
|
|
120
|
-
// see https://stackoverflow.com/questions/28922275/in-reactjs-why-does-setstate-behave-differently-when-called-synchronously/28922465#28922465
|
|
121
|
-
this.toDisposeOnRefresh.push(repository.input.onDidChange(() => this.updateImmediately()));
|
|
122
|
-
this.toDisposeOnRefresh.push(repository.input.onDidFocus(() => this.focusInput()));
|
|
123
|
-
|
|
124
|
-
this.commitWidget.show();
|
|
125
|
-
this.resourceWidget.show();
|
|
126
|
-
this.amendWidget.show();
|
|
127
|
-
this.noRepositoryWidget.hide();
|
|
128
|
-
} else {
|
|
129
|
-
this.commitWidget.hide();
|
|
130
|
-
this.resourceWidget.hide();
|
|
131
|
-
this.amendWidget.hide();
|
|
132
|
-
this.noRepositoryWidget.show();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
protected updateImmediately(): void {
|
|
137
|
-
this.onUpdateRequest(Widget.Msg.UpdateRequest);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
protected override onUpdateRequest(msg: Message): void {
|
|
141
|
-
MessageLoop.sendMessage(this.commitWidget, msg);
|
|
142
|
-
MessageLoop.sendMessage(this.resourceWidget, msg);
|
|
143
|
-
MessageLoop.sendMessage(this.amendWidget, msg);
|
|
144
|
-
MessageLoop.sendMessage(this.noRepositoryWidget, msg);
|
|
145
|
-
super.onUpdateRequest(msg);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
protected override onAfterAttach(msg: Message): void {
|
|
149
|
-
this.node.appendChild(this.commitWidget.node);
|
|
150
|
-
this.node.appendChild(this.resourceWidget.node);
|
|
151
|
-
this.node.appendChild(this.amendWidget.node);
|
|
152
|
-
this.node.appendChild(this.noRepositoryWidget.node);
|
|
153
|
-
|
|
154
|
-
super.onAfterAttach(msg);
|
|
155
|
-
this.update();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
protected override onActivateRequest(msg: Message): void {
|
|
159
|
-
super.onActivateRequest(msg);
|
|
160
|
-
this.refresh();
|
|
161
|
-
if (this.commitWidget.isVisible) {
|
|
162
|
-
this.commitWidget.focus();
|
|
163
|
-
} else {
|
|
164
|
-
this.node.focus();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
protected focusInput(): void {
|
|
169
|
-
this.commitWidget.focus();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
storeState(): any {
|
|
173
|
-
const state: object = {
|
|
174
|
-
commitState: this.commitWidget.storeState(),
|
|
175
|
-
changesTreeState: this.resourceWidget.storeState(),
|
|
176
|
-
};
|
|
177
|
-
return state;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
restoreState(oldState: any): void {
|
|
181
|
-
const { commitState, changesTreeState } = oldState;
|
|
182
|
-
this.commitWidget.restoreState(commitState);
|
|
183
|
-
this.resourceWidget.restoreState(changesTreeState);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
collapseScmTree(): void {
|
|
187
|
-
const { model } = this.resourceWidget;
|
|
188
|
-
const root = model.root;
|
|
189
|
-
if (CompositeTreeNode.is(root)) {
|
|
190
|
-
root.children.map(group => {
|
|
191
|
-
if (CompositeTreeNode.is(group)) {
|
|
192
|
-
group.children.map(folderNode => {
|
|
193
|
-
if (CompositeTreeNode.is(folderNode)) {
|
|
194
|
-
model.collapseAll(folderNode);
|
|
195
|
-
}
|
|
196
|
-
if (SelectableTreeNode.isSelected(folderNode)) {
|
|
197
|
-
model.toggleNode(folderNode);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. 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
|
+
/* eslint-disable no-null/no-null, @typescript-eslint/no-explicit-any */
|
|
18
|
+
|
|
19
|
+
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
20
|
+
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
21
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
22
|
+
import {
|
|
23
|
+
BaseWidget, Widget, StatefulWidget, Panel, PanelLayout, MessageLoop, CompositeTreeNode, SelectableTreeNode, ApplicationShell, NavigatableWidget,
|
|
24
|
+
} from '@theia/core/lib/browser';
|
|
25
|
+
import { ScmCommitWidget } from './scm-commit-widget';
|
|
26
|
+
import { ScmAmendWidget } from './scm-amend-widget';
|
|
27
|
+
import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
|
|
28
|
+
import { ScmService } from './scm-service';
|
|
29
|
+
import { ScmTreeWidget } from './scm-tree-widget';
|
|
30
|
+
import { ScmPreferences } from './scm-preferences';
|
|
31
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
32
|
+
|
|
33
|
+
@injectable()
|
|
34
|
+
export class ScmWidget extends BaseWidget implements StatefulWidget {
|
|
35
|
+
|
|
36
|
+
protected panel: Panel;
|
|
37
|
+
|
|
38
|
+
static ID = 'scm-view';
|
|
39
|
+
|
|
40
|
+
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
|
|
41
|
+
@inject(ScmService) protected readonly scmService: ScmService;
|
|
42
|
+
@inject(ScmCommitWidget) protected readonly commitWidget: ScmCommitWidget;
|
|
43
|
+
@inject(ScmTreeWidget) readonly resourceWidget: ScmTreeWidget;
|
|
44
|
+
@inject(ScmAmendWidget) protected readonly amendWidget: ScmAmendWidget;
|
|
45
|
+
@inject(ScmNoRepositoryWidget) readonly noRepositoryWidget: ScmNoRepositoryWidget;
|
|
46
|
+
@inject(ScmPreferences) protected readonly scmPreferences: ScmPreferences;
|
|
47
|
+
|
|
48
|
+
set viewMode(mode: 'tree' | 'list') {
|
|
49
|
+
this.resourceWidget.viewMode = mode;
|
|
50
|
+
}
|
|
51
|
+
get viewMode(): 'tree' | 'list' {
|
|
52
|
+
return this.resourceWidget.viewMode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
this.node.tabIndex = 0;
|
|
58
|
+
this.id = ScmWidget.ID;
|
|
59
|
+
this.addClass('theia-scm');
|
|
60
|
+
this.addClass('theia-scm-main-container');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@postConstruct()
|
|
64
|
+
protected init(): void {
|
|
65
|
+
const layout = new PanelLayout();
|
|
66
|
+
this.layout = layout;
|
|
67
|
+
this.panel = new Panel({
|
|
68
|
+
layout: new PanelLayout({
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
this.panel.node.tabIndex = -1;
|
|
72
|
+
this.panel.node.setAttribute('class', 'theia-scm-panel');
|
|
73
|
+
layout.addWidget(this.panel);
|
|
74
|
+
|
|
75
|
+
this.containerLayout.addWidget(this.commitWidget);
|
|
76
|
+
this.containerLayout.addWidget(this.resourceWidget);
|
|
77
|
+
this.containerLayout.addWidget(this.amendWidget);
|
|
78
|
+
this.containerLayout.addWidget(this.noRepositoryWidget);
|
|
79
|
+
|
|
80
|
+
this.refresh();
|
|
81
|
+
this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => this.refresh()));
|
|
82
|
+
this.updateViewMode(this.scmPreferences.get('scm.defaultViewMode'));
|
|
83
|
+
this.toDispose.push(this.scmPreferences.onPreferenceChanged(e => {
|
|
84
|
+
if (e.preferenceName === 'scm.defaultViewMode') {
|
|
85
|
+
this.updateViewMode(e.newValue);
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
this.toDispose.push(this.shell.onDidChangeCurrentWidget(({ newValue }) => {
|
|
89
|
+
const uri = NavigatableWidget.getUri(newValue || undefined);
|
|
90
|
+
if (uri) {
|
|
91
|
+
this.resourceWidget.selectNodeByUri(uri);
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get containerLayout(): PanelLayout {
|
|
98
|
+
return this.panel.layout as PanelLayout;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Updates the view mode based on the preference value.
|
|
103
|
+
* @param preference the view mode preference.
|
|
104
|
+
*/
|
|
105
|
+
protected updateViewMode(preference: 'tree' | 'list'): void {
|
|
106
|
+
this.viewMode = preference;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected readonly toDisposeOnRefresh = new DisposableCollection();
|
|
110
|
+
protected refresh(): void {
|
|
111
|
+
this.toDisposeOnRefresh.dispose();
|
|
112
|
+
this.toDispose.push(this.toDisposeOnRefresh);
|
|
113
|
+
const repository = this.scmService.selectedRepository;
|
|
114
|
+
this.title.label = repository ? repository.provider.label : nls.localize('theia/scm/noRepositoryFound', 'No repository found');
|
|
115
|
+
this.title.caption = this.title.label;
|
|
116
|
+
this.update();
|
|
117
|
+
if (repository) {
|
|
118
|
+
this.toDisposeOnRefresh.push(repository.onDidChange(() => this.update()));
|
|
119
|
+
// render synchronously to avoid cursor jumping
|
|
120
|
+
// see https://stackoverflow.com/questions/28922275/in-reactjs-why-does-setstate-behave-differently-when-called-synchronously/28922465#28922465
|
|
121
|
+
this.toDisposeOnRefresh.push(repository.input.onDidChange(() => this.updateImmediately()));
|
|
122
|
+
this.toDisposeOnRefresh.push(repository.input.onDidFocus(() => this.focusInput()));
|
|
123
|
+
|
|
124
|
+
this.commitWidget.show();
|
|
125
|
+
this.resourceWidget.show();
|
|
126
|
+
this.amendWidget.show();
|
|
127
|
+
this.noRepositoryWidget.hide();
|
|
128
|
+
} else {
|
|
129
|
+
this.commitWidget.hide();
|
|
130
|
+
this.resourceWidget.hide();
|
|
131
|
+
this.amendWidget.hide();
|
|
132
|
+
this.noRepositoryWidget.show();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
protected updateImmediately(): void {
|
|
137
|
+
this.onUpdateRequest(Widget.Msg.UpdateRequest);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
protected override onUpdateRequest(msg: Message): void {
|
|
141
|
+
MessageLoop.sendMessage(this.commitWidget, msg);
|
|
142
|
+
MessageLoop.sendMessage(this.resourceWidget, msg);
|
|
143
|
+
MessageLoop.sendMessage(this.amendWidget, msg);
|
|
144
|
+
MessageLoop.sendMessage(this.noRepositoryWidget, msg);
|
|
145
|
+
super.onUpdateRequest(msg);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
protected override onAfterAttach(msg: Message): void {
|
|
149
|
+
this.node.appendChild(this.commitWidget.node);
|
|
150
|
+
this.node.appendChild(this.resourceWidget.node);
|
|
151
|
+
this.node.appendChild(this.amendWidget.node);
|
|
152
|
+
this.node.appendChild(this.noRepositoryWidget.node);
|
|
153
|
+
|
|
154
|
+
super.onAfterAttach(msg);
|
|
155
|
+
this.update();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
protected override onActivateRequest(msg: Message): void {
|
|
159
|
+
super.onActivateRequest(msg);
|
|
160
|
+
this.refresh();
|
|
161
|
+
if (this.commitWidget.isVisible) {
|
|
162
|
+
this.commitWidget.focus();
|
|
163
|
+
} else {
|
|
164
|
+
this.node.focus();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
protected focusInput(): void {
|
|
169
|
+
this.commitWidget.focus();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
storeState(): any {
|
|
173
|
+
const state: object = {
|
|
174
|
+
commitState: this.commitWidget.storeState(),
|
|
175
|
+
changesTreeState: this.resourceWidget.storeState(),
|
|
176
|
+
};
|
|
177
|
+
return state;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
restoreState(oldState: any): void {
|
|
181
|
+
const { commitState, changesTreeState } = oldState;
|
|
182
|
+
this.commitWidget.restoreState(commitState);
|
|
183
|
+
this.resourceWidget.restoreState(changesTreeState);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
collapseScmTree(): void {
|
|
187
|
+
const { model } = this.resourceWidget;
|
|
188
|
+
const root = model.root;
|
|
189
|
+
if (CompositeTreeNode.is(root)) {
|
|
190
|
+
root.children.map(group => {
|
|
191
|
+
if (CompositeTreeNode.is(group)) {
|
|
192
|
+
group.children.map(folderNode => {
|
|
193
|
+
if (CompositeTreeNode.is(folderNode)) {
|
|
194
|
+
model.collapseAll(folderNode);
|
|
195
|
+
}
|
|
196
|
+
if (SelectableTreeNode.isSelected(folderNode)) {
|
|
197
|
+
model.toggleNode(folderNode);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
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
|
-
|
|
6
|
-
.dirty-diff-glyph {
|
|
7
|
-
margin-left: 5px;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dirty-diff-removed-line:after {
|
|
12
|
-
content: '';
|
|
13
|
-
position: absolute;
|
|
14
|
-
bottom: -4px;
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
width: 4px;
|
|
17
|
-
height: 0;
|
|
18
|
-
z-index: 9;
|
|
19
|
-
border-top: 4px solid transparent;
|
|
20
|
-
border-bottom: 4px solid transparent;
|
|
21
|
-
transition: border-top-width 80ms linear, border-bottom-width 80ms linear, bottom 80ms linear;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.dirty-diff-glyph:before {
|
|
25
|
-
position: absolute;
|
|
26
|
-
content: '';
|
|
27
|
-
height: 100%;
|
|
28
|
-
width: 0;
|
|
29
|
-
left: -2px;
|
|
30
|
-
transition: width 80ms linear, left 80ms linear;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.dirty-diff-removed-line:before {
|
|
34
|
-
margin-left: 3px;
|
|
35
|
-
height: 0;
|
|
36
|
-
bottom: 0;
|
|
37
|
-
transition: height 80ms linear;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.margin-view-overlays > div:hover > .dirty-diff-glyph:before {
|
|
41
|
-
position: absolute;
|
|
42
|
-
content: '';
|
|
43
|
-
height: 100%;
|
|
44
|
-
width: 9px;
|
|
45
|
-
left: -6px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.margin-view-overlays > div:hover > .dirty-diff-removed-line:after {
|
|
49
|
-
bottom: 0;
|
|
50
|
-
border-top-width: 0;
|
|
51
|
-
border-bottom-width: 0;
|
|
52
|
-
}
|
|
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
|
+
|
|
6
|
+
.dirty-diff-glyph {
|
|
7
|
+
margin-left: 5px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dirty-diff-removed-line:after {
|
|
12
|
+
content: '';
|
|
13
|
+
position: absolute;
|
|
14
|
+
bottom: -4px;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
width: 4px;
|
|
17
|
+
height: 0;
|
|
18
|
+
z-index: 9;
|
|
19
|
+
border-top: 4px solid transparent;
|
|
20
|
+
border-bottom: 4px solid transparent;
|
|
21
|
+
transition: border-top-width 80ms linear, border-bottom-width 80ms linear, bottom 80ms linear;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dirty-diff-glyph:before {
|
|
25
|
+
position: absolute;
|
|
26
|
+
content: '';
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 0;
|
|
29
|
+
left: -2px;
|
|
30
|
+
transition: width 80ms linear, left 80ms linear;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dirty-diff-removed-line:before {
|
|
34
|
+
margin-left: 3px;
|
|
35
|
+
height: 0;
|
|
36
|
+
bottom: 0;
|
|
37
|
+
transition: height 80ms linear;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.margin-view-overlays > div:hover > .dirty-diff-glyph:before {
|
|
41
|
+
position: absolute;
|
|
42
|
+
content: '';
|
|
43
|
+
height: 100%;
|
|
44
|
+
width: 9px;
|
|
45
|
+
left: -6px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.margin-view-overlays > div:hover > .dirty-diff-removed-line:after {
|
|
49
|
+
bottom: 0;
|
|
50
|
+
border-top-width: 0;
|
|
51
|
+
border-bottom-width: 0;
|
|
52
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2018 TypeFox 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 "dirty-diff-decorator.css";
|
|
18
|
-
|
|
19
|
-
.monaco-editor .dirty-diff-added-line {
|
|
20
|
-
border-left: 3px solid var(--theia-editorGutter-addedBackground);
|
|
21
|
-
transition: opacity 0.5s;
|
|
22
|
-
}
|
|
23
|
-
.monaco-editor .dirty-diff-added-line:before {
|
|
24
|
-
background: var(--theia-editorGutter-addedBackground);
|
|
25
|
-
}
|
|
26
|
-
.monaco-editor .margin:hover .dirty-diff-added-line {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.monaco-editor .dirty-diff-removed-line:after {
|
|
31
|
-
border-left: 4px solid var(--theia-editorGutter-deletedBackground);
|
|
32
|
-
transition: opacity 0.5s;
|
|
33
|
-
}
|
|
34
|
-
.monaco-editor .dirty-diff-removed-line:before {
|
|
35
|
-
background: var(--theia-editorGutter-deletedBackground);
|
|
36
|
-
}
|
|
37
|
-
.monaco-editor .margin:hover .dirty-diff-removed-line {
|
|
38
|
-
opacity: 1;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.monaco-editor .dirty-diff-modified-line {
|
|
42
|
-
border-left: 3px solid var(--theia-editorGutter-modifiedBackground);
|
|
43
|
-
transition: opacity 0.5s;
|
|
44
|
-
}
|
|
45
|
-
.monaco-editor .dirty-diff-modified-line:before {
|
|
46
|
-
background: var(--theia-editorGutter-modifiedBackground);
|
|
47
|
-
}
|
|
48
|
-
.monaco-editor .margin:hover .dirty-diff-modified-line {
|
|
49
|
-
opacity: 1;
|
|
50
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2018 TypeFox 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 "dirty-diff-decorator.css";
|
|
18
|
+
|
|
19
|
+
.monaco-editor .dirty-diff-added-line {
|
|
20
|
+
border-left: 3px solid var(--theia-editorGutter-addedBackground);
|
|
21
|
+
transition: opacity 0.5s;
|
|
22
|
+
}
|
|
23
|
+
.monaco-editor .dirty-diff-added-line:before {
|
|
24
|
+
background: var(--theia-editorGutter-addedBackground);
|
|
25
|
+
}
|
|
26
|
+
.monaco-editor .margin:hover .dirty-diff-added-line {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.monaco-editor .dirty-diff-removed-line:after {
|
|
31
|
+
border-left: 4px solid var(--theia-editorGutter-deletedBackground);
|
|
32
|
+
transition: opacity 0.5s;
|
|
33
|
+
}
|
|
34
|
+
.monaco-editor .dirty-diff-removed-line:before {
|
|
35
|
+
background: var(--theia-editorGutter-deletedBackground);
|
|
36
|
+
}
|
|
37
|
+
.monaco-editor .margin:hover .dirty-diff-removed-line {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.monaco-editor .dirty-diff-modified-line {
|
|
42
|
+
border-left: 3px solid var(--theia-editorGutter-modifiedBackground);
|
|
43
|
+
transition: opacity 0.5s;
|
|
44
|
+
}
|
|
45
|
+
.monaco-editor .dirty-diff-modified-line:before {
|
|
46
|
+
background: var(--theia-editorGutter-modifiedBackground);
|
|
47
|
+
}
|
|
48
|
+
.monaco-editor .margin:hover .dirty-diff-modified-line {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
}
|