Browse Source

Fixes showing views

main
Eric Amodio 6 years ago
parent
commit
f6f0fd48bc
5 changed files with 23 additions and 7 deletions
  1. +4
    -0
      src/views/fileHistoryView.ts
  2. +4
    -0
      src/views/lineHistoryView.ts
  3. +4
    -0
      src/views/repositoriesView.ts
  4. +4
    -0
      src/views/resultsView.ts
  5. +7
    -7
      src/views/viewBase.ts

+ 4
- 0
src/views/fileHistoryView.ts View File

@ -16,6 +16,10 @@ export class FileHistoryView extends ViewBase {
return new FileHistoryTrackerNode(this); return new FileHistoryTrackerNode(this);
} }
protected get location(): string {
return this.config.location;
}
protected registerCommands() { protected registerCommands() {
Container.viewCommands; Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);

+ 4
- 0
src/views/lineHistoryView.ts View File

@ -16,6 +16,10 @@ export class LineHistoryView extends ViewBase {
return new LineHistoryTrackerNode(this); return new LineHistoryTrackerNode(this);
} }
protected get location(): string {
return this.config.location;
}
protected registerCommands() { protected registerCommands() {
Container.viewCommands; Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);

+ 4
- 0
src/views/repositoriesView.ts View File

@ -22,6 +22,10 @@ export class RepositoriesView extends ViewBase {
return new RepositoriesNode(this); return new RepositoriesNode(this);
} }
protected get location(): string {
return this.config.location;
}
protected registerCommands() { protected registerCommands() {
Container.viewCommands; Container.viewCommands;

+ 4
- 0
src/views/resultsView.ts View File

@ -28,6 +28,10 @@ export class ResultsView extends ViewBase {
return new ResultsNode(this); return new ResultsNode(this);
} }
protected get location(): string {
return this.config.location;
}
protected registerCommands() { protected registerCommands() {
Container.viewCommands; Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this); commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);

+ 7
- 7
src/views/viewBase.ts View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
import { import {
commands,
ConfigurationChangeEvent, ConfigurationChangeEvent,
Disposable, Disposable,
Event, Event,
@ -73,6 +74,8 @@ export abstract class ViewBase implements TreeDataProvid
return `${this.id}.${command}`; return `${this.id}.${command}`;
} }
protected abstract get location(): string;
protected abstract getRoot(): TRoot; protected abstract getRoot(): TRoot;
protected abstract registerCommands(): void; protected abstract registerCommands(): void;
protected abstract onConfigurationChanged(e: ConfigurationChangeEvent): void; protected abstract onConfigurationChanged(e: ConfigurationChangeEvent): void;
@ -178,7 +181,7 @@ export abstract class ViewBase implements TreeDataProvid
focus?: boolean | undefined; focus?: boolean | undefined;
} }
) { ) {
if (this._tree === undefined || this._root === undefined) return;
if (this._tree === undefined) return;
try { try {
await this._tree.reveal(node, options); await this._tree.reveal(node, options);
@ -189,12 +192,9 @@ export abstract class ViewBase implements TreeDataProvid
} }
@log() @log()
async show() {
if (this._tree === undefined || this._root === undefined) return;
// This sucks -- have to get the first child to reveal the tree
const [child] = await this._root.getChildren();
return this.reveal(child, { select: false, focus: true });
show() {
const location = this.location;
return commands.executeCommand(`${this.id}${location ? `:${location}` : ''}.focus`);
} }
@debug({ @debug({

Loading…
Cancel
Save