| 
| ecore reference xsd [message #108162] | Thu, 01 March 2007 07:20  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: rahuliiitb.gmail.com 
 Hi,
 
 I have an attribute whose type i have specified as an ecore:ref to a
 another element present in the xsd. The declartion looks like this
 
 <xsd:attribute ecore:reference="ElementType" name="attrFile">
 <xsd:simpleType>
 <xsd:list itemType="xsd:anyURI"/>
 </xsd:simpleType>
 
 A button comes when we click on this attribute value in propertysheet view
 after i run this eclipse application. On clicking of this button a Dialog
 is opened which is created in FeatureEditorDialog.class.
 
 Instead of the dialog created by FeatureEditorDialog i want to display my
 own custom dialog when the user clicks on this button.
 
 Since FeatureEditorDialog is a .class file so i cannot modify it.
 The another option is to catch hold of this button listener but i am
 unable to find that.
 
 Can some one help me on resolving this issue.
 
 Thanks in advance
 Rahul
 |  |  |  | 
|  | 
|  | 
|  | 
|  | 
| 
| Re: ecore reference xsd [message #108791 is a reply to message #108777] | Mon, 05 March 2007 01:55   |  | 
| Eclipse User  |  |  |  |  | Originally posted by: merks.ca.ibm.com 
 This is a multi-part message in MIME format.
 --------------030006090703070004020509
 Content-Type: text/plain; charset=ISO-8859-15; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Rahul,
 
 The setPropertyValue method does this:
 
 public void setPropertyValue(Object object, Object value)
 {
 EObject eObject = (EObject)object;
 EditingDomain editingDomain = getEditingDomain(object);
 
 if (parentReferences != null)
 {
 Command removeCommand = null;
 for (int i = 0; i < parentReferences.length; ++i)
 {
 Object oldValue = eObject.eGet(parentReferences[i]);
 if (oldValue != null)
 {
 final EReference parentReference = parentReferences[i];
 if (oldValue == value)
 {
 return;
 }
 else if (parentReference.getEType().isInstance(value))
 {
 if (editingDomain == null)
 {
 eObject.eSet(parentReference, value);
 }
 else
 {
 
 editingDomain.getCommandStack().execute(SetCommand.create(ed itingDomain,
 getCommandOwner(eObject), parentReference, value));
 }
 return;
 }
 else
 {
 if (editingDomain == null)
 {
 eObject.eSet(parentReference, null);
 }
 else
 {
 removeCommand = SetCommand.create(editingDomain,
 getCommandOwner(eObject), parentReference, null);
 }
 break;
 }
 }
 }
 
 for (int i = 0; i < parentReferences.length; ++i)
 {
 final EReference parentReference = parentReferences[i];
 if (parentReference.getEType().isInstance(value))
 {
 if (editingDomain == null)
 {
 eObject.eSet(parentReferences[i], value);
 }
 else
 {
 if (removeCommand != null)
 {
 final CompoundCommand compoundCommand = new
 CompoundCommand(CompoundCommand.LAST_COMMAND_ALL);
 compoundCommand.append(removeCommand);
 
 compoundCommand.append(SetCommand.create(editingDomain,
 getCommandOwner(eObject), parentReference, value));
 editingDomain.getCommandStack().execute(compoundCommand);
 }
 else
 {
 
 editingDomain.getCommandStack().execute(SetCommand.create(ed itingDomain,
 getCommandOwner(eObject), parentReference, value));
 }
 }
 break;
 }
 }
 }
 else
 {
 if (editingDomain == null)
 {
 eObject.eSet(feature, value);
 }
 else
 {
 
 editingDomain.getCommandStack().execute(SetCommand.create(ed itingDomain,
 getCommandOwner(eObject), feature, value));
 }
 }
 }
 
 I suggested looking at it because that's how the EMF properties view
 does all it's updating.  I.e., no matter what cell editor is used, it
 eventually calls this with the value that the cell editor has
 specified.  I don't really understand the issue you describe about
 getPropertyDescriptor.   All I can really do is point you at the
 generated code that already works as an example and hope that from that
 example you can make the specializations you need to make your case work...
 
 
 Rahul wrote:
 > Hi Ed Merks,
 >
 > I have put breakpoint in the ItemPropertyDescriptor.setPropertyValue
 > as suggested by you. It goes to the getPropertyDescriptor(Object
 > object, Object propertyId) function but it does not go inside the if
 > (propertyId.equals(itemPropertyDescriptor.getId(object)))  present for
 > the attribute which has been
 > modified.
 > The same thing happens in mindmap example where if you select the
 > Topic element and assign some value to the subtopic it does not get
 > written back in the model back. Is this problem because i have
 > specified the type of an attribute as an ecore:refernce.
 >
 > And can you please suggest if i can get a button in the propertyview
 > without specifying the type of an attribute as an ecore:reference.
 >
 > Thanks in advance
 >
 > Rahul
 >
 
 
 --------------030006090703070004020509
 Content-Type: text/html; charset=ISO-8859-15
 Content-Transfer-Encoding: 8bit
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
 </head>
 <body bgcolor="#ffffff" text="#000000">
 Rahul,<br>
 <br>
 The setPropertyValue method does this:<br>
 <blockquote><small>
 |  |  |  | 
|  | 
|  | 
Powered by 
FUDForum. Page generated in 0.32063 seconds