1 11 package org.eclipse.jdt.internal.junit.launcher; 12 13 14 import org.eclipse.swt.graphics.Image; 15 import org.eclipse.swt.widgets.Shell; 16 17 import org.eclipse.ui.dialogs.TwoPaneElementSelector; 18 19 import org.eclipse.jdt.core.IType; 20 21 import org.eclipse.jdt.ui.JavaElementLabelProvider; 22 23 26 public class TestSelectionDialog extends TwoPaneElementSelector { 27 28 private final IType[] fTypes; 29 30 private static class PackageRenderer extends JavaElementLabelProvider { 31 public PackageRenderer() { 32 super(JavaElementLabelProvider.SHOW_PARAMETERS | JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT); 33 } 34 35 public Image getImage(Object element) { 36 return super.getImage(((IType)element).getPackageFragment()); 37 } 38 39 public String getText(Object element) { 40 return super.getText(((IType)element).getPackageFragment()); 41 } 42 } 43 44 public TestSelectionDialog(Shell shell, IType[] types) { 45 super(shell, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS), 46 new PackageRenderer()); 47 fTypes= types; 48 } 49 50 53 protected void configureShell(Shell newShell) { 54 super.configureShell(newShell); 55 } 57 58 61 public int open() { 62 setElements(fTypes); 63 return super.open(); 64 } 65 66 } 67 | Popular Tags |