|
Re: How do I know if Save button is pressed? [message #330930 is a reply to message #330929] |
Mon, 18 August 2008 09:47 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
On Mon, 18 Aug 2008 07:11:10 +0000 (UTC), kaprasannagt@gmail.com
(kaprasanna) wrote:
>Hello,
>
>How do I come to know if user presses 'Save' button in Eclipse IDE?
>Is there any listener or some other place where I get a notification about
>the save button having been pressed?
>Please guide.
>
>Thanks.
I assume you are talking about saving an editor. You save your editor
by implementing IEditorPart (which comes for free if you subclass your
editor from EditorPart). You have to implement the save() and saveAs()
methods.
If you are not using an editor it should be sufficient to implement
ISaveablePart where the save/saveAs methods are introduced.
Achim
--
Achim Lörke
Eclipse-Stammtisch in the Braunschweig, Germany area:
http://www.bredex.de/de/news/events.html
Achim Lörke
|
|
|
|
|
|
|
Re: How do I know if Save button is pressed? [message #330983 is a reply to message #330979] |
Wed, 20 August 2008 13:32 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
On Wed, 20 Aug 2008 10:55:57 +0000 (UTC), kaprasannagt@gmail.com
(kaprasanna) wrote:
>Hi Paul,
>
>My view implements ISaveablePart so I implement following methods :
>isSaveOnCloseNeeded, isDirty, doSave.
>Save on close works just great..
>Problem is I can't get the save buton to be enabled on demand. This is how
>isDirty() looks like :
>
> ...
>
>Not only the save button doesn't get enabled, I get this error : unhandled
>event loop exception java.lang.StackOverFlow at the firePropertyChange()
>line.
>
>What is wrong? What I must be doing?
>Please guide.
>
>Thanks.
You should implement something like
private boolean isDirty = false;
public boolean isDirty() {
return isDirty;
}
public void setDirty(boolean dirty) {
isDirty = dirty;
firePropertyChange(PROP_DIRTY);
}
firePropertyChange() whill notify the platform which will in turn call
isDirty() to get the dirty state. Using your implementation triggers
another property change and therefore goes into an indefinite
recursion.
Achim
--
Achim Lörke
Eclipse-Stammtisch in the Braunschweig, Germany area:
http://www.bredex.de/de/news/events.html
Achim Lörke
|
|
|
|
Powered by
FUDForum. Page generated in 0.04399 seconds