Bug 367454 -Progress icon still shows error after successful operation
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/progress.js b/bundles/org.eclipse.orion.client.core/web/orion/progress.js
index 553b41d..37b818a 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/progress.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/progress.js
@@ -24,6 +24,8 @@
 		this._operationsClient = operationsClient;

 		this._initDone = false;

 		this._topicListeners = {};

+		this._myOperations = {};

+		this._lastOperation = null;

 	}

 	

 	ProgressService.prototype = /** @lends orion.progress.ProgressService.prototype */ {

@@ -133,7 +135,7 @@
 				dijit.focus(this._operationsDialog.domNode);

 			},

 			_generateOperationsInfo: function(operations){

-				this._operationsDialog.setOperations(operations);

+				this._operationsDialog.setOperations(operations, this._myOperations);

 				

 				if(!operations.Children || operations.Children.length==0){

 					this._progressPane.className = "progressPane progressPane_empty";

@@ -143,12 +145,17 @@
 				var status = "";

 				for(var i=0; i<operations.Children.length; i++){

 					var operation = operations.Children[i];

+					if(!this._myOperations[operation.Id])

+						continue; //only operations run by this page change status

 					if(operation.Running==true){

 						status = "running";

 						break;

 					}

-					if(operation.Result){

-						switch (this._operationsDialog.parseProgressResult(operation.Result).Severity) {

+				}

+				

+				if(status==="" && this._lastOperation!=null){

+					if(this._lastOperation.Result){

+						switch (this._operationsDialog.parseProgressResult(this._lastOperation.Result).Severity) {

 						case "Warning":

 							if(status!=="error")

 								status="warning";

@@ -183,6 +190,9 @@
 			 * @returns {dojo.Deferred} notified when operation finishes

 			 */

 			followOperation: function(operationJson, deferred, operationLocation){

+				if(operationJson.Id){

+					this._myOperations[operationJson.Id] = true;

+				}

 				var result = deferred ? deferred : new dojo.Deferred();

 				this.writeOperation(operationJson);

 				var that = this;

@@ -215,6 +225,12 @@
 			},

 			removeOperation: function(operationLocation, operationId){

 				that = this;

+				if(operationId){

+					if(this._lastOperation!=null && this._lastOperation.Id === operationId){

+						this._lastOperation = null;

+					}

+					delete this._myOperations[operationId];

+				}

 				dojo.hitch(that._operationsClient, that._operationsClient.removeOperation)(operationLocation).then(function(){

 					var operations = JSON.parse(localStorage.getItem("orionOperations") || '{"Children": []}');

 					for(var i=0; i<operations.Children.length; i++){

@@ -270,6 +286,7 @@
 			},

 			writeOperation: function(operationj){

 				var operationJson = JSON.parse(JSON.stringify(operationj));

+				this._lastOperation = operationJson;

 				var operations = JSON.parse(localStorage.getItem("orionOperations") || '{"Children": []}');

 				for(var i=0; i<operations.Children.length; i++){

 					var operation = operations.Children[i];

diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OperationsDialog.js b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OperationsDialog.js
index d752364..a88a98b 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OperationsDialog.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OperationsDialog.js
@@ -22,15 +22,26 @@
 			this.inherited(arguments);

 			this.options = arguments[0] || {};

 			this._operations = [];

+			this._myOperations = [];

 		},

 		postCreate: function(){

 			this.inherited(arguments);

 			this.allOperationsLink.href = require.toUrl("operations/list.html");

 			this._setOperationsVisibility();

 		},

-		setOperations: function(operations){

-			this._operations = operations.Children ? operations.Children : [];

+		setOperations: function(operations, myOperations){

+			this._operations = [];

+			myOperations = myOperations || {};

+			this._myOperations = [];

+			for(var i=0; i<operations.Children.length; i++){

+				if(myOperations[operations.Children[i].Id]){

+					this._myOperations.push(operations.Children[i]);

+				} else {

+					this._operations.push(operations.Children[i]);

+				}

+			}

 			this._operations.sort(function(op1, op2){return parseInt(op2.Modified) - parseInt(op1.Modified);});

+			this._myOperations.sort(function(op1, op2){return parseInt(op2.Modified) - parseInt(op1.Modified);});

 			this._renderOperations();

 		},

 		parseProgressResult: function(message){

@@ -48,9 +59,13 @@
 			return {Message: status.Message || status, Severity: status.Severity};

 		},

 		_renderOperations: function(){

-			dojo.empty(this.operationsList);

-			for(var i=0; i<this._operations.length; i++){

-				var operation = this._operations[i];

+			this._renderOperationsTable(this.myOperationsList, this._myOperations);

+			this._renderOperationsTable(this.operationsList, this._operations);

+		},

+		_renderOperationsTable: function(operationsTable, operations){

+			dojo.empty(operationsTable);

+			for(var i=0; i<operations.length; i++){

+				var operation = operations[i];

 				var tr = dojo.create("tr");

 				var col = dojo.create("td", {style: "padding-left: 5px; padding-right: 5px", innerHTML: operation.Name}, tr);

 				var div = dojo.create("div", null, col, "only");

@@ -89,13 +104,17 @@
 					

 				}

 				

-				dojo.place(tr, this.operationsList, "last");

+				dojo.place(tr, operationsTable, "last");

 			}

 			this._setOperationsVisibility();

 		},

 		_setOperationsVisibility: function(){			

 			this.operationsList.style.display = this._operations.length > 0 ? "" : "none";

-			this.allOperations.style.display = this._operations.length > 0 ? "none": "";

+			this.otherOperations.style.display  = this._operations.length > 0 ? "" : "none";

+			this.myOperationsList.style.display = this._myOperations.length > 0 ? "" : "none";

+			this.myOperationsListEmpty.style.display = this._myOperations.length > 0 ? "none" : "";

+			this.operationsDontExist.style.display = this._operations.length + this._myOperations.length > 0 ? "none": "";

+			this.operationsExist.style.display = this._operations.length + this._myOperations.length > 0 ? "" : "none";

 		},

 		_onBlur: function(){

 			this.inherited(arguments);

diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/templates/OperationsDialog.html b/bundles/org.eclipse.orion.client.core/web/orion/widgets/templates/OperationsDialog.html
index 6d2a625..e11ad0a 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/widgets/templates/OperationsDialog.html
+++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/templates/OperationsDialog.html
@@ -9,9 +9,15 @@
 					<td style="text-align: right;"><a dojoAttachPoint="allOperationsLink">All Operations</a></td>

 				</tr>

 			</table>

-			<table dojoAttachPoint="operationsList" style="display: none;">

-			</table>

-			<span class="secondaryColumn" dojoAttachPoint="allOperations">No operations running.</span>

+			<span dojoAttachPoint="operationsExist">

+				<span class="secondaryColumn" dojoAttachPoint="myOperationsListEmpty">No operations running on this page.</span>

+				<table dojoAttachPoint="myOperationsList" style="display: none;">

+				</table>

+				<span class="secondaryColumn" dojoAttachPoint="otherOperations"><br>Operations from other pages:</span>

+				<table dojoAttachPoint="operationsList" style="display: none;">

+				</table>

+			</span>

+			<span class="secondaryColumn" dojoAttachPoint="operationsDontExist">No operations running.</span>

 		</div>

 	</div>

 	<div class="dijitTooltipConnector" role="presentation"></div>