Skip to content

Commit

Permalink
implement refresh logic
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed May 5, 2024
1 parent 6a3ddc6 commit b8f8e91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/web/artifacts_tree_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { AnyArtifact, findArtifacts } from "./artifacts";

export class ArtifactsTreeProvider implements vscode.TreeDataProvider<ArtifactTreeItem> {

private _onDidChangeTreeData: vscode.EventEmitter<ArtifactTreeItem | undefined | void> = new vscode.EventEmitter<ArtifactTreeItem | undefined | void>();
readonly onDidChangeTreeData: vscode.Event<ArtifactTreeItem | undefined | void> = this._onDidChangeTreeData.event;

public refresh(): void {
this._onDidChangeTreeData.fire();
}

public getTreeItem(element: ArtifactTreeItem): vscode.TreeItem {
return element;
}
Expand Down Expand Up @@ -49,5 +56,5 @@ export class ArtifactTreeItem extends vscode.TreeItem {
};
}

public contextValue = "abap-artifacts-context";
// public contextValue = "abap-artifacts-context";
}
6 changes: 4 additions & 2 deletions src/web/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () =>
Expand Down

0 comments on commit b8f8e91

Please sign in to comment.