Skip to content

Commit

Permalink
Permit using 'open-with' with folders in navigator context menu
Browse files Browse the repository at this point in the history
Since the following Theia PR, the navigator's context menu "open-with"
command only appears when invoked on file nodes. Since we want to open
trace folders using this feature, we now re-register the command for
folders, as part of the trace viewer extension.

Theia PR: eclipse-theia/theia#13678

Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
  • Loading branch information
marcdumais-work committed Jul 8, 2024
1 parent 4e7aebc commit 702959f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions theia-extensions/viewer-prototype/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@theia/editor": "1.50.0",
"@theia/filesystem": "1.50.0",
"@theia/messages": "1.50.0",
"@theia/navigator": "1.50.0",
"animate.css": "^4.1.1",
"traceviewer-base": "0.2.3",
"traceviewer-react-components": "0.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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, FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution';

@injectable()
export class TraceExplorerContribution
Expand Down Expand Up @@ -44,6 +45,15 @@ export class TraceExplorerContribution
label: TraceExplorerCommands.REMOVE_TRACE.label,
order: 'c'
});

// since the following PR, navigator's "open-with" in Theia only works
// on files: https://github.com/eclipse-theia/theia/pull/13678
// Work-around: re-register the command only for folders:
menus.registerMenuAction(NavigatorContextMenu.NAVIGATION, {
commandId: FileNavigatorCommands.OPEN_WITH.id,
when: 'explorerResourceIsFolder',
label: 'Open With...'
});
}

async registerCommands(registry: CommandRegistry): Promise<void> {
Expand Down

0 comments on commit 702959f

Please sign in to comment.