1 11 package org.eclipse.pde.internal.ui.views.dependencies; 12 13 import org.eclipse.jface.viewers.IContentProvider; 14 import org.eclipse.jface.viewers.StructuredViewer; 15 import org.eclipse.jface.viewers.TableViewer; 16 import org.eclipse.swt.SWT; 17 import org.eclipse.swt.events.DisposeEvent; 18 import org.eclipse.swt.events.DisposeListener; 19 import org.eclipse.swt.widgets.Composite; 20 import org.eclipse.swt.widgets.Table; 21 22 public class DependenciesViewListPage extends DependenciesViewPage { 23 24 27 public DependenciesViewListPage(DependenciesView view, 28 IContentProvider contentProvider) { 29 super(view, contentProvider); 30 } 31 32 37 protected StructuredViewer createViewer(Composite parent) { 38 Table table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); 39 40 fViewer = new TableViewer(table); 41 fViewer.setContentProvider(fContentProvider); 42 final DependenciesLabelProvider labelProvider = new DependenciesLabelProvider( 43 false); 44 fViewer.setLabelProvider(labelProvider); 45 fViewer.getControl().addDisposeListener(new DisposeListener() { 46 public void widgetDisposed(DisposeEvent e) { 47 labelProvider.dispose(); 48 } 49 }); 50 51 return fViewer; 52 } 53 54 protected void handleShowOptional(boolean isChecked, boolean refreshIfNecessary) { 55 if (fContentProvider instanceof CalleesListContentProvider) { 56 ((CalleesListContentProvider)fContentProvider).setShowOptional(isChecked); 57 if (refreshIfNecessary) 58 fViewer.refresh(); 59 } 60 } 61 62 protected boolean isShowingOptional() { 63 if (fContentProvider instanceof CalleesListContentProvider) { 64 return ((CalleesListContentProvider)fContentProvider).getShowOptional(); 65 } 66 return true; 67 } 68 } 69 | Popular Tags |