summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorGabriel Luong2013-06-12 07:18:01 (EDT)
committer Szymon Brandys2013-06-12 07:18:01 (EDT)
commitf8eec058fac4f24503be27d3c894122cffe8e6f9 (patch)
tree7b400c0ed08a7046c6c5a65599f2d7228cfea97b
parentf53641337b5093a4e0c34fa1d04ef7c39208e63e (diff)
downloadorg.eclipse.orion.client-f8eec058fac4f24503be27d3c894122cffe8e6f9.zip
org.eclipse.orion.client-f8eec058fac4f24503be27d3c894122cffe8e6f9.tar.gz
org.eclipse.orion.client-f8eec058fac4f24503be27d3c894122cffe8e6f9.tar.bz2
Bug 410546 - Add tooltips to the file sprites in git status. Removed
unused statusTypeMap and formatted util.js Conflicts: bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js64
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/util.js53
2 files changed, 61 insertions, 56 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
index 1927952..af446c9 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
@@ -10,9 +10,10 @@
******************************************************************************/
/*global define document window Image*/
define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orion/selection', 'orion/section', 'orion/PageUtil', 'orion/webui/littlelib',
- 'orion/i18nUtil', 'orion/globalCommands', 'orion/git/util', 'orion/git/gitCommands', 'orion/Deferred', 'orion/git/widgets/CommitTooltipDialog'],
+ 'orion/i18nUtil', 'orion/globalCommands', 'orion/git/util', 'orion/git/gitCommands', 'orion/Deferred', 'orion/git/widgets/CommitTooltipDialog',
+ 'orion/webui/tooltip'],
function(require, messages, mExplorer, mSelection, mSection, PageUtil, lib, i18nUtil, mGlobalCommands, mGitUtil, mGitCommands,
- Deferred, mCommitTooltip) {
+ Deferred, mCommitTooltip, Tooltip) {
var exports = {};
var conflictTypeStr = "Conflicting"; //$NON-NLS-0$
@@ -32,30 +33,30 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
this.conflictType = "Conflicting"; //$NON-NLS-0$
this.statusTypeMap = {
- "Missing" : [ "gitImageSprite git-sprite-removal", messages['Unstaged removal'] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Removed" : [ "gitImageSprite git-sprite-removal", messages['Staged removal'] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Modified" : [ "gitImageSprite git-sprite-file", messages['Unstaged change'] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Changed" : [ "gitImageSprite git-sprite-file", messages['Staged change'] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Untracked" : [ "gitImageSprite git-sprite-addition", messages["Unstaged addition"] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Added" : [ "gitImageSprite git-sprite-addition", messages["Staged addition"] ], //$NON-NLS-1$ //$NON-NLS-0$
- "Conflicting" : [ "gitImageSprite git-sprite-conflict-file", messages['Conflicting'] ] //$NON-NLS-1$ //$NON-NLS-0$
+ "Missing" : { imageClass: "gitImageSprite git-sprite-removal", tooltip: messages['Unstaged removal'] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Removed" : { imageClass: "gitImageSprite git-sprite-removal", tooltip: messages['Staged removal'] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Modified" : { imageClass: "gitImageSprite git-sprite-file", tooltip: messages['Unstaged change'] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Changed" : { imageClass: "gitImageSprite git-sprite-file", tooltip: messages['Staged change'] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Untracked" : { imageClass: "gitImageSprite git-sprite-addition", tooltip: messages["Unstaged addition"] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Added" : { imageClass: "gitImageSprite git-sprite-addition", tooltip: messages["Staged addition"] }, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ "Conflicting" : { imageClass: "gitImageSprite git-sprite-conflict-file", tooltip: messages['Conflicting'] } //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
};
}
GitStatusModel.prototype = {
- destroy : function() {},
+ destroy: function() {},
- interestedCategory : function() {},
+ interestedCategory: function() {},
- init : function(jsonData) {
+ init: function(jsonData) {
this.items = jsonData;
},
- getModelType : function(groupItem, groupName) {
+ getModelType: function(groupItem, groupName) {
return groupName;
},
- _markConflict : function(conflictPattern) {
+ _markConflict: function(conflictPattern) {
// if git status server API response a file with "Modified"
// ,"Added", "Changed","Missing" states , we treat it as a
// conflicting file
@@ -94,7 +95,7 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
}
},
- _findSameFile : function(fileLocation, groupData) {
+ _findSameFile: function(fileLocation, groupData) {
for (var j = 0; j < groupData.length; j++) {
if (groupData[j].Conflicting)
continue;
@@ -104,11 +105,11 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
return undefined;
},
- getGroupData : function(groupName) {
+ getGroupData: function(groupName) {
return this.items[groupName];
},
- isStaged : function(type) {
+ isStaged: function(type) {
for (var i = 0; i < this.interestedStagedGroup.length; i++) {
if (type === this.interestedStagedGroup[i]) {
return true;
@@ -117,10 +118,15 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
return false;
},
- getClass : function(type) {
- return this.statusTypeMap[type][0];
+ getClass: function(type) {
+ return this.statusTypeMap[type].imageClass;
+ },
+
+ getTooltip: function(type) {
+ return this.statusTypeMap[type].tooltip;
}
};
+
return GitStatusModel;
}());
@@ -423,8 +429,13 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
"DefaultActionWrapper", diffActionWrapper.id, item, that, "tool", null, navGridHolder); //$NON-NLS-1$ //$NON-NLS-0$
}, 300);
- var icon = document.createElement("span"); //$NON-NLS-0$
- icon.className = "gitImageSprite " + that._model.getClass(item.type); //$NON-NLS-0$
+ var icon = document.createElement("span"); //$NON-NLS-0$
+ icon.className = that._model.getClass(item.type);
+ icon.commandTooltip = new Tooltip.Tooltip({
+ node: icon,
+ text: that._model.getTooltip(item.type),
+ position: ["above", "below", "right", "left"] //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ });
div.appendChild(icon);
var itemLabel = document.createElement("span"); //$NON-NLS-0$
@@ -635,10 +646,15 @@ define(['require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orio
"DefaultActionWrapper", diffActionWrapper.id, item, that, "tool", null, navGridHolder); //$NON-NLS-1$ //$NON-NLS-0$
}, 300);
- var icon = document.createElement("span"); //$NON-NLS-0$
- icon.className = "gitImageSprite " + that._model.getClass(item.type); //$NON-NLS-0$
+ var icon = document.createElement("span"); //$NON-NLS-0$
+ icon.className = that._model.getClass(item.type);
+ icon.commandTooltip = new Tooltip.Tooltip({
+ node: icon,
+ text: that._model.getTooltip(item.type),
+ position: ["above", "below", "right", "left"] //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ });
div.appendChild(icon);
-
+
var itemLabel = document.createElement("span"); //$NON-NLS-0$
itemLabel.textContent = item.name;
div.appendChild(itemLabel);
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/util.js b/bundles/org.eclipse.orion.client.git/web/orion/git/util.js
index a673b3e..397c0b1 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/util.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/util.js
@@ -1,6 +1,6 @@
/*******************************************************************************
* @license
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 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 Distribution
@@ -17,47 +17,37 @@
*/
define(['i18n!git/nls/gitmessages', 'orion/compare/compareCommands', 'orion/compare/resourceComparer', 'orion/webui/littlelib'], function(messages, mCompareCommands, mResourceComparer, lib) {
- var interestedUnstagedGroup = ["Missing","Modified","Untracked","Conflicting"]; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- var interestedStagedGroup = ["Added", "Changed","Removed"]; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
- var conflictPatterns = [["Both","Modified","Added", "Changed","Missing"],["RemoteDelete","Untracked","Removed"],["LocalDelete","Modified","Added", "Missing"]]; //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ var interestedUnstagedGroup = ["Missing", "Modified", "Untracked", "Conflicting"]; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ var interestedStagedGroup = ["Added", "Changed", "Removed"]; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ var conflictPatterns = [["Both", "Modified", "Added", "Changed", "Missing"], ["RemoteDelete", "Untracked", "Removed"], ["LocalDelete", "Modified", "Added", "Missing"]]; //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
var conflictType = "Conflicting"; //$NON-NLS-0$
- var statusTypeMap = {
- "Missing":["gitImageSprite git-sprite-removal", messages['Unstaged removal']], //$NON-NLS-1$ //$NON-NLS-0$
- "Removed":["gitImageSprite git-sprite-removal",messages['Staged removal']], //$NON-NLS-1$ //$NON-NLS-0$
- "Modified":["gitImageSprite git-sprite-file",messages['Unstaged change']], //$NON-NLS-1$ //$NON-NLS-0$
- "Changed":["gitImageSprite git-sprite-file",messages['Staged change']], //$NON-NLS-1$ //$NON-NLS-0$
- "Untracked":["gitImageSprite git-sprite-addition",messages['Unstaged addition']], //$NON-NLS-1$ //$NON-NLS-0$
- "Added":["gitImageSprite git-sprite-addition",messages['Staged addition']], //$NON-NLS-1$ //$NON-NLS-0$
- "Conflicting":["gitImageSprite git-sprite-conflict-file", messages['Conflicting']] //$NON-NLS-1$ //$NON-NLS-0$
- };
-
var statusUILocation = "git/git-status2.html"; //$NON-NLS-0$
- function isStaged(change){
- for(var i = 0; i < interestedStagedGroup.length ; i++){
- if(change.type === interestedStagedGroup[i]){
- return true;
+ function isStaged(change) {
+ for (var i = 0; i < interestedStagedGroup.length; i++) {
+ if (change.type === interestedStagedGroup[i]) {
+ return true;
}
}
return false;
}
- function isUnstaged(change){
- for(var i = 0; i < interestedUnstagedGroup.length ; i++){
- if(change.type === interestedUnstagedGroup[i]){
- return true;
+ function isUnstaged(change) {
+ for (var i = 0; i < interestedUnstagedGroup.length; i++) {
+ if (change.type === interestedUnstagedGroup[i]) {
+ return true;
}
}
return false;
}
- function isChange(change){
+ function isChange(change) {
return isStaged(change) || isUnstaged(change);
}
- function hasStagedChanges(status){
- for(var i = 0; i < interestedStagedGroup.length ; i++){
+ function hasStagedChanges(status) {
+ for (var i = 0; i < interestedStagedGroup.length; i++) {
if (status[interestedStagedGroup[i]].length > 0) {
return true;
}
@@ -65,8 +55,8 @@ define(['i18n!git/nls/gitmessages', 'orion/compare/compareCommands', 'orion/comp
return false;
}
- function hasUnstagedChanges(status){
- for(var i = 0; i < interestedUnstagedGroup.length ; i++){
+ function hasUnstagedChanges(status) {
+ for (var i = 0; i < interestedUnstagedGroup.length; i++) {
if (status[interestedUnstagedGroup[i]].length > 0) {
return true;
}
@@ -86,7 +76,7 @@ define(['i18n!git/nls/gitmessages', 'orion/compare/compareCommands', 'orion/comp
* @param {Object} gridRenderer If all the commands have to be rendered as grids, especially inside a row of Orion explorer, this has to be provided. Optional.
* @param {String} compareTo Optional. If the resource parameter is a simple file URL then this can be used as the second file URI to compare with.
*/
- function createCompareWidget(serviceRegistry, commandService, resource, hasConflicts, parentDivId, commandSpanId, editableInComparePage, gridRenderer, compareTo){
+ function createCompareWidget(serviceRegistry, commandService, resource, hasConflicts, parentDivId, commandSpanId, editableInComparePage, gridRenderer, compareTo) {
var diffProvider = new mResourceComparer.DefaultDiffProvider(serviceRegistry);
var cmdProvider = new mCompareCommands.CompareCommandFactory({commandService: commandService, commandSpanId: commandSpanId, gridRenderer: gridRenderer});
var comparerOptions = {
@@ -95,9 +85,9 @@ define(['i18n!git/nls/gitmessages', 'orion/compare/compareCommands', 'orion/comp
readonly: true,
hasConflicts: hasConflicts,
diffProvider: diffProvider,
- resource : resource,
- compareTo : compareTo,
- editableInComparePage : editableInComparePage
+ resource: resource,
+ compareTo: compareTo,
+ editableInComparePage: editableInComparePage
};
var viewOptions = {
parentDivId: parentDivId,
@@ -124,5 +114,4 @@ define(['i18n!git/nls/gitmessages', 'orion/compare/compareCommands', 'orion/comp
hasUnstagedChanges: hasUnstagedChanges,
createCompareWidget: createCompareWidget
};
-
});