Bug 144294 Performance: CommonNavigator could easily cache its ISelection to improve its performance
Currently, the CommonNavigator does not override the getSelection() method, which is quite expensive when called repeatedly by clients since it gets the current selection from the underlying SWT widget each time it gets called. A simple trick is to cache the selection and update it only when it actually changes. This would result in improved performance for clients who call getSelection() often. This defect is related to 140032. Please refer to it for more info. I will be submitting a patch shortly.
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/CommonViewer.java
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.navigator.ContributorTrackingSet;
import org.eclipse.ui.internal.navigator.NavigatorContentService;
import org.eclipse.ui.internal.navigator.NavigatorPipelineService;
/**
 * 
 * Provides the Tree Viewer for the Common Navigator. Content and labels are
 * provided by an instance of {@link INavigatorContentService}&nbsp; which uses
 * the ID supplied in the constructor
 * {@link CommonViewer#CommonViewer(String, Composite, int)} or through
 * {@link NavigatorContentServiceFactory#createContentService(String, org.eclipse.jface.viewers.StructuredViewer)}.
 * 
 * <p>
 * Clients may extend this class.
 * </p>
 * 
 * 
 * @since 3.2
 */
public class CommonViewer extends TreeViewer {