/** * Removes this object from the corresponding StyledText widget. Object can't be used after this * call, until another attach. This method is called automatically, when StyledText widget is * disposed */ public void detach() { if (text == null) return; text.removeDisposeListener(ml); text.removeLineStyleListener(ml); text.removeLineBackgroundListener(ml); text.removePaintListener(ml); text.removeVerifyListener(ml); text.removeExtendedModifyListener(ml); text.removeControlListener(ml); text.removeKeyListener(ml); text.removeTraverseListener(ml); text.removeMouseListener(ml); text.removeSelectionListener(ml); ScrollBar sb = text.getVerticalBar(); if (sb != null) sb.removeSelectionListener(ml); baseEditor = null; }