summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorGabriel Luong2013-06-06 03:29:50 (EDT)
committer Mark Macdonald2013-06-06 13:24:08 (EDT)
commitcb87c2fbca9dad177fee393c6303acad2d3f7c5a (patch)
tree994dfce10b41d3546f1a8b2c907693347264c19b
parenta4ec3c2a7e1f2e4a811a7e4e7e8671c1007dcf5f (diff)
downloadorg.eclipse.orion.client-cb87c2fbca9dad177fee393c6303acad2d3f7c5a.zip
org.eclipse.orion.client-cb87c2fbca9dad177fee393c6303acad2d3f7c5a.tar.gz
org.eclipse.orion.client-cb87c2fbca9dad177fee393c6303acad2d3f7c5a.tar.bz2
Bug 410017 - commands.js#createCommandItem() should use image if imageClass is provided
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-commit.js113
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js13
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/commands.js8
3 files changed, 63 insertions, 71 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-commit.js b/bundles/org.eclipse.orion.client.git/web/git/git-commit.js
index 5f288e9..506f2d4 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-commit.js
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-commit.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * @license Copyright (c) 2011, 2012 IBM Corporation and others. All rights
+ * @license Copyright (c) 2011, 2013 IBM Corporation and others. All rights
* reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse
@@ -13,78 +13,79 @@
var eclipse;
-define([ 'i18n!git/nls/gitmessages', 'require', 'orion/bootstrap', 'orion/status', 'orion/progress', 'orion/commandRegistry', 'orion/commands', 'orion/keyBinding', 'orion/dialogs', 'orion/selection',
+define(['i18n!git/nls/gitmessages', 'require', 'orion/bootstrap', 'orion/status', 'orion/progress', 'orion/commandRegistry', 'orion/commands', 'orion/keyBinding', 'orion/dialogs', 'orion/selection',
'orion/fileClient', 'orion/operationsClient', 'orion/searchClient', 'orion/globalCommands', 'orion/git/gitCommitExplorer', 'orion/git/gitCommands', 'orion/widgets/themes/ThemePreferences', 'orion/widgets/themes/editor/ThemeData',
- 'orion/git/gitClient', 'orion/links', 'orion/contentTypes', 'orion/PageUtil' ], function(messages, require, mBootstrap, mStatus, mProgress, CommandRegistry,
+ 'orion/git/gitClient', 'orion/links', 'orion/contentTypes', 'orion/PageUtil'],
+ function(messages, require, mBootstrap, mStatus, mProgress, CommandRegistry,
Commands, KeyBinding, mDialogs, mSelection, mFileClient, mOperationsClient, mSearchClient, mGlobalCommands, mGitCommitExplorer, mGitCommands, mThemePreferences, mThemeData, mGitClient, mLinks,
mContentTypes, PageUtil) {
mBootstrap.startup().then(
- function(core) {
- var serviceRegistry = core.serviceRegistry;
- var preferences = core.preferences;
+ function(core) {
+ var serviceRegistry = core.serviceRegistry;
+ var preferences = core.preferences;
- new mDialogs.DialogService(serviceRegistry);
- var selection = new mSelection.Selection(serviceRegistry);
- var commandRegistry = new CommandRegistry.CommandRegistry({selection: selection});
- var operationsClient = new mOperationsClient.OperationsClient(serviceRegistry);
- new mStatus.StatusReportingService(serviceRegistry, operationsClient, "statusPane", "notifications", "notificationArea"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- new mProgress.ProgressService(serviceRegistry, operationsClient, commandRegistry);
- var themePreferences = new mThemePreferences.ThemePreferences(preferences, new mThemeData.ThemeData());
- themePreferences.apply();
-
- // ...
- var linkService = new mLinks.TextLinkService({ serviceRegistry : serviceRegistry
- });
- var gitClient = new mGitClient.GitService(serviceRegistry);
- var fileClient = new mFileClient.FileClient(serviceRegistry);
- var contentTypeService = new mContentTypes.ContentTypeService(serviceRegistry);
- var searcher = new mSearchClient.Searcher({ serviceRegistry : serviceRegistry,
- commandService : commandRegistry,
- fileService : fileClient
- });
+ new mDialogs.DialogService(serviceRegistry);
+ var selection = new mSelection.Selection(serviceRegistry);
+ var commandRegistry = new CommandRegistry.CommandRegistry({selection: selection});
+ var operationsClient = new mOperationsClient.OperationsClient(serviceRegistry);
+ new mStatus.StatusReportingService(serviceRegistry, operationsClient, "statusPane", "notifications", "notificationArea"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ new mProgress.ProgressService(serviceRegistry, operationsClient, commandRegistry);
+ var themePreferences = new mThemePreferences.ThemePreferences(preferences, new mThemeData.ThemeData());
+ themePreferences.apply();
- var explorer = new mGitCommitExplorer.GitCommitExplorer(serviceRegistry, commandRegistry, linkService, /* selection */null,
- "artifacts", "pageActions", null, "itemLevelCommands"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- mGlobalCommands.generateBanner("orion-git-commit", serviceRegistry, commandRegistry, preferences, searcher, explorer); //$NON-NLS-0$
+ // ...
+ var linkService = new mLinks.TextLinkService({serviceRegistry: serviceRegistry});
+ var gitClient = new mGitClient.GitService(serviceRegistry);
+ var fileClient = new mFileClient.FileClient(serviceRegistry);
+ var contentTypeService = new mContentTypes.ContentTypeService(serviceRegistry);
+ var searcher = new mSearchClient.Searcher({
+ serviceRegistry: serviceRegistry,
+ commandService: commandRegistry,
+ fileService: fileClient
+ });
+
+ var explorer = new mGitCommitExplorer.GitCommitExplorer(serviceRegistry, commandRegistry, linkService, /* selection */null,
+ "artifacts", "pageActions", null, "itemLevelCommands"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ mGlobalCommands.generateBanner("orion-git-commit", serviceRegistry, commandRegistry, preferences, searcher, explorer); //$NON-NLS-0$
- // define commands
- mGitCommands.createFileCommands(serviceRegistry, commandRegistry, explorer, "pageActions", "selectionTools"); //$NON-NLS-1$ //$NON-NLS-0$
- mGitCommands.createGitClonesCommands(serviceRegistry, commandRegistry, explorer, "pageActions", "selectionTools", fileClient); //$NON-NLS-1$ //$NON-NLS-0$
+ // define commands
+ mGitCommands.createFileCommands(serviceRegistry, commandRegistry, explorer, "pageActions", "selectionTools"); //$NON-NLS-1$ //$NON-NLS-0$
+ mGitCommands.createGitClonesCommands(serviceRegistry, commandRegistry, explorer, "pageActions", "selectionTools", fileClient); //$NON-NLS-1$ //$NON-NLS-0$
- // define the command contributions - where things appear, first
- // the groups
- commandRegistry.addCommandGroup("pageActions", "eclipse.gitGroup", 100); //$NON-NLS-1$ //$NON-NLS-0$
- commandRegistry.registerCommandContribution("pageActions", "eclipse.orion.git.cherryPick", 100, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- commandRegistry.registerCommandContribution("pageActions", "eclipse.orion.git.askForReviewCommand", 101, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- commandRegistry.registerCommandContribution(
- "pageActions", "eclipse.orion.git.openCommitCommand", 102, "eclipse.gitGroup", true, new KeyBinding.KeyBinding('h', true, true)); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ // define the command contributions - where things appear, first
+ // the groups
+ commandRegistry.addCommandGroup("pageActions", "eclipse.gitGroup", 100); //$NON-NLS-1$ //$NON-NLS-0$
+ commandRegistry.registerCommandContribution("pageActions", "eclipse.orion.git.cherryPick", 100, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ commandRegistry.registerCommandContribution("pageActions", "eclipse.orion.git.askForReviewCommand", 101, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ commandRegistry.registerCommandContribution(
+ "pageActions", "eclipse.orion.git.openCommitCommand", 102, "eclipse.gitGroup", true, new KeyBinding.KeyBinding('h', true, true)); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- // object contributions
- commandRegistry.registerCommandContribution("itemLevelCommands", "eclipse.removeTag", 1000); //$NON-NLS-1$ //$NON-NLS-0$
+ // object contributions
+ commandRegistry.registerCommandContribution("itemLevelCommands", "eclipse.removeTag", 1000); //$NON-NLS-1$ //$NON-NLS-0$
- var showDiffCommand = new Commands.Command({ name : messages["Working Directory Version"],
- tooltip : messages["View the working directory version of the file"],
- imageClass : "git-sprite-open_compare", //$NON-NLS-0$
- spriteClass : "gitCommandSprite", //$NON-NLS-0$
- id : "eclipse.orion.git.diff.showCurrent", //$NON-NLS-0$
- hrefCallback : function(data) {
+ var showDiffCommand = new Commands.Command({
+ name: messages["Working Directory Version"],
+ tooltip: messages["View the working directory version of the file"],
+ id: "eclipse.orion.git.diff.showCurrent", //$NON-NLS-0$
+ hrefCallback: function(data) {
return require.toUrl("edit/edit.html") + "#" + data.items.ContentLocation; //$NON-NLS-1$ //$NON-NLS-0$
},
- visibleWhen : function(item) {
+ visibleWhen: function(item) {
return item.Type === "Diff"; //$NON-NLS-0$
}
- });
+ });
- commandRegistry.addCommand(showDiffCommand);
- commandRegistry.registerCommandContribution("itemLevelCommands", "eclipse.orion.git.diff.showCurrent", 2000); //$NON-NLS-1$ //$NON-NLS-0$
+ commandRegistry.addCommand(showDiffCommand);
+ commandRegistry.registerCommandContribution("itemLevelCommands", "eclipse.orion.git.diff.showCurrent", 2000); //$NON-NLS-1$ //$NON-NLS-0$
+ var pageParams = PageUtil.matchResourceParameters();
+ explorer.display(pageParams.resource);
+
+ window.addEventListener("hashchange", function() { //$NON-NLS-0$
var pageParams = PageUtil.matchResourceParameters();
explorer.display(pageParams.resource);
-
- window.addEventListener("hashchange", function() { //$NON-NLS-0$
- var pageParams = PageUtil.matchResourceParameters();
- explorer.display(pageParams.resource);
- }, false);
- });
+ }, false);
+ }
+ );
}); // end of define \ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
index 21173c7..343f99f 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
@@ -462,7 +462,6 @@ var exports = {};
var addBranchCommand = new mCommands.Command({
name: messages["New Branch"],
tooltip: messages["Add a new local branch to the repository"],
- imageClass: "core-sprite-add", //$NON-NLS-0$
id: "eclipse.addBranch", //$NON-NLS-0$
parameters: branchNameParameters,
callback: function(data) {
@@ -554,7 +553,6 @@ var exports = {};
var addRemoteCommand = new mCommands.Command({
name: messages["New Remote"],
tooltip: messages["Add a new remote to the repository"],
- imageClass: "core-sprite-add", //$NON-NLS-0$
id: "eclipse.addRemote", //$NON-NLS-0$
parameters: addRemoteParameters,
callback : function(data) {
@@ -656,8 +654,6 @@ var exports = {};
name : messages["Git Log"],
tooltip: messages["Open the log for the branch"],
id : "eclipse.openGitLog", //$NON-NLS-0$
- imageClass: "git-sprite-log", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
hrefCallback : function(data) {
var item = data.items;
return require.toUrl("git/git-log.html")+"#" + item.CommitLocation + "?page=1"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
@@ -690,8 +686,6 @@ var exports = {};
name : messages['Git Status'],
tooltip: messages["Open the status for the repository"],
id : "eclipse.openGitStatus", //$NON-NLS-0$
- imageClass: "git-sprite-status", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
hrefCallback : function(data) {
return require.toUrl(mGitUtil.statusUILocation) + "#" + data.items.StatusLocation; //$NON-NLS-0$
},
@@ -720,8 +714,6 @@ var exports = {};
var compareGitCommits = new mCommands.Command({
name : messages["Compare With Each Other"],
- imageClass: "git-sprite-open_compare", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
id : "eclipse.compareGitCommits", //$NON-NLS-0$
hrefCallback : function(data) {
var item = data.items;
@@ -742,8 +734,6 @@ var exports = {};
var compareWithWorkingTree = new mCommands.Command({
name : messages["Compare With Working Tree"],
- imageClass: "git-sprite-open_compare", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
id : "eclipse.compareWithWorkingTree", //$NON-NLS-0$
hrefCallback : function(data) {
return mCompareUtils.generateCompareHref(data.items.DiffLocation, {});
@@ -1979,7 +1969,6 @@ var exports = {};
var addConfigEntryCommand = new mCommands.Command({
name: messages["New Configuration Entry"],
tooltip: "Add a new entry to the repository configuration", //$NON-NLS-0$
- imageClass: "core-sprite-add", //$NON-NLS-0$
id: "eclipse.orion.git.addConfigEntryCommand", //$NON-NLS-0$
parameters: addConfigParameters,
callback: function(data) {
@@ -2836,8 +2825,6 @@ var exports = {};
var showPatchCommand = new mCommands.Command({
name: messages["Show Patch"],
tooltip: messages["Show workspace changes as a patch"],
- imageClass: "git-sprite-diff", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
id: "eclipse.orion.git.showPatchCommand", //$NON-NLS-0$
hrefCallback : function(data) {
var items = forceArray(data.items);
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 7205c62..4c13940 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/commands.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/commands.js
@@ -254,8 +254,12 @@ define(['require', 'orion/util', 'orion/webui/littlelib', 'orion/webui/dropdown'
if (command.hrefCallback) {
element = document.createElement("a"); //$NON-NLS-0$
element.id = id;
- element.className = "commandLink"; //$NON-NLS-0$
- element.appendChild(document.createTextNode(command.name));
+ if (useImage && command.hasImage()) {
+ _addImageToElement(command, element, id);
+ } else {
+ element.className = "commandLink"; //$NON-NLS-0$
+ element.appendChild(document.createTextNode(command.name));
+ }
var href = command.hrefCallback.call(commandInvocation.handler, commandInvocation);
if (href.then){
href.then(function(l){