fd_wCreate.bottom = new FormAttachment(100, -5);
fd_wCreate.right = new FormAttachment(100, -4);
wCreate.setLayoutData(fd_wCreate);
wCreate.setText("Create bnd.bnd");
final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER);
table = tableViewer.getTable();
final FormData fd_table = new FormData();
fd_table.top = new FormAttachment(0, 3);
fd_table.left = new FormAttachment(0, 3);
fd_table.right = new FormAttachment(100, -4);
fd_table.bottom = new FormAttachment(100, -37);
table.setLayoutData(fd_table);
table.setLinesVisible(true);
table.setHeaderVisible(true);
final TableColumn wBsn = new TableColumn(table, SWT.NONE);
wBsn.setWidth(200);
wBsn.setText("Bundle Symbolic Name");
final TableColumn wVersion = new TableColumn(table, SWT.NONE);
wVersion.setWidth(100);
wVersion.setText("Version");
final TableColumn wOptions = new TableColumn(table, SWT.NONE);
wOptions.setWidth(200);
wOptions.setText("Options");
final TableColumn wFile = new TableColumn(table, SWT.NONE);
wFile.setWidth(100);
wFile.setText("File");
tableViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
if (model != null)
try {
return model.getBuildpath().toArray();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new Object[0];
}
public void dispose() {
// TODO Auto-generated method stub
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
tableViewer.setLabelProvider(new ITableLabelProvider() {
public Image getColumnImage(Object element, int columnIndex) {
// TODO Auto-generated method stub
return null;
}
public String getColumnText(Object element, int columnIndex) {
Container c = (Container) element;
switch (columnIndex) {
case 0 :
return c.getBundleSymbolicName();
case 1 :
return c.getVersion();
case 2 :
return c.getError();
case 3 :
return c.getFile() + " (" + (c.getFile() != null && c.getFile().exists() ? "exists" : "?") + ")";
default :
break;
}
return null;
}
public void addListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
public void dispose() {
// TODO Auto-generated method stub
}
public boolean isLabelProperty(Object element, String property) {
// TODO Auto-generated method stub
return false;
}
public void removeListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
});
tableViewer.setInput(model);
wCreate.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
System.out.println("defw selected");
}
public void widgetSelected(SelectionEvent e) {
wCreate.setEnabled(!createBnd());
tableViewer.setInput(model);
}
});
}