java - How to handle close tab in eclipse RCP 4 -
i want make validation when pulse close button of tab in eclipse rcp 4 application , if validation fails prevent de close.
if don't want use part.setdirty(true)
isavehandler
greg-449 montioned, listen model events , correct things there. in direction of this:
public class preventcloseaddon { @postconstruct public void init(final ieventbroker eventbroker, final epartservice partservice) { eventhandler tbrhandler = new eventhandler() { @override public void handleevent(event event) { if (!uievents.isset(event)) return; object element = event.getproperty(uievents.eventtags.element); if (element instanceof mpart) { mpart part = (mpart) element; if (!part.istoberendered()) { // ... validate here ... part.settoberendered(true); partservice.activate(part); } } } }; eventbroker.subscribe(uievents.uielement.topic_toberendered, tbrhandler); } }
you should aware part rendered again code.
Comments
Post a Comment