1 11 package org.eclipse.jdt.internal.debug.ui.actions; 12 13 14 import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants; 15 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 16 import org.eclipse.jface.dialogs.IDialogSettings; 17 import org.eclipse.jface.viewers.ILabelProvider; 18 import org.eclipse.jface.viewers.IStructuredContentProvider; 19 import org.eclipse.swt.SWT; 20 import org.eclipse.swt.events.SelectionAdapter; 21 import org.eclipse.swt.events.SelectionEvent; 22 import org.eclipse.swt.graphics.Font; 23 import org.eclipse.swt.widgets.Button; 24 import org.eclipse.swt.widgets.Composite; 25 import org.eclipse.swt.widgets.Control; 26 import org.eclipse.swt.widgets.Shell; 27 import org.eclipse.ui.dialogs.ListSelectionDialog; 28 29 34 public class ProjectSelectionDialog extends ListSelectionDialog { 35 36 private boolean fAddExportedEntries = true; 37 private boolean fAddRequiredProjects = true; 38 39 42 public ProjectSelectionDialog( 43 Shell parentShell, 44 Object input, 45 IStructuredContentProvider contentProvider, 46 ILabelProvider labelProvider, 47 String message) { 48 super(parentShell, input, contentProvider, labelProvider, message); 49 setShellStyle(getShellStyle() | SWT.RESIZE); 50 } 51 52 55 protected Control createDialogArea(Composite parent) { 56 Font font = parent.getFont(); 57 58 Composite composite = (Composite)super.createDialogArea(parent); 59 60 final Button addExported = new Button(composite, SWT.CHECK); 61 addExported.setText(ActionMessages.ProjectSelectionDialog_Add_exported_entries_of_selected_projects__1); 62 addExported.addSelectionListener(new SelectionAdapter() { 63 public void widgetSelected(SelectionEvent e) { 64 fAddExportedEntries = addExported.getSelection(); 65 } 66 }); 67 addExported.setSelection(fAddExportedEntries); 68 addExported.setFont(font); 69 70 final Button addRequired = new Button(composite, SWT.CHECK); 71 addRequired.setText(ActionMessages.ProjectSelectionDialog_Add_required_projects_of_selected_projects__2); 72 addRequired.addSelectionListener(new SelectionAdapter() { 73 public void widgetSelected(SelectionEvent e) { 74 fAddRequiredProjects = addRequired.getSelection(); 75 } 76 }); 77 addRequired.setSelection(fAddRequiredProjects); 78 addRequired.setFont(font); 79 80 applyDialogFont(composite); 81 return composite; 82 } 83 84 89 public boolean isAddExportedEntries() { 90 return fAddExportedEntries; 91 } 92 93 98 public boolean isAddRequiredProjects() { 99 return fAddRequiredProjects; 100 } 101 102 107 protected String getDialogSettingsSectionName() { 108 return IJavaDebugUIConstants.PLUGIN_ID + ".P ROJECT_SELECTION_DIALOG_SECTION"; } 110 111 114 protected IDialogSettings getDialogBoundsSettings() { 115 IDialogSettings settings = JDIDebugUIPlugin.getDefault().getDialogSettings(); 116 IDialogSettings section = settings.getSection(getDialogSettingsSectionName()); 117 if (section == null) { 118 section = settings.addNewSection(getDialogSettingsSectionName()); 119 } 120 return section; 121 } 122 } 123 | Popular Tags |