diff options
3 files changed, 16 insertions, 2 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/edit/setup.js b/bundles/org.eclipse.orion.client.ui/web/edit/setup.js index a172d67..684624b 100644 --- a/bundles/org.eclipse.orion.client.ui/web/edit/setup.js +++ b/bundles/org.eclipse.orion.client.ui/web/edit/setup.js @@ -710,8 +710,13 @@ objects.mixin(EditorSetup.prototype, { var href = this.computeNavigationHref({Location: loc}, {start: options.start, end: options.end}); if (!href) return; - - var mode = typeof(options.mode) === 'string' ? options.mode : 'replace'; + + var mode = 'replace'; //$NON-NLS-1$ + if (this.editorCommands.triggerEvent) { + var e = this.editorCommands.triggerEvent; + mode = e.ctrlKey ? e.altKey ? "split" : "tab" : "replace"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + mode = typeof(options.mode) === 'string' ? options.mode : mode; switch (mode) { case 'replace': window.location = href; diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/commands.js b/bundles/org.eclipse.orion.client.ui/web/orion/commands.js index 5d0fb3a..d20c3a7 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/commands.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/commands.js @@ -418,7 +418,11 @@ define([ if (dropdown){ dropdown.close(true); } + + // Cache the event that triggered this invocation + commandInvocation.triggerEvent = e; onClick.call(commandInvocation.handler, commandInvocation); + commandInvocation.triggerEvent = undefined; }, false); element.addEventListener("keydown", function(e) { //$NON-NLS-0$ if (e.keyCode === lib.KEY.ENTER || e.keyCode === lib.KEY.SPACE) { @@ -529,6 +533,7 @@ define([ var copy = new CommandInvocation(this.handler, this.items, this.userData, this.command, this.commandRegistry); copy.domNode = this.domNode; copy.domParent = this.domParent; + copy.triggerEvent = this.triggerEvent; if (parameters) { copy.parameters = parameters.makeCopy(); } else if (this.parameters) { diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js index d2fa8c0..d23c3fb 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js @@ -746,6 +746,9 @@ define([ return !commandVisibleWhen || commandVisibleWhen(items); }; options.callback = function(data) { + // track the event in editorCommands (openEditor will interpret this) + this.editorCommands.triggerEvent = data.triggerEvent; + var editor = this.editor || that.editor; var inputManager = this.inputManager || that.inputManager; //TODO should all text editors have selection? @@ -831,6 +834,7 @@ define([ }; } progress.showWhile(serviceCall, i18nUtil.formatMessage(messages.running, options.name)).then(handleResult); +// this.editorCommands.triggerEvent = undefined; return true; }; return new mCommands.Command(options); |