Bug 211493 [Markers] [Markers] New Markers view slows down traversal in Package Explorer
I20071127-0800 Traversing over elements in the Package Explorer via Arrow_Down key is slowed down by the new Markers view. Steps: - select org.eclipse.jdt.doc.user (from CVS) - press Arrow_Right - press and hold Arrow_Down => selection moves slowly, gets faster after folders with many files have been passed I quickly profiled this and found that a lot of time is burned in org.eclipse.ui.internal.provisional.views.markers.CachedMarkerBuilder$1.run(IProgressMonitor) This is probably because ExtendedMarkersView.createPartControl(Composite) contains: ISelectionListener listener = getPageSelectionListener(); getSite().getPage().addSelectionListener(listener); listener.selectionChanged(getSite().getPage().getActivePart(), getSite().getPage().getSelection()); 1. => should not leak the listener when the view is disposed 2. => should not update when the Markers view is not visible 3. => should not use addSelectionListener() but addPostSelectionListener()
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/provisional/views/markers/ExtendedMarkersView.java
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.internal.ide.IDEInternalPreferences;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.ide.StatusUtil;
import org.eclipse.ui.internal.provisional.views.markers.api.MarkerField;
import org.eclipse.ui.internal.provisional.views.markers.api.MarkerItem;
import org.eclipse.ui.internal.provisional.views.markers.api.MarkerSupportConstants;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.part.ViewPart;