[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: AW: AW: [ve-dev] Overriding the Property-Editor in a Subclassdoes notseem 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
<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>
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)
at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:147)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:1378)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTypeName(XMLHandler.java:1304)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:1241)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1081)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:466)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:65)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:449)
at org.eclipse.emf.ecore.xmi.impl.SAXWrapper.startElement(SAXWrapper.java:73)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:140)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:169)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:977)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:832)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:249)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.demandLoad(ProjectResourceSetImpl.java:83)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:264)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:349)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(ProjectResourceSetImpl.java:262)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter$ExtensionDocApplies.run(BeaninfoClassAdapter.java:1027)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter.createOverrideCache(BeaninfoClassAdapter.java:1001)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter.applyExtensionDocument(BeaninfoClassAdapter.java:972)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter.introspect(BeaninfoClassAdapter.java:695)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter.introspectIfNecessary(BeaninfoClassAdapter.java:474)
at org.eclipse.jem.internal.beaninfo.adapters.BeaninfoClassAdapter.introspectIfNecessary(BeaninfoClassAdapter.java:461)
at org.eclipse.jem.java.impl.JavaClassImpl.getEAnnotations(JavaClassImpl.java:387)
at org.eclipse.ve.internal.cde.emf.ClassDecoratorTypeIterator.findDecorator(ClassDecoratorTypeIterator.java:37)
at org.eclipse.ve.internal.cde.emf.ClassDecoratorIterator.initialize(ClassDecoratorIterator.java:47)
at org.eclipse.ve.internal.cde.emf.ClassDecoratorTypeIterator.<init>(ClassDecoratorTypeIterator.java:33)
at org.eclipse.ve.internal.cde.emf.ClassDecoratorFeatureAccess.getDecoratorWithFeature(ClassDecoratorFeatureAccess.java:40)
at org.eclipse.ve.internal.cde.emf.ClassDescriptorDecoratorPolicy.findDecorator(ClassDescriptorDecoratorPolicy.java:130)
at org.eclipse.ve.internal.cde.emf.ClassDescriptorDecoratorPolicy.getModelAdapterClassname(ClassDescriptorDecoratorPolicy.java:197)
at org.eclipse.ve.internal.cde.emf.DefaultModelAdapterFactory.createAdapter(DefaultModelAdapterFactory.java:76)
at org.eclipse.ve.internal.cde.emf.DefaultModelAdapterFactory.getAdapter(DefaultModelAdapterFactory.java:51)
at org.eclipse.ve.internal.cde.emf.AbstractEMFContainerPolicy.isParentAcceptable(AbstractEMFContainerPolicy.java:148)
at org.eclipse.ve.internal.cde.emf.AbstractEMFContainerPolicy.getCreateCommand(AbstractEMFContainerPolicy.java:205)
at org.eclipse.ve.internal.cde.emf.AbstractEMFContainerPolicy.getCreateCommand(AbstractEMFContainerPolicy.java:159)
at org.eclipse.ve.internal.cde.core.ContainerPolicy.getCommand(ContainerPolicy.java:272)
at org.eclipse.ve.internal.cde.core.VisualInfoXYLayoutEditPolicy.getCreateCommand(VisualInfoXYLayoutEditPolicy.java:96)
at org.eclipse.gef.editpolicies.LayoutEditPolicy.getCommand(LayoutEditPolicy.java:199)
at org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.getCommand(ConstrainedLayoutEditPolicy.java:152)
at org.eclipse.ve.internal.cde.core.XYLayoutEditPolicy.getCommand(XYLayoutEditPolicy.java:249)
at org.eclipse.ve.internal.cde.core.VisualInfoXYLayoutEditPolicy.getCommand(VisualInfoXYLayoutEditPolicy.java:210)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:485)
at org.eclipse.gef.tools.TargetingTool.getCommand(TargetingTool.java:124)
at org.eclipse.ve.internal.cde.core.CDECreationTool.getCommand(CDECreationTool.java:105)
at org.eclipse.gef.tools.CreationTool.handleMove(CreationTool.java:239)
at org.eclipse.gef.tools.AbstractTool.mouseMove(AbstractTool.java:1038)
at org.eclipse.gef.EditDomain.mouseMove(EditDomain.java:248)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseMoved(DomainEventDispatcher.java:359)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove(LightweightSystem.java:543)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:145)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)