Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problems when referencing ChangeDescription
Problems when referencing ChangeDescription [message #422701] Sun, 14 September 2008 03:04 Go to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
I'm trying something new, and I've run into a problem. I have a
modeled class that references ChangeDescription. I've modeled the
reference with Changeable = false, Containment = true, and Transient =
true. The model is generated with:

protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
(ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
"");

which throws a runtime excepton. Additionally, both the edit and
editor bundles are generated with compile errors. I've hacked around
the problems to make forward progress. Is this something I should just
not be doing as a reference?

Bryan
Re: Problems when referencing ChangeDescription [message #422702 is a reply to message #422701] Sun, 14 September 2008 03:08 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
On 2008-09-13 22:04:38 -0500, Bryan Hunt <bhunt@mac.com> said:

> I'm trying something new, and I've run into a problem. I have a
> modeled class that references ChangeDescription. I've modeled the
> reference with Changeable = false, Containment = true, and Transient =
> true. The model is generated with:
>
> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
> "");
>
> which throws a runtime excepton. Additionally, both the edit and
> editor bundles are generated with compile errors. I've hacked around
> the problems to make forward progress. Is this something I should just
> not be doing as a reference?
>
> Bryan

Doh, I pressed send too quickly. I should also mention that I'm
referencing ChangeDescription which is modeled with Changeable = true,
Containment = true, and Transient = true.
Re: Problems when referencing ChangeDescription [message #422703 is a reply to message #422702] Sun, 14 September 2008 06:33 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6469
Registered: July 2009
Senior Member
Hi Bryan,

I think it's not very fair to keep the stack trace and the compiler
messages from us :-P

Cheers
/Eike


Bryan Hunt schrieb:
> On 2008-09-13 22:04:38 -0500, Bryan Hunt <bhunt@mac.com> said:
>
>> I'm trying something new, and I've run into a problem. I have a
>> modeled class that references ChangeDescription. I've modeled the
>> reference with Changeable = false, Containment = true, and Transient
>> = true. The model is generated with:
>>
>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>> "");
>>
>> which throws a runtime excepton. Additionally, both the edit and
>> editor bundles are generated with compile errors. I've hacked around
>> the problems to make forward progress. Is this something I should
>> just not be doing as a reference?
>>
>> Bryan
>
> Doh, I pressed send too quickly. I should also mention that I'm
> referencing ChangeDescription which is modeled with Changeable = true,
> Containment = true, and Transient = true.


Re: Problems when referencing ChangeDescription [message #422704 is a reply to message #422703] Sun, 14 September 2008 11:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30825
Registered: July 2009
Senior Member
Eike,

Yes, there are a few details missing. The first sentence talks about a
modeled class that used ChangeDescription, but the example is showing
ChangeRecorder. They're two different things. The code makes it clear
that ChangeRecorder is modeled as an EDataType. That implies that the
generated DataFactoryImpl must have
createdChangeRecorderFromString/convertChangeRecorderToStrin g methods
for it, unless the EDataType is marked as not serializeable. I don't
think it makes sense to support string conversion for it...

How are the ChangeDescription issue and the ChangeRecorder issues related?




Eike Stepper wrote:
> Hi Bryan,
>
> I think it's not very fair to keep the stack trace and the compiler
> messages from us :-P
>
> Cheers
> /Eike
>
>
> Bryan Hunt schrieb:
>> On 2008-09-13 22:04:38 -0500, Bryan Hunt <bhunt@mac.com> said:
>>
>>> I'm trying something new, and I've run into a problem. I have a
>>> modeled class that references ChangeDescription. I've modeled the
>>> reference with Changeable = false, Containment = true, and Transient
>>> = true. The model is generated with:
>>>
>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>>> "");
>>>
>>> which throws a runtime excepton. Additionally, both the edit and
>>> editor bundles are generated with compile errors. I've hacked
>>> around the problems to make forward progress. Is this something I
>>> should just not be doing as a reference?
>>>
>>> Bryan
>>
>> Doh, I pressed send too quickly. I should also mention that I'm
>> referencing ChangeDescription which is modeled with Changeable =
>> true, Containment = true, and Transient = true.
Re: Problems when referencing ChangeDescription [message #422709 is a reply to message #422704] Sun, 14 September 2008 16:06 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
I apologize for the poor post. I was in a hurry. Here are the details:

I have a modeled class that has a containment reference to both a
ChangeRecorder and a ChangeDescription. Both are modeled as transient.
The generated default for ChangeRecorder is:

protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
(ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
"");

and when that code executes, the following exception is thrown from
EFactoryImpl on line 441:

throw new IllegalArgumentException("The value '" + stringValue + "'
is invalid. " + exceptionString, formatException);

I've hacked around the problem by:

/**
* The default value of the '{@link #getChangeRecorder() <em>Change
Recorder</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChangeRecorder()
* @generated NOT
* @ordered
*/
protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT = new
ChangeRecorder();

When I generate the edit bundle, I get two types of compile errors:

Import not found:

import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;

When I try to "open type" on ChangeEditPlugin, it can't be found. The
other compile error is:

/**
* Create the instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataEditPlugin()
{
super
(new ResourceLocator []
{
ChangeEditPlugin.INSTANCE, // compile error here
EcoreEditPlugin.INSTANCE,
});
}

When I generate the editor bundle, I get to similar types of compile errors:

Import not found:

import org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;

and

adapterFactory.addAdapterFactory(new ChangeItemProviderAdapterFactory());

Hopefully, this is a more complete description of the problem.

Bryan
Re: Problems when referencing ChangeDescription [message #422712 is a reply to message #422709] Sun, 14 September 2008 17:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30825
Registered: July 2009
Senior Member
Byran,

Comments below.

Bryan Hunt wrote:
> I apologize for the poor post. I was in a hurry. Here are the details:
>
> I have a modeled class that has a containment reference to both a
> ChangeRecorder and a ChangeDescription. Both are modeled as
> transient. The generated default for ChangeRecorder is:
>
> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
> "");
This is telling me something is very wrong... It's saying you modeled
ChangeRecorder as an EDataType when you need to model it as an EClass.
Or it's fine as an EAttribute too, but it contradicts what you said above.

It also sounds like the empty string worked its way in as the default
value. You should ensure it gets set back to null...
>
> and when that code executes, the following exception is thrown from
> EFactoryImpl on line 441:
>
> throw new IllegalArgumentException("The value '" + stringValue + "'
> is invalid. " + exceptionString, formatException);
>
> I've hacked around the problem by:
>
> /**
> * The default value of the '{@link #getChangeRecorder()
> <em>Change Recorder</em>}' attribute.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @see #getChangeRecorder()
> * @generated NOT
> * @ordered
> */
> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
> new ChangeRecorder();
>
> When I generate the edit bundle, I get two types of compile errors:
>
> Import not found:
>
> import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
>
> When I try to "open type" on ChangeEditPlugin, it can't be found. The
> other compile error is:
>
> /**
> * Create the instance.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public DataEditPlugin()
> {
> super
> (new ResourceLocator []
> {
> ChangeEditPlugin.INSTANCE, // compile error here
> EcoreEditPlugin.INSTANCE,
> });
> }
>
> When I generate the editor bundle, I get to similar types of compile
> errors:
>
> Import not found:
>
> import
> org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
Did you add a real dependency on the serialized Change.ecore model so
that the Change.genmodel dependency is there in your GenModel? I get
this sense that that's missing...

How did you create your Ecore model and GenModel for this?
>
> and
>
> adapterFactory.addAdapterFactory(new
> ChangeItemProviderAdapterFactory());
>
> Hopefully, this is a more complete description of the problem.
>
> Bryan
>
Re: Problems when referencing ChangeDescription [message #422714 is a reply to message #422712] Sun, 14 September 2008 18:05 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
See below ...

On 2008-09-14 12:34:39 -0500, Ed Merks <Ed.Merks@gmail.com> said:

> Byran,
>
> Comments below.
>
> Bryan Hunt wrote:
>> I apologize for the poor post. I was in a hurry. Here are the details:
>>
>> I have a modeled class that has a containment reference to both a
>> ChangeRecorder and a ChangeDescription. Both are modeled as transient.
>> The generated default for ChangeRecorder is:
>>
>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>> "");
> This is telling me something is very wrong... It's saying you modeled
> ChangeRecorder as an EDataType when you need to model it as an EClass.
> Or it's fine as an EAttribute too, but it contradicts what you said
> above.

You are correct, I modeled ChangeRecorder as an EDataType and use it as
an EAttribute. This stuff I'm working on right now is very complex for
me, and I often confuse myself and others when I try to explain it.
Hopefully, this problem will get better as I make more progress.


>
> It also sounds like the empty string worked its way in as the default
> value. You should ensure it gets set back to null...

I think I may know what happened here. I started to set the default
value in the properties view, but then backed my change out. Looking
at the ecore model with the text editor, I see that the default value
is set to the empty string. I removed the value from the model, and
now it generates a null. This problem is fixed.

>>
>> and when that code executes, the following exception is thrown from
>> EFactoryImpl on line 441:
>>
>> throw new IllegalArgumentException("The value '" + stringValue + "'
>> is invalid. " + exceptionString, formatException);
>>
>> I've hacked around the problem by:
>>
>> /**
>> * The default value of the '{@link #getChangeRecorder() <em>Change
>> Recorder</em>}' attribute.
>> * <!-- begin-user-doc -->
>> * <!-- end-user-doc -->
>> * @see #getChangeRecorder()
>> * @generated NOT
>> * @ordered
>> */
>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>> new ChangeRecorder();
>>
>> When I generate the edit bundle, I get two types of compile errors:
>>
>> Import not found:
>>
>> import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
>>
>> When I try to "open type" on ChangeEditPlugin, it can't be found. The
>> other compile error is:
>>
>> /**
>> * Create the instance.
>> * <!-- begin-user-doc -->
>> * <!-- end-user-doc -->
>> * @generated
>> */
>> public DataEditPlugin()
>> {
>> super
>> (new ResourceLocator []
>> {
>> ChangeEditPlugin.INSTANCE, // compile error here
>> EcoreEditPlugin.INSTANCE,
>> });
>> }
>>
>> When I generate the editor bundle, I get to similar types of compile errors:
>>
>> Import not found:
>>
>> import org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
> Did you add a real dependency on the serialized Change.ecore model so
> that the Change.genmodel dependency is there in your GenModel? I get
> this sense that that's missing...

Is this what you are looking for:

usedGenPackages=" platform:/plugin/org.eclipse.emf.ecore.change/model/Change.g enmodel#//change
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel# //ecore "

> How did you create your Ecore model and GenModel for this?

After I added ChangeDescription, I reloaded the genmodel and used the
wzard to add the dependency on the Change.genmodel.


>>
>> and
>>
>> adapterFactory.addAdapterFactory(new
>> ChangeItemProviderAdapterFactory());
>>
>> Hopefully, this is a more complete description of the problem.
>>
>> Bryan
Re: Problems when referencing ChangeDescription [message #422715 is a reply to message #422714] Sun, 14 September 2008 18:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30825
Registered: July 2009
Senior Member
Bryan,

Comments below.

Bryan Hunt wrote:
> See below ...
>
> On 2008-09-14 12:34:39 -0500, Ed Merks <Ed.Merks@gmail.com> said:
>
>> Byran,
>>
>> Comments below.
>>
>> Bryan Hunt wrote:
>>> I apologize for the poor post. I was in a hurry. Here are the
>>> details:
>>>
>>> I have a modeled class that has a containment reference to both a
>>> ChangeRecorder and a ChangeDescription. Both are modeled as
>>> transient. The generated default for ChangeRecorder is:
>>>
>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>>> "");
>> This is telling me something is very wrong... It's saying you
>> modeled ChangeRecorder as an EDataType when you need to model it as
>> an EClass. Or it's fine as an EAttribute too, but it contradicts
>> what you said above.
>
> You are correct, I modeled ChangeRecorder as an EDataType and use it
> as an EAttribute. This stuff I'm working on right now is very complex
> for me, and I often confuse myself and others
Especially me. :-P But I can read the generated code to give me the
right clues.
> when I try to explain it. Hopefully, this problem will get better as
> I make more progress.
>
>
>>
>> It also sounds like the empty string worked its way in as the default
>> value. You should ensure it gets set back to null...
>
> I think I may know what happened here. I started to set the default
> value in the properties view, but then backed my change out. Looking
> at the ecore model with the text editor, I see that the default value
> is set to the empty string. I removed the value from the model, and
> now it generates a null. This problem is fixed.
It's one of those really annoying aspects of the properties view that
touching a property sets it to the empty string. Oddly this is such a
fundamental problem that I don't see anyone has got any good solutions
for it in data binding or elsewhere. How does one distinguish in the
GUI a string valued property being set to null verses ""? And on the
meta-level, why would such a fundamental problem still be in need of a
solution?!
>
>>>
>>> and when that code executes, the following exception is thrown from
>>> EFactoryImpl on line 441:
>>>
>>> throw new IllegalArgumentException("The value '" + stringValue +
>>> "' is invalid. " + exceptionString, formatException);
>>>
>>> I've hacked around the problem by:
>>>
>>> /**
>>> * The default value of the '{@link #getChangeRecorder()
>>> <em>Change Recorder</em>}' attribute.
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @see #getChangeRecorder()
>>> * @generated NOT
>>> * @ordered
>>> */
>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>>> new ChangeRecorder();
This should end up being null...
>>>
>>> When I generate the edit bundle, I get two types of compile errors:
>>>
>>> Import not found:
>>>
>>> import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
>>>
>>> When I try to "open type" on ChangeEditPlugin, it can't be found.
>>> The other compile error is:
>>>
>>> /**
>>> * Create the instance.
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @generated
>>> */
>>> public DataEditPlugin()
>>> {
>>> super
>>> (new ResourceLocator []
>>> {
>>> ChangeEditPlugin.INSTANCE, // compile error here
>>> EcoreEditPlugin.INSTANCE,
>>> });
>>> }
>>>
>>> When I generate the editor bundle, I get to similar types of compile
>>> errors:
>>>
>>> Import not found:
>>>
>>> import
>>> org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
>> Did you add a real dependency on the serialized Change.ecore model so
>> that the Change.genmodel dependency is there in your GenModel? I
>> get this sense that that's missing...
>
> Is this what you are looking for:
>
> usedGenPackages=" platform:/plugin/org.eclipse.emf.ecore.change/model/Change.g enmodel#//change
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel# //ecore "
So that looks right... I wonder why the dependency on
org.eclipse.emf.ecore.change.edit would be missing from the MANIFEST.MF?
>
>> How did you create your Ecore model and GenModel for this?
>
> After I added ChangeDescription, I reloaded the genmodel and used the
> wzard to add the dependency on the Change.genmodel.
So that sounds okay... It sounds like you added dependencies later and
given that the MANIFEST.MF doesn't regenerate, you're bitten by that age
old problem... :-(
>
>
>>>
>>> and
>>>
>>> adapterFactory.addAdapterFactory(new
>>> ChangeItemProviderAdapterFactory());
>>>
>>> Hopefully, this is a more complete description of the problem.
>>>
>>> Bryan
>
>
Re: Problems when referencing ChangeDescription [message #422717 is a reply to message #422715] Sun, 14 September 2008 22:09 Go to previous messageGo to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
Ed,

Comments below.

On 2008-09-14 13:17:32 -0500, Ed Merks <Ed.Merks@gmail.com> said:

> Bryan,
>
> Comments below.
>
> Bryan Hunt wrote:
>> See below ...
>>
>> On 2008-09-14 12:34:39 -0500, Ed Merks <Ed.Merks@gmail.com> said:
>>
>>> Byran,
>>>
>>> Comments below.
>>>
>>> Bryan Hunt wrote:
>>>> I apologize for the poor post. I was in a hurry. Here are the details:
>>>>
>>>> I have a modeled class that has a containment reference to both a
>>>> ChangeRecorder and a ChangeDescription. Both are modeled as transient.
>>>> The generated default for ChangeRecorder is:
>>>>
>>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>>>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>>>> "");
>>> This is telling me something is very wrong... It's saying you modeled
>>> ChangeRecorder as an EDataType when you need to model it as an EClass.
>>> Or it's fine as an EAttribute too, but it contradicts what you said
>>> above.
>>
>> You are correct, I modeled ChangeRecorder as an EDataType and use it as
>> an EAttribute. This stuff I'm working on right now is very complex for
>> me, and I often confuse myself and others
> Especially me. :-P But I can read the generated code to give me the
> right clues.
>> when I try to explain it. Hopefully, this problem will get better as I
>> make more progress.
>>
>>
>>>
>>> It also sounds like the empty string worked its way in as the default
>>> value. You should ensure it gets set back to null...
>>
>> I think I may know what happened here. I started to set the default
>> value in the properties view, but then backed my change out. Looking
>> at the ecore model with the text editor, I see that the default value
>> is set to the empty string. I removed the value from the model, and
>> now it generates a null. This problem is fixed.
> It's one of those really annoying aspects of the properties view that
> touching a property sets it to the empty string. Oddly this is such a
> fundamental problem that I don't see anyone has got any good solutions
> for it in data binding or elsewhere. How does one distinguish in the
> GUI a string valued property being set to null verses ""? And on the
> meta-level, why would such a fundamental problem still be in need of a
> solution?!

If I were architect for a day, I'd add a checkbox to the property.
Unchecked = null, Checked = value in box.

>>
>>>>
>>>> and when that code executes, the following exception is thrown from
>>>> EFactoryImpl on line 441:
>>>>
>>>> throw new IllegalArgumentException("The value '" + stringValue + "'
>>>> is invalid. " + exceptionString, formatException);
>>>>
>>>> I've hacked around the problem by:
>>>>
>>>> /**
>>>> * The default value of the '{@link #getChangeRecorder() <em>Change
>>>> Recorder</em>}' attribute.
>>>> * <!-- begin-user-doc -->
>>>> * <!-- end-user-doc -->
>>>> * @see #getChangeRecorder()
>>>> * @generated NOT
>>>> * @ordered
>>>> */
>>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
>>>> new ChangeRecorder();
> This should end up being null...
>>>>
>>>> When I generate the edit bundle, I get two types of compile errors:
>>>>
>>>> Import not found:
>>>>
>>>> import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
>>>>
>>>> When I try to "open type" on ChangeEditPlugin, it can't be found. The
>>>> other compile error is:
>>>>
>>>> /**
>>>> * Create the instance.
>>>> * <!-- begin-user-doc -->
>>>> * <!-- end-user-doc -->
>>>> * @generated
>>>> */
>>>> public DataEditPlugin()
>>>> {
>>>> super
>>>> (new ResourceLocator []
>>>> {
>>>> ChangeEditPlugin.INSTANCE, // compile error here
>>>> EcoreEditPlugin.INSTANCE,
>>>> });
>>>> }
>>>>
>>>> When I generate the editor bundle, I get to similar types of compile errors:
>>>>
>>>> Import not found:
>>>>
>>>> import org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
>>> Did you add a real dependency on the serialized Change.ecore model so
>>> that the Change.genmodel dependency is there in your GenModel? I get
>>> this sense that that's missing...
>>
>> Is this what you are looking for:
>>
>> usedGenPackages=" platform:/plugin/org.eclipse.emf.ecore.change/model/Change.g enmodel#//change
>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel# //ecore "
> So that looks right... I wonder why the dependency on
> org.eclipse.emf.ecore.change.edit would be missing from the MANIFEST.MF?
>>
>>> How did you create your Ecore model and GenModel for this?
>>
>> After I added ChangeDescription, I reloaded the genmodel and used the
>> wzard to add the dependency on the Change.genmodel.
> So that sounds okay... It sounds like you added dependencies later and
> given that the MANIFEST.MF doesn't regenerate, you're bitten by that
> age old problem... :-(

I deleted the entire edit bundle, and re-generated it, it's still not
including org.eclipse.emf.ecore.change.edit in the manifest. Same with
the editor.

>>
>>
>>>>
>>>> and
>>>>
>>>> adapterFactory.addAdapterFactory(new
>>>> ChangeItemProviderAdapterFactory());
>>>>
>>>> Hopefully, this is a more complete description of the problem.
>>>>
>>>> Bryan
Re: Problems when referencing ChangeDescription [message #422719 is a reply to message #422717] Sun, 14 September 2008 22:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30825
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090500000103040406080105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Bryan,

Comments below.

Bryan Hunt wrote:
> Ed,
>
> Comments below.
>
> On 2008-09-14 13:17:32 -0500, Ed Merks <Ed.Merks@gmail.com> said:
>
>> Bryan,
>>
>> Comments below.
>>
>> Bryan Hunt wrote:
>>> See below ...
>>>
>>> On 2008-09-14 12:34:39 -0500, Ed Merks <Ed.Merks@gmail.com> said:
>>>
>>>> Byran,
>>>>
>>>> Comments below.
>>>>
>>>> Bryan Hunt wrote:
>>>>> I apologize for the poor post. I was in a hurry. Here are the
>>>>> details:
>>>>>
>>>>> I have a modeled class that has a containment reference to both a
>>>>> ChangeRecorder and a ChangeDescription. Both are modeled as
>>>>> transient. The generated default for ChangeRecorder is:
>>>>>
>>>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT
>>>>> =
>>>>> (ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
>>>>> "");
>>>> This is telling me something is very wrong... It's saying you
>>>> modeled ChangeRecorder as an EDataType when you need to model it as
>>>> an EClass. Or it's fine as an EAttribute too, but it contradicts
>>>> what you said above.
>>>
>>> You are correct, I modeled ChangeRecorder as an EDataType and use it
>>> as an EAttribute. This stuff I'm working on right now is very
>>> complex for me, and I often confuse myself and others
>> Especially me. :-P But I can read the generated code to give me the
>> right clues.
>>> when I try to explain it. Hopefully, this problem will get better
>>> as I make more progress.
>>>
>>>
>>>>
>>>> It also sounds like the empty string worked its way in as the
>>>> default value. You should ensure it gets set back to null...
>>>
>>> I think I may know what happened here. I started to set the default
>>> value in the properties view, but then backed my change out.
>>> Looking at the ecore model with the text editor, I see that the
>>> default value is set to the empty string. I removed the value from
>>> the model, and now it generates a null. This problem is fixed.
>> It's one of those really annoying aspects of the properties view that
>> touching a property sets it to the empty string. Oddly this is such
>> a fundamental problem that I don't see anyone has got any good
>> solutions for it in data binding or elsewhere. How does one
>> distinguish in the GUI a string valued property being set to null
>> verses ""? And on the meta-level, why would such a fundamental
>> problem still be in need of a solution?!
>
> If I were architect for a day, I'd add a checkbox to the property.
> Unchecked = null, Checked = value in box.
Yes. But the properties sheet doesn't support that nor does the
property descriptor API have enough declarative data for it. Can you
think of any GUI in Eclipse that does this well already?
>
>>>
>>>>>
>>>>> and when that code executes, the following exception is thrown
>>>>> from EFactoryImpl on line 441:
>>>>>
>>>>> throw new IllegalArgumentException("The value '" + stringValue
>>>>> + "' is invalid. " + exceptionString, formatException);
>>>>>
>>>>> I've hacked around the problem by:
>>>>>
>>>>> /**
>>>>> * The default value of the '{@link #getChangeRecorder()
>>>>> <em>Change Recorder</em>}' attribute.
>>>>> * <!-- begin-user-doc -->
>>>>> * <!-- end-user-doc -->
>>>>> * @see #getChangeRecorder()
>>>>> * @generated NOT
>>>>> * @ordered
>>>>> */
>>>>> protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT
>>>>> = new ChangeRecorder();
>> This should end up being null...
>>>>>
>>>>> When I generate the edit bundle, I get two types of compile errors:
>>>>>
>>>>> Import not found:
>>>>>
>>>>> import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
>>>>>
>>>>> When I try to "open type" on ChangeEditPlugin, it can't be found.
>>>>> The other compile error is:
>>>>>
>>>>> /**
>>>>> * Create the instance.
>>>>> * <!-- begin-user-doc -->
>>>>> * <!-- end-user-doc -->
>>>>> * @generated
>>>>> */
>>>>> public DataEditPlugin()
>>>>> {
>>>>> super
>>>>> (new ResourceLocator []
>>>>> {
>>>>> ChangeEditPlugin.INSTANCE, // compile error here
>>>>> EcoreEditPlugin.INSTANCE,
>>>>> });
>>>>> }
>>>>>
>>>>> When I generate the editor bundle, I get to similar types of
>>>>> compile errors:
>>>>>
>>>>> Import not found:
>>>>>
>>>>> import
>>>>> org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
>>>>>
>>>> Did you add a real dependency on the serialized Change.ecore model
>>>> so that the Change.genmodel dependency is there in your GenModel?
>>>> I get this sense that that's missing...
>>>
>>> Is this what you are looking for:
>>>
>>> usedGenPackages=" platform:/plugin/org.eclipse.emf.ecore.change/model/Change.g enmodel#//change
>>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel# //ecore "
>> So that looks right... I wonder why the dependency on
>> org.eclipse.emf.ecore.change.edit would be missing from the MANIFEST.MF?
>>>
>>>> How did you create your Ecore model and GenModel for this?
>>>
>>> After I added ChangeDescription, I reloaded the genmodel and used
>>> the wzard to add the dependency on the Change.genmodel.
>> So that sounds okay... It sounds like you added dependencies later
>> and given that the MANIFEST.MF doesn't regenerate, you're bitten by
>> that age old problem... :-(
>
> I deleted the entire edit bundle, and re-generated it, it's still not
> including org.eclipse.emf.ecore.change.edit in the manifest. Same
> with the editor.
Ah. It looks like a bug in the Change.genmodel itself. Note that the
Edit Plugin ID property is org.eclipse.emf.ecore.change rather than
org.eclipse.emf.ecore.change.*edit*. Please open a bugzilla so we can
correct it. In the meantime, you can edit the MANIFEST of the generated
..edit project to add it properly.
>
>>>
>>>
>>>>>
>>>>> and
>>>>>
>>>>> adapterFactory.addAdapterFactory(new
>>>>> ChangeItemProviderAdapterFactory());
>>>>>
>>>>> Hopefully, this is a more complete description of the problem.
>>>>>
>>>>> Bryan
>
>

--------------090500000103040406080105
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Bryan,<br>
<br>
Comments below.<br>
<br>
Bryan Hunt wrote:
<blockquote cite="mid:gak23d$h30$1@build.eclipse.org" type="cite">Ed,
<br>
<br>
Comments below.
<br>
<br>
On 2008-09-14 13:17:32 -0500, Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:Ed.Merks@gmail.com">&lt;Ed.Merks@gmail.com&gt;</a> said:
<br>
<br>
<blockquote type="cite">Bryan,
<br>
<br>
Comments below.
<br>
<br>
Bryan Hunt wrote:
<br>
<blockquote type="cite">See below ...
<br>
<br>
On 2008-09-14 12:34:39 -0500, Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:Ed.Merks@gmail.com">&lt;Ed.Merks@gmail.com&gt;</a> said:
<br>
<br>
<blockquote type="cite">Byran,
<br>
<br>
Comments below.
<br>
<br>
Bryan Hunt wrote:
<br>
<blockquote type="cite">I apologize for the poor post.&nbsp; I was
in a hurry.&nbsp; Here are the details:
<br>
<br>
I have a modeled class that has a containment reference to both a
ChangeRecorder and a ChangeDescription.&nbsp; Both are modeled as transient.
The generated default for ChangeRecorder is:
<br>
<br>
&nbsp;&nbsp;&nbsp; protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
(ChangeRecorder)DataFactory.eINSTANCE.createFromString(DataP ackage.eINSTANCE.getChangeRecorder(),
"");
<br>
</blockquote>
This is telling me something is very wrong...&nbsp; It's saying you modeled
ChangeRecorder as an EDataType when you need to model it as an EClass.&nbsp;
Or it's fine as an EAttribute too, but it contradicts what you said
above.
<br>
</blockquote>
<br>
You are correct, I modeled ChangeRecorder as an EDataType and use it as
an EAttribute.&nbsp; This stuff I'm working on right now is very complex for
me, and I often confuse myself and others
<br>
</blockquote>
Especially me.&nbsp; :-P&nbsp; But I can read the generated code to give me the
right clues.
<br>
<blockquote type="cite">when I try to explain it.&nbsp; Hopefully, this
problem will get better as I make more progress.
<br>
<br>
<br>
<blockquote type="cite"><br>
It also sounds like the empty string worked its way in as the default
value.&nbsp; You should ensure it gets set back to null...
<br>
</blockquote>
<br>
I think I may know what happened here.&nbsp; I started to set the default
value in the properties view, but then backed my change out.&nbsp; Looking
at the ecore model with the text editor, I see that the default value
is set to the empty string.&nbsp; I removed the value from the model, and
now it generates a null.&nbsp; This problem is fixed.
<br>
</blockquote>
It's one of those really annoying aspects of the properties view that
touching a property sets it to the empty string.&nbsp; Oddly this is such a
fundamental problem that I don't see anyone has got any good solutions
for it in data binding or elsewhere.&nbsp; How does one distinguish in the
GUI a string valued property being set to null verses ""?&nbsp; And on the
meta-level, why would such a fundamental problem still be in need of a
solution?!
<br>
</blockquote>
<br>
If I were architect for a day, I'd add a checkbox to the property.&nbsp;
Unchecked = null, Checked = value in box.
<br>
</blockquote>
Yes.&nbsp; But the properties sheet doesn't support that nor does the
property descriptor API have enough declarative data for it.&nbsp; Can you
think of any GUI in Eclipse that does this well already?<br>
<blockquote cite="mid:gak23d$h30$1@build.eclipse.org" type="cite"><br>
<blockquote type="cite">
<blockquote type="cite"><br>
<blockquote type="cite">
<blockquote type="cite"><br>
and when that code executes, the following exception is thrown from
EFactoryImpl on line 441:
<br>
<br>
&nbsp;&nbsp; throw new IllegalArgumentException("The value '" + stringValue + "'
is invalid. " + exceptionString, formatException);
<br>
<br>
I've hacked around the problem by:
<br>
<br>
&nbsp;&nbsp;&nbsp; /**
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * The default value of the '{@link #getChangeRecorder()
&lt;em&gt;Change Recorder&lt;/em&gt;}' attribute.
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @see #getChangeRecorder()
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @generated NOT
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @ordered
<br>
&nbsp;&nbsp;&nbsp;&nbsp; */
<br>
&nbsp;&nbsp;&nbsp; protected static final ChangeRecorder CHANGE_RECORDER_EDEFAULT =
new ChangeRecorder();
<br>
</blockquote>
</blockquote>
</blockquote>
This should end up being null...
<br>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite"><br>
When I generate the edit bundle, I get two types of compile errors:
<br>
<br>
Import not found:
<br>
<br>
import org.eclipse.emf.ecore.change.provider.ChangeEditPlugin;
<br>
<br>
When I try to "open type" on ChangeEditPlugin, it can't be found.&nbsp; The
other compile error is:
<br>
<br>
&nbsp;&nbsp;&nbsp; /**
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * Create the instance.
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp; * @generated
<br>
&nbsp;&nbsp;&nbsp;&nbsp; */
<br>
&nbsp;&nbsp;&nbsp; public DataEditPlugin()
<br>
&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; super
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (new ResourceLocator []
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeEditPlugin.INSTANCE,&nbsp; // compile error here
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EcoreEditPlugin.INSTANCE,
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; });
<br>
&nbsp;&nbsp;&nbsp; }
<br>
<br>
When I generate the editor bundle, I get to similar types of compile
errors:
<br>
<br>
Import not found:
<br>
<br>
import
org.eclipse.emf.ecore.change.provider.ChangeItemProviderAdap terFactory;
<br>
</blockquote>
Did you add a real dependency on the serialized Change.ecore model so
that the Change.genmodel dependency is there in your GenModel?&nbsp;&nbsp; I get
this sense that that's missing...
<br>
</blockquote>
<br>
Is this what you are looking for:
<br>
<br>
usedGenPackages=" platform:/plugin/org.eclipse.emf.ecore.change/model/Change.g enmodel#//change
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel# //ecore "
<br>
</blockquote>
So that looks right...&nbsp; I wonder why the dependency on
org.eclipse.emf.ecore.change.edit would be missing from the
MANIFEST.MF?
<br>
<blockquote type="cite"><br>
<blockquote type="cite">How did you create your Ecore model and
GenModel for this?
<br>
</blockquote>
<br>
After I added ChangeDescription, I reloaded the genmodel and used the
wzard to add the dependency on the Change.genmodel.
<br>
</blockquote>
So that sounds okay...&nbsp; It sounds like you added dependencies later and
given that the MANIFEST.MF doesn't regenerate, you're bitten by that
age old problem... :-(
<br>
</blockquote>
<br>
I deleted the entire edit bundle, and re-generated it, it's still not
including org.eclipse.emf.ecore.change.edit in the manifest.&nbsp; Same with
the editor.
<br>
</blockquote>
Ah.&nbsp; It looks like a bug in the Change.genmodel itself.&nbsp; Note that the
Edit Plugin ID property is org.eclipse.emf.ecore.change rather than
org.eclipse.emf.ecore.change.<b>edit</b>.&nbsp; Please open a bugzilla so we
can correct it.&nbsp; In the meantime, you can edit the MANIFEST of the
generated .edit project to add it properly.<br>
<blockquote cite="mid:gak23d$h30$1@build.eclipse.org" type="cite"><br>
<blockquote type="cite">
<blockquote type="cite"><br>
<br>
<blockquote type="cite">
<blockquote type="cite"><br>
and
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; adapterFactory.addAdapterFactory(new
ChangeItemProviderAdapterFactory());
<br>
<br>
Hopefully, this is a more complete description of the problem.
<br>
<br>
Bryan
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
</body>
</html>

--------------090500000103040406080105--
Previous Topic:How to get all the derived classes
Next Topic:[CDO] ExtendedLibrary sample with CDO ?
Goto Forum:
  


Current Time: Wed Jan 29 05:16:10 GMT 2020

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

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

Back to the top