1 11 package org.eclipse.ui.dialogs; 12 13 import org.eclipse.jface.dialogs.IDialogConstants; 14 import org.eclipse.swt.widgets.Composite; 15 import org.eclipse.swt.widgets.Shell; 16 import org.eclipse.ui.PlatformUI; 17 import org.eclipse.ui.internal.IWorkbenchHelpContextIds; 18 19 27 public class YesNoCancelListSelectionDialog extends ListSelectionDialog { 28 39 public YesNoCancelListSelectionDialog( 40 org.eclipse.swt.widgets.Shell parentShell, 41 Object input, 42 org.eclipse.jface.viewers.IStructuredContentProvider contentProvider, 43 org.eclipse.jface.viewers.ILabelProvider labelProvider, 44 String message) { 45 super(parentShell, input, contentProvider, labelProvider, message); 46 } 47 48 51 protected void buttonPressed(int buttonId) { 52 switch (buttonId) { 53 case IDialogConstants.YES_ID: { 54 yesPressed(); 55 return; 56 } 57 case IDialogConstants.NO_ID: { 58 noPressed(); 59 return; 60 } 61 case IDialogConstants.CANCEL_ID: { 62 cancelPressed(); 63 return; 64 } 65 } 66 } 67 68 71 protected void configureShell(Shell shell) { 72 super.configureShell(shell); 73 PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, 74 IWorkbenchHelpContextIds.YES_NO_CANCEL_LIST_SELECTION_DIALOG); 75 } 76 77 80 protected void createButtonsForButtonBar(Composite parent) { 81 createButton(parent, IDialogConstants.YES_ID, 82 IDialogConstants.YES_LABEL, true); 83 createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, 84 false); 85 createButton(parent, IDialogConstants.CANCEL_ID, 86 IDialogConstants.CANCEL_LABEL, false); 87 } 88 89 97 protected void noPressed() { 98 setReturnCode(IDialogConstants.NO_ID); 99 close(); 100 } 101 102 106 protected void yesPressed() { 107 okPressed(); 108 setReturnCode(IDialogConstants.YES_ID); 109 } 110 } 111 | Popular Tags |