KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > parts > TreeMessageDialog


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