diff --git a/README.md b/README.md index 0b337f09c..6e95f9488 100644 --- a/README.md +++ b/README.md @@ -222,9 +222,9 @@ This is the most intuitive way to open traces and trace groups, but it can only #### Via the File Explorer -You can open any supported trace format via the file explorer context menu. For a single trace, right-click on the trace file, or folder (for a CTF trace), then select **Open With → Open Trace**. To open several CTF trace files as a group, right-click on the parent folder instead. +You can open any supported trace format via the file explorer context menu. For a single trace, right-click on the trace file, or folder (for a CTF trace), then select **Open in Trace Viewer**. To open several CTF trace files as a group, right-click on the parent folder instead. -![Open With Trace Viewer][image-open-with] +![Open in Trace Viewer][image-open-in-trace-viewer] ### Open a view @@ -466,7 +466,7 @@ The code in this repository is licensed under `MIT` (see root `LICENSE`), except [image-icon]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-icon.png [image-open-browser]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-browser.png [image-open-view]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-view.gif -[image-open-with]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-with-trace-viewer.gif +[image-open-in-trace-viewer]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-in-trace-viewer.gif [image-properties]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-item-properties-0.0.2.png [image-sidebar]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-open-trace-viewer.gif [image-viewer]: https://raw.githubusercontent.com/eclipse-cdt-cloud/theia-trace-extension/master/doc/images/theia-trace-extension-0.0.3.png diff --git a/doc/images/theia-trace-extension-open-in-trace-viewer.gif b/doc/images/theia-trace-extension-open-in-trace-viewer.gif new file mode 100644 index 000000000..2995cf6f3 Binary files /dev/null and b/doc/images/theia-trace-extension-open-in-trace-viewer.gif differ diff --git a/doc/images/theia-trace-extension-open-with-trace-viewer.gif b/doc/images/theia-trace-extension-open-with-trace-viewer.gif deleted file mode 100644 index f4e5c68df..000000000 Binary files a/doc/images/theia-trace-extension-open-with-trace-viewer.gif and /dev/null differ diff --git a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-commands.ts b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-commands.ts index 4dfa7aac0..6cb64642d 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-commands.ts +++ b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-commands.ts @@ -17,4 +17,9 @@ export namespace TraceExplorerCommands { id: 'trace-explorer:remove-trace', label: 'Remove Trace' }; + + export const OPEN_IN_TRACE_VIEWER: Command = { + id: 'trace-explorer:open-in-trace-viewer', + label: 'Open in Trace Viewer' + }; } diff --git a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-contribution.ts b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-contribution.ts index 418922030..5f3a8cf05 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-contribution.ts +++ b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-contribution.ts @@ -1,15 +1,22 @@ -import { injectable } from '@theia/core/shared/inversify'; +import { injectable, inject } from '@theia/core/shared/inversify'; import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; import { TraceExplorerWidget } from './trace-explorer-widget'; import { FrontendApplicationContribution, FrontendApplication } from '@theia/core/lib/browser'; import { MenuModelRegistry, CommandRegistry } from '@theia/core'; import { TraceExplorerCommands, TraceExplorerMenus } from './trace-explorer-commands'; +import { NavigatorContextMenu } from '@theia/navigator/lib/browser/navigator-contribution'; +import { UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler'; +import { SelectionService } from '@theia/core/lib/common'; +import { TraceViewerContribution } from '../trace-viewer/trace-viewer-contribution'; @injectable() export class TraceExplorerContribution extends AbstractViewContribution implements FrontendApplicationContribution { + @inject(SelectionService) protected readonly selectionService: SelectionService; + @inject(TraceViewerContribution) protected readonly traceViewer: TraceViewerContribution; + constructor() { super({ widgetId: TraceExplorerWidget.ID, @@ -44,6 +51,11 @@ export class TraceExplorerContribution label: TraceExplorerCommands.REMOVE_TRACE.label, order: 'c' }); + + menus.registerMenuAction(NavigatorContextMenu.NAVIGATION, { + commandId: TraceExplorerCommands.OPEN_IN_TRACE_VIEWER.id, + order: 'z9' + }); } async registerCommands(registry: CommandRegistry): Promise { @@ -67,5 +79,14 @@ export class TraceExplorerContribution explorerWidget.deleteExperiment(traceUUID); } }); + + registry.registerCommand( + TraceExplorerCommands.OPEN_IN_TRACE_VIEWER, + UriAwareCommandHandler.MonoSelect(this.selectionService, { + execute: uri => { + this.traceViewer.open(uri); + } + }) + ); } }