Search in sources :

Example 1 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project tdi-studio-se by Talend.

the class EditAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    Shell shell = ShellUtil.getShell();
    if (shell != null) {
        IItemPropertySource itemPropertySource = EmfPropertyHelper.getItemPropertySource(adapterFactory, eObject);
        IItemPropertyDescriptor itemPropertyDescriptor = EmfPropertyHelper.getItemPropertyDescriptor(itemPropertySource, eObject, structuralFeature);
        if (itemPropertySource != null) {
            EditAction.EditDialog editDialog = new EditDialog(shell, adapterFactory, itemPropertyDescriptor, eObject);
            if (editDialog.open() == Dialog.OK) {
                itemPropertyDescriptor.setPropertyValue(eObject, editDialog.getValue());
            }
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource) IItemPropertyDescriptor(org.eclipse.emf.edit.provider.IItemPropertyDescriptor)

Example 2 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project tdi-studio-se by Talend.

the class AssignmentPropertySection method getItemPropertyDescriptor.

private IItemPropertyDescriptor getItemPropertyDescriptor() {
    // PTODO mhelleboid find another way to itempropertysource without an eobject
    BusinessAssignment sampleBusinessAssignment = BusinessFactory.eINSTANCE.createBusinessAssignment();
    EStructuralFeature businessAssignment_Comment = BusinessPackage.eINSTANCE.getBusinessAssignment_Comment();
    IItemPropertySource itemPropertySource = EmfPropertyHelper.getItemPropertySource(adapterFactory, sampleBusinessAssignment);
    return EmfPropertyHelper.getItemPropertyDescriptor(itemPropertySource, sampleBusinessAssignment, businessAssignment_Comment);
}
Also used : BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource)

Example 3 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project tdi-studio-se by Talend.

the class EmfPropertyHelper method getValue.

/**
     * DOC mhelleboid Comment method "getValue".
     * 
     * @param itemPropertyDescriptor TODO
     * @param eObject TODO
     * @return
     */
public static String getValue(IItemPropertyDescriptor itemPropertyDescriptor, Object eObject) {
    //$NON-NLS-1$
    String value = "";
    Object propertyValue = itemPropertyDescriptor.getPropertyValue(eObject);
    if (propertyValue instanceof IItemPropertySource) {
        IItemPropertySource propertyValueWrapper = (IItemPropertySource) propertyValue;
        value = propertyValueWrapper.getEditableValue(eObject).toString();
    }
    return value;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource)

Example 4 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project tdi-studio-se by Talend.

the class BusinessAssignmentComposite method getItemPropertyDescriptor.

private IItemPropertyDescriptor getItemPropertyDescriptor() {
    // PTODO mhelleboid find another way to itempropertysource without an eobject
    BusinessAssignment sampleBusinessAssignment = BusinessFactory.eINSTANCE.createBusinessAssignment();
    EStructuralFeature businessAssignment_Comment = BusinessPackage.eINSTANCE.getBusinessAssignment_Comment();
    IItemPropertySource itemPropertySource = EmfPropertyHelper.getItemPropertySource(adapterFactory, sampleBusinessAssignment);
    return EmfPropertyHelper.getItemPropertyDescriptor(itemPropertySource, sampleBusinessAssignment, businessAssignment_Comment);
}
Also used : BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource)

Example 5 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project tdi-studio-se by Talend.

the class EmfPropertyHelper method getValue.

/**
     * DOC mhelleboid Comment method "getValue".
     * 
     * @param itemPropertyDescriptor TODO
     * @param eObject TODO
     * @return
     */
public static String getValue(IItemPropertyDescriptor itemPropertyDescriptor, Object eObject) {
    //$NON-NLS-1$
    String value = "";
    Object propertyValue = itemPropertyDescriptor.getPropertyValue(eObject);
    if (propertyValue instanceof IItemPropertySource) {
        IItemPropertySource propertyValueWrapper = (IItemPropertySource) propertyValue;
        value = propertyValueWrapper.getEditableValue(eObject).toString();
    }
    return value;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource)

Aggregations

IItemPropertySource (org.eclipse.emf.edit.provider.IItemPropertySource)6 EObject (org.eclipse.emf.ecore.EObject)3 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)2 BusinessAssignment (org.talend.designer.business.model.business.BusinessAssignment)2 Iterator (java.util.Iterator)1 List (java.util.List)1 IItemPropertyDescriptor (org.eclipse.emf.edit.provider.IItemPropertyDescriptor)1 PropertySource (org.eclipse.emf.edit.ui.provider.PropertySource)1 Shell (org.eclipse.swt.widgets.Shell)1 IPropertySource (org.eclipse.ui.views.properties.IPropertySource)1