From b8f8e916600def9bb0ae381f670d042e72c267af Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Sun, 5 May 2024 13:42:35 +0200 Subject: [PATCH] implement refresh logic --- src/web/artifacts_tree_provider.ts | 9 ++++++++- src/web/extension.ts | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/web/artifacts_tree_provider.ts b/src/web/artifacts_tree_provider.ts index 314454a..7fb2757 100644 --- a/src/web/artifacts_tree_provider.ts +++ b/src/web/artifacts_tree_provider.ts @@ -3,6 +3,13 @@ import { AnyArtifact, findArtifacts } from "./artifacts"; export class ArtifactsTreeProvider implements vscode.TreeDataProvider { + private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter(); + readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event; + + public refresh(): void { + this._onDidChangeTreeData.fire(); + } + public getTreeItem(element: ArtifactTreeItem): vscode.TreeItem { return element; } @@ -49,5 +56,5 @@ export class ArtifactTreeItem extends vscode.TreeItem { }; } - public contextValue = "abap-artifacts-context"; +// public contextValue = "abap-artifacts-context"; } \ No newline at end of file diff --git a/src/web/extension.ts b/src/web/extension.ts index de75895..d38bd9f 100644 --- a/src/web/extension.ts +++ b/src/web/extension.ts @@ -3,16 +3,18 @@ import { createArtifact } from './create'; import { ArtifactsTreeProvider } from './artifacts_tree_provider'; export function activate(context: vscode.ExtensionContext) { - vscode.window.registerTreeDataProvider("abap-artifacts.artifacts", new ArtifactsTreeProvider()); + const tree = new ArtifactsTreeProvider(); + vscode.window.registerTreeDataProvider("abap-artifacts.artifacts", tree); vscode.commands.registerCommand('abap-artifacts.tree.refresh', () => - vscode.window.showInformationMessage('todo, refresh') + tree.refresh() ); vscode.commands.registerCommand('abap-artifacts.tree.create', () => vscode.window.showInformationMessage('todo, create') ); vscode.commands.registerCommand('abap-artifacts.tree.rename', () => + // todo: this will call the abaplint extension to rename the object vscode.window.showInformationMessage('todo, rename') ); vscode.commands.registerCommand('abap-artifacts.tree.delete', () =>