Salut,

J'essaye d'afficher une table vide avec deux colonnes dans la page des préférences d'eclipse mais rien ne s'affiche.

Serait-ce du au fait que les données manques ?

Ou aurais oublier quelque chose dans la construction du composant

voici mon code

d avance merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 
public class NamespacesPreferencesPage extends AbstractPreferencePage{
 
	/** The prefix column string constant*/
	private final static String PREFIX_COLUMN = "Prefix";
	/** The uri column string constant*/
	private final static String URI_COLUMN = "Uri";
	/** The table container*/
	private Table table;
	/** The table viewer component*/
	private TableViewer tableViewer;
	/** Set column names */
	private String[] columnNames = new String[] {PREFIX_COLUMN,	URI_COLUMN};
 
	/**
         * Performs the defaults.
         * 
         * @param preferences The Preferences to update
         * @param defaultPreferences The default Preferences
         */
	protected void performDefaults(Preferences preferences, Preferences defaultPreferences) {
 
	}
 
	/**
         * Performs the Ok.
         * 
         * @param preferences The Preferences to update
         */
	protected void performOk(Preferences preferences) {
 
	}
 
 
	/**
         * Initializes this preference page for the given workbench.
         * <p>
         * This method is called automatically as the preference page is being created and initialized. Clients must not
         * call this method.
         * </p>
         * 
         * @param workbench
         *            the workbench
         */
	public void init(IWorkbench workbench) {
	}
 
	/**
         * Creates the contents of the Preference Page.
         * 
         * @param parent
         *            The parent control
         * @return Control The control
         */
	protected Control createContents(Composite parent) {
		Composite panel = new Composite(parent, SWT.NONE);
		createTable(panel);
		createTableViewer();
		return panel;
	}
 
	/**
         * Create the Table
         * 
         * @param parent
         *                      The parent component
         */
	private void createTable(Composite parent) {
		int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | 
					SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
 
 
		table = new Table(parent, style);
 
		GridData gridData = new GridData(GridData.FILL_BOTH);
		gridData.grabExcessVerticalSpace = true;
		gridData.horizontalSpan = 3;
		table.setLayoutData(gridData);		
 
		table.setLinesVisible(true);
		table.setHeaderVisible(true);
 
		// 1st column with image/checkboxes - NOTE: The SWT.CENTER has no effect!!
		TableColumn column = new TableColumn(table, SWT.CENTER, 0);		
		column.setText(PREFIX_COLUMN);
		column.setWidth(20);
 
		// 2nd column with task Description
		column = new TableColumn(table, SWT.LEFT, 1);
		column.setText(URI_COLUMN);
		column.setWidth(400);
		// Add listener to column so tasks are sorted by description when clicked 
		column.addSelectionListener(new SelectionAdapter() {
 
			public void widgetSelected(SelectionEvent e) {
				//tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.DESCRIPTION));
			}
		});	
	}
 
	/**
         * Create the TableViewer 
         */
	private void createTableViewer() {
 
		tableViewer = new TableViewer(table);
		tableViewer.setUseHashlookup(true);
		tableViewer.setColumnProperties(columnNames);
		// Create the cell editors
		CellEditor[] editors = new CellEditor[columnNames.length];
		// Column 1 : Completed (Checkbox)
		TextCellEditor textEditor = new TextCellEditor(table);
		editors[0] = textEditor;
		// Column 2 : Description (Free text)
		textEditor = new TextCellEditor(table);
		((Text) textEditor.getControl()).setTextLimit(60);
		editors[1] = textEditor;
		// Assign the cell editors to the viewer 
		tableViewer.setCellEditors(editors);
	}