@theia/scm 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.
- 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,41 +1,41 @@
|
|
|
1
|
-
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
2
|
-
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
3
|
-
import { BaseWidget, StatefulWidget, Panel, PanelLayout, ApplicationShell } from '@theia/core/lib/browser';
|
|
4
|
-
import { ScmCommitWidget } from './scm-commit-widget';
|
|
5
|
-
import { ScmAmendWidget } from './scm-amend-widget';
|
|
6
|
-
import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
|
|
7
|
-
import { ScmService } from './scm-service';
|
|
8
|
-
import { ScmTreeWidget } from './scm-tree-widget';
|
|
9
|
-
import { ScmPreferences } from './scm-preferences';
|
|
10
|
-
export declare class ScmWidget extends BaseWidget implements StatefulWidget {
|
|
11
|
-
protected panel: Panel;
|
|
12
|
-
static ID: string;
|
|
13
|
-
protected readonly shell: ApplicationShell;
|
|
14
|
-
protected readonly scmService: ScmService;
|
|
15
|
-
protected readonly commitWidget: ScmCommitWidget;
|
|
16
|
-
readonly resourceWidget: ScmTreeWidget;
|
|
17
|
-
protected readonly amendWidget: ScmAmendWidget;
|
|
18
|
-
readonly noRepositoryWidget: ScmNoRepositoryWidget;
|
|
19
|
-
protected readonly scmPreferences: ScmPreferences;
|
|
20
|
-
set viewMode(mode: 'tree' | 'list');
|
|
21
|
-
get viewMode(): 'tree' | 'list';
|
|
22
|
-
constructor();
|
|
23
|
-
protected init(): void;
|
|
24
|
-
get containerLayout(): PanelLayout;
|
|
25
|
-
/**
|
|
26
|
-
* Updates the view mode based on the preference value.
|
|
27
|
-
* @param preference the view mode preference.
|
|
28
|
-
*/
|
|
29
|
-
protected updateViewMode(preference: 'tree' | 'list'): void;
|
|
30
|
-
protected readonly toDisposeOnRefresh: DisposableCollection;
|
|
31
|
-
protected refresh(): void;
|
|
32
|
-
protected updateImmediately(): void;
|
|
33
|
-
protected onUpdateRequest(msg: Message): void;
|
|
34
|
-
protected onAfterAttach(msg: Message): void;
|
|
35
|
-
protected onActivateRequest(msg: Message): void;
|
|
36
|
-
protected focusInput(): void;
|
|
37
|
-
storeState(): any;
|
|
38
|
-
restoreState(oldState: any): void;
|
|
39
|
-
collapseScmTree(): void;
|
|
40
|
-
}
|
|
1
|
+
import { Message } from '@theia/core/shared/@phosphor/messaging';
|
|
2
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
3
|
+
import { BaseWidget, StatefulWidget, Panel, PanelLayout, ApplicationShell } from '@theia/core/lib/browser';
|
|
4
|
+
import { ScmCommitWidget } from './scm-commit-widget';
|
|
5
|
+
import { ScmAmendWidget } from './scm-amend-widget';
|
|
6
|
+
import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
|
|
7
|
+
import { ScmService } from './scm-service';
|
|
8
|
+
import { ScmTreeWidget } from './scm-tree-widget';
|
|
9
|
+
import { ScmPreferences } from './scm-preferences';
|
|
10
|
+
export declare class ScmWidget extends BaseWidget implements StatefulWidget {
|
|
11
|
+
protected panel: Panel;
|
|
12
|
+
static ID: string;
|
|
13
|
+
protected readonly shell: ApplicationShell;
|
|
14
|
+
protected readonly scmService: ScmService;
|
|
15
|
+
protected readonly commitWidget: ScmCommitWidget;
|
|
16
|
+
readonly resourceWidget: ScmTreeWidget;
|
|
17
|
+
protected readonly amendWidget: ScmAmendWidget;
|
|
18
|
+
readonly noRepositoryWidget: ScmNoRepositoryWidget;
|
|
19
|
+
protected readonly scmPreferences: ScmPreferences;
|
|
20
|
+
set viewMode(mode: 'tree' | 'list');
|
|
21
|
+
get viewMode(): 'tree' | 'list';
|
|
22
|
+
constructor();
|
|
23
|
+
protected init(): void;
|
|
24
|
+
get containerLayout(): PanelLayout;
|
|
25
|
+
/**
|
|
26
|
+
* Updates the view mode based on the preference value.
|
|
27
|
+
* @param preference the view mode preference.
|
|
28
|
+
*/
|
|
29
|
+
protected updateViewMode(preference: 'tree' | 'list'): void;
|
|
30
|
+
protected readonly toDisposeOnRefresh: DisposableCollection;
|
|
31
|
+
protected refresh(): void;
|
|
32
|
+
protected updateImmediately(): void;
|
|
33
|
+
protected onUpdateRequest(msg: Message): void;
|
|
34
|
+
protected onAfterAttach(msg: Message): void;
|
|
35
|
+
protected onActivateRequest(msg: Message): void;
|
|
36
|
+
protected focusInput(): void;
|
|
37
|
+
storeState(): any;
|
|
38
|
+
restoreState(oldState: any): void;
|
|
39
|
+
collapseScmTree(): void;
|
|
40
|
+
}
|
|
41
41
|
//# sourceMappingURL=scm-widget.d.ts.map
|
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var ScmWidget_1;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.ScmWidget = void 0;
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
31
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
32
|
-
const scm_commit_widget_1 = require("./scm-commit-widget");
|
|
33
|
-
const scm_amend_widget_1 = require("./scm-amend-widget");
|
|
34
|
-
const scm_no_repository_widget_1 = require("./scm-no-repository-widget");
|
|
35
|
-
const scm_service_1 = require("./scm-service");
|
|
36
|
-
const scm_tree_widget_1 = require("./scm-tree-widget");
|
|
37
|
-
const scm_preferences_1 = require("./scm-preferences");
|
|
38
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
39
|
-
let ScmWidget = ScmWidget_1 = class ScmWidget extends browser_1.BaseWidget {
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
this.toDisposeOnRefresh = new disposable_1.DisposableCollection();
|
|
43
|
-
this.node.tabIndex = 0;
|
|
44
|
-
this.id = ScmWidget_1.ID;
|
|
45
|
-
this.addClass('theia-scm');
|
|
46
|
-
this.addClass('theia-scm-main-container');
|
|
47
|
-
}
|
|
48
|
-
set viewMode(mode) {
|
|
49
|
-
this.resourceWidget.viewMode = mode;
|
|
50
|
-
}
|
|
51
|
-
get viewMode() {
|
|
52
|
-
return this.resourceWidget.viewMode;
|
|
53
|
-
}
|
|
54
|
-
init() {
|
|
55
|
-
const layout = new browser_1.PanelLayout();
|
|
56
|
-
this.layout = layout;
|
|
57
|
-
this.panel = new browser_1.Panel({
|
|
58
|
-
layout: new browser_1.PanelLayout({})
|
|
59
|
-
});
|
|
60
|
-
this.panel.node.tabIndex = -1;
|
|
61
|
-
this.panel.node.setAttribute('class', 'theia-scm-panel');
|
|
62
|
-
layout.addWidget(this.panel);
|
|
63
|
-
this.containerLayout.addWidget(this.commitWidget);
|
|
64
|
-
this.containerLayout.addWidget(this.resourceWidget);
|
|
65
|
-
this.containerLayout.addWidget(this.amendWidget);
|
|
66
|
-
this.containerLayout.addWidget(this.noRepositoryWidget);
|
|
67
|
-
this.refresh();
|
|
68
|
-
this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => this.refresh()));
|
|
69
|
-
this.updateViewMode(this.scmPreferences.get('scm.defaultViewMode'));
|
|
70
|
-
this.toDispose.push(this.scmPreferences.onPreferenceChanged(e => {
|
|
71
|
-
if (e.preferenceName === 'scm.defaultViewMode') {
|
|
72
|
-
this.updateViewMode(e.newValue);
|
|
73
|
-
}
|
|
74
|
-
}));
|
|
75
|
-
this.toDispose.push(this.shell.onDidChangeCurrentWidget(({ newValue }) => {
|
|
76
|
-
const uri = browser_1.NavigatableWidget.getUri(newValue || undefined);
|
|
77
|
-
if (uri) {
|
|
78
|
-
this.resourceWidget.selectNodeByUri(uri);
|
|
79
|
-
}
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
get containerLayout() {
|
|
83
|
-
return this.panel.layout;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Updates the view mode based on the preference value.
|
|
87
|
-
* @param preference the view mode preference.
|
|
88
|
-
*/
|
|
89
|
-
updateViewMode(preference) {
|
|
90
|
-
this.viewMode = preference;
|
|
91
|
-
}
|
|
92
|
-
refresh() {
|
|
93
|
-
this.toDisposeOnRefresh.dispose();
|
|
94
|
-
this.toDispose.push(this.toDisposeOnRefresh);
|
|
95
|
-
const repository = this.scmService.selectedRepository;
|
|
96
|
-
this.title.label = repository ? repository.provider.label : nls_1.nls.localize('theia/scm/noRepositoryFound', 'No repository found');
|
|
97
|
-
this.title.caption = this.title.label;
|
|
98
|
-
this.update();
|
|
99
|
-
if (repository) {
|
|
100
|
-
this.toDisposeOnRefresh.push(repository.onDidChange(() => this.update()));
|
|
101
|
-
// render synchronously to avoid cursor jumping
|
|
102
|
-
// see https://stackoverflow.com/questions/28922275/in-reactjs-why-does-setstate-behave-differently-when-called-synchronously/28922465#28922465
|
|
103
|
-
this.toDisposeOnRefresh.push(repository.input.onDidChange(() => this.updateImmediately()));
|
|
104
|
-
this.toDisposeOnRefresh.push(repository.input.onDidFocus(() => this.focusInput()));
|
|
105
|
-
this.commitWidget.show();
|
|
106
|
-
this.resourceWidget.show();
|
|
107
|
-
this.amendWidget.show();
|
|
108
|
-
this.noRepositoryWidget.hide();
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.commitWidget.hide();
|
|
112
|
-
this.resourceWidget.hide();
|
|
113
|
-
this.amendWidget.hide();
|
|
114
|
-
this.noRepositoryWidget.show();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
updateImmediately() {
|
|
118
|
-
this.onUpdateRequest(browser_1.Widget.Msg.UpdateRequest);
|
|
119
|
-
}
|
|
120
|
-
onUpdateRequest(msg) {
|
|
121
|
-
browser_1.MessageLoop.sendMessage(this.commitWidget, msg);
|
|
122
|
-
browser_1.MessageLoop.sendMessage(this.resourceWidget, msg);
|
|
123
|
-
browser_1.MessageLoop.sendMessage(this.amendWidget, msg);
|
|
124
|
-
browser_1.MessageLoop.sendMessage(this.noRepositoryWidget, msg);
|
|
125
|
-
super.onUpdateRequest(msg);
|
|
126
|
-
}
|
|
127
|
-
onAfterAttach(msg) {
|
|
128
|
-
this.node.appendChild(this.commitWidget.node);
|
|
129
|
-
this.node.appendChild(this.resourceWidget.node);
|
|
130
|
-
this.node.appendChild(this.amendWidget.node);
|
|
131
|
-
this.node.appendChild(this.noRepositoryWidget.node);
|
|
132
|
-
super.onAfterAttach(msg);
|
|
133
|
-
this.update();
|
|
134
|
-
}
|
|
135
|
-
onActivateRequest(msg) {
|
|
136
|
-
super.onActivateRequest(msg);
|
|
137
|
-
this.refresh();
|
|
138
|
-
if (this.commitWidget.isVisible) {
|
|
139
|
-
this.commitWidget.focus();
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
this.node.focus();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
focusInput() {
|
|
146
|
-
this.commitWidget.focus();
|
|
147
|
-
}
|
|
148
|
-
storeState() {
|
|
149
|
-
const state = {
|
|
150
|
-
commitState: this.commitWidget.storeState(),
|
|
151
|
-
changesTreeState: this.resourceWidget.storeState(),
|
|
152
|
-
};
|
|
153
|
-
return state;
|
|
154
|
-
}
|
|
155
|
-
restoreState(oldState) {
|
|
156
|
-
const { commitState, changesTreeState } = oldState;
|
|
157
|
-
this.commitWidget.restoreState(commitState);
|
|
158
|
-
this.resourceWidget.restoreState(changesTreeState);
|
|
159
|
-
}
|
|
160
|
-
collapseScmTree() {
|
|
161
|
-
const { model } = this.resourceWidget;
|
|
162
|
-
const root = model.root;
|
|
163
|
-
if (browser_1.CompositeTreeNode.is(root)) {
|
|
164
|
-
root.children.map(group => {
|
|
165
|
-
if (browser_1.CompositeTreeNode.is(group)) {
|
|
166
|
-
group.children.map(folderNode => {
|
|
167
|
-
if (browser_1.CompositeTreeNode.is(folderNode)) {
|
|
168
|
-
model.collapseAll(folderNode);
|
|
169
|
-
}
|
|
170
|
-
if (browser_1.SelectableTreeNode.isSelected(folderNode)) {
|
|
171
|
-
model.toggleNode(folderNode);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
ScmWidget.ID = 'scm-view';
|
|
180
|
-
__decorate([
|
|
181
|
-
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
182
|
-
__metadata("design:type", browser_1.ApplicationShell)
|
|
183
|
-
], ScmWidget.prototype, "shell", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
(0, inversify_1.inject)(scm_service_1.ScmService),
|
|
186
|
-
__metadata("design:type", scm_service_1.ScmService)
|
|
187
|
-
], ScmWidget.prototype, "scmService", void 0);
|
|
188
|
-
__decorate([
|
|
189
|
-
(0, inversify_1.inject)(scm_commit_widget_1.ScmCommitWidget),
|
|
190
|
-
__metadata("design:type", scm_commit_widget_1.ScmCommitWidget)
|
|
191
|
-
], ScmWidget.prototype, "commitWidget", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
(0, inversify_1.inject)(scm_tree_widget_1.ScmTreeWidget),
|
|
194
|
-
__metadata("design:type", scm_tree_widget_1.ScmTreeWidget)
|
|
195
|
-
], ScmWidget.prototype, "resourceWidget", void 0);
|
|
196
|
-
__decorate([
|
|
197
|
-
(0, inversify_1.inject)(scm_amend_widget_1.ScmAmendWidget),
|
|
198
|
-
__metadata("design:type", scm_amend_widget_1.ScmAmendWidget)
|
|
199
|
-
], ScmWidget.prototype, "amendWidget", void 0);
|
|
200
|
-
__decorate([
|
|
201
|
-
(0, inversify_1.inject)(scm_no_repository_widget_1.ScmNoRepositoryWidget),
|
|
202
|
-
__metadata("design:type", scm_no_repository_widget_1.ScmNoRepositoryWidget)
|
|
203
|
-
], ScmWidget.prototype, "noRepositoryWidget", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
(0, inversify_1.inject)(scm_preferences_1.ScmPreferences),
|
|
206
|
-
__metadata("design:type", Object)
|
|
207
|
-
], ScmWidget.prototype, "scmPreferences", void 0);
|
|
208
|
-
__decorate([
|
|
209
|
-
(0, inversify_1.postConstruct)(),
|
|
210
|
-
__metadata("design:type", Function),
|
|
211
|
-
__metadata("design:paramtypes", []),
|
|
212
|
-
__metadata("design:returntype", void 0)
|
|
213
|
-
], ScmWidget.prototype, "init", null);
|
|
214
|
-
ScmWidget = ScmWidget_1 = __decorate([
|
|
215
|
-
(0, inversify_1.injectable)(),
|
|
216
|
-
__metadata("design:paramtypes", [])
|
|
217
|
-
], ScmWidget);
|
|
218
|
-
exports.ScmWidget = ScmWidget;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var ScmWidget_1;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ScmWidget = void 0;
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
31
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
32
|
+
const scm_commit_widget_1 = require("./scm-commit-widget");
|
|
33
|
+
const scm_amend_widget_1 = require("./scm-amend-widget");
|
|
34
|
+
const scm_no_repository_widget_1 = require("./scm-no-repository-widget");
|
|
35
|
+
const scm_service_1 = require("./scm-service");
|
|
36
|
+
const scm_tree_widget_1 = require("./scm-tree-widget");
|
|
37
|
+
const scm_preferences_1 = require("./scm-preferences");
|
|
38
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
39
|
+
let ScmWidget = ScmWidget_1 = class ScmWidget extends browser_1.BaseWidget {
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
this.toDisposeOnRefresh = new disposable_1.DisposableCollection();
|
|
43
|
+
this.node.tabIndex = 0;
|
|
44
|
+
this.id = ScmWidget_1.ID;
|
|
45
|
+
this.addClass('theia-scm');
|
|
46
|
+
this.addClass('theia-scm-main-container');
|
|
47
|
+
}
|
|
48
|
+
set viewMode(mode) {
|
|
49
|
+
this.resourceWidget.viewMode = mode;
|
|
50
|
+
}
|
|
51
|
+
get viewMode() {
|
|
52
|
+
return this.resourceWidget.viewMode;
|
|
53
|
+
}
|
|
54
|
+
init() {
|
|
55
|
+
const layout = new browser_1.PanelLayout();
|
|
56
|
+
this.layout = layout;
|
|
57
|
+
this.panel = new browser_1.Panel({
|
|
58
|
+
layout: new browser_1.PanelLayout({})
|
|
59
|
+
});
|
|
60
|
+
this.panel.node.tabIndex = -1;
|
|
61
|
+
this.panel.node.setAttribute('class', 'theia-scm-panel');
|
|
62
|
+
layout.addWidget(this.panel);
|
|
63
|
+
this.containerLayout.addWidget(this.commitWidget);
|
|
64
|
+
this.containerLayout.addWidget(this.resourceWidget);
|
|
65
|
+
this.containerLayout.addWidget(this.amendWidget);
|
|
66
|
+
this.containerLayout.addWidget(this.noRepositoryWidget);
|
|
67
|
+
this.refresh();
|
|
68
|
+
this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => this.refresh()));
|
|
69
|
+
this.updateViewMode(this.scmPreferences.get('scm.defaultViewMode'));
|
|
70
|
+
this.toDispose.push(this.scmPreferences.onPreferenceChanged(e => {
|
|
71
|
+
if (e.preferenceName === 'scm.defaultViewMode') {
|
|
72
|
+
this.updateViewMode(e.newValue);
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
this.toDispose.push(this.shell.onDidChangeCurrentWidget(({ newValue }) => {
|
|
76
|
+
const uri = browser_1.NavigatableWidget.getUri(newValue || undefined);
|
|
77
|
+
if (uri) {
|
|
78
|
+
this.resourceWidget.selectNodeByUri(uri);
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
get containerLayout() {
|
|
83
|
+
return this.panel.layout;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Updates the view mode based on the preference value.
|
|
87
|
+
* @param preference the view mode preference.
|
|
88
|
+
*/
|
|
89
|
+
updateViewMode(preference) {
|
|
90
|
+
this.viewMode = preference;
|
|
91
|
+
}
|
|
92
|
+
refresh() {
|
|
93
|
+
this.toDisposeOnRefresh.dispose();
|
|
94
|
+
this.toDispose.push(this.toDisposeOnRefresh);
|
|
95
|
+
const repository = this.scmService.selectedRepository;
|
|
96
|
+
this.title.label = repository ? repository.provider.label : nls_1.nls.localize('theia/scm/noRepositoryFound', 'No repository found');
|
|
97
|
+
this.title.caption = this.title.label;
|
|
98
|
+
this.update();
|
|
99
|
+
if (repository) {
|
|
100
|
+
this.toDisposeOnRefresh.push(repository.onDidChange(() => this.update()));
|
|
101
|
+
// render synchronously to avoid cursor jumping
|
|
102
|
+
// see https://stackoverflow.com/questions/28922275/in-reactjs-why-does-setstate-behave-differently-when-called-synchronously/28922465#28922465
|
|
103
|
+
this.toDisposeOnRefresh.push(repository.input.onDidChange(() => this.updateImmediately()));
|
|
104
|
+
this.toDisposeOnRefresh.push(repository.input.onDidFocus(() => this.focusInput()));
|
|
105
|
+
this.commitWidget.show();
|
|
106
|
+
this.resourceWidget.show();
|
|
107
|
+
this.amendWidget.show();
|
|
108
|
+
this.noRepositoryWidget.hide();
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.commitWidget.hide();
|
|
112
|
+
this.resourceWidget.hide();
|
|
113
|
+
this.amendWidget.hide();
|
|
114
|
+
this.noRepositoryWidget.show();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
updateImmediately() {
|
|
118
|
+
this.onUpdateRequest(browser_1.Widget.Msg.UpdateRequest);
|
|
119
|
+
}
|
|
120
|
+
onUpdateRequest(msg) {
|
|
121
|
+
browser_1.MessageLoop.sendMessage(this.commitWidget, msg);
|
|
122
|
+
browser_1.MessageLoop.sendMessage(this.resourceWidget, msg);
|
|
123
|
+
browser_1.MessageLoop.sendMessage(this.amendWidget, msg);
|
|
124
|
+
browser_1.MessageLoop.sendMessage(this.noRepositoryWidget, msg);
|
|
125
|
+
super.onUpdateRequest(msg);
|
|
126
|
+
}
|
|
127
|
+
onAfterAttach(msg) {
|
|
128
|
+
this.node.appendChild(this.commitWidget.node);
|
|
129
|
+
this.node.appendChild(this.resourceWidget.node);
|
|
130
|
+
this.node.appendChild(this.amendWidget.node);
|
|
131
|
+
this.node.appendChild(this.noRepositoryWidget.node);
|
|
132
|
+
super.onAfterAttach(msg);
|
|
133
|
+
this.update();
|
|
134
|
+
}
|
|
135
|
+
onActivateRequest(msg) {
|
|
136
|
+
super.onActivateRequest(msg);
|
|
137
|
+
this.refresh();
|
|
138
|
+
if (this.commitWidget.isVisible) {
|
|
139
|
+
this.commitWidget.focus();
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.node.focus();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
focusInput() {
|
|
146
|
+
this.commitWidget.focus();
|
|
147
|
+
}
|
|
148
|
+
storeState() {
|
|
149
|
+
const state = {
|
|
150
|
+
commitState: this.commitWidget.storeState(),
|
|
151
|
+
changesTreeState: this.resourceWidget.storeState(),
|
|
152
|
+
};
|
|
153
|
+
return state;
|
|
154
|
+
}
|
|
155
|
+
restoreState(oldState) {
|
|
156
|
+
const { commitState, changesTreeState } = oldState;
|
|
157
|
+
this.commitWidget.restoreState(commitState);
|
|
158
|
+
this.resourceWidget.restoreState(changesTreeState);
|
|
159
|
+
}
|
|
160
|
+
collapseScmTree() {
|
|
161
|
+
const { model } = this.resourceWidget;
|
|
162
|
+
const root = model.root;
|
|
163
|
+
if (browser_1.CompositeTreeNode.is(root)) {
|
|
164
|
+
root.children.map(group => {
|
|
165
|
+
if (browser_1.CompositeTreeNode.is(group)) {
|
|
166
|
+
group.children.map(folderNode => {
|
|
167
|
+
if (browser_1.CompositeTreeNode.is(folderNode)) {
|
|
168
|
+
model.collapseAll(folderNode);
|
|
169
|
+
}
|
|
170
|
+
if (browser_1.SelectableTreeNode.isSelected(folderNode)) {
|
|
171
|
+
model.toggleNode(folderNode);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
ScmWidget.ID = 'scm-view';
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
182
|
+
__metadata("design:type", browser_1.ApplicationShell)
|
|
183
|
+
], ScmWidget.prototype, "shell", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, inversify_1.inject)(scm_service_1.ScmService),
|
|
186
|
+
__metadata("design:type", scm_service_1.ScmService)
|
|
187
|
+
], ScmWidget.prototype, "scmService", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
(0, inversify_1.inject)(scm_commit_widget_1.ScmCommitWidget),
|
|
190
|
+
__metadata("design:type", scm_commit_widget_1.ScmCommitWidget)
|
|
191
|
+
], ScmWidget.prototype, "commitWidget", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, inversify_1.inject)(scm_tree_widget_1.ScmTreeWidget),
|
|
194
|
+
__metadata("design:type", scm_tree_widget_1.ScmTreeWidget)
|
|
195
|
+
], ScmWidget.prototype, "resourceWidget", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
(0, inversify_1.inject)(scm_amend_widget_1.ScmAmendWidget),
|
|
198
|
+
__metadata("design:type", scm_amend_widget_1.ScmAmendWidget)
|
|
199
|
+
], ScmWidget.prototype, "amendWidget", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, inversify_1.inject)(scm_no_repository_widget_1.ScmNoRepositoryWidget),
|
|
202
|
+
__metadata("design:type", scm_no_repository_widget_1.ScmNoRepositoryWidget)
|
|
203
|
+
], ScmWidget.prototype, "noRepositoryWidget", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, inversify_1.inject)(scm_preferences_1.ScmPreferences),
|
|
206
|
+
__metadata("design:type", Object)
|
|
207
|
+
], ScmWidget.prototype, "scmPreferences", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, inversify_1.postConstruct)(),
|
|
210
|
+
__metadata("design:type", Function),
|
|
211
|
+
__metadata("design:paramtypes", []),
|
|
212
|
+
__metadata("design:returntype", void 0)
|
|
213
|
+
], ScmWidget.prototype, "init", null);
|
|
214
|
+
ScmWidget = ScmWidget_1 = __decorate([
|
|
215
|
+
(0, inversify_1.injectable)(),
|
|
216
|
+
__metadata("design:paramtypes", [])
|
|
217
|
+
], ScmWidget);
|
|
218
|
+
exports.ScmWidget = ScmWidget;
|
|
219
219
|
//# sourceMappingURL=scm-widget.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/scm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0-next.72+4a275b29d",
|
|
4
4
|
"description": "Theia - Source control Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
6
|
+
"@theia/core": "1.46.0-next.72+4a275b29d",
|
|
7
|
+
"@theia/editor": "1.46.0-next.72+4a275b29d",
|
|
8
|
+
"@theia/filesystem": "1.46.0-next.72+4a275b29d",
|
|
9
9
|
"@types/diff": "^3.2.2",
|
|
10
10
|
"diff": "^3.4.0",
|
|
11
11
|
"p-debounce": "^2.1.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"watch": "theiaext watch"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@theia/ext-scripts": "1.
|
|
48
|
+
"@theia/ext-scripts": "1.46.0"
|
|
49
49
|
},
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "../../configs/nyc.json"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "4a275b29d0db6c81190488c7f76cb667da05ef19"
|
|
54
54
|
}
|