diff --git a/package.json b/package.json index 7250606..851eba2 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,11 @@ "title": "%extension.haoide.deployThisToServer.title%", "category": "Haoide" }, + { + "command": "extension.haoide.deployOpenFilesToServer", + "title": "%extension.haoide.deployOpenFilesToServer.title%", + "category": "Haoide" + }, { "command": "extension.haoide.reloadSobjectCache", "title": "%extension.haoide.reloadSobjectCache.title%", @@ -177,6 +182,10 @@ "command": "extension.haoide.deployThisToServer", "when": "haoide.hasOpenProject" }, + { + "command": "extension.haoide.deployOpenFilesToServer", + "when": "haoide.hasOpenProject" + }, { "command": "extension.haoide.reloadSobjectCache", "when": "haoide.hasOpenProject" diff --git a/package.nls.json b/package.nls.json index 043036c..f3be0d8 100644 --- a/package.nls.json +++ b/package.nls.json @@ -15,6 +15,7 @@ "extension.haoide.retrieveThisFromServer.title": "Retrieve This File From Server", "extension.haoide.retrieveOpenFilesFromServer.title": "Retrieve Open File From Server", "extension.haoide.deployThisToServer.title": "Deploy This Files to Server", + "extension.haoide.deployOpenFilesToServer.title": "Deploy Open Files to Server", "extension.haoide.reloadSobjectCache.title": "Reload sObject Cache", "extension.haoide.formatJson.title": "Format JSON", "extension.haoide.convertXml2Json.title": "Convert XML to JSON", diff --git a/src/commands/main.ts b/src/commands/main.ts index 08655c8..0b71c12 100644 --- a/src/commands/main.ts +++ b/src/commands/main.ts @@ -242,6 +242,23 @@ export function deployThisToServer() { } } +/** + * Deploy open files to server + */ +export function deployOpenFilesToServer() { + let documents: vscode.TextDocument[] = vscode.workspace.textDocuments; + if (documents) { + let fileNames: string[] = []; + for (const doc of documents) { + fileNames.push(doc.fileName); + } + deployFilesToServer(fileNames); + } + else { + util.showCommandWarning(); + } +} + /** * Deploy files to server * @param files files to be deployed diff --git a/src/extension.ts b/src/extension.ts index b7b0938..24d3ad1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -61,6 +61,12 @@ export function activate(context: vscode.ExtensionContext) { main.deployThisToServer )); + // Register deployOpenFilesToServer command + context.subscriptions.push(vscode.commands.registerCommand( + "extension.haoide.deployOpenFilesToServer", + main.deployOpenFilesToServer + )); + // Register switchProject command context.subscriptions.push(vscode.commands.registerCommand( "extension.haoide.switchProject", utility.switchProject