/** * Removes the control from this manager. Unmanages this position, * * @param c the control to remove * @param doRemove whether or not this control should be completely removed, or just temporarily * (eg- during a save) * @return the position of the removed control */ private Position removeControl(ContainedEditorManager c, boolean doRemove) { Position p; if (doRemove) { p = editorPositionMap.remove(c); } else { p = editorPositionMap.get(c); } try { ppManager.unmanagePosition(p); if (doRemove && !p.isDeleted()) { // Position projected = modelToProjected(p); // styledText.replaceStyleRanges(projected.offset, projected.length, new // StyleRange[0]); styledText.replaceStyleRanges(p.offset, p.length, new StyleRange[0]); } } catch (NullPointerException e) { // do nothing...trying to unmanage posn after // document has already been uninstalled. } c.removeListener(this); c.dispose(); return p; }