From 7efc8b569196ef31608f81a52023585feb6fe833 Mon Sep 17 00:00:00 2001 From: Kyrellos Salib Date: Tue, 14 May 2019 11:54:56 -0400 Subject: [PATCH 1/9] show build commands in the editor context menu depending on file type --- lib/spl-build.js | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/lib/spl-build.js b/lib/spl-build.js index 3406395..2fb5978 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -392,6 +392,61 @@ export default { { type: 'separator' } + ], + 'atom-text-editor': [ + { + type: 'separator' + }, + { + label: 'IBM Streams', + shouldDisplay: self.shouldShowMenuE, + beforeGroupContaining: ['tree-view:open-selected-entry-up'], + submenu: [ + { + label: 'Build', + command: 'spl-build:build-download', + shouldDisplay: self.shouldShowMenuSplE + }, + { + label: 'Build and submit job', + command: 'spl-build:build-submit', + shouldDisplay: self.shouldShowMenuSplE + }, + { + label: 'Build', + command: 'spl-build:build-make-download', + shouldDisplay: self.shouldShowMenuMakeE + }, + { + label: 'Build and submit job(s)', + command: 'spl-build:build-make-submit', + shouldDisplay: self.shouldShowMenuMakeE + }, + { + label: 'Submit job', + command: 'spl-build:submit', + shouldDisplay: self.shouldShowMenuSubmitE + }, + { + label: 'Open IBM Cloud Private for Data dashboard', + command: 'spl-build:open-icp4d-dashboard', + shouldDisplay: self.shouldShowMenuV5E.bind(self) + }, + { + label: 'Open IBM Cloud dashboard', + command: 'spl-build:open-IBM-cloud-dashboard', + shouldDisplay: self.shouldShowMenuV4E.bind(self) + }, + { + label: 'Open IBM Streams Console', + command: 'spl-build:open-streams-console', + shouldDisplay: self.shouldShowMenuE.bind(self) + } + ] + }, + { + type: 'separator' + } ] }) ); @@ -425,14 +480,23 @@ export default { shouldShowMenuSpl(event) { return !!event.target.innerText.toLowerCase().endsWith('.spl'); }, + shouldShowMenuSplE() { + return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('spl'); + }, shouldShowMenuMake(event) { return event.target.innerText.toLowerCase() === 'makefile'; }, + shouldShowMenuMakeE() { + return atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile'; + }, shouldShowMenuSubmit(event) { return !!event.target.innerText.toLowerCase().endsWith('.sab'); }, + shouldShowMenuSubmitE() { + return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab'); + }, shouldShowMenu(event) { return !!(event.target.innerText.toLowerCase() === 'makefile' @@ -440,15 +504,29 @@ export default { || event.target.innerText.toLowerCase().endsWith('.sab')); }, + shouldShowMenuE() { + return !!(atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile' + || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.spl') + || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab')); + }, + shouldShowMenuV4(event) { this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V4; }, + shouldShowMenuV4E() { + this.shouldShowMenuE = this.shouldShowMenuE.bind(this); + return this.shouldShowMenuE() && this.apiVersion === CONF_API_VERSION_V4; + }, shouldShowMenuV5(event) { this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V5; }, + shouldShowMenuV5E(event) { + this.shouldShowMenuE = this.shouldShowMenuE.bind(this); + return this.shouldShowMenuE() && this.apiVersion === CONF_API_VERSION_V5; + }, handleBuildCallback(e) { const selectedComp = this.mainCompositePickerView.mainComposite; From 2e3d57131541cbc9fdf640f7ea1aa5753f739ab1 Mon Sep 17 00:00:00 2001 From: Kyrellos Salib Date: Thu, 16 May 2019 10:58:53 -0400 Subject: [PATCH 2/9] show build commands in the editor context menu depending on file type --- lib/spl-build.js | 183 ++++++++++++++++++----------------------------- 1 file changed, 70 insertions(+), 113 deletions(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 2fb5978..b2bcf1d 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -346,48 +346,7 @@ export default { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, beforeGroupContaining: ['tree-view:open-selected-entry-up'], - submenu: [ - { - label: 'Build', - command: 'spl-build:build-download', - shouldDisplay: self.shouldShowMenuSpl - }, - { - label: 'Build and submit job', - command: 'spl-build:build-submit', - shouldDisplay: self.shouldShowMenuSpl - }, - { - label: 'Build', - command: 'spl-build:build-make-download', - shouldDisplay: self.shouldShowMenuMake - }, - { - label: 'Build and submit job(s)', - command: 'spl-build:build-make-submit', - shouldDisplay: self.shouldShowMenuMake - }, - { - label: 'Submit job', - command: 'spl-build:submit', - shouldDisplay: self.shouldShowMenuSubmit - }, - { - label: 'Open IBM Cloud Private for Data dashboard', - command: 'spl-build:open-icp4d-dashboard', - shouldDisplay: self.shouldShowMenuV5.bind(self) - }, - { - label: 'Open IBM Cloud dashboard', - command: 'spl-build:open-IBM-cloud-dashboard', - shouldDisplay: self.shouldShowMenuV4.bind(self) - }, - { - label: 'Open IBM Streams Console', - command: 'spl-build:open-streams-console', - shouldDisplay: self.shouldShowMenu.bind(self) - } - ] + submenu: self.menu(self) }, { type: 'separator' @@ -399,50 +358,9 @@ export default { }, { label: 'IBM Streams', - shouldDisplay: self.shouldShowMenuE, + shouldDisplay: self.shouldShowMenu, beforeGroupContaining: ['tree-view:open-selected-entry-up'], - submenu: [ - { - label: 'Build', - command: 'spl-build:build-download', - shouldDisplay: self.shouldShowMenuSplE - }, - { - label: 'Build and submit job', - command: 'spl-build:build-submit', - shouldDisplay: self.shouldShowMenuSplE - }, - { - label: 'Build', - command: 'spl-build:build-make-download', - shouldDisplay: self.shouldShowMenuMakeE - }, - { - label: 'Build and submit job(s)', - command: 'spl-build:build-make-submit', - shouldDisplay: self.shouldShowMenuMakeE - }, - { - label: 'Submit job', - command: 'spl-build:submit', - shouldDisplay: self.shouldShowMenuSubmitE - }, - { - label: 'Open IBM Cloud Private for Data dashboard', - command: 'spl-build:open-icp4d-dashboard', - shouldDisplay: self.shouldShowMenuV5E.bind(self) - }, - { - label: 'Open IBM Cloud dashboard', - command: 'spl-build:open-IBM-cloud-dashboard', - shouldDisplay: self.shouldShowMenuV4E.bind(self) - }, - { - label: 'Open IBM Streams Console', - command: 'spl-build:open-streams-console', - shouldDisplay: self.shouldShowMenuE.bind(self) - } - ] + submenu: self.menu(self) }, { type: 'separator' @@ -452,6 +370,51 @@ export default { ); }, + menu(self) { + const m = [ + { + label: 'Build', + command: 'spl-build:build-download', + shouldDisplay: self.shouldShowMenuSpl + }, + { + label: 'Build and submit job', + command: 'spl-build:build-submit', + shouldDisplay: self.shouldShowMenuSpl + }, + { + label: 'Build', + command: 'spl-build:build-make-download', + shouldDisplay: self.shouldShowMenuMake + }, + { + label: 'Build and submit job(s)', + command: 'spl-build:build-make-submit', + shouldDisplay: self.shouldShowMenuMake + }, + { + label: 'Submit job', + command: 'spl-build:submit', + shouldDisplay: self.shouldShowMenuSubmit + }, + { + label: 'Open IBM Cloud Private for Data dashboard', + command: 'spl-build:open-icp4d-dashboard', + shouldDisplay: self.shouldShowMenuV5.bind(self) + }, + { + label: 'Open IBM Cloud dashboard', + command: 'spl-build:open-IBM-cloud-dashboard', + shouldDisplay: self.shouldShowMenuV4.bind(self) + }, + { + label: 'Open IBM Streams Console', + command: 'spl-build:open-streams-console', + shouldDisplay: self.shouldShowMenu.bind(self) + } + ]; + return m; + }, consumeLinter(registerIndie) { this.linterService = registerIndie({ name: 'SPL Build' @@ -478,56 +441,50 @@ export default { }, shouldShowMenuSpl(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('spl'); + } return !!event.target.innerText.toLowerCase().endsWith('.spl'); }, - shouldShowMenuSplE() { - return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('spl'); - }, shouldShowMenuMake(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + return atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile'; + } return event.target.innerText.toLowerCase() === 'makefile'; }, - shouldShowMenuMakeE() { - return atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile'; - }, - shouldShowMenuSubmit(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab'); + } return !!event.target.innerText.toLowerCase().endsWith('.sab'); }, - shouldShowMenuSubmitE() { - return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab'); - }, - shouldShowMenu(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + return !!(atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile' + || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.spl') + || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab')); + } return !!(event.target.innerText.toLowerCase() === 'makefile' || event.target.innerText.toLowerCase().endsWith('.spl') || event.target.innerText.toLowerCase().endsWith('.sab')); }, - - shouldShowMenuE() { - return !!(atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile' - || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.spl') - || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab')); - }, - shouldShowMenuV4(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + this.shouldShowMenu = this.shouldShowMenu.bind(this); + return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V4; + } this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V4; }, - shouldShowMenuV4E() { - this.shouldShowMenuE = this.shouldShowMenuE.bind(this); - return this.shouldShowMenuE() && this.apiVersion === CONF_API_VERSION_V4; - }, - shouldShowMenuV5(event) { + if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + this.shouldShowMenu = this.shouldShowMenu.bind(this); + return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V5; + } this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V5; }, - shouldShowMenuV5E(event) { - this.shouldShowMenuE = this.shouldShowMenuE.bind(this); - return this.shouldShowMenuE() && this.apiVersion === CONF_API_VERSION_V5; - }, - handleBuildCallback(e) { const selectedComp = this.mainCompositePickerView.mainComposite; if (selectedComp) { From cfa0820c96061e79bdc666a28792079cedb9bb86 Mon Sep 17 00:00:00 2001 From: Kyrellos-Salib <50332691+Kyrellos-Salib@users.noreply.github.com> Date: Tue, 25 Jun 2019 10:24:02 -0400 Subject: [PATCH 3/9] Update lib/spl-build.js Co-Authored-By: Christian Guy --- lib/spl-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index b2bcf1d..50f9e5f 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -370,7 +370,7 @@ export default { ); }, - menu(self) { + getContextMenu(self) { const m = [ { label: 'Build', From c63359e57719b551bea7bf541af5903baa590aeb Mon Sep 17 00:00:00 2001 From: Kyrellos-Salib <50332691+Kyrellos-Salib@users.noreply.github.com> Date: Tue, 25 Jun 2019 10:24:11 -0400 Subject: [PATCH 4/9] Update lib/spl-build.js Co-Authored-By: Christian Guy --- lib/spl-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 50f9e5f..3a09379 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -346,7 +346,7 @@ export default { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, beforeGroupContaining: ['tree-view:open-selected-entry-up'], - submenu: self.menu(self) + submenu: self.getContextMenu(self) }, { type: 'separator' From 92e0e784b532b4b7ac817a438734d1a5498e377f Mon Sep 17 00:00:00 2001 From: Kyrellos-Salib <50332691+Kyrellos-Salib@users.noreply.github.com> Date: Tue, 25 Jun 2019 10:29:16 -0400 Subject: [PATCH 5/9] Update lib/spl-build.js Co-Authored-By: Christian Guy --- lib/spl-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 3a09379..a83d3d1 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -360,7 +360,7 @@ export default { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, beforeGroupContaining: ['tree-view:open-selected-entry-up'], - submenu: self.menu(self) + submenu: self.getContextMenu(self) }, { type: 'separator' From 8eaefdfe35910d48120c53138323465c47b6b073 Mon Sep 17 00:00:00 2001 From: Kyrellos-Salib <50332691+Kyrellos-Salib@users.noreply.github.com> Date: Tue, 25 Jun 2019 10:33:22 -0400 Subject: [PATCH 6/9] Update lib/spl-build.js Co-Authored-By: Christian Guy --- lib/spl-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index a83d3d1..4721715 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -441,7 +441,7 @@ export default { }, shouldShowMenuSpl(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('spl'); } return !!event.target.innerText.toLowerCase().endsWith('.spl'); From 5573f5538ad92dd01fb4e5a1d261b56ec7f2d76b Mon Sep 17 00:00:00 2001 From: Kyrellos-Salib <50332691+Kyrellos-Salib@users.noreply.github.com> Date: Tue, 25 Jun 2019 10:33:49 -0400 Subject: [PATCH 7/9] Update lib/spl-build.js Co-Authored-By: Christian Guy --- lib/spl-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 4721715..5afaad6 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -359,7 +359,7 @@ export default { { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, - beforeGroupContaining: ['tree-view:open-selected-entry-up'], + beforeGroupContaining: ['core:undo'], submenu: self.getContextMenu(self) }, { From 1ebaa640e67324ae74812573751b6a3789ae9568 Mon Sep 17 00:00:00 2001 From: Kyrellos Salib Date: Tue, 25 Jun 2019 10:34:39 -0400 Subject: [PATCH 8/9] suggested changes --- lib/spl-build.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 3a09379..82c1f2c 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -360,7 +360,7 @@ export default { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, beforeGroupContaining: ['tree-view:open-selected-entry-up'], - submenu: self.menu(self) + submenu: self.getContextMenu(self) }, { type: 'separator' @@ -441,26 +441,26 @@ export default { }, shouldShowMenuSpl(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('spl'); } return !!event.target.innerText.toLowerCase().endsWith('.spl'); }, shouldShowMenuMake(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { return atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile'; } return event.target.innerText.toLowerCase() === 'makefile'; }, shouldShowMenuSubmit(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { return !!atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab'); } return !!event.target.innerText.toLowerCase().endsWith('.sab'); }, shouldShowMenu(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { return !!(atom.workspace.getActiveTextEditor().getTitle().toLowerCase() === 'makefile' || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.spl') || atom.workspace.getActiveTextEditor().getTitle().toLowerCase().endsWith('.sab')); @@ -470,7 +470,7 @@ export default { || event.target.innerText.toLowerCase().endsWith('.sab')); }, shouldShowMenuV4(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V4; } @@ -478,7 +478,7 @@ export default { return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V4; }, shouldShowMenuV5(event) { - if (atom.workspace.getActivePane().activeItem.constructor.name === 'TextEditor') { + if (atom.workspace.getActiveTextEditor()) { this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V5; } From d9ab71da2c050bf40a6a5a35d93c038812318f01 Mon Sep 17 00:00:00 2001 From: Kyrellos Salib Date: Tue, 25 Jun 2019 10:48:27 -0400 Subject: [PATCH 9/9] suggested changes --- lib/spl-build.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/spl-build.js b/lib/spl-build.js index 34d0aba..aaae103 100644 --- a/lib/spl-build.js +++ b/lib/spl-build.js @@ -359,11 +359,7 @@ export default { { label: 'IBM Streams', shouldDisplay: self.shouldShowMenu, -<<<<<<< HEAD - beforeGroupContaining: ['tree-view:open-selected-entry-up'], -======= beforeGroupContaining: ['core:undo'], ->>>>>>> 5573f5538ad92dd01fb4e5a1d261b56ec7f2d76b submenu: self.getContextMenu(self) }, { @@ -474,19 +470,9 @@ export default { || event.target.innerText.toLowerCase().endsWith('.sab')); }, shouldShowMenuV4(event) { - if (atom.workspace.getActiveTextEditor()) { - this.shouldShowMenu = this.shouldShowMenu.bind(this); - return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V4; - } - this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V4; }, shouldShowMenuV5(event) { - if (atom.workspace.getActiveTextEditor()) { - this.shouldShowMenu = this.shouldShowMenu.bind(this); - return this.shouldShowMenu() && this.apiVersion === CONF_API_VERSION_V5; - } - this.shouldShowMenu = this.shouldShowMenu.bind(this); return this.shouldShowMenu(event) && this.apiVersion === CONF_API_VERSION_V5; }, handleBuildCallback(e) {