Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 212202 Details for
Bug 373504
WidgetProperties.text(int event) is automatically changed into Italic and produces an error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Source File
View.java (text/plain), 4.10 KB, created by
MyungWoon Oh
on 2012-03-07 08:00:45 EST
(
hide
)
Description:
Source File
Filename:
MIME Type:
Creator:
MyungWoon Oh
Created:
2012-03-07 08:00:45 EST
Size:
4.10 KB
patch
obsolete
>package de.vogella.emf.swt.databinding; > >import org.eclipse.core.databinding.DataBindingContext; >import org.eclipse.core.databinding.observable.value.IObservableValue; >import org.eclipse.emf.databinding.EMFProperties; >import org.eclipse.emf.databinding.FeaturePath; >import org.eclipse.jface.databinding.swt.WidgetProperties; >import org.eclipse.jface.dialogs.MessageDialog; >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseAdapter; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Layout; >import org.eclipse.swt.widgets.Text; >import org.eclipse.ui.part.ViewPart; > >import de.vogella.emf.swt.databinding.model.ModelFactory; >import de.vogella.emf.swt.databinding.model.ModelPackage; >import de.vogella.emf.swt.databinding.model.Person; >import de.vogella.emf.swt.databinding.model.Phone; > >public class View extends ViewPart { > public static final String ID = "de.vogella.emf.swt.databinding.view"; > > > /** > * This is a callback that will allow us to create the viewer and initialize > * it. > */ > public void createPartControl(Composite parent) { > // Let's put thing to order > Layout layout = new GridLayout(2, false); > parent.setLayout(layout); > > // Initialize the model > ModelPackage.eINSTANCE.eClass(); > // Retrieve the default factory singleton > ModelFactory factory = ModelFactory.eINSTANCE; > > Phone phone = factory.createPhone(); > phone.setNumber("0123456789"); > > final Person person = factory.createPerson(); > person.setFirstName("Lars"); > person.setLastName("Vogel"); > person.setGender("m"); > person.setPhone(phone); > > // New text element > Text firstName = new Text(parent, SWT.NONE); > GridData gridData = new GridData(); > gridData.horizontalAlignment = GridData.FILL; > gridData.horizontalSpan = 2; > > Text phoneNumber = new Text(parent, SWT.NONE); > gridData = new GridData(); > gridData.horizontalAlignment = GridData.FILL; > gridData.horizontalSpan = 2; > phoneNumber.setLayoutData(gridData); > > // Cut from here to verify the problem > DataBindingContext bindingContext = new DataBindingContext(); > > // This first use of 'WidgetProperties.text(SWT.Modify)' changes into Italic > IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(firstName); > IObservableValue modelValue = EMFProperties.value(ModelPackage.Literals.PERSON__FIRST_NAME).observe(person); > > bindingContext.bindValue(widgetValue, modelValue); > > Feature feature = FeaturePath.fromList( > ModelPackage.Literals.PERSON__PHONE, > ModelPackage.Literals.PHONE__NUMBER); > > // This second use of 'WidgetProperties.text(SWT.Modify)' doesn't change into italic and produces no error > widgetValue = WidgetProperties.text(SWT.Modify).observe(phoneNumber); > modelValue = EMFProperties.value(feature).observe(person); > > bindingContext.bindValue(widgetValue, modelValue); > // Cut to here to verify the problem > > Button button1 = new Button(parent, SWT.PUSH); > button1.setText("Write to Model"); > button1.addMouseListener(new MouseAdapter() { > public void mouseUp(MouseEvent e) { > /* > MessageDialog.openInformation(parent, > "Write completed. Show Data from EMF Model", > "firstName : [" + person.getFirstName() +"]\n" + > "lastName : [" + person.getLastName() +"]\n" + > "gender : [" + person.getGender() +"]\n" + > "phoneNumber : [" + person.getPhone().getNumber() +"]"); > */ > System.out.println(person.getFirstName()); > System.out.println(person.getPhone().getNumber()); > } > }); > > Button button2 = new Button(parent, SWT.PUSH); > button2.setText("Change Model Data"); > button2.addMouseListener(new MouseAdapter() { > @Override > public void mouseUp(MouseEvent e) { > person.setFirstName("Lars2"); > String reversedNumber = new StringBuffer(person.getPhone() > .getNumber()).reverse().toString(); > person.getPhone().setNumber(reversedNumber); > } > }); > } > > /** > * Passing the focus request to the viewer's control. > */ > public void setFocus() { > //viewer.getControl().setFocus(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 373504
:
212201
| 212202