Issue 39330

Summary: BeanShell editor should prompt to save before closing
Product: General Reporter: tomaisoc
Component: scriptingAssignee: joerg.skottke
Status: CLOSED FIXED QA Contact: issues <>
Severity: Trivial    
Priority: P3 CC: issues
Version: 680m65   
Target Milestone: OOo 2.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description tomaisoc 2004-12-20 11:43:33 UTC
The BeanShell editor window does not prompt the user to save or discard
changes when the Close button is clicked if there are unsaved changes. Also
the name of the macro being edited should be displayed in the title bar to
distinguish between multiple open BeanShell editor windows.
Comment 1 tomaisoc 2004-12-20 11:45:53 UTC
setting target
Comment 2 tomaisoc 2005-01-06 10:57:41 UTC
reassign before resolving
Comment 3 tomaisoc 2005-01-06 11:00:17 UTC
Fixed now in the scriptingf10 CWS. The user should be prompted if they have unsaved
changes when they click the Close button. The full UCB URL to the script source file
is displayed in the title bar, this is the same as is done in the JavaScript
editor. It isn't
very readable but at least it allows the user to differentiate between editor
Comment 4 joerg.skottke 2005-01-18 10:39:47 UTC
Comment 5 joerg.skottke 2005-01-18 10:42:28 UTC
Using the close-button works ok. When closing via frame control there is no
dialog: changes are lost.

Back to toconnor
Dataloss -> should be fixed in this CWS
Comment 6 tomaisoc 2005-01-18 17:50:25 UTC
reassign before resolving
Comment 7 tomaisoc 2005-01-18 17:51:11 UTC
The user will now be prompted if the use the window close button also.
Comment 8 joerg.skottke 2005-01-19 07:22:30 UTC
Jupp, this works. But:

On a network-installation the user gets an errormessage:
"Error saving file: an error
occurred during file opening"

I did not expect to be able to write to the directories below /opt, but the
errormessage is kind of uncool. Can i get something helpful there? Something
that tells the user that he does not have permissions to write to the directory?

Comment 9 joerg.skottke 2005-01-19 07:23:20 UTC
back to toconnor
Comment 10 joerg.skottke 2005-01-19 07:25:18 UTC
Argh. Wenn the errormessage is closed, the editor closes as well -> dataloss. :(

NOTE: all this happens when selecting a script from the StarOffice branch, not
"My Macros"
Comment 11 tomaisoc 2005-01-19 10:53:24 UTC
The problem in this case is that the file in question is not writable,
so the user will not be able to save the contents of the window.

This could be handled in a number of ways:

1. Disable the Edit button in the Organizer if the source file is not
   writable. This would mean that the user could not view the script from
   within OOo

2. Enable the Edit button, and when the editor is open disable editing of
   the text area.

3. Leave the text area editable, but put ReadOnly in the title bar of the
   editor and disable the Save button

4. Change the error message to be more descriptive

I do not like option 1 because all of our examples are in the OOo Macros
area, so users would not be able to view other examples and copy from them.

Option 2 and 3 are a problem because this also affects the JavaScript
debugger which is very difficult to change reliably.

I think that Option 4 is the most practical option given resource
constraints, what do you think?
Comment 12 joerg.skottke 2005-01-20 09:32:16 UTC
Hi Tom,

i think option 4 is fine. 
Comment 13 joerg.skottke 2005-01-20 10:03:50 UTC
back to Tom,

i need to get my intray clean. ;)
Comment 14 tomaisoc 2005-01-20 10:55:33 UTC
reassign before marking resolved again
Comment 15 tomaisoc 2005-01-20 10:58:00 UTC
and back to Joerg :)

I have fixed the error message so that it now says

"Error saving script: File is read only"

And when the user clicks OK on the message the editor window is not
closed so they don't lose their data.
Comment 16 joerg.skottke 2005-01-25 06:39:04 UTC
Comment 17 joerg.skottke 2005-02-22 13:29:42 UTC