Skip to content
Snippets Groups Projects
Commit ce94d747 authored by Sytze de Witte's avatar Sytze de Witte
Browse files

added clear view button and undo button

parent e6660a94
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,10 @@
"command": "analysisResults.openInCompView",
"title": "Show results in comparison view"
},
{
"command": "analysisResults.clear",
"title": "Clear view"
},
{
"command": "analysisResultsCompView.load",
"title": "Open analysis results"
......@@ -97,10 +101,16 @@
},
{
"command": "analysisResults.openFileInEditor",
"when": "view == analysisResults"
"when": "view == analysisResults",
"group": "show"
},
{
"command": "analysisResults.openInCompView",
"when": "view == analysisResults",
"group": "show"
},
{
"command": "analysisResults.clear",
"when": "view == analysisResults"
},
{
......@@ -115,7 +125,8 @@
},
{
"command": "analysisResultsCompView.openFileInEditor",
"when": "view == analysisResultsCompView"
"when": "view == analysisResultsCompView",
"group": "show"
},
{
"command": "analysisResultsCompView.clearCompView",
......
......@@ -223,13 +223,17 @@ export function activate(context: ExtensionContext) {
);
vscode.commands.registerCommand(
"analysisResults.openInCompView",
() => analysisResultsCompProvider.setJsonObject(analysisResultsProvider.getJsonObject())
"analysisResults.clear",
() => clearView(analysisResultsProvider)
);
vscode.commands.registerCommand(
"analysisResultsCompView.clearCompView",
() => analysisResultsCompProvider.setJsonObject(null)
() => clearView(analysisResultsCompProvider)
);
vscode.commands.registerCommand(
"analysisResults.openInCompView",
() => analysisResultsCompProvider.setJsonObject(analysisResultsProvider.getJsonObject())
);
//#endregion
}
......@@ -389,6 +393,18 @@ function openFileInEditor(prov: AnalysisResultsProvider) {
}
}
async function clearView(prov: AnalysisResultsProvider) {
if (prov.getJsonObject()) {
const jsonObject = prov.getJsonObject();
prov.setJsonObject(null);
var choice = await vscode.window.showInformationMessage("Analysis results view has been cleared.", "Undo");
if (choice === "Undo") {
prov.setJsonObject(jsonObject);
}
}
}
function pathExists(p: string): boolean {
try {
fs.accessSync(p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment