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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -