Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Deleting a file with unsaved changes
Deleting a file with unsaved changes [message #336464] Mon, 15 June 2009 13:07 Go to next message
Eclipse UserFriend
Does anyone know what is controlling the severity of "File 'x' has unsaved
changes." problem in the "Confirm Delete" dialog?

If I try this scenario with basic eclipse text editor, the message
severity is warning and I can still delete the file.

If I try this scenario with a custom multi-page editor that I wrote, the
message severity is error and I cannot delete the file.

Thanks,

- Konstantin
Re: Deleting a file with unsaved changes [message #336502 is a reply to message #336464] Wed, 17 June 2009 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Anyone? It is clearly a platform facility that is getting in the way here,
but I haven't been able to any information about any switch that I might
be able to set to switch this message from error to warning the way it
should be.

- Konstantin
Re: Deleting a file with unsaved changes [message #336504 is a reply to message #336464] Wed, 17 June 2009 21:18 Go to previous messageGo to next message
Eclipse UserFriend
Searching for the "unsaved changes" message I came across
checkDirtyFile(...) in
org.eclipse.ltk.internal.core.refactoring.resource.DeleteRes ourceProcessor
which seems to drive the behavior you are seeing. The logic is something
like,

1. Get the ITextFileBuffer for the IFile
2. Make sure its dirty
3. If the buffer's state is validated AND synchronized, make it a warning
4. Otherwise make it an error

You'll have to dig into the buffer API to figure out how to influence
the state. Not something I'm familiar with.

HTH
Ben

Konstantin Komissarchik wrote:
> Does anyone know what is controlling the severity of "File 'x' has
> unsaved changes." problem in the "Confirm Delete" dialog?
>
> If I try this scenario with basic eclipse text editor, the message
> severity is warning and I can still delete the file.
>
> If I try this scenario with a custom multi-page editor that I wrote, the
> message severity is error and I cannot delete the file.
>
> Thanks,
>
> - Konstantin
>
Re: Deleting a file with unsaved changes [message #336523 is a reply to message #336504] Thu, 18 June 2009 21:17 Go to previous message
Eclipse UserFriend
Ben,

Your help in digging this up is much appreciated. This was enough for me
to chase down the problem to a missing call to the text editor's
validateEditorInputState() method prior to driving any text buffer changes
from the design page of my editor.

Thanks!

- Konstantin
Previous Topic:navigator VS. project explorer
Next Topic:ViewPart and undo/redo
Goto Forum:
  


Current Time: Fri May 02 07:54:13 EDT 2025

Powered by FUDForum. Page generated in 0.02962 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top