summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Moffatt <emoffatt@ca.ibm.com>2015-06-22 10:03:16 -0400
committerEric Moffatt <emoffatt@ca.ibm.com>2015-06-22 10:03:16 -0400
commite5b373d12c0ef443fa1e4b6a7e77748a8eb1973a (patch)
tree5a8bca1daec88f900156cf2afd540c57f0e214ed
parent301dcec3af8a30a5f0f7d9a677c6c49656249f58 (diff)
downloadorg.eclipse.orion.client-origin/emoffatt/EditorOpenMode.zip
org.eclipse.orion.client-origin/emoffatt/EditorOpenMode.tar.gz
org.eclipse.orion.client-origin/emoffatt/EditorOpenMode.tar.bz2
Save this for the future (perhaps). Covers allowing Ctrl and Ctrl+Alt clicking a menu item...origin/emoffatt/EditorOpenMode
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/edit/setup.js9
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/commands.js5
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js4
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);