01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.readmetool;
11:
12: import org.eclipse.core.runtime.IAdaptable;
13: import org.eclipse.jface.dialogs.Dialog;
14: import org.eclipse.jface.viewers.ListViewer;
15: import org.eclipse.swt.SWT;
16: import org.eclipse.swt.layout.GridData;
17: import org.eclipse.swt.widgets.Composite;
18: import org.eclipse.swt.widgets.Control;
19: import org.eclipse.swt.widgets.List;
20: import org.eclipse.swt.widgets.Shell;
21: import org.eclipse.ui.PlatformUI;
22: import org.eclipse.ui.model.WorkbenchContentProvider;
23: import org.eclipse.ui.model.WorkbenchLabelProvider;
24:
25: /**
26: * This dialog is an example of a detached window launched
27: * from an action in the workbench.
28: */
29: public class SectionsDialog extends Dialog {
30: protected IAdaptable input;
31:
32: /**
33: * Creates a new SectionsDialog.
34: */
35: public SectionsDialog(Shell parentShell, IAdaptable input) {
36: super (parentShell);
37: this .input = input;
38: }
39:
40: /* (non-Javadoc)
41: * Method declared on Window.
42: */
43: protected void configureShell(Shell newShell) {
44: super .configureShell(newShell);
45: newShell.setText(MessageUtil.getString("Readme_Sections")); //$NON-NLS-1$
46: PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
47: IReadmeConstants.SECTIONS_DIALOG_CONTEXT);
48: }
49:
50: /* (non-Javadoc)
51: * Method declared on Dialog
52: */
53: protected Control createDialogArea(Composite parent) {
54: Composite composite = (Composite) super
55: .createDialogArea(parent);
56:
57: List list = new List(composite, SWT.BORDER);
58: GridData data = new GridData(GridData.FILL_BOTH);
59: list.setLayoutData(data);
60: ListViewer viewer = new ListViewer(list);
61: viewer.setContentProvider(new WorkbenchContentProvider());
62: viewer.setLabelProvider(new WorkbenchLabelProvider());
63: viewer.setInput(input);
64:
65: return composite;
66: }
67: }
|