Button b = toolkit.createButton( buttonComp, "Remove", SWT.PUSH );
b.setLayoutData( new GridData( GridData.FILL, GridData.BEGINNING, false, false ) );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent e ) {
KeyValuePair value = (KeyValuePair) ( (IStructuredSelection) v.getSelection() ).getFirstElement();
if ( value != null ) {
if ( handleRemoveMetaInfFile( value ) ) {
v.setInput( task.getFiles() );
}
}
else {
MessageDialog.openWarning( getSite().getShell(), "Warning", "Please select an entry" );
}
}
} );
}
}
{
toolkit.createLabel( sectionClient, "Fonts:" ).setLayoutData( new GridData( GridData.BEGINNING, GridData.BEGINNING, false, false ) );
Composite container = toolkit.createComposite( sectionClient );
GridLayout gl = new GridLayout( 2, false );
gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0;
container.setLayout( gl );
GridData gdContainer = new GridData( GridData.FILL_HORIZONTAL );
gdContainer.horizontalSpan = COLUMN_COUNT - 1;
container.setLayoutData( gdContainer );
Composite tableContainer = toolkit.createComposite( container );
Table t = toolkit.createTable( tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
t.setHeaderVisible( true );
t.setLinesVisible( true );
GridData gdTable = new GridData( GridData.FILL_HORIZONTAL );
gdTable.heightHint = t.getItemHeight() * 5;
tableContainer.setLayoutData( gdTable );
TableColumnLayout tablelayout = new TableColumnLayout();
final TableViewer v = new TableViewer( t );
GridData gd = new GridData( GridData.FILL_HORIZONTAL );
gd.heightHint = t.getItemHeight() * 5;
v.getControl().setLayoutData( gd );
final ArrayContentProvider cp = new ArrayContentProvider();
v.setContentProvider( cp );
{
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, ParametersPackage.Literals.KEY_VALUE_PAIR__KEY );
TableViewerColumn c = new TableViewerColumn( v, SWT.NONE );
TableColumn tc = c.getColumn();
tc.setText( "Font name" );
c.setLabelProvider( new ColumnLabelProvider() {
@Override
public String getText( Object element ) {
return ( (KeyValuePair) element ).getKey();
}
} );
tablelayout.setColumnData( c.getColumn(), new ColumnWeightData( 33 ) );
}
{
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, ParametersPackage.Literals.KEY_VALUE_PAIR__VALUE );
TableViewerColumn c = new TableViewerColumn( v, SWT.NONE );
TableColumn tc = c.getColumn();
tc.setText( "File" );
c.setLabelProvider( new ColumnLabelProvider() {
@Override
public String getText( Object element ) {
return ( (KeyValuePair) element ).getValue();
}
} );
tablelayout.setColumnData( c.getColumn(), new ColumnWeightData( 67 ) );
}
tableContainer.setLayout( tablelayout );
v.setInput( task.getFonts() );
Composite buttonComp = toolkit.createComposite( container );
buttonComp.setLayoutData( new GridData( GridData.BEGINNING, GridData.END, false, false ) );
buttonComp.setLayout( new GridLayout() );
{
Button b = toolkit.createButton( buttonComp, "Add ...", SWT.PUSH );
b.setLayoutData( new GridData( GridData.FILL, GridData.BEGINNING, false, false ) );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent e ) {
if ( handleAddFont() ) {
final KeyValuePair newFont = task.getFonts().get( task.getFonts().size() - 1 );
v.refresh();
v.setSelection( new StructuredSelection( newFont ) );
}
}
} );
}
{
Button b = toolkit.createButton( buttonComp, "Remove", SWT.PUSH );
b.setLayoutData( new GridData( GridData.FILL, GridData.BEGINNING, false, false ) );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent e ) {
KeyValuePair value = (KeyValuePair) ( (IStructuredSelection) v.getSelection() ).getFirstElement();
if ( value != null ) {
if ( handleRemoveFont( value ) ) {
v.setInput( task.getFonts() );
}
}