Community
Participate
Working Groups
Open a file from remote machine. In my example it is a file (filelist) that has a list of files the the directory. Editor is opened with no problem. Then in remote shell, update the file using 'ls -l > filelist'. In the editor, it does not say file has been changed or it is not possible to reload it by double clicking the file. You need to close the editor than double click the file. Or you can use open with menu to open the file. -----------Enter bugs above this line----------- TM 2.0M6 Testing installation : eclipse-platform-3.3M6 CDT-4.0M6 RSE install : update-site RSE-runtime-all java.runtime : Sun 1.6.0-b105 os.name: : Windows XP 5.1, Service Pack 2 ------------------------------------------------ systemtype : Unix-ssh targetos : Open SUSE LINUX 10.2 (i586) targetuname : Linux linux-sbko 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 i686 i686 i386 GNU/Linux targetvm : Sun Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode) ------------------------------------------------
Seen this again with 2.0M7. Now that bug #181145 is fixed, I think the dbl click operation should do the same as Right-click > Open with > Text editor i.e. check the file and reload it if it has changed.
The following is the code segment for SystemViewRemoteFileAdapter#handleDoubleClick(): SystemViewRemoteFileAdapter#handleDoubleClick() { . . . // only handle double click if object is a file ISystemEditableRemoteObject editable = getEditableRemoteObject(remoteFile); if (editable != null) { try { if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ { if (isFileCached(editable, remoteFile)) { editable.openEditor(); } else { DownloadJob oJob = new DownloadJob(editable, false); oJob.schedule(); } } else ^^^^ { editable.setLocalResourceProperties(); editable.openEditor(); } } catch (Exception e) { } } . . . } As we can see, if a file already been opened in the same perspective, we there is no isFileCached() check. So if a file had been changed, it will not be downloaded again. We need to check isFileCache() even when a file has been opened. If the file has been updated in the host, we need to download it again.
Created attachment 68866 [details] Need to check if the file need to be re-downloaded even if file has been opened Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
Kushal, could you please review this?
Created attachment 69311 [details] recreated patch since this file has been changed in between. Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
Xuan, your changes are fine, but we end up with some duplicate code in the if and else blocks. How about having editable.setLocalResourceProperties() if we're in the same perspective, and moving the other code (which is the same for both if and else blocks) outside the if block?
Created attachment 69322 [details] Updated according to Kushal's comment to remove duplicated code. Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
Changes look good! Approved. Thanks Xuan.
Created attachment 69691 [details] Update patch since file changed in between. Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
Patch looks basically good, I'm just wondering whether it is OK to editable.setLocalResourceProperties(); AFTER the file has already been opened through editable.openEditor()? This is a change compared to the previous way it worked -- please review and check. Also note that because the new code does isFileCached() on dblcklick, which resolves to subsystem.getRemoteFileObject() this performs a remote query IN THE UI THREAD. Which is dangerous, because if it hangs all Eclipse will hang. There should either be a watchdog to cancel the query after some time, or there should be some delegation to a background thread. I created bug #190774 to deal with this potentially dangerous situation in 2.0.1
I will update the fix to make sure for the case where the file already been opened in the same perspective, call setLocalResourceProperties() first, then call openEditor().
Created attachment 70008 [details] Updated according to Martin's comment. Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
I've applied the update to cvs.
[target cleanup] 2.0 RC2 was the original target milestone for this bug