Mike Shreek Messages: 16 Registered: September 2012
Junior Member
Hi, Is there anyway you can stop a part from closing?
Like for example when a data inside a table was modified it will promp a save (yes no cancel) and when hit cancel the part will not be closed. Thank you!
Mike Shreek Messages: 16 Registered: September 2012
Junior Member
Dear Mike,
I think you got it wrong. In your MParts, there is a thing called "setDirty" which tells the eclipse that the part is modify and needs to trigger a save dialog when closing. This will help you to manipulate parts that are going to be saved.
For example, when part is modified
part.setDirty(true);
then include the following in your class (MPart's class)
@Persist
public static void savePart(MPart part){
// In this area, parts that are set to be saved is here, so you can get the part and do whatever data saving you want
part.setDirty(false); //don't forget to mark this as false again!
}
@PersistState
public static void beforeDisposePart(MPart part){
//Optional: in this area, if you still want to get the parts that are set NOT to be saved
if(part.isDirty()){
//Do something here
}
}
Also, when creating a new part, don't forget to tag your part EPartService.REMOVE_ON_HIDE_TAG
Mike Shreek Messages: 16 Registered: September 2012
Junior Member
Dear Mike,
Why THANK you so much!! It's been like 5 days of figuring on how to do this!! Thank you Thank you!
But anyway I'd like to see some answers on how to stop parts from closing. This is for anyone who needs to stop their parts from being destroy if there are other reasons...
If it is not closeable then mark it that way in the e4xmi.
Tom
Am 24.11.12 08:27, schrieb Mike Shreek:
> Dear Mike,
>
> Why THANK you so much!! It's been like 5 days of figuring on how to do
> this!! Thank you Thank you!
>
> But anyway I'd like to see some answers on how to stop parts from
> closing. This is for anyone who needs to stop their parts from being
> destroy if there are other reasons...
>
> Cheers!