Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Emfatic] Pattern Validation and Creating Dynamic Instances
[Emfatic] Pattern Validation and Creating Dynamic Instances [message #558361] Sat, 11 September 2010 17:33 Go to next message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi all,

I'm writing a small metamodel to test some regular expressions. I
have used emfatic, and as you can see below, the metamodel is very
simple. It only contains the root class named Test and other class with
two attributes: name and value. Value represents a string that should
match a regular expression (the regular expression I'm testing). To
constraint the values, a datatype named RegExp1 has been specified (you
can see the details below.

@namespace(uri="http://regexp.test", prefix="test")
package testregexp;

class Test {
val Example[+] examples;
}


class Example{
attr String name;
attr RegExp1 value;
}


@ExtendedMetaData(name="RegExp1",
baseType="http://www.eclipse.org/emf/2003/XMLType#string",
pattern="[A-Z]")
datatype RegExp1: String;


My problem arises when I try to write a model that conforms to this
metamodel by creating a dynamic instance with the Sample Reflective
Ecore Model Editor. Every time I try to write some text in the value
attribute the exception I have included below is thrown. My question is
if I'm missing something, it's seems there's some kind of problem with
the validation of the regular expression, but I really don't know what
the problem is, so I'd be grateful if you could give some hint:

null Error
Unhandled event loop exception

java.lang.NullPointerException
at
org.eclipse.emf.ecore.util.EObjectValidator.reportDataValueT ypeViolation(EObjectValidator.java:1652)
at
org.eclipse.emf.ecore.util.EObjectValidator.validate(EObject Validator.java:1447)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:209)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:197)
at
org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.isValid(PropertyDescriptor.java:176)
at org.eclipse.jface.viewers.CellEditor.isCorrect(CellEditor.ja va:529)
at
org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:253)
at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
at
org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
at
org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
at
org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
at
org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
at
org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
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.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

Regards,
Toñi
Re: [Emfatic] Pattern Validation and Creating Dynamic Instances [message #558365 is a reply to message #558361] Sat, 11 September 2010 18:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Toñi,

It looks like eDataType.getInstanceClass().getName() fails. So probably
the instance class can't be created. Perhaps we should be using
eDataType.getInstanceTypeName, but not being able to create the class
instance would make verifying that something is an instance of that data
type's class difficult (impossible). Should you have specified
java.lang.String somewhere?


Toñi Reina Quintero wrote:
> Hi all,
>
> I'm writing a small metamodel to test some regular expressions. I
> have used emfatic, and as you can see below, the metamodel is very
> simple. It only contains the root class named Test and other class
> with two attributes: name and value. Value represents a string that
> should match a regular expression (the regular expression I'm
> testing). To constraint the values, a datatype named RegExp1 has been
> specified (you can see the details below.
>
> @namespace(uri="http://regexp.test", prefix="test")
> package testregexp;
>
> class Test {
> val Example[+] examples;
> }
>
>
> class Example{
> attr String name;
> attr RegExp1 value;
> }
>
>
> @ExtendedMetaData(name="RegExp1",
> baseType="http://www.eclipse.org/emf/2003/XMLType#string",
> pattern="[A-Z]")
> datatype RegExp1: String;
>
>
> My problem arises when I try to write a model that conforms to this
> metamodel by creating a dynamic instance with the Sample Reflective
> Ecore Model Editor. Every time I try to write some text in the value
> attribute the exception I have included below is thrown. My question
> is if I'm missing something, it's seems there's some kind of problem
> with the validation of the regular expression, but I really don't know
> what the problem is, so I'd be grateful if you could give some hint:
>
> null Error
> Unhandled event loop exception
>
> java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.EObjectValidator.reportDataValueT ypeViolation(EObjectValidator.java:1652)
>
> at
> org.eclipse.emf.ecore.util.EObjectValidator.validate(EObject Validator.java:1447)
>
> at
> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:209)
> at
> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:197)
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.isValid(PropertyDescriptor.java:176)
>
> at org.eclipse.jface.viewers.CellEditor.isCorrect(CellEditor.ja va:529)
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:253)
>
> at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
> at
> org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
>
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> 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.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
>
> Regards,
> Toñi
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Emfatic] Pattern Validation and Creating Dynamic Instances [message #558399 is a reply to message #558365] Sun, 12 September 2010 10:59 Go to previous message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi Ed,

thanks for the help. That was the problem, I wasn't using
java.lang.String as Instance type name. However, the strange thing is
that I have written other metamodels setting Instance type name to
String, instead of java.lang.String and they worked.

Now, I know that I have to be very careful with the datatypes.



El 11/09/2010 20:19, Ed Merks escribió:
> Toñi,
>
> It looks like eDataType.getInstanceClass().getName() fails. So probably
> the instance class can't be created. Perhaps we should be using
> eDataType.getInstanceTypeName, but not being able to create the class
> instance would make verifying that something is an instance of that data
> type's class difficult (impossible). Should you have specified
> java.lang.String somewhere?
>
>
> Toñi Reina Quintero wrote:
>> Hi all,
>>
>> I'm writing a small metamodel to test some regular expressions. I have
>> used emfatic, and as you can see below, the metamodel is very simple.
>> It only contains the root class named Test and other class with two
>> attributes: name and value. Value represents a string that should
>> match a regular expression (the regular expression I'm testing). To
>> constraint the values, a datatype named RegExp1 has been specified
>> (you can see the details below.
>>
>> @namespace(uri="http://regexp.test", prefix="test")
>> package testregexp;
>>
>> class Test {
>> val Example[+] examples;
>> }
>>
>>
>> class Example{
>> attr String name;
>> attr RegExp1 value;
>> }
>>
>>
>> @ExtendedMetaData(name="RegExp1",
>> baseType="http://www.eclipse.org/emf/2003/XMLType#string",
>> pattern="[A-Z]")
>> datatype RegExp1: String;
>>
>>
>> My problem arises when I try to write a model that conforms to this
>> metamodel by creating a dynamic instance with the Sample Reflective
>> Ecore Model Editor. Every time I try to write some text in the value
>> attribute the exception I have included below is thrown. My question
>> is if I'm missing something, it's seems there's some kind of problem
>> with the validation of the regular expression, but I really don't know
>> what the problem is, so I'd be grateful if you could give some hint:
>>
>> null Error
>> Unhandled event loop exception
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.emf.ecore.util.EObjectValidator.reportDataValueT ypeViolation(EObjectValidator.java:1652)
>>
>> at
>> org.eclipse.emf.ecore.util.EObjectValidator.validate(EObject Validator.java:1447)
>>
>> at
>> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:209)
>> at
>> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:197)
>> at
>> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.isValid(PropertyDescriptor.java:176)
>>
>> at org.eclipse.jface.viewers.CellEditor.isCorrect(CellEditor.ja va:529)
>> at
>> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:253)
>>
>> at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
>> at
>> org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
>>
>> at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
>> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
>> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>>
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
>>
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at
>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>>
>> 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.equinox.launcher.Main.invokeFramework(Main.java: 619)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
>>
>> Regards,
>> Toñi
>>
Re: [Emfatic] Pattern Validation and Creating Dynamic Instances [message #623169 is a reply to message #558361] Sat, 11 September 2010 18:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Toñi,

It looks like eDataType.getInstanceClass().getName() fails. So probably
the instance class can't be created. Perhaps we should be using
eDataType.getInstanceTypeName, but not being able to create the class
instance would make verifying that something is an instance of that data
type's class difficult (impossible). Should you have specified
java.lang.String somewhere?


Toñi Reina Quintero wrote:
> Hi all,
>
> I'm writing a small metamodel to test some regular expressions. I
> have used emfatic, and as you can see below, the metamodel is very
> simple. It only contains the root class named Test and other class
> with two attributes: name and value. Value represents a string that
> should match a regular expression (the regular expression I'm
> testing). To constraint the values, a datatype named RegExp1 has been
> specified (you can see the details below.
>
> @namespace(uri="http://regexp.test", prefix="test")
> package testregexp;
>
> class Test {
> val Example[+] examples;
> }
>
>
> class Example{
> attr String name;
> attr RegExp1 value;
> }
>
>
> @ExtendedMetaData(name="RegExp1",
> baseType="http://www.eclipse.org/emf/2003/XMLType#string",
> pattern="[A-Z]")
> datatype RegExp1: String;
>
>
> My problem arises when I try to write a model that conforms to this
> metamodel by creating a dynamic instance with the Sample Reflective
> Ecore Model Editor. Every time I try to write some text in the value
> attribute the exception I have included below is thrown. My question
> is if I'm missing something, it's seems there's some kind of problem
> with the validation of the regular expression, but I really don't know
> what the problem is, so I'd be grateful if you could give some hint:
>
> null Error
> Unhandled event loop exception
>
> java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.EObjectValidator.reportDataValueT ypeViolation(EObjectValidator.java:1652)
>
> at
> org.eclipse.emf.ecore.util.EObjectValidator.validate(EObject Validator.java:1447)
>
> at
> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:209)
> at
> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:197)
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.isValid(PropertyDescriptor.java:176)
>
> at org.eclipse.jface.viewers.CellEditor.isCorrect(CellEditor.ja va:529)
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:253)
>
> at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
> at
> org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
>
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> 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.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
>
> Regards,
> Toñi
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Emfatic] Pattern Validation and Creating Dynamic Instances [message #623170 is a reply to message #558365] Sun, 12 September 2010 10:59 Go to previous message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi Ed,

thanks for the help. That was the problem, I wasn't using
java.lang.String as Instance type name. However, the strange thing is
that I have written other metamodels setting Instance type name to
String, instead of java.lang.String and they worked.

Now, I know that I have to be very careful with the datatypes.



El 11/09/2010 20:19, Ed Merks escribió:
> Toñi,
>
> It looks like eDataType.getInstanceClass().getName() fails. So probably
> the instance class can't be created. Perhaps we should be using
> eDataType.getInstanceTypeName, but not being able to create the class
> instance would make verifying that something is an instance of that data
> type's class difficult (impossible). Should you have specified
> java.lang.String somewhere?
>
>
> Toñi Reina Quintero wrote:
>> Hi all,
>>
>> I'm writing a small metamodel to test some regular expressions. I have
>> used emfatic, and as you can see below, the metamodel is very simple.
>> It only contains the root class named Test and other class with two
>> attributes: name and value. Value represents a string that should
>> match a regular expression (the regular expression I'm testing). To
>> constraint the values, a datatype named RegExp1 has been specified
>> (you can see the details below.
>>
>> @namespace(uri="http://regexp.test", prefix="test")
>> package testregexp;
>>
>> class Test {
>> val Example[+] examples;
>> }
>>
>>
>> class Example{
>> attr String name;
>> attr RegExp1 value;
>> }
>>
>>
>> @ExtendedMetaData(name="RegExp1",
>> baseType="http://www.eclipse.org/emf/2003/XMLType#string",
>> pattern="[A-Z]")
>> datatype RegExp1: String;
>>
>>
>> My problem arises when I try to write a model that conforms to this
>> metamodel by creating a dynamic instance with the Sample Reflective
>> Ecore Model Editor. Every time I try to write some text in the value
>> attribute the exception I have included below is thrown. My question
>> is if I'm missing something, it's seems there's some kind of problem
>> with the validation of the regular expression, but I really don't know
>> what the problem is, so I'd be grateful if you could give some hint:
>>
>> null Error
>> Unhandled event loop exception
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.emf.ecore.util.EObjectValidator.reportDataValueT ypeViolation(EObjectValidator.java:1652)
>>
>> at
>> org.eclipse.emf.ecore.util.EObjectValidator.validate(EObject Validator.java:1447)
>>
>> at
>> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:209)
>> at
>> org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostic ian.java:197)
>> at
>> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.isValid(PropertyDescriptor.java:176)
>>
>> at org.eclipse.jface.viewers.CellEditor.isCorrect(CellEditor.ja va:529)
>> at
>> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:253)
>>
>> at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
>> at
>> org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
>>
>> at
>> org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
>>
>> at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
>> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2629)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
>> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>>
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
>>
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at
>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>>
>> 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.equinox.launcher.Main.invokeFramework(Main.java: 619)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
>>
>> Regards,
>> Toñi
>>
Previous Topic:[Emfatic] Pattern Validation and Creating Dynamic Instances
Next Topic:EMF Compare: compare order
Goto Forum:
  


Current Time: Tue Apr 23 11:23:32 GMT 2024

Powered by FUDForum. Page generated in 0.03425 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top