Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Deleting a file with unsaved changes
Deleting a file with unsaved changes [message #336464] Mon, 15 June 2009 17:07 Go to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
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 18:25 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
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] Thu, 18 June 2009 01:18 Go to previous messageGo to next message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
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] Fri, 19 June 2009 01:17 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
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: Sun Jun 30 08:48:16 GMT 2024

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

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

Back to the top