42 import org.eclipse.swt.widgets.Label; |
42 import org.eclipse.swt.widgets.Label; |
43 import org.eclipse.swt.widgets.TableColumn; |
43 import org.eclipse.swt.widgets.TableColumn; |
44 import org.eclipse.swt.widgets.Text; |
44 import org.eclipse.swt.widgets.Text; |
45 |
45 |
46 import com.nokia.carbide.discovery.ui.Activator; |
46 import com.nokia.carbide.discovery.ui.Activator; |
|
47 import com.nokia.carbide.discovery.ui.Messages; |
47 |
48 |
48 /** |
49 /** |
49 * Abstract superclass of import and export page |
50 * Abstract superclass of import and export page |
50 */ |
51 */ |
51 abstract class AbstractImportExportPage extends WizardPage { |
52 abstract class AbstractImportExportPage extends WizardPage { |
90 public void modifyText(ModifyEvent e) { |
91 public void modifyText(ModifyEvent e) { |
91 setPageComplete(validatePage()); |
92 setPageComplete(validatePage()); |
92 } |
93 } |
93 }); |
94 }); |
94 browseButton = new Button(composite, SWT.PUSH); |
95 browseButton = new Button(composite, SWT.PUSH); |
95 browseButton.setText("Browse..."); |
96 browseButton.setText(Messages.AbstractImportExportPage_BrowseButtonLabel); |
96 browseButton |
97 browseButton |
97 .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); |
98 .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); |
98 setButtonLayoutData(browseButton); |
99 setButtonLayoutData(browseButton); |
99 |
100 |
100 new Label(parent, SWT.NONE); // spacer |
101 new Label(parent, SWT.NONE); // spacer |
106 GridDataFactory.defaultsFor(label).span(2, 1).applyTo(label); |
107 GridDataFactory.defaultsFor(label).span(2, 1).applyTo(label); |
107 |
108 |
108 viewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER); |
109 viewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER); |
109 TableViewerColumn featureColumn = new TableViewerColumn(viewer, |
110 TableViewerColumn featureColumn = new TableViewerColumn(viewer, |
110 SWT.CENTER); |
111 SWT.CENTER); |
111 featureColumn.getColumn().setText("Feature"); |
112 featureColumn.getColumn().setText(Messages.AbstractImportExportPage_FeatureColTitle); |
112 featureColumn.setLabelProvider(new ColumnLabelProvider() { |
113 featureColumn.setLabelProvider(new ColumnLabelProvider() { |
113 @Override |
114 @Override |
114 public Image getImage(Object element) { |
115 public Image getImage(Object element) { |
115 return featureImg; |
116 return featureImg; |
116 } |
117 } |
122 return null; |
123 return null; |
123 } |
124 } |
124 }); |
125 }); |
125 TableViewerColumn versionColumn = new TableViewerColumn(viewer, |
126 TableViewerColumn versionColumn = new TableViewerColumn(viewer, |
126 SWT.CENTER); |
127 SWT.CENTER); |
127 versionColumn.getColumn().setText("Version"); |
128 versionColumn.getColumn().setText(Messages.AbstractImportExportPage_VersionColTitle); |
128 versionColumn.setLabelProvider(new ColumnLabelProvider() { |
129 versionColumn.setLabelProvider(new ColumnLabelProvider() { |
129 @Override |
130 @Override |
130 public String getText(Object element) { |
131 public String getText(Object element) { |
131 if (element instanceof FeatureInfo) { |
132 if (element instanceof FeatureInfo) { |
132 return ((FeatureInfo) element).getVersion().toString(); |
133 return ((FeatureInfo) element).getVersion().toString(); |
144 Composite buttonComposite = new Composite(parent, SWT.NONE); |
145 Composite buttonComposite = new Composite(parent, SWT.NONE); |
145 GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING) |
146 GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING) |
146 .applyTo(buttonComposite); |
147 .applyTo(buttonComposite); |
147 buttonComposite.setLayout(new GridLayout()); |
148 buttonComposite.setLayout(new GridLayout()); |
148 Button checkAllButton = new Button(buttonComposite, SWT.PUSH); |
149 Button checkAllButton = new Button(buttonComposite, SWT.PUSH); |
149 checkAllButton.setText("Select All"); |
150 checkAllButton.setText(Messages.AbstractImportExportPage_CheckAllLabel); |
150 setButtonLayoutData(checkAllButton); |
151 setButtonLayoutData(checkAllButton); |
151 checkAllButton.addSelectionListener(new SelectionAdapter() { |
152 checkAllButton.addSelectionListener(new SelectionAdapter() { |
152 @Override |
153 @Override |
153 public void widgetSelected(SelectionEvent e) { |
154 public void widgetSelected(SelectionEvent e) { |
154 viewer.setAllChecked(true); |
155 viewer.setAllChecked(true); |
155 } |
156 } |
156 }); |
157 }); |
157 Button checkNoneButton = new Button(buttonComposite, SWT.PUSH); |
158 Button checkNoneButton = new Button(buttonComposite, SWT.PUSH); |
158 checkNoneButton.setText("Deselect All"); |
159 checkNoneButton.setText(Messages.AbstractImportExportPage_CheckNoneLabel); |
159 setButtonLayoutData(checkNoneButton); |
160 setButtonLayoutData(checkNoneButton); |
160 checkNoneButton.addSelectionListener(new SelectionAdapter() { |
161 checkNoneButton.addSelectionListener(new SelectionAdapter() { |
161 @Override |
162 @Override |
162 public void widgetSelected(SelectionEvent e) { |
163 public void widgetSelected(SelectionEvent e) { |
163 viewer.setAllChecked(false); |
164 viewer.setAllChecked(false); |