From b181688da972edee8dc45b7963a1575ef3e36624 Mon Sep 17 00:00:00 2001 From: Florian Gareis Date: Tue, 13 Nov 2018 16:54:13 +0100 Subject: [PATCH] #1 #3 #4 Add button visual composer button --- vscode-extension/package.json | 37 +++++++++++++++++++++++++++---- vscode-extension/src/extension.ts | 22 +++++++++++++++--- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/vscode-extension/package.json b/vscode-extension/package.json index f5b845c..84e3274 100644 --- a/vscode-extension/package.json +++ b/vscode-extension/package.json @@ -11,16 +11,45 @@ "Other" ], "activationEvents": [ - "onCommand:extension.sayHello" + "onCommand:extension.createExampleProject", + "onCommand:extension.createSeedProject", + "onCommand:extension.generateUISchema" ], "main": "./out/extension", "contributes": { "commands": [ { - "command": "extension.sayHello", - "title": "Hello World" + "command": "extension.createExampleProject", + "title": "Create Example Project" + }, + { + "command": "extension.createSeedProject", + "title": "Create Seed Project" + }, + { + "command": "extension.generateUISchema", + "title": "Generate UI Schema" } - ] + ], + "menus": { + "explorer/context": [ + { + "when": "explorerResourceIsFolder", + "command": "extension.createExampleProject", + "group": "jsonforms" + }, + { + "when": "explorerResourceIsFolder", + "command": "extension.createSeedProject", + "group": "jsonforms" + }, + { + "when": "resourceExtname == .json", + "command": "extension.generateUISchema", + "group": "jsonforms" + } + ] + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/vscode-extension/src/extension.ts b/vscode-extension/src/extension.ts index d38a48c..6b8a7fb 100644 --- a/vscode-extension/src/extension.ts +++ b/vscode-extension/src/extension.ts @@ -14,14 +14,30 @@ export function activate(context: vscode.ExtensionContext) { // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('extension.sayHello', () => { + let createExampleProject = vscode.commands.registerCommand('extension.createExampleProject', (args: any) => { // The code you place here will be executed every time your command is executed + let path = (args) ? args.path : ""; + // Display a message box to the user + vscode.window.showInformationMessage('Creating example project: '+path); + }); + let createSeedProject = vscode.commands.registerCommand('extension.createSeedProject', (args: any) => { + // The code you place here will be executed every time your command is executed + let path = (args) ? args.path : ""; + // Display a message box to the user + vscode.window.showInformationMessage('Creating seed project: '+path); + }); + + let generateUISchema = vscode.commands.registerCommand('extension.generateUISchema', (args: any) => { + // The code you place here will be executed every time your command is executed + let path = (args) ? args.path : ""; // Display a message box to the user - vscode.window.showInformationMessage('Hello World!'); + vscode.window.showInformationMessage('Generating UI Schema: '+path); }); - context.subscriptions.push(disposable); + context.subscriptions.push(createExampleProject); + context.subscriptions.push(createSeedProject); + context.subscriptions.push(generateUISchema); } // this method is called when your extension is deactivated