Skip to content

Commit

Permalink
menu scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed May 5, 2024
1 parent 177506f commit 6a3ddc6
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@
"command": "abap-artifacts.create.artifact",
"title": "Create ABAP Artifact",
"category": "abap-artifacts"
},
{
"command": "abap-artifacts.tree.create",
"title": "Create"
},
{
"command": "abap-artifacts.tree.rename",
"title": "Rename"
},
{
"command": "abap-artifacts.tree.delete",
"title": "Delete"
},
{
"command": "abap-artifacts.tree.refresh",
"title": "Refresh",
"icon": {
"light": "resources/light/refresh.svg",
"dark": "resources/dark/refresh.svg"
}
}
],
"views": {
Expand All @@ -49,6 +69,27 @@
]
},
"menus": {
"view/title": [
{
"command": "abap-artifacts.tree.refresh",
"when": "view == abap-artifacts.artifacts",
"group": "navigation"
}
],
"view/item/context": [
{
"command": "abap-artifacts.tree.create",
"when": "view == abap-artifacts.artifacts && viewItem =~ /create/"
},
{
"command": "abap-artifacts.tree.rename",
"when": "view == abap-artifacts.artifacts && viewItem =~ /rename/"
},
{
"command": "abap-artifacts.tree.delete",
"when": "view == abap-artifacts.artifacts && viewItem =~ /delete/"
}
],
"explorer/context": [
{
"command": "abap-artifacts.create.artifact",
Expand Down
1 change: 1 addition & 0 deletions resources/dark/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/light/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/web/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface AnyArtifact {
file: vscode.Uri,
isFolder: boolean,
expand: boolean,
contextValue: string,
sub: AnyArtifact[];
};

Expand Down Expand Up @@ -77,6 +78,7 @@ async function buildFolder(path: string, filenames: vscode.Uri[]): Promise<AnyAr
isFolder: false,
expand: false,
file: filename,
contextValue: "",
});
} else {
sub.push({
Expand All @@ -86,6 +88,7 @@ async function buildFolder(path: string, filenames: vscode.Uri[]): Promise<AnyAr
isFolder: false,
expand: false,
sub: [],
contextValue: "rename,delete",
});
}
}
Expand All @@ -98,6 +101,7 @@ async function buildFolder(path: string, filenames: vscode.Uri[]): Promise<AnyAr
file: packageXmlUri || parsed,
expand: false,
sub: sub,
contextValue: "create,delete",
};
}

Expand Down
1 change: 1 addition & 0 deletions src/web/artifacts_tree_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class ArtifactTreeItem extends vscode.TreeItem {
this.description = info.description;
this.resourceUri = info.file;
this.sub = info.sub;
this.contextValue = info.contextValue;

this.command = {
command: "vscode.open",
Expand Down
14 changes: 14 additions & 0 deletions src/web/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ import { ArtifactsTreeProvider } from './artifacts_tree_provider';
export function activate(context: vscode.ExtensionContext) {
vscode.window.registerTreeDataProvider("abap-artifacts.artifacts", new ArtifactsTreeProvider());

vscode.commands.registerCommand('abap-artifacts.tree.refresh', () =>
vscode.window.showInformationMessage('todo, refresh')
);

vscode.commands.registerCommand('abap-artifacts.tree.create', () =>
vscode.window.showInformationMessage('todo, create')
);
vscode.commands.registerCommand('abap-artifacts.tree.rename', () =>
vscode.window.showInformationMessage('todo, rename')
);
vscode.commands.registerCommand('abap-artifacts.tree.delete', () =>
vscode.window.showInformationMessage('todo, delete')
);

let disposable = vscode.commands.registerCommand('abap-artifacts.create.artifact', createArtifact);
context.subscriptions.push(disposable);
}
Expand Down

0 comments on commit 6a3ddc6

Please sign in to comment.