Skip to content

Commit

Permalink
Use constants for undo, redo and updateZoom vscode messages
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Hufmann <[email protected]>
  • Loading branch information
bhufmann committed Jun 8, 2023
1 parent 807cf9b commit 9372436
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions vscode-trace-common/src/messages/vscode-message-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const VSCODE_MESSAGES = {
TRACE_VIEWER_TAB_ACTIVATED: 'traceViewerTabActivated',
UPDATE_PROPERTIES: 'updateProperties',
WEBVIEW_READY: 'webviewReady',
UNDO: 'undo',
REDO: 'redo',
UPDATE_ZOOM: 'updateZoom'
};

export class VsCodeMessageManager extends Messages.MessageManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ export class TraceViewerPanel {

undoRedo(undo: boolean): void {
if (undo) {
this._panel.webview.postMessage({ command: 'undo' });
this._panel.webview.postMessage({ command: VSCODE_MESSAGES.UNDO });
} else {
this._panel.webview.postMessage({ command: 'redo' });
this._panel.webview.postMessage({ command: VSCODE_MESSAGES.REDO });
}
}

updateZoom(hasZoomedIn: boolean): void {
this._panel.webview.postMessage({ command: 'updateZoom', data: hasZoomedIn});
this._panel.webview.postMessage({ command: VSCODE_MESSAGES.UPDATE_ZOOM, data: hasZoomedIn});
}

loadTheme(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ class TraceViewerContainer extends React.Component<{}, VscodeAppState> {
case VSCODE_MESSAGES.RESET_ZOOM:
this.resetZoom();
break;
case 'undo':
case VSCODE_MESSAGES.UNDO:
this.undo();
break;
case 'redo':
case VSCODE_MESSAGES.REDO:
this.redo();
break;
case 'updateZoom':
case VSCODE_MESSAGES.UPDATE_ZOOM:
this.updateZoom(message.data);
break;
}
Expand Down

0 comments on commit 9372436

Please sign in to comment.