Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
502147: Validation support in generated code
Generated code signatures Delegation to DataBindingHelper Using new DataBindingHelper in generated methods Polimorphic dispatcher updated Comments and packaging Change-Id: I9560188605279ca4824cb5b8ca8e5ca5f6ce6907 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=502147 Signed-off-by: Francesco Guidieri <francesco.guidieri@gmail.com>
- Loading branch information
Showing
5 changed files
with
109 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...mf.parsley.common/src/org/eclipse/emf/parsley/internal/databinding/DataBindingHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 RCP Vision (http://www.rcp-vision.com) and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Francesco Guidieri - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.emf.parsley.internal.databinding; | ||
|
||
import org.eclipse.core.databinding.Binding; | ||
import org.eclipse.core.databinding.DataBindingContext; | ||
import org.eclipse.core.databinding.observable.value.IObservableValue; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.emf.ecore.EStructuralFeature; | ||
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport; | ||
import org.eclipse.swt.SWT; | ||
|
||
import com.google.inject.Inject; | ||
|
||
/** | ||
* Helper class for performing databinding | ||
* | ||
* @author Francesco Guidieri - initial API and implementation | ||
* | ||
* @noextend This class is not intended to be subclassed by clients. | ||
* @noinstantiate This class is not intended to be instantiated by clients. | ||
* @since 1.1 | ||
*/ | ||
public class DataBindingHelper { | ||
|
||
@Inject | ||
private DatabindingValidationUtil databindingValidationUtil; | ||
|
||
@SuppressWarnings("rawtypes") | ||
public Binding bindValue(EStructuralFeature feature, IObservableValue target, IObservableValue source, | ||
EObject owner, DataBindingContext dataBindingContext) { | ||
EmfValidationTargetToModelUpdateValueStrategy targetToModelUpdateValueStrategy = new EmfValidationTargetToModelUpdateValueStrategy( | ||
owner, feature, databindingValidationUtil); | ||
|
||
Binding bindValue = dataBindingContext.bindValue(target, source, targetToModelUpdateValueStrategy, null); | ||
ControlDecorationSupport.create(bindValue, SWT.TOP | SWT.LEFT); | ||
return bindValue; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters