Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 256048

Summary: Saving a member open in Remote LPEX editor while Working Offline doesn't set the dirty property
Product: [Tools] Target Management Reporter: Dmitry Baev <dbaev>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dbaev, kjdoyle, rdibugs
Version: 3.0.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 256131    
Attachments:
Description Flags
patch to mark properties dirty when offline and update editor if lpex
none
update to patch none

Description Dmitry Baev CLA 2008-11-20 17:42:46 EST
Saving a member open in Remote LPEX editor while Working Offline doesn't set the dirty property in the SystemIFileProperties. As a result the editor doesn't show the dirty flag.

In 71, the dirty property was set in SystemIFileProperties when a member is saved while working offline. See lines 610-634 in SystemTempFileListener (71 driver).

In 75, there was a change in this code which essentially checks isOffline() and doesn't set the dirty property if working offline. See line 687 in org.eclipse.rse.files.ui.resources.SystemTempFileListener

1. We might need to commented out the check isOffline() on line 687:
if (doesHandle(fs) /*&& !fs.isOffline()*/)

2. or have separate handling for offline case (probably we don't want to attempt connecting when working offline, see line 696)...

One issue i discovered during testing with case 1 is that the editor doesn't show the dirty indicator on the first save (while offline) after a member is opened.
Steps to reproduce:
1. Open member in Remote Lpex
2. Select Work Offline
3. Make changes in editor and save
=> dirty indicator disappears from the editor, yet the dirty property is set in SystemIFileProperties. This only happens on the first save after member is opened. 

Normally, we want to set dirty property in SystemTempFileListener when a member is being saved offline. This is done so that we can prompt the user about unsaved changes in this member when a connection is back online. Thus, we need to make sure that editor displays the dirty indicator appropriately.

** Notes: This fix is required for a number of defects scheduled for RDi 7.5.0.2
Please target a fix for 3.0.2
Comment 1 David McKnight CLA 2008-11-21 10:36:27 EST
I've opened bug 256131 for the backport.
Comment 2 David McKnight CLA 2008-11-21 12:03:29 EST
Created attachment 118496 [details]
patch to mark properties dirty when offline and update editor if lpex

Dmitry, could you try this patch?  Note that the dirty indicator for the editor will only be updated for lpex (i.e. other editors don't have a way to update this that I know of).
Comment 3 Dmitry Baev CLA 2008-11-24 16:00:56 EST
Dave, I tried the patch. It works fine in Remote LPEX editor so we should be good.
Comment 4 Dmitry Baev CLA 2008-11-24 16:06:19 EST
When can we expect to have the backport to 3.0.2 ready?
Comment 5 David McKnight CLA 2008-11-24 16:24:02 EST
I've committed the fix for this to cvs.  The backport will be committed after it gets a positive review from Kevin Doyle.  Hopefully within the next couple days.
Comment 6 Dmitry Baev CLA 2008-11-24 18:10:07 EST
I noticed another minor issue related to save when disconnected:

First time a member is saved after connection is disconnected - the editor does not display dirty indicator.
Steps to reproduce:
1. open member in RSE editor and disconnect the connection
2. makes some changes in the editor, and save
3. when prompted to reconnect, DONT connect

Dirty property is set in SystemIFileProperties (line 708 in SystemTempFileListener) but the editor doesn't display the dirty indicator.

This happens only after the first save.

Dave, should I open a new defect for this?
Comment 7 David McKnight CLA 2008-11-25 10:07:55 EST
Created attachment 118660 [details]
update to patch

Here's an update that lets this follow through when not connected too so that ISystemTextEditor can be marked as dirty in this case as well.
Comment 8 David McKnight CLA 2008-11-25 10:11:53 EST
I've committed the update to cvs.