Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » CellEditors don't show up in table
CellEditors don't show up in table [message #290156] Fri, 19 August 2005 02:15
Eclipse UserFriend
Originally posted by: busch.roguewave.com

I've been trying to follow the the "Building and delivering a table editor
with SWT/JFace" article but I don't get cell editors at all in my app.

I'm building a wizard and one of the pages uses a table with two columns.
The first column should have a TextCellEditor and the second one should
have a ComboCellEditor.

Following the article, I have a createTable method:

public void createTable(Composite parent){
int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
table3 = new Table (parent, style);
table3.setLinesVisible (true);
table3.setHeaderVisible(true);
// table3.addListener(SWT.Selection, this);
GridData data = new GridData(GridData.FILL_BOTH);
data.grabExcessVerticalSpace = true;
data.horizontalSpan = 3;
data.widthHint = 500;
table3.setLayoutData(data);

//Column 1 - the Part Name text box
TableColumn column = new TableColumn(table3, SWT.CENTER, 0);
column.setText("Part Name");
column.setWidth(100);

//Column 2 - the Type combo box
column = new TableColumn(table3, SWT.LEFT, 1);
column.setText("Type");
column.setWidth(400);
}

and a createTableViewer method:

public void createTableViewer(){
CreateWsdlWizard wizard = (CreateWsdlWizard)getWizard();
WsdlModel model = wizard.model;

// Create the TableViewer
viewer = new TableViewer(table3);
viewer.setUseHashlookup(true);
viewer.setColumnProperties(columnNames);

// Create the cell editors
CellEditor[] editors = new CellEditor[2];

// Column 1 : Description (Free text)
TextCellEditor textEditor = new TextCellEditor(table3);
((Text) textEditor.getControl()).setTextLimit(100);
editors[0] = textEditor;

// Column 2 : Owner (Combo Box)
editors[1] = new ComboBoxCellEditor(table3,
model.getTypes(),SWT.READ_ONLY); // Combo gets data from model
// Assign the cell editors to the viewer
viewer.setCellEditors(editors);
}

Then, in the WizardPage's createControl method I set contentprovider,
labelprovider, etc.

createTable(composite);
createTableViewer();
InputPageContentProvider contentProvider = new
InputPageContentProvider();
InputPageLabelProvider labelProvider = new InputPageLabelProvider();
IDEPlugin.getPluginIFace().writeToLog("InputPage: createControl: Before
contentProvider.setModel(partsVector);");
contentProvider.setModel(partsVector);
labelProvider.setModel(partsVector);
viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(labelProvider );
viewer.setInput(partsVector);

All I get is a nice looking table with two columns that does absolutly
nothing! What am I doing wrong? I'm at my wit's end and deadlines are
looming! HELP!

Thanks,
Mike
Previous Topic:JDBCEditor question
Next Topic:Plug-in not working in deployment
Goto Forum:
  


Current Time: Fri Apr 26 03:43:15 GMT 2024

Powered by FUDForum. Page generated in 0.02948 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top