01: /*******************************************************************************
02: * Copyright (c) 2005, 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.pde.internal.ui.parts;
11:
12: import org.eclipse.jface.dialogs.MessageDialog;
13: import org.eclipse.jface.viewers.ILabelProvider;
14: import org.eclipse.jface.viewers.ITreeContentProvider;
15: import org.eclipse.jface.viewers.TreeViewer;
16: import org.eclipse.swt.SWT;
17: import org.eclipse.swt.graphics.Image;
18: import org.eclipse.swt.layout.GridData;
19: import org.eclipse.swt.widgets.Composite;
20: import org.eclipse.swt.widgets.Control;
21: import org.eclipse.swt.widgets.Shell;
22:
23: public class TreeMessageDialog extends MessageDialog {
24:
25: private ITreeContentProvider fContentProvider;
26: private ILabelProvider fLabelProvider;
27: private Object fInput;
28:
29: public TreeMessageDialog(Shell parentShell, String dialogTitle,
30: Image dialogTitleImage, String dialogMessage,
31: int dialogImageType, String[] dialogButtonLabels,
32: int defaultIndex) {
33: super (parentShell, dialogTitle, dialogTitleImage,
34: dialogMessage, dialogImageType, dialogButtonLabels,
35: defaultIndex);
36: }
37:
38: protected Control createCustomArea(Composite parent) {
39: TreeViewer viewer = new TreeViewer(parent, SWT.BORDER);
40: GridData gd = new GridData(GridData.FILL_BOTH);
41: gd.heightHint = 150;
42: viewer.getTree().setLayoutData(gd);
43: viewer.setContentProvider(fContentProvider);
44: viewer.setLabelProvider(fLabelProvider);
45: viewer.setInput(fInput);
46: applyDialogFont(viewer.getControl());
47: return viewer.getControl();
48: }
49:
50: public void setContentProvider(ITreeContentProvider provider) {
51: fContentProvider = provider;
52: }
53:
54: public void setLabelProvider(ILabelProvider provider) {
55: fLabelProvider = provider;
56: }
57:
58: public void setInput(Object input) {
59: fInput = input;
60: }
61:
62: }
|