javafx - Checking if a Part inside of a PartStack was closed by pressing the close icon on the corresponding tab -
platform: windows 8.1 pro, e4 e(fx)clipse
i'm working on caching opened parts reopen when reloading partstack. reloading method uses epartservice.hidepart() close parts in partstack. since need remove parts cache, need differentiate between reloading , closing tab/part.
i tried add part cache second time before removing again sending event predestroy() method of part. less ideal.
is there special event can catch when clicking on close icon or way check this?
thanks help.
turns out, easiest way wanted use tags. since access code when part closed program, needed set tag on part.
if (part.isdirty()) { if(!partservice.savepart(part, true)) { return; } part.gettags().add(tag.part_closed_by_program); partservice.hidepart(part); } else if (part.iscloseable()) { part.gettags().add(tag.part_closed_by_program); partservice.hidepart(part); } }
now can check in predestroy() method if part being closed program or user.
@predestroy protected void predestroy() { if (part.gettags().contains(tag.part_closed_by_program)) { part.gettags().remove(tag.part_closed_by_program); } else { try { //remove "part" cache } catch (illegalaccessexception e) { } catch (invocationtargetexception e) { } catch (nosuchmethodexception e) { } } }
Comments
Post a Comment