Bug 14849 - [EditorMgmt] Need a new API IEditorPart.isSaveAllowed() to control Save menu
Summary: [EditorMgmt] Need a new API IEditorPart.isSaveAllowed() to control Save menu
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted, investigate
Depends on:
Blocks:
 
Reported: 2002-04-29 11:10 EDT by Tetsuro Asahata CLA
Modified: 2016-11-10 12:13 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tetsuro Asahata CLA 2002-04-29 11:10:24 EDT
Currently Save menu's enable/disable state is controled by isDirty() flag,
but it should not be the only factor to control Save menu's state.
For example, suppose a editor has a global setting for output encoding 
character set and if user changes the setting from ascii to UTF-8.
User will open a file which is encoded by ascii format, and will want 
to save it as the same name without modifing the file.

Most windows application allow such usage, but eclipse doesn't allow
this since in this case isDirty() returns false.

So, my proposal is IEditorPart has a new API called isSaveAllowed()
and this method should control Save menu.
Comment 1 Nick Edgar CLA 2002-04-30 11:30:33 EDT
In this case, since the encoding is part of the editor's state, changing the 
output encoding should dirty the editor.
Will reconsider this for v3 though.
Comment 2 Tetsuro Asahata CLA 2002-04-30 12:11:54 EDT
Changing dirty state will confuse user,
since user only changed global preference and not each editor's content.
In this case editor should not change dirty state.

Also output encoding is just an example.
Editor may update their own meta data such as GENERATOR in HTML,
editor's private information which usually user don't care or don't change,
and so on...

However, I agree this is a V3 item.
Comment 3 Randy Giffen CLA 2002-08-12 09:32:07 EDT
Reopen for investigation
Comment 4 Michael Van Meekeren CLA 2006-04-21 13:58:33 EDT
Moving Dougs bugs
Comment 5 Tomasz Zarna CLA 2009-01-06 06:58:15 EST
What if the editor is opened on a read-only input (e.g. CVS revision), should changing the encoding dirty the editor as well? Observed in N20090101-2000.
Comment 6 Susan McCourt CLA 2009-07-09 19:01:49 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 7 Boris Bokowski CLA 2009-11-17 13:03:15 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 8 Mickael Istria CLA 2016-11-10 12:13:55 EST
Usually, on all editors I can figure out, Save is always enabled independently of the state of the file being edited, even if it contains "wrong" data. It's actually important for user to be able to save even invalid content, as a milestone.
So despite the idea is interesting, I question how users will really like it or not, compared to established workflows (of Eclipse IDE and all editors in general). It seems to me that in most case, error in files have to be reported in the editor and the decision of whether to save or not should entirely belong to the user.