Skip to content

Commit b181688

Browse files
committed
#1 #3 #4 Add button visual composer button
1 parent 29b5e75 commit b181688

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

vscode-extension/package.json

+33-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,45 @@
1111
"Other"
1212
],
1313
"activationEvents": [
14-
"onCommand:extension.sayHello"
14+
"onCommand:extension.createExampleProject",
15+
"onCommand:extension.createSeedProject",
16+
"onCommand:extension.generateUISchema"
1517
],
1618
"main": "./out/extension",
1719
"contributes": {
1820
"commands": [
1921
{
20-
"command": "extension.sayHello",
21-
"title": "Hello World"
22+
"command": "extension.createExampleProject",
23+
"title": "Create Example Project"
24+
},
25+
{
26+
"command": "extension.createSeedProject",
27+
"title": "Create Seed Project"
28+
},
29+
{
30+
"command": "extension.generateUISchema",
31+
"title": "Generate UI Schema"
2232
}
23-
]
33+
],
34+
"menus": {
35+
"explorer/context": [
36+
{
37+
"when": "explorerResourceIsFolder",
38+
"command": "extension.createExampleProject",
39+
"group": "jsonforms"
40+
},
41+
{
42+
"when": "explorerResourceIsFolder",
43+
"command": "extension.createSeedProject",
44+
"group": "jsonforms"
45+
},
46+
{
47+
"when": "resourceExtname == .json",
48+
"command": "extension.generateUISchema",
49+
"group": "jsonforms"
50+
}
51+
]
52+
}
2453
},
2554
"scripts": {
2655
"vscode:prepublish": "npm run compile",

vscode-extension/src/extension.ts

+19-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,30 @@ export function activate(context: vscode.ExtensionContext) {
1414
// The command has been defined in the package.json file
1515
// Now provide the implementation of the command with registerCommand
1616
// The commandId parameter must match the command field in package.json
17-
let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
17+
let createExampleProject = vscode.commands.registerCommand('extension.createExampleProject', (args: any) => {
1818
// The code you place here will be executed every time your command is executed
19+
let path = (args) ? args.path : "";
20+
// Display a message box to the user
21+
vscode.window.showInformationMessage('Creating example project: '+path);
22+
});
1923

24+
let createSeedProject = vscode.commands.registerCommand('extension.createSeedProject', (args: any) => {
25+
// The code you place here will be executed every time your command is executed
26+
let path = (args) ? args.path : "";
27+
// Display a message box to the user
28+
vscode.window.showInformationMessage('Creating seed project: '+path);
29+
});
30+
31+
let generateUISchema = vscode.commands.registerCommand('extension.generateUISchema', (args: any) => {
32+
// The code you place here will be executed every time your command is executed
33+
let path = (args) ? args.path : "";
2034
// Display a message box to the user
21-
vscode.window.showInformationMessage('Hello World!');
35+
vscode.window.showInformationMessage('Generating UI Schema: '+path);
2236
});
2337

24-
context.subscriptions.push(disposable);
38+
context.subscriptions.push(createExampleProject);
39+
context.subscriptions.push(createSeedProject);
40+
context.subscriptions.push(generateUISchema);
2541
}
2642

2743
// this method is called when your extension is deactivated

0 commit comments

Comments
 (0)