Skip to content

Commit

Permalink
Add command to open overview view when closed
Browse files Browse the repository at this point in the history
Contributes to eclipse-cdt-cloud#55

Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
bhufmann committed Jan 18, 2023
1 parent 8fa6a58 commit f6d5553
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions vscode-trace-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
],
"contributes": {
"commands": [
{
"command": "outputs.openOverview",
"title": "Open Overview View",
"icon": "assets/media/chart-line-solid.svg"
},
{
"command": "traces.openTrace",
"title": "Open Trace",
Expand Down
6 changes: 5 additions & 1 deletion vscode-trace-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as vscode from 'vscode';
import { AnalysisProvider } from './trace-explorer/analysis-tree';
import { TraceExplorerAvailableViewsProvider } from './trace-explorer/views/trace-explorer-available-views-webview-provider';
import { TraceExplorerOpenedTracesViewProvider } from './trace-explorer/opened-traces/trace-explorer-opened-traces-webview-provider';
import { fileHandler } from './trace-explorer/trace-tree';
import { fileHandler, openOverviewHandler } from './trace-explorer/trace-tree';
import { updateTspClient } from './utils/tspClient';

export function activate(context: vscode.ExtensionContext): void {
Expand All @@ -30,4 +30,8 @@ export function activate(context: vscode.ExtensionContext): void {
}
}));

const overViewOpenHanlder = openOverviewHandler();
context.subscriptions.push(vscode.commands.registerCommand('outputs.openOverview', () => {
overViewOpenHanlder();
}));
}
4 changes: 4 additions & 0 deletions vscode-trace-extension/src/trace-explorer/trace-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export const traceHandler = (analysisTree: AnalysisProvider) => (context: vscode
})();
};

export const openOverviewHandler = () => (): void => {
TraceViewerPanel.showOverviewToCurrent();
};

export const fileHandler = (analysisTree: AnalysisProvider) => (context: vscode.ExtensionContext, file: vscode.Uri): void => {
const uri: string = file.path;
if (!uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class TraceViewerPanel {
TraceViewerPanel.currentPanel?.addOutput(descriptor);
}

public static showOverviewToCurrent(): void {
TraceViewerPanel.currentPanel?.showOverview();
}

private constructor(extensionUri: vscode.Uri, column: vscode.ViewColumn, name: string) {
this._extensionUri = extensionUri;
// Create and show a new webview panel
Expand Down Expand Up @@ -167,6 +171,10 @@ export class TraceViewerPanel {
this._panel.webview.postMessage({command: 'add-output', data: wrapper});
}

showOverview(): void {
this._panel.webview.postMessage({command: 'open-overview'});
}

private _getHtmlForWebview() {
try {
return this._getReactHtmlForWebview();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class App extends React.Component<{}, VscodeAppState> {
const descriptor = JSONBig.parse(message.data);
this.setState({outputs: [...this.state.outputs, descriptor] });
break;
case 'open-overview':
this.doHandleExperimentSetSignal(this.state.experiment);
}
});
this.onOutputRemoved = this.onOutputRemoved.bind(this);
Expand Down

0 comments on commit f6d5553

Please sign in to comment.