From 561c2777de1e76032008a8d2387c1b4b3e53b825 Mon Sep 17 00:00:00 2001 From: Seb Julliand Date: Fri, 23 Feb 2024 22:04:17 +0100 Subject: [PATCH] Refactored object browser delete action Signed-off-by: Seb Julliand --- package.json | 16 +--------------- src/locale/ids/da.ts | 1 - src/locale/ids/en.ts | 1 - src/locale/ids/fr.ts | 1 - src/views/objectBrowser.ts | 24 ------------------------ 5 files changed, 1 insertion(+), 42 deletions(-) diff --git a/package.json b/package.json index 3f40933ee..39ca55ab2 100644 --- a/package.json +++ b/package.json @@ -1224,13 +1224,6 @@ "category": "IBM i", "icon": "$(files)" }, - { - "command": "code-for-ibmi.deleteMember", - "enablement": "code-for-ibmi:connected", - "title": "Delete...", - "category": "IBM i", - "icon": "$(symbol-file)" - }, { "command": "code-for-ibmi.updateMemberText", "enablement": "code-for-ibmi:connected", @@ -1523,13 +1516,6 @@ "category": "IBM i", "icon": "$(symbol-file)" }, - { - "command": "code-for-ibmi.deleteObject", - "enablement": "code-for-ibmi:connected", - "title": "Delete...", - "category": "IBM i", - "icon": "$(symbol-file)" - }, { "command": "code-for-ibmi.renameObject", "enablement": "code-for-ibmi:connected", @@ -2527,7 +2513,7 @@ "group": "1_objActions@2" }, { - "command": "code-for-ibmi.deleteObject", + "command": "code-for-ibmi.objectBrowser.delete", "when": "view == objectBrowser && viewItem =~ /^object/", "group": "1_objActions@5" }, diff --git a/src/locale/ids/da.ts b/src/locale/ids/da.ts index c7783c46e..6d8d20684 100644 --- a/src/locale/ids/da.ts +++ b/src/locale/ids/da.ts @@ -192,7 +192,6 @@ export const da: Locale = { 'objectBrowser.copyObject.infoMessage': `Kopierede objekt {0} {1} til {2}.`, 'objectBrowser.copyObject.infoMessage2': `Kopierede objekt {0} {1} til {2}. Opfrisk object browser.`, 'objectBrowser.copyObject.errorMessage4': `Fejl ved kopiering af objekt {0}! {1}`, - 'objectBrowser.deleteObject.warningMessage': `Er du sikker på at du vil slette {0} {1}?`, 'objectBrowser.deleteObject.infoMessage': `Slettede {0} {1}.`, 'objectBrowser.deleteObject.errorMessage': `Fejl ved sletning af objekt! {0}`, 'objectBrowser.deleteObject.progress':'Sletter objekt {0} {1}...', diff --git a/src/locale/ids/en.ts b/src/locale/ids/en.ts index 53ef7f945..c55bda3f5 100644 --- a/src/locale/ids/en.ts +++ b/src/locale/ids/en.ts @@ -192,7 +192,6 @@ export const en: Locale = { 'objectBrowser.copyObject.infoMessage': `Copied object {0} {1} to {2}.`, 'objectBrowser.copyObject.infoMessage2': `Copied object {0} {1} to {2}. Refresh object browser.`, 'objectBrowser.copyObject.errorMessage4': `Error copying object {0}! {1}`, - 'objectBrowser.deleteObject.warningMessage': `Are you sure you want to delete {0} {1}?`, 'objectBrowser.deleteObject.infoMessage': `Deleted {0} {1}.`, 'objectBrowser.deleteObject.errorMessage': `Error deleting object! {0}`, 'objectBrowser.deleteObject.progress':'Deleting object {0} {1}...', diff --git a/src/locale/ids/fr.ts b/src/locale/ids/fr.ts index ab0791326..99170658c 100644 --- a/src/locale/ids/fr.ts +++ b/src/locale/ids/fr.ts @@ -192,7 +192,6 @@ export const fr: Locale = { 'objectBrowser.copyObject.infoMessage': `Objet {0} {1} copié vers {2}.`, 'objectBrowser.copyObject.infoMessage2': `Objet {0} {1} copié vers {2}. Rafraîchissement de l'explorateur d'objet.`, 'objectBrowser.copyObject.errorMessage4': `Erreur lors de la copie de l'objet {0}! {1}`, - 'objectBrowser.deleteObject.warningMessage': `Êtes-vous sûr de vouloir supprimer {0} {1}?`, 'objectBrowser.deleteObject.infoMessage': `{0} {1} supprimé.`, 'objectBrowser.deleteObject.errorMessage': `Erreur lors de la suppression de l'objet! {0}`, 'objectBrowser.deleteObject.progress':`Suppression de l'objet {0} {1}...`, diff --git a/src/views/objectBrowser.ts b/src/views/objectBrowser.ts index 01e40c037..fa80fcc21 100644 --- a/src/views/objectBrowser.ts +++ b/src/views/objectBrowser.ts @@ -1047,30 +1047,6 @@ export function initializeObjectBrowser(context: vscode.ExtensionContext) { } while (newPath && !newPathOK) }), - vscode.commands.registerCommand(`code-for-ibmi.deleteObject`, async (node: ObjectBrowserObjectItem | ObjectBrowserSourcePhysicalFileItem) => { - let result = await vscode.window.showWarningMessage(t(`objectBrowser.deleteObject.warningMessage`, node.path, node.object.type.toUpperCase()), t(`Yes`), t(`Cancel`)); - - if (result === t(`Yes`)) { - const connection = getConnection(); - await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: t("objectBrowser.deleteObject.progress", node.path, node.object.type.toUpperCase()) } - , async (progress) => { - // TODO: Progress message about deleting! - const deleteResult = await connection.runCommand({ - command: `DLTOBJ OBJ(${node.path}) OBJTYPE(${node.object.type})`, - noLibList: true - }); - - if (deleteResult.code === 0) { - vscode.window.showInformationMessage(t(`objectBrowser.deleteObject.infoMessage`, node.path, node.object.type.toUpperCase())); - objectBrowser.refresh(node.parent); - } else { - vscode.window.showErrorMessage(t(`objectBrowser.deleteObject.errorMessage`, deleteResult.stderr)); - } - } - ); - } - }), - vscode.commands.registerCommand(`code-for-ibmi.renameObject`, async (node: ObjectBrowserObjectItem) => { let [, newObject] = node.path.split(`/`); let newObjectOK;