Skip to content

Commit 899178d

Browse files
committed
Added info message for no resource on delete
1 parent 74d9308 commit 899178d

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/resxProvider.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export class ResxProvider implements vscode.CustomTextEditorProvider {
99
public static register(context: vscode.ExtensionContext): vscode.Disposable {
1010
const provider = new ResxProvider(context);
1111
const providerRegistration = vscode.window.registerCustomEditorProvider(ResxProvider.viewType, provider);
12-
printChannelOutput("ResX Editor custom editor provider registered.", true);
12+
printChannelOutput("ResX Editor custom editor provider registered.", true);
1313
return providerRegistration;
1414
}
1515

1616
private static readonly viewType = 'resx-editor.editor';
1717
private registered = false;
1818
private currentPanel: vscode.WebviewPanel | undefined = undefined;
19-
19+
2020
constructor(
2121
private readonly context: vscode.ExtensionContext
2222
) { }
@@ -56,16 +56,15 @@ export class ResxProvider implements vscode.CustomTextEditorProvider {
5656
comment: result.comment
5757
});
5858
});
59-
});
59+
});
6060

61-
this.context.subscriptions.push(deleteCommand);
62-
this.context.subscriptions.push(addCommand);
61+
this.context.subscriptions.push(deleteCommand);
62+
this.context.subscriptions.push(addCommand);
63+
}
64+
}
65+
catch (e) {
66+
console.log(e);
6367
}
64-
}
65-
catch (e)
66-
{
67-
console.log(e);
68-
}
6968

7069
async function updateWebview() {
7170
webviewPanel.webview.postMessage({
@@ -96,9 +95,13 @@ export class ResxProvider implements vscode.CustomTextEditorProvider {
9695
printChannelOutput(e.message, true);
9796
vscode.window.showErrorMessage(e.message);
9897
return;
98+
case 'info':
99+
printChannelOutput(e.message, true);
100+
vscode.window.showInformationMessage(e.message);
101+
return;
99102
}
100103
});
101-
104+
102105
updateWebview();
103106
}
104107

src/webview/webview.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ let currentRowData = null;
2121
currentRowData = sourceElement._rowData;
2222

2323
if (sourceElement && sourceElement.className !== "column-header") {
24-
24+
2525
const handleChange = (target) => {
2626
const column = target._columnDefinition;
2727
const originalRow = target._rowData;
2828
const originalValue = originalRow[column.columnDataKey];
2929
const newValue = target.innerText;
30-
30+
3131

3232
if (originalValue !== newValue) {
3333
sendLog("Value changed...Original value: " + originalValue + "; " + "New value: " + newValue);
@@ -80,6 +80,12 @@ let currentRowData = null;
8080
refreshResxData();
8181
}
8282
}
83+
else {
84+
vscode.postMessage({
85+
type: 'info',
86+
message: `No selected resource selected. Please select a resource to delete.`
87+
});
88+
}
8389
return;
8490
case 'add':
8591
sendLog(`Adding new resource: Key: ${message.key}, Value: ${message.value}, Comment: ${message.comment}`);
@@ -127,7 +133,7 @@ let currentRowData = null;
127133

128134
function updateContent(/** @type {string} **/ text) {
129135
if (text) {
130-
136+
131137
var resxValues = [];
132138

133139
let json;

0 commit comments

Comments
 (0)