Source:
<code>public void init(IViewPart view) { fPart = view; if (fAction != null && !fAction.isChecked()) { IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(fPart.getViewSite().getWorkbenchWindow()); boolean pinnable = PinCloneUtils.isPinnable(fPart, service.getActiveContext()); fAction.setEnabled(pinnable); } fPart.addPropertyListener(new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if (IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION == propId) { String desc = ((WorkbenchPart) fPart).getContentDescription(); if (!fPinnedContextLabel.equals(desc)) { fLastKnownDescription = desc; } if (fAction != null && fAction.isChecked()) { PinCloneUtils.setPartContentDescription(fPart, fPinnedContextLabel); } } else if (IWorkbenchPartConstants.PROP_PART_NAME == propId) { PinCloneUtils.setPartTitle(fPart); } } }); DebugUITools.addPartDebugContextListener(fPart.getSite(), this); fPartListener = new IPartListener2() { @Override public void partBroughtToTop(IWorkbenchPartReference partRef) @Override <START> public void partClosed(IWorkbenchPartReference partRef) { <END> IWorkbenchPart part = partRef.getPart(false); if (part.equals(fPart)) { PinDebugContextActionDelegate.this.dispose(); } } @Override public void partDeactivated(IWorkbenchPartReference partRef) @Override public void partOpened(IWorkbenchPartReference partRef) @Override public void partHidden(IWorkbenchPartReference partRef) @Override public void partVisible(IWorkbenchPartReference partRef) @Override public void partInputChanged(IWorkbenchPartReference partRef) @Override public void partActivated(IWorkbenchPartReference partRef) }; fPart.getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener); }</code><technical_language>Is a case partClosed() called dispose() method called directly? If not, do need this IPartListener2 rely dispose() time? If so, calling dispose() more cleanup to</technical_language>

Target:
public void init(IViewPart view) { fPart = view; if (fAction != null && !fAction.isChecked()) { IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(fPart.getViewSite().getWorkbenchWindow()); boolean pinnable = PinCloneUtils.isPinnable(fPart, service.getActiveContext()); fAction.setEnabled(pinnable); } fPart.addPropertyListener(new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if (IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION == propId) { String desc = ((WorkbenchPart) fPart).getContentDescription(); if (!fPinnedContextLabel.equals(desc)) { fLastKnownDescription = desc; } if (fAction != null && fAction.isChecked()) { PinCloneUtils.setPartContentDescription(fPart, fPinnedContextLabel); } } else if (IWorkbenchPartConstants.PROP_PART_NAME == propId) { PinCloneUtils.setPartTitle(fPart); } } }); DebugUITools.addPartDebugContextListener(fPart.getSite(), this); fPartListener = new IPartListener2() { @Override public void partBroughtToTop(IWorkbenchPartReference partRef) @Override public void partClosed(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); if (part.equals(fPart)) { if (fAction.isChecked()) { DebugEventFilterService.getInstance().removeDebugEventFilter(fPart); fAction.setChecked(false); } } } @Override public void partDeactivated(IWorkbenchPartReference partRef) @Override public void partOpened(IWorkbenchPartReference partRef) @Override public void partHidden(IWorkbenchPartReference partRef) @Override public void partVisible(IWorkbenchPartReference partRef) @Override public void partInputChanged(IWorkbenchPartReference partRef) @Override public void partActivated(IWorkbenchPartReference partRef) }; fPart.getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener); }