Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: AW: AW: [ve-dev] Overriding the Property-Editor in a Subclassdoesnotseem to work


Hi, Not quite right, it should be:


   <event:Add featureName="eStructuralFeatures">
       <addedEObjects xsi:type="ecore:EReference" name="text"
           eType="org.eclipse.jem.java:JavaClass java:/java.lang#String"
           unsettable="true">
           <eAnnotations
               xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"        
               cellEditorClassname="RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor"/>
           <eAnnotations
               xsi:type="org.eclipse.jem.internal.beaninfo:PropertyDecorator"
               shortDescription="Text displayed on the button"
               readMethod="java:/ch.ivyteam.ivy.designer.richdialog.widgets.components#RButton.getText("
               writeMethod="java:/ch.ivyteam.ivy.designer.richdialog.widgets.components#RButton.setText(java.lang.String"/>
       </addedEObjects>
   </event:Add>


You are only adding ONE feature that has two annotations on it. The way you had shown below would not of worked because the second <eAnnotation is not valid directly inside an <addedEObjects>.

Rich


"Peter Koch" <Peter.Koch@xxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

06/22/2006 10:57 AM

Please respond to
Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>

To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
AW: AW: AW: [ve-dev] Overriding the Property-Editor in        a        Subclassdoesnotseem to work





Hi Rich!

Thanks for the help.

Your example was a little "shaky" ;-) (missing </addedEObjects>, <event:Add> instead of <event:AddMany>),
so I completed it with my very limited EMF skill to this version, but it still does not work
(also no error in errorlog):

   <event:AddMany featureName="eStructuralFeatures">
       <addedEObjects xsi:type="ecore:EReference" name="text"
           eType="org.eclipse.jem.java:JavaClass java:/java.lang#String"
           unsettable="true">
           <eAnnotations
               xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"        
               cellEditorClassname="RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor"/>
       </addedEObjects>
       <addedEObjects>
           <eAnnotations
               xsi:type="org.eclipse.jem.internal.beaninfo:PropertyDecorator"
               shortDescription="Text displayed on the button"
               readMethod="java:/ch.ivyteam.ivy.designer.richdialog.widgets.components#RButton.getText("
               writeMethod="java:/ch.ivyteam.ivy.designer.richdialog.widgets.components#RButton.setText(java.lang.String"/>
       </addedEObjects>
   </event:AddMany>

hmm... could you once again review it ?

best regards,
peter

ps: org.eclipse.jem.java.JavaClass is in org.eclipse.jem_1.1.0.1/mofjava.jar,
which is shipped with VE SDK 1.1.0.1

-----Ursprüngliche Nachricht-----
Von: ve-dev-bounces@xxxxxxxxxxx im Auftrag von Rich Kulp
Gesendet: Do 22.06.2006 15:57
An: Discussions people developing code for the Visual Editor project
Betreff: Re: AW: AW: [ve-dev] Overriding the Property-Editor in a                 Subclassdoesnotseem to work

Hi,

Your last statement about what Janak said is true. In general you cannot
do this. EMF itself can give you problems. But if you are careful, and
under certain conditions, it may work. As I said before, as long as it is
just a simple standard property it may be able to be overridden. If it is
a special one, then it cannot be overridden.

However, there may be a problem with the BeanPropertySourceAdapter. When
it creates the IPropertyDescriptors it creates both one for the ULCButton
and one for the RButton. It may be that the property sheet only allows one
of them to display and it is the first one found. I'm not sure, but that
may be happening. Or it may show both in the property sheet!

I forgot you some stuff. What I gave was if you had a beaninfo to provide
the rest the info. You need to specify everything, including the read and
write methods:


<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="
http://www.eclipse.org/emf/2002/Ecore" xmlns:event="event.xmi"
xmlns:org.eclipse.ve.internal.cde.decorators="
http:///org/eclipse/ve/internal/cde/decorators.ecore"
xmlns:org.eclipse.jem.internal.beaninfo.beaninfo="http:///org/eclipse/jem/internal/beaninfo/beaninfo.ecore"
xmlns:org.eclipse.jem.internal.java="java.xmi">
 <event:Add featureName="eStructuralFeatures">
   <addedEObjects xsi:type="ecore:EReference" name="text"
eType="org.eclipse.jem.internal.java:JavaClass java:/java.lang#String"
unsettable="true">
     <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"
       cellEditorClassname="
RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor
"/>
   </addedEObjects>
   <addedEObjects>
     <eAnnotations
xsi:type="org.eclipse.jem.internal.beaninfo.beaninfo:PropertyDecorator"
       shortDescription="Text displayed on the button"
       readMethod="java:/
ch.ivyteam.ivy.designer.richdialog.widgets#RButton.getText("
       writeMethod="java:/
ch.ivyteam.ivy.designer.richdialog.widgets#RButton
.setText(java.lang.String"/>
 </event:Add>
</xmi:XMI>

I'm surprised that  eType="org.eclipse.jem.java:JavaClass
java:/java.lang#String" didn't give you an error too because that is the
format for VE 1.2. It doesn't exist at all in VE 1.1.0.1.

Rich



"Peter Koch" <Peter.Koch@xxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx
06/22/2006 04:31 AM
Please respond to
Discussions people developing code for the Visual Editor project
<ve-dev@xxxxxxxxxxx>


To
"Discussions people developing code for the Visual Editor project"
<ve-dev@xxxxxxxxxxx>
cc

Subject
AW: AW: [ve-dev] Overriding the Property-Editor in a    Subclassdoes
notseem to work






Hi Rich!

if I write

<event:Add featureName="eStructuralFeatures">
 <addedEObjects xsi:type="ecore:EReference" name="text"
  eType="org.eclipse.jem.internal.java:JavaClass java:/java.lang#String"
  unsettable="true">
  <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"

cellEditorClassname="RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor"/>
 </addedEObjects>
</event:Add>

then I have

Warning 2006-06-22 09:48:12.122 Error loading
file"platform:/plugin/RichDialogVisualEditor/overrides/ch/ivyteam/ivy/designer/richdialog/widgets/RButton.override"
java.lang.NullPointerException
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleProxy(XMLHandler.java:1988)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setValueFromId(XMLHandler.java:1881)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:1840)
...
(error1.txt[Peter]  attachment)

if I correct this to

<event:Add featureName="eStructuralFeatures">
 <addedEObjects xsi:type="ecore:EReference" name="text"
  eType="org.eclipse.jem.java:JavaClass java:/java.lang#String"
  unsettable="true">
  <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"

cellEditorClassname="RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor"/>
 </addedEObjects>
</event:Add>

then I don't have an error, but also not my property editor for the text
property.



If I do this (for an other property which was nowhere defined in a
superclass)

<event:Add featureName="eStructuralFeatures">
 <addedEObjects xsi:type="ecore:EReference" name="buttonText"
  unsettable="true">
  <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"

cellEditorClassname="RichDialogVisualEditor/ch.ivyteam.ivy.designer.richdialog.visualeditor.propertyeditor.RTextPropertyEditor"/>
 </addedEObjects>
</event:Add>

I have my editor for the buttonText property, everything is fine.



So, whats wrong ? Or do we have to think once again about my initial
assumption that this
is just not possible with VE  ?
Janak Mulani wrote to me "Eclipse VE's bean handler requires that an
attribute (a structural feature) exists at one level only"

For me, this is an important restriction. Almost a deadly one... Probably
this has changed with VE 1.2 ?

thanks & best regards,
Peter


-----Ursprüngliche Nachricht-----
Von: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]Im
Auftrag von Rich Kulp
Gesendet: Mittwoch, 21. Juni 2006 16:35
An: Discussions people developing code for the Visual Editor project
Betreff: Re: AW: [ve-dev] Overriding the Property-Editor in a Subclassdoes
notseem to work


Hi,
You can do it through the beaninfo, but if you don't have one it would be
easier to do it through the override file.

I wish you were at 1.2 because the format of the override file changes and
I had to go back and try to dig up the old format. :-)

I think this will do it:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="
http://www.eclipse.org/emf/2002/Ecore" xmlns:event="event.xmi"
xmlns:org.eclipse.ve.internal.cde.decorators="
http:///org/eclipse/ve/internal/cde/decorators.ecore">
 <event:Add featureName="eStructuralFeatures">
   <addedEObjects xsi:type="ecore:EReference" name="text"
eType="org.eclipse.jem.internal.java:JavaClass java:/java.lang#String"
unsettable="true">
     <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:BasePropertyDecorator"
       cellEditorClassname="...your cell editor to use..."/>
   </addedEObjects>
 </event:Add>
</xmi:XMI>

Rich

"Peter Koch" <Peter.Koch@xxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx
06/21/2006 10:19 AM

Please respond to
Discussions people developing code for the Visual Editor project
<ve-dev@xxxxxxxxxxx>



To
"Discussions people developing code for the Visual Editor project"
<ve-dev@xxxxxxxxxxx>
cc

Subject
AW: [ve-dev] Overriding the Property-Editor in a Subclass does notseem  to
work








Hi Rich!

Thanks for the answer.

"You would have to completely redefine the property at the RButton level.
You would have to completely specify it".

How could I redefine the property? How to completely specify it?
Thru writing a custom BeanInfo class?

Thanks & best regards,
Peter


-----Ursprüngliche Nachricht-----
Von: ve-dev-bounces@xxxxxxxxxxx im Auftrag von Rich Kulp
Gesendet: Mi 21.06.2006 16:06
An: Discussions people developing code for the Visual Editor project
Betreff: Re: [ve-dev] Overriding the Property-Editor in a Subclass does
notseem                 to work

Hello,

There isn't really a safe way to do that. You would have to completely
redefine the property at the RButton level. You would have to completely
specify it.

As long as the "text" property isn't a special property that some super
class may access directly through the ULCButton's text estructuralfeature
it may work. An example of an override that wouldn't work is to try to
change the "components" feature of the awt Container. That is because this

is a very special feature that is used directly and is not looked up by
name. Because of that it would find the awt Component's feature. In your
case I don't think this is true. Everywhere the feature is probably looked

up by name and so it will find your feature first.

Rich



"Peter Koch" <Peter.Koch@xxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx
06/21/2006 09:19 AM
Please respond to
Discussions people developing code for the Visual Editor project
<ve-dev@xxxxxxxxxxx>


To
<ve-dev@xxxxxxxxxxx>
cc

Subject
[ve-dev] Overriding the Property-Editor in a Subclass does not seem     to

work






Hi!

I'm currently writing a plugin which customizes
the ULC VE plugin (own widgets, different palette,
other property-editors, ...).

I'm struggling about the following problem:

I have a class RButton which extends ULCButton.
In my RButton.override I'd like to define an own
property editor for the "text" property
(like in MyCustomPrompter.override from the VE tutorial).

But this does not work.

Overriding of property editors for properties which
already have defined a property editor
for a property in a superclass generally
does not seem to be possible.

If I make an own property like "buttonText", everything is fine.
But this is only a workaround.

(I'm working with ULC VE 5.0 which bases on VE 1.1.0.1)


Any ideas, comments ?

Thanks & best regards,
Peter Koch
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev

Attachment: winmail.dat
Description: Binary data


Back to the top