KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > view > DependenciesViewListPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.view;
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.pde.internal.ui.wizards.ListUtil;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.events.DisposeEvent;
19 import org.eclipse.swt.events.DisposeListener;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.swt.widgets.Table;
22
23 public class DependenciesViewListPage extends DependenciesViewPage {
24     private IContentProvider fContentProvider;
25
26     /**
27      *
28      */

29     public DependenciesViewListPage(DependenciesView view,
30             IContentProvider contentProvider) {
31         super(view);
32         fContentProvider = contentProvider;
33     }
34
35     /*
36      * (non-Javadoc)
37      *
38      * @see org.eclipse.pde.internal.ui.view.DependenciesViewPage#createViewer(org.eclipse.swt.widgets.Composite)
39      */

40     protected StructuredViewer createViewer(Composite parent) {
41         Table table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
42
43         fViewer = new TableViewer(table);
44         fViewer.setContentProvider(fContentProvider);
45         final DependenciesLabelProvider labelProvider = new DependenciesLabelProvider(
46                 false);
47         fViewer.setLabelProvider(labelProvider);
48         fViewer.getControl().addDisposeListener(new DisposeListener() {
49             public void widgetDisposed(DisposeEvent e) {
50                 labelProvider.dispose();
51             }
52         });
53         fViewer.setSorter(ListUtil.PLUGIN_SORTER);
54
55         return fViewer;
56     }
57 }
58
Popular Tags