List of usage examples for org.eclipse.jface.databinding.swt WidgetProperties text
public static IWidgetValueProperty text(int... events)
From source file:at.bestsolution.e4.addressbook.ui.swt.AddressForm.java
License:Open Source License
public void bindControls(DataBindingContext dbc, IObservableValue master) { this.dbc = dbc; this.master = master; IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); IViewerValueProperty sProp = ViewerProperties.singleSelection(); {/* w w w .jav a 2 s . co m*/ IEMFValueProperty mProp = EMFProperties.value(AddressbookPackage.Literals.ADDRESS__STREET); dbc.bindValue(tProp.observe(w_street), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFProperties.value(AddressbookPackage.Literals.ADDRESS__ZIP); dbc.bindValue(tProp.observe(w_zip), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFProperties.value(AddressbookPackage.Literals.ADDRESS__CITY); dbc.bindValue(tProp.observe(w_city), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFProperties .value(FeaturePath.fromList(AddressbookPackage.Literals.ADDRESS__COUNTRY)); dbc.bindValue(sProp.observe(v_country), mProp.observeDetail(master)); } bindState(); IWidgetValueProperty eProp = WidgetProperties.enabled(); for (Control c : getChildren()) { EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy(); modelToTarget.setConverter(new Converter(Address.class, boolean.class) { @Override public Object convert(Object fromObject) { return fromObject != null; } }); final Binding b = dbc.bindValue(eProp.observe(c), master, new EMFUpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modelToTarget); master.addValueChangeListener(new IValueChangeListener() { @Override public void handleValueChange(ValueChangeEvent event) { if (event.diff.getNewValue() == null) b.updateModelToTarget(); } }); } }
From source file:at.bestsolution.e4.addressbook.ui.swt.AddressForm.java
License:Open Source License
public void bindControls(EditingDomain editingDomain, DataBindingContext dbc, IObservableValue master) { this.dbc = dbc; this.master = master; this.editingDomain = editingDomain; IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); IViewerValueProperty sProp = ViewerProperties.singleSelection(); {/* w ww . j a v a 2s . co m*/ IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, AddressbookPackage.Literals.ADDRESS__STREET); dbc.bindValue(tProp.observeDelayed(PersonForm.DELAY, w_street), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, AddressbookPackage.Literals.ADDRESS__ZIP); dbc.bindValue(tProp.observeDelayed(PersonForm.DELAY, w_zip), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, AddressbookPackage.Literals.ADDRESS__CITY); dbc.bindValue(tProp.observeDelayed(PersonForm.DELAY, w_city), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, FeaturePath.fromList(AddressbookPackage.Literals.ADDRESS__COUNTRY)); dbc.bindValue(sProp.observe(v_country), mProp.observeDetail(master)); } bindState(); IWidgetValueProperty eProp = WidgetProperties.enabled(); for (Control c : getChildren()) { EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy(); modelToTarget.setConverter(new Converter(Address.class, boolean.class) { @Override public Object convert(Object fromObject) { return fromObject != null; } }); final Binding b = dbc.bindValue(eProp.observe(c), master, new EMFUpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modelToTarget); master.addValueChangeListener(new IValueChangeListener() { @Override public void handleValueChange(ValueChangeEvent event) { if (event.diff.getNewValue() == null) b.updateModelToTarget(); } }); } }
From source file:at.bestsolution.e4.addressbook.ui.swt.PersonForm.java
License:Open Source License
private void bindControls() { EMFDataBindingContext dbc = new EMFDataBindingContext(); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {/*from w w w . j av a 2 s . co m*/ IEMFValueProperty mProp = EMFProperties.value(AddressbookPackage.Literals.PERSON__FIRSTNAME); dbc.bindValue(tProp.observe(w_firstName), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFProperties.value(AddressbookPackage.Literals.PERSON__LASTNAME); dbc.bindValue(tProp.observe(w_lastName), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFProperties.list(AddressbookPackage.Literals.PERSON__ADDRESSES) .value(new ElementAccessImpl(AddressType.PRIVATE)); IObservableValue value = mProp.observeDetail(master); privateAddressForm.bindControls(dbc, value); } { IEMFValueProperty mProp = EMFProperties.list(AddressbookPackage.Literals.PERSON__ADDRESSES) .value(new ElementAccessImpl(AddressType.BUSINESS)); IObservableValue value = mProp.observeDetail(master); IWidgetValueProperty cProp = WidgetProperties.selection(); EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER); EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy(); modelToTarget.setConverter(new Converter(Address.class, boolean.class) { @Override public Object convert(Object fromObject) { return fromObject != null; } }); dbc.bindValue(cProp.observe(w_hasBusinessAddress), value, targetToModel, modelToTarget); businessAddressForm.bindControls(dbc, value); } }
From source file:at.bestsolution.e4.addressbook.ui.swt.PersonForm.java
License:Open Source License
private void bindControls(EditingDomain editingDomain) { EMFDataBindingContext dbc = new EMFDataBindingContext(); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {/* www.j a va 2 s .c om*/ IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, AddressbookPackage.Literals.PERSON__FIRSTNAME); dbc.bindValue(tProp.observeDelayed(PersonForm.DELAY, w_firstName), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFEditProperties.value(editingDomain, AddressbookPackage.Literals.PERSON__LASTNAME); dbc.bindValue(tProp.observeDelayed(PersonForm.DELAY, w_lastName), mProp.observeDetail(master)); } { IEMFValueProperty mProp = EMFEditProperties .list(editingDomain, AddressbookPackage.Literals.PERSON__ADDRESSES) .value(new ElementAccessImpl(AddressType.PRIVATE)); IObservableValue value = mProp.observeDetail(master); privateAddressForm.bindControls(dbc, value); } { IEMFValueProperty mProp = EMFEditProperties .list(editingDomain, AddressbookPackage.Literals.PERSON__ADDRESSES) .value(new ElementAccessImpl(AddressType.BUSINESS)); IObservableValue value = mProp.observeDetail(master); IWidgetValueProperty cProp = WidgetProperties.selection(); EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER); EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy(); modelToTarget.setConverter(new Converter(Address.class, boolean.class) { @Override public Object convert(Object fromObject) { return fromObject != null; } }); dbc.bindValue(cProp.observe(w_hasBusinessAddress), value, targetToModel, modelToTarget); businessAddressForm.bindControls(dbc, value); } }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.AddFontDialog.java
License:Open Source License
@Override protected Control createDialogContent(Composite parent) { o = ParametersFactory.eINSTANCE.createKeyValuePair(); Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); getShell().setText("Add font "); setTitle("Add font"); setMessage("Enter informations about the font to add"); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(3, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {/* w ww . ja va 2 s . c om*/ Label l = new Label(container, SWT.NONE); l.setText("Font name*:"); tFontName = new Text(container, SWT.BORDER); GridData tFontGD = new GridData(GridData.FILL_HORIZONTAL); tFontGD.horizontalSpan = 2; tFontName.setLayoutData(tFontGD); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, KEY_VALUE_PAIR__KEY); dbContext.bindValue(tProp.observeDelayed(DELAY, tFontName), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("File*:"); tFile = new Text(container, SWT.BORDER); tFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tFile.setEditable(false); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, KEY_VALUE_PAIR__VALUE); dbContext.bindValue(tProp.observeDelayed(DELAY, tFile), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); Button b = new Button(container, SWT.NONE); b.setText("Browse ..."); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog(getShell(), false, resourceContainer, IResource.FILE) { @Override protected IStatus validateItem(final Object item) { IFile f = (IFile) item; if (f.getParent() instanceof IProject) { return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder"); } if (!f.getName().endsWith(".ttf")) { return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource does not seem to be a font"); } return super.validateItem(item); } }; if (d.open() == ResourceSelectionDialog.OK) { Object[] rv = d.getResult(); if (rv.length == 1) { IFile f = (IFile) rv[0]; IJavaElement j = JavaCore.create(f.getParent()); if (j instanceof IPackageFragment) { IPackageFragment p = (IPackageFragment) j; tFile.setText(p.getElementName().replace('.', '/') + "/" + f.getName()); } else if (j instanceof IPackageFragmentRoot) { IPackageFragmentRoot p = (IPackageFragmentRoot) j; tFile.setText(f.getName()); } else { MessageDialog.openInformation(getShell(), "Not valid", "The selected resource has to be part of the source folder"); } } } } }); } return area; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.AddIconDialog.java
License:Open Source License
@Override protected Control createDialogContent(final Composite parent) { o = ParametersFactory.eINSTANCE.createIcon(); Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); getShell().setText("Add icon"); setTitle("Add icon"); setMessage("Enter informations about the icon to add"); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); IViewerValueProperty selProp = ViewerProperties.singleSelection(); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {//from w ww . j a v a 2 s .c o m Label l = new Label(container, SWT.NONE); l.setText("Kind:"); ComboViewer v = new ComboViewer(container, SWT.READ_ONLY); v.setLabelProvider(new LabelProvider()); v.setContentProvider(ArrayContentProvider.getInstance()); v.setInput(IconType.VALUES); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ICON__KIND); dbContext.bindValue(selProp.observe(v), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("URL*:"); tUrl = new Text(container, SWT.BORDER); tUrl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ICON__HREF); dbContext.bindValue(tProp.observeDelayed(DELAY, tUrl), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("Depth:"); ComboViewer v = new ComboViewer(container, SWT.READ_ONLY); v.setLabelProvider(new LabelProvider()); v.setContentProvider(ArrayContentProvider.getInstance()); // TODO not hard coded here v.setInput(new String[] { "8", "24", "32" }); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ICON__DEPTH); dbContext.bindValue(selProp.observe(v), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("Width:"); tWidth = new Text(container, SWT.BORDER); tWidth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ICON__WIDTH); dbContext.bindValue(tProp.observeDelayed(DELAY, tWidth), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("Height:"); tHeight = new Text(container, SWT.BORDER); tHeight.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ICON__HEIGHT); dbContext.bindValue(tProp.observeDelayed(DELAY, tHeight), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } return area; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.AddManifestAttributeDialog.java
License:Open Source License
@Override protected Control createDialogContent(final Composite parent) { o = ParametersFactory.eINSTANCE.createParam(); Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); getShell().setText("Add manifest attribute"); setTitle("Add manifest attribute"); setMessage("Enter informations about manifest header entry"); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {/* www . j a v a 2s . c o m*/ Label l = new Label(container, SWT.NONE); l.setText("Name*:"); tName = new Text(container, SWT.BORDER); tName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, PARAM__NAME); dbContext.bindValue(tProp.observe(tName), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("Value*:"); tValue = new Text(container, SWT.BORDER); tValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, PARAM__VALUE); dbContext.bindValue(tProp.observe(tValue), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } return area; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.AddMetaInfFileDialog.java
License:Open Source License
@Override protected Control createDialogContent(Composite parent) { o = ParametersFactory.eINSTANCE.createKeyValuePair(); Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); getShell().setText("Add META-INF file"); setTitle("Add META-INF file"); setMessage("Enter informations about the META-INF file to add"); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(4, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {/*from w ww.ja va2 s . c om*/ Label l = new Label(container, SWT.NONE); l.setText("Service Folder*:"); tFolder = new Text(container, SWT.BORDER); tFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData tFolderGD = new GridData(GridData.FILL_HORIZONTAL); tFolderGD.horizontalSpan = 3; tFolder.setLayoutData(tFolderGD); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, KEY_VALUE_PAIR__KEY); dbContext.bindValue(tProp.observeDelayed(DELAY, tFolder), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("File*:"); tFile = new Text(container, SWT.BORDER); tFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tFile.setEditable(false); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, KEY_VALUE_PAIR__VALUE); dbContext.bindValue(tProp.observeDelayed(DELAY, tFile), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); Button bFilesystem = new Button(container, SWT.NONE); bFilesystem.setText("Filesystem ..."); bFilesystem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { FileDialog d = new FileDialog(getShell()); String val = d.open(); if (val != null) { tFile.setText(val); } } }); Button bWorkspace = new Button(container, SWT.NONE); bWorkspace.setText("Workspace ..."); bWorkspace.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog(getShell(), false, resourceContainer, IResource.FILE) { @Override protected IStatus validateItem(final Object item) { IFile f = (IFile) item; if (f.getParent() instanceof IProject) { return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder"); } return super.validateItem(item); } }; if (d.open() == ResourceSelectionDialog.OK) { Object[] rv = d.getResult(); if (rv.length == 1) { IFile f = (IFile) rv[0]; tFile.setText("${workspace}/" + f.getProject().getName() + "/" + f.getProjectRelativePath().toString()); } } } }); } return area; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.AddSplashDialog.java
License:Open Source License
@Override protected Control createDialogContent(final Composite parent) { o = ParametersFactory.eINSTANCE.createSplash(); Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); getShell().setText("Add splash icon"); setTitle("Add splash"); setMessage("Enter informations about the splash to add"); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); IViewerValueProperty selProp = ViewerProperties.singleSelection(); IWidgetValueProperty tProp = WidgetProperties.text(SWT.Modify); {// w ww.ja v a 2 s. co m Label l = new Label(container, SWT.NONE); l.setText("Mode*:"); ComboViewer v = new ComboViewer(container, SWT.READ_ONLY); v.setLabelProvider(new LabelProvider()); v.setContentProvider(ArrayContentProvider.getInstance()); v.setInput(SplashMode.values()); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, SPLASH__MODE); dbContext.bindValue(selProp.observe(v), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } { Label l = new Label(container, SWT.NONE); l.setText("URL*:"); tUrl = new Text(container, SWT.BORDER); tUrl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, SPLASH__HREF); dbContext.bindValue(tProp.observeDelayed(DELAY, tUrl), prop.observe(o), new EMFUpdateValueStrategy(EMFUpdateValueStrategy.POLICY_ON_REQUEST), new EMFUpdateValueStrategy()); } return area; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java
License:Open Source License
private void createPageOverview(final AntTask task) { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout);/*from www. ja v a2s . c o m*/ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JavaFXUIPlugin.PLUGIN_ID + ".JFXBuildConfigurationEditor_overview"); bean.setValue(task); toolkit = new FormToolkit(composite.getDisplay()); final Form form = toolkit.createForm(composite); form.setText("FX Build Configuration"); form.setImage(getTitleImage()); form.getBody().setLayout(new FillLayout()); toolkit.decorateFormHeading(form); initToolbar(form); 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)); } { 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)); } } section.setClient(sectionClient); } { Section section = toolkit.createSection(sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); section.setText("Building & Exporting"); section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, true, 1, 2)); Composite sectionClient = toolkit.createComposite(section); sectionClient.setLayout(new GridLayout(1, false)); { FormText text = toolkit.createFormText(sectionClient, false); text.setText( "<p>To generate build instructions and export the project: <li style=\"bullet\" bindent=\"1\">Generate <a href=\"generateAnt\">ant build.xml</a> only</li><li style=\"bullet\" bindent=\"2\">Generate <a href=\"generateAndRun\">ant build.xml and run</a></li> </p>", true, false); text.addHyperlinkListener(new IHyperlinkListener() { @Override public void linkExited(final HyperlinkEvent e) { } @Override public void linkEntered(HyperlinkEvent e) { } @Override public void linkActivated(HyperlinkEvent e) { try { if ("generateAndRun".equals(e.getHref())) { executeExport(); } else { executeGenerateAnt(); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } section.setClient(sectionClient); } int index = addPage(composite); setPageText(index, "Overview"); }