ScrolledForm scrolledForm = toolkit.createScrolledForm( form.getBody() );
scrolledForm.getBody().setLayout( new GridLayout( 2, false ) );
Composite sectionParent = scrolledForm.getBody();
dbc = new DataBindingContext();
IWidgetValueProperty textModify = WidgetProperties.text( SWT.Modify );
IWidgetValueProperty selChange = WidgetProperties.selection();
{
Section section = toolkit.createSection( sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED );
section.setText( "Build && Package Properties" );
section.setDescription( "The following properties are needed to build the JavaFX-Application" );
section.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
Composite sectionClient = toolkit.createComposite( section );
sectionClient.setLayout( new GridLayout( 4, false ) );
{
toolkit.createLabel( sectionClient, "Build Directory*:" );
final Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
toolkit.createButton( sectionClient, "Filesystem ...", SWT.PUSH ).addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent e ) {
String dir = handleBuildFilesystemDirectorySelection( t.getShell() );
if ( dir != null ) {
t.setText( dir );
}
}
} );
toolkit.createButton( sectionClient, "Workspace ...", SWT.PUSH ).addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( final SelectionEvent e ) {
String dir = handleBuildWorkbenchDirectorySelection( t.getShell() );
if ( dir != null ) {
t.setText( dir );
}
}
} );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, ANT_TASK__BUILD_DIRECTORY );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Vendor name*:" );
Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 3, 1 ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__INFO, INFO__VENDOR ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Application title*:" );
Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 3, 1 ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain,
FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__NAME ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Application version*:" );
Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 3, 1 ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain,
FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__VERSION ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Application class*:" );
final Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 2, 1 ) );
Button b = toolkit.createButton( sectionClient, "Browse ...", SWT.PUSH );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e ) {
String name = handleRootclassSelection( t.getShell() );
if ( name != null ) {
t.setText( name );
}
}
} );
b.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, false, false ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain,
FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__MAINCLASS ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Preloader class:" );
final Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 2, 1 ) );
Button b = toolkit.createButton( sectionClient, "Browse ...", SWT.PUSH );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e ) {
String name = handlePreloaderclassSelection( t.getShell() );
if ( name != null ) {
t.setText( name );
}
}
} );
b.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, false, false ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain,
FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__PRELOADERCLASS ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Splash:" );
final Text t = toolkit.createText( sectionClient, "", SWT.BORDER );
t.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 2, 1 ) );
Button b = toolkit.createButton( sectionClient, "Browse ...", SWT.PUSH );
b.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e ) {
String name = handleSplashImage( t.getShell() );
if ( name != null ) {
t.setText( name );
}
}
} );
b.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, false, false ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__SPLASH_IMAGE ) );
dbc.bindValue( textModify.observeDelayed( DELAY, t ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Manifest-Attributes:" )
.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 = 2;
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.getHeaderHeight() + 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.getHeaderHeight() + t.getItemHeight() * 5;
v.getControl().setLayoutData( gd );
v.setContentProvider( ArrayContentProvider.getInstance() );
{
TableViewerColumn c = new TableViewerColumn( v, SWT.NONE );
c.setLabelProvider( new ColumnLabelProvider() {
@Override
public String getText( final Object element ) {
return ( (Param) element ).getName();
}
} );
tablelayout.setColumnData( c.getColumn(), new ColumnWeightData( 33 ) );
c.getColumn().setText( "Name" );
}
{
TableViewerColumn c = new TableViewerColumn( v, SWT.NONE );
c.setLabelProvider( new ColumnLabelProvider() {
@Override
public String getText( final Object element ) {
return ( (Param) element ).getValue();
}
} );
tablelayout.setColumnData( c.getColumn(), new ColumnWeightData( 67 ) );
c.getColumn().setText( "Value" );
}
tableContainer.setLayout( tablelayout );
v.setInput( task.getManifestEntries() );
Composite buttonComp = toolkit.createComposite( sectionClient );
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 ( handleAddManifestAttr( getSite().getShell() ) ) {
v.setInput( task.getManifestEntries() );
v.setSelection( new StructuredSelection( task.getManifestEntries().get( task.getManifestEntries().size() - 1 ) ) );
}
}
} );
}
{
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 ) {
Param value = (Param) ( (IStructuredSelection) v.getSelection() ).getFirstElement();
if ( value != null ) {
if ( handleRemoveManifestAttr( value ) ) {
v.setInput( task.getManifestEntries() );
}
}
else {
MessageDialog.openWarning( getSite().getShell(), "Warning", "Please select an entry" );
}
}
} );
}
{
toolkit.createLabel( sectionClient, "Toolkit Type:" ).setLayoutData( new GridData( GridData.BEGINNING, GridData.BEGINNING, false, false ) );
ComboViewer c = new ComboViewer( sectionClient );
c.getCombo().setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 3, 1 ) );
c.setContentProvider( new ArrayContentProvider() );
c.setInput( ApplicationToolkitType.VALUES );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain,
FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__TOOLKIT ) );
dbc.bindValue( selChange.observe( c.getCombo() ), prop.observeDetail( bean ) );
}
{
toolkit.createLabel( sectionClient, "Packaging Format:" ).setLayoutData( new GridData( GridData.BEGINNING, GridData.BEGINNING, false, false ) );
ComboViewer c = new ComboViewer( sectionClient );
c.getCombo().setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 3, 1 ) );
c.setContentProvider( new ArrayContentProvider() );
c.setInput( PackagingFormat.VALUES );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__PACKAGING_FORMAT ) );
dbc.bindValue( selChange.observe( c.getCombo() ), prop.observeDetail( bean ) );
}
{
Button b = toolkit.createButton( sectionClient, "Convert CSS into binary form", SWT.CHECK );
b.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 4, 1 ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, FeaturePath.fromList( ANT_TASK__CSS_TO_BIN ) );
dbc.bindValue( selChange.observe( b ), prop.observeDetail( bean ) );
}
{
Button b = toolkit.createButton( sectionClient, "Enable verbose build mode (Not recommended)", SWT.CHECK );
b.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 4, 1 ) );
IEMFValueProperty prop = EMFEditProperties.value( editingDomain, FeaturePath.fromList( ANT_TASK__DEPLOY, DEPLOY__VERBOSE ) );
dbc.bindValue( selChange.observe( b ), prop.observeDetail( bean ) );
}
}
section.setClient( sectionClient );
}