| Summary: | File client should dispatch "changed" event when files change. | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | libing wang <libingw> |
| Component: | Client | Assignee: | libing wang <libingw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Michael_Rennie, Silenio_Quarti |
| Version: | 11.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 487279, 488980 | ||
|
Description
libing wang
We will have to fix this shortly. *** Bug 481606 has been marked as a duplicate of this bug. *** I have a fix in my work space for bug 488980. I am sending an event on fileClient.write and listen to it from inputManager. Patch:
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js b/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js
index 0188e99..2c5735a 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js
@@ -500,7 +500,11 @@
* @return {Deferred} A deferred for chaining events after the write completes with new metadata object
*/
write: function(writeLocation, contents, args) {
- return _doServiceCall(this._getService(writeLocation), "write", arguments); //$NON-NLS-1$
+ //return _doServiceCall(this._getService(writeLocation), "write", arguments); //$NON-NLS-1$
+ return _doServiceCall(this._getService(writeLocation), "write", arguments).then(function(result){ //$NON-NLS-0$
+ this.dispatchEvent({ type: "Changed", modified: [writeLocation]}); //$NON-NLS-0$
+ return result;
+ }.bind(this));
},
/**
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js b/bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js
index e673fb1..4540e18 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js
@@ -134,6 +134,21 @@
this.contentTypeRegistry = options.contentTypeRegistry;
this.selection = options.selection;
this._input = this._title = "";
+ this.fileClient.addEventListener("Changed", function(evt) { //$NON-NLS-0$
+ if (this._fileMetadata && this._fileMetadata._saving) {
+ return;
+ }
+ if(evt && evt.modified) {
+ var metadata = this.getFileMetadata();
+ if(metadata && metadata.Location) {
+ if(evt.modified.some(function(loc){
+ return metadata.Location === loc;
+ })) {
+ this.load();
+ }
+ }
+ }
+ }.bind(this));
}
objects.mixin(InputManager.prototype, /** @lends orion.editor.InputManager.prototype */ {
/**
First cut of commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=13c0610ab6c12b53123230024eb08af3f331efa9 last commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=84d0548120fbb3609de40cec073783fdd1883aa4 We do not want to send out event from fileClient.createProject API because the {parent, newValue} object require from the UI side can not be obtained directly from the fileClient. Neither do we want to send out event from fileClient.remoteImport API for hte same reason. Added one more fix to dispatch "Changed" event on copied property on fileClinet.remoteImport. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e24154d4d3946eb11b63a7d327b3062224e7182b One more commit to fix the issue: When create a folder under the root of work space, fileClient.createProject API is called. As currently we do not send out "Changed" event on project creation yet, the UI is not reflecting it. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b93ea3996bcb8efdfd57c7ff91d561133146df90. So far fileClient.createProject is hte only API that is not sending out "Changed" event because the UI side is relying on much more information to refresh the work space and select the project. I've opened Bug 491942 to fix it. Remove the old "fileContentChanged" event and dispatch muultiple file modified change event. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=651df6c32b0c600550b2ae1132bb09ddf61e68d6 |