1 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 fInput; 29 30 public TreeMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String [] 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 input) { 56 fInput = input; 57 } 58 59 } 60 | Popular Tags |