Search in sources :

Example 6 with IEMFValueProperty

use of org.eclipse.emf.databinding.IEMFValueProperty in project statecharts by Yakindu.

the class StatechartPropertySection method bindDomainCombo.

protected void bindDomainCombo(EMFDataBindingContext context) {
    IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID);
    IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(domainCombo);
    UpdateValueStrategy modelToTarget = new UpdateValueStrategy() {

        @Override
        public Object convert(Object value) {
            return ((IDomain) value).getDomainID();
        }
    };
    UpdateValueStrategy targetToModel = new UpdateValueStrategy() {

        @Override
        public Object convert(Object value) {
            return DomainRegistry.getDomain((String) value);
        }
    };
    context.bindValue(observeSingleSelection, property.observe(eObject), modelToTarget, targetToModel);
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) IDomain(org.yakindu.sct.domain.extension.IDomain) EObject(org.eclipse.emf.ecore.EObject) IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty) IViewerObservableValue(org.eclipse.jface.databinding.viewers.IViewerObservableValue)

Example 7 with IEMFValueProperty

use of org.eclipse.emf.databinding.IEMFValueProperty in project statecharts by Yakindu.

the class StatechartPropertySection method bindSpecificationControl.

protected void bindSpecificationControl(EMFDataBindingContext context) {
    IEMFValueProperty modelProperty = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION);
    ISWTObservableValue uiProperty = WidgetProperties.text(SWT.FocusOut).observe(textControl);
    context.bindValue(uiProperty, modelProperty.observe(eObject), null, new UpdateValueStrategy() {

        @Override
        protected IStatus doSet(IObservableValue observableValue, Object value) {
            if (getCompletionProposalAdapter() != null && !getCompletionProposalAdapter().isProposalPopupOpen())
                return super.doSet(observableValue, value);
            return Status.OK_STATUS;
        }
    });
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) IStatus(org.eclipse.core.runtime.IStatus) ISWTObservableValue(org.eclipse.jface.databinding.swt.ISWTObservableValue) EObject(org.eclipse.emf.ecore.EObject) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty)

Example 8 with IEMFValueProperty

use of org.eclipse.emf.databinding.IEMFValueProperty in project statecharts by Yakindu.

the class EntryPropertySection method bindNameControl.

private void bindNameControl(EMFDataBindingContext context) {
    IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), BasePackage.Literals.NAMED_ELEMENT__NAME);
    ISWTObservableValue observe = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection }).observe(nameText);
    context.bindValue(observe, property.observe(eObject));
}
Also used : ISWTObservableValue(org.eclipse.jface.databinding.swt.ISWTObservableValue) IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty)

Example 9 with IEMFValueProperty

use of org.eclipse.emf.databinding.IEMFValueProperty in project statecharts by Yakindu.

the class EntryPropertySection method bindEntryKindControl.

private void bindEntryKindControl(EMFDataBindingContext context) {
    IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), SGraphPackage.Literals.ENTRY__KIND);
    context.bindValue(ViewerProperties.singleSelection().observe(entryKindViewer), property.observe(eObject));
}
Also used : IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty)

Example 10 with IEMFValueProperty

use of org.eclipse.emf.databinding.IEMFValueProperty in project statecharts by Yakindu.

the class StatechartPropertySection method bindNameControl.

protected void bindNameControl(EMFDataBindingContext context) {
    IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), BasePackage.Literals.NAMED_ELEMENT__NAME);
    ISWTObservableValue observe = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection }).observe(txtName);
    context.bindValue(observe, property.observe(eObject));
}
Also used : ISWTObservableValue(org.eclipse.jface.databinding.swt.ISWTObservableValue) IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty)

Aggregations

IEMFValueProperty (org.eclipse.emf.databinding.IEMFValueProperty)14 ISWTObservableValue (org.eclipse.jface.databinding.swt.ISWTObservableValue)11 UpdateValueStrategy (org.eclipse.core.databinding.UpdateValueStrategy)4 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)4 IStatus (org.eclipse.core.runtime.IStatus)3 EObject (org.eclipse.emf.ecore.EObject)3 IViewerObservableValue (org.eclipse.jface.databinding.viewers.IViewerObservableValue)1 IDomain (org.yakindu.sct.domain.extension.IDomain)1 ValidatingEMFDatabindingContext (org.yakindu.sct.ui.editor.propertysheets.ValidatingEMFDatabindingContext)1