@Override protected void dispose() { if (projectClientListener != null) { projectClientListener.remove(); projectClientListener = null; } super.dispose(); }
/** Removes save cookie from the DO. */ final void removeSaveCookie() { DataObject dataObj = getDataObject(); // add Save cookie to the data object if (dataObj instanceof MultiDataObject) { if (dataObj.getCookie(SaveCookie.class) == this) { getCookieSet((MultiDataObject) dataObj).remove(this); } } }
@Override public void setModified(boolean modif) { super.setModified(modif); if (!modif) { GenericEditorSupport ges = getLookup().lookup(GenericEditorSupport.class); // defect #203688, probably file deletion in parallel with DO's creation - not completed, so // cookie not registered yet. if (ges != null) { ges.removeSaveCookie(); } } }
/* * @see org.openide.loaders.DataObject#setModified(boolean) */ public void setModified(boolean isModified) { // I tied the SaveCookie implementation into this such that // the Save action is enabled whenever the object is modified. if (isModified) { if (getCookie(SaveCookie.class) == null) { getCookieSet().add(saveCookie); } } else { SaveCookie cookie = (SaveCookie) getCookie(SaveCookie.class); if (cookie != null) { getCookieSet().remove(cookie); } } super.setModified(isModified); }
@Override protected void handleDelete() throws IOException { dispose(); super.handleDelete(); }