KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > eclipse > mapper > editors > reveng > SQLTypeMappingFormPage


1 package org.hibernate.eclipse.mapper.editors.reveng;
2
3 import org.eclipse.jface.viewers.TableViewer;
4 import org.eclipse.swt.SWT;
5 import org.eclipse.swt.layout.GridData;
6 import org.eclipse.swt.layout.GridLayout;
7 import org.eclipse.swt.widgets.Table;
8 import org.eclipse.swt.widgets.TableColumn;
9 import org.eclipse.ui.forms.IManagedForm;
10 import org.eclipse.ui.forms.SectionPart;
11 import org.eclipse.ui.forms.editor.FormPage;
12 import org.eclipse.ui.forms.widgets.ScrolledForm;
13 import org.eclipse.ui.forms.widgets.Section;
14 import org.hibernate.eclipse.mapper.editors.ReverseEngineeringMultiPageEditor;
15 import org.hibernate.eclipse.mapper.editors.SQLTypeContentProvider;
16
17 public class SQLTypeMappingFormPage extends FormPage {
18
19     public SQLTypeMappingFormPage(ReverseEngineeringMultiPageEditor editor) {
20         super(editor, SQLTypeMappingFormPage.class.getName(), "Type mapping");
21     }
22
23     protected void createFormContent(IManagedForm managedForm) {
24         ScrolledForm form = managedForm.getForm();
25         form.setText("Mappings from JDBC types to Hibernate types");
26                  new String JavaDoc();
27         managedForm.getToolkit().paintBordersFor(form);
28         
29         GridLayout layout = new GridLayout(1,false);
30         form.getBody().setLayout(layout);
31         
32         Table table = managedForm.getToolkit().createTable(form.getBody(), SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
33         
34         TableColumn col = new TableColumn(table, SWT.LEFT);
35         col.setText("Test");
36         col.setWidth(100);
37         
38         col = new TableColumn(table, SWT.LEFT);
39         col.setWidth(100);
40         col.setText("Test 2");
41         
42         table.setHeaderVisible(true);
43
44         GridData gd = new GridData(GridData.FILL_BOTH);
45         //gd.horizontalAlignment = GridData.F
46
table.setLayoutData(gd);
47         
48         
49         TableViewer tableViewer = new TableViewer(table);
50         tableViewer.setContentProvider(new SQLTypeContentProvider());
51         
52         
53         /*tableViewer.setLabelProvider(new ITableLabelProvider() {
54             
55             String[] columns = new String[] { "SQL Type", "Length", "Precision", "Scale", "Hibernate Type"};
56             public void removeListener(ILabelProviderListener listener) { }
57         
58             public boolean isLabelProperty(Object element, String property) { return false; }
59         
60             public void dispose() { }
61         
62             public void addListener(ILabelProviderListener listener) { }
63         
64             public String getColumnText(Object element, int columnIndex) {
65
66                 return null;
67             }
68         
69             public Image getColumnImage(Object element, int columnIndex) {
70                 // TODO Auto-generated method stub
71                 return null;
72             }
73         
74         });*/

75     
76     
77
78     }
79 }
80
Popular Tags