Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » saving properties
saving properties [message #431207] Thu, 02 July 2009 14:12 Go to next message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Hi All,

How can I save model changes from property view ?
this is a sample of my viewer code:

@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPropertySheetPage.class)
return getPropertySheetPage();
return super.getAdapter(adapter);
}

public IPropertySheetPage getPropertySheetPage()
{
if (propertySheetPage == null)
{
propertySheetPage = new
ExtendedPropertySheetPage((AdapterFactoryEditingDomain)
ModalUtils.getEditingDomain());

((ExtendedPropertySheetPage)propertySheetPage).setPropertySo urceProvider(new
AdapterFactoryContentProvider(ModalUtils.getComposedAdapterF actory()));
}
return propertySheetPage;
}

I can see properties of my selected elements but changes are not taken
into account. It's really hard to find relevant how-to's. I have checked
the editor has been generated the EMF framework but it does'nt help so much.

Cheers.
Re: saving properties [message #431210 is a reply to message #431207] Thu, 02 July 2009 14:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
You're not providing much in the way of context. Set a breakpoint in
org.eclipse.emf.edit.provider.ItemPropertyDescriptor.setProp ertyValue.
Is the editing domain being found in that method?


exquisitus wrote:
> Hi All,
>
> How can I save model changes from property view ?
> this is a sample of my viewer code:
>
> @SuppressWarnings("unchecked")
> @Override
> public Object getAdapter(Class adapter) {
> if (adapter == IPropertySheetPage.class)
> return getPropertySheetPage();
> return super.getAdapter(adapter);
> }
>
> public IPropertySheetPage getPropertySheetPage()
> {
> if (propertySheetPage == null)
> {
> propertySheetPage = new
> ExtendedPropertySheetPage((AdapterFactoryEditingDomain)
> ModalUtils.getEditingDomain());
>
> ((ExtendedPropertySheetPage)propertySheetPage).setPropertySo urceProvider(new
> AdapterFactoryContentProvider(ModalUtils.getComposedAdapterF actory()));
> }
> return propertySheetPage;
> }
>
> I can see properties of my selected elements but changes are not taken
> into account. It's really hard to find relevant how-to's. I have
> checked the editor has been generated the EMF framework but it does'nt
> help so much.
>
> Cheers.
Re: saving properties [message #431216 is a reply to message #431210] Thu, 02 July 2009 15:11 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
Editing domain is actually found. I can see change on my view but it's
not saved. I mean, although I can see change on my view, changes are not
saved between two starts.
thx.

Ed Merks a écrit :
> You're not providing much in the way of context. Set a breakpoint in
> org.eclipse.emf.edit.provider.ItemPropertyDescriptor.setProp ertyValue.
> Is the editing domain being found in that method?
>
>
> exquisitus wrote:
>> Hi All,
>>
>> How can I save model changes from property view ?
>> this is a sample of my viewer code:
>>
>> @SuppressWarnings("unchecked")
>> @Override
>> public Object getAdapter(Class adapter) {
>> if (adapter == IPropertySheetPage.class)
>> return getPropertySheetPage();
>> return super.getAdapter(adapter);
>> }
>>
>> public IPropertySheetPage getPropertySheetPage()
>> {
>> if (propertySheetPage == null)
>> {
>> propertySheetPage = new
>> ExtendedPropertySheetPage((AdapterFactoryEditingDomain)
>> ModalUtils.getEditingDomain());
>>
>> ((ExtendedPropertySheetPage)propertySheetPage).setPropertySo urceProvider(new
>> AdapterFactoryContentProvider(ModalUtils.getComposedAdapterF actory()));
>> }
>> return propertySheetPage;
>> }
>>
>> I can see properties of my selected elements but changes are not taken
>> into account. It's really hard to find relevant how-to's. I have
>> checked the editor has been generated the EMF framework but it does'nt
>> help so much.
>>
>> Cheers.
Re: saving properties [message #431217 is a reply to message #431216] Thu, 02 July 2009 15:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
I'm confused by your problem. Is save failing. Is it doing nothing?
What have you done to track down what's happening while saving?


exquisitus wrote:
> Editing domain is actually found. I can see change on my view but it's
> not saved. I mean, although I can see change on my view, changes are
> not saved between two starts.
> thx.
>
> Ed Merks a écrit :
>> You're not providing much in the way of context. Set a breakpoint
>> in
>> org.eclipse.emf.edit.provider.ItemPropertyDescriptor.setProp ertyValue.
>> Is the editing domain being found in that method?
>>
>>
>> exquisitus wrote:
>>> Hi All,
>>>
>>> How can I save model changes from property view ?
>>> this is a sample of my viewer code:
>>>
>>> @SuppressWarnings("unchecked")
>>> @Override
>>> public Object getAdapter(Class adapter) {
>>> if (adapter == IPropertySheetPage.class)
>>> return getPropertySheetPage();
>>> return super.getAdapter(adapter);
>>> }
>>>
>>> public IPropertySheetPage getPropertySheetPage()
>>> {
>>> if (propertySheetPage == null)
>>> {
>>> propertySheetPage = new
>>> ExtendedPropertySheetPage((AdapterFactoryEditingDomain)
>>> ModalUtils.getEditingDomain());
>>>
>>> ((ExtendedPropertySheetPage)propertySheetPage).setPropertySo urceProvider(new
>>> AdapterFactoryContentProvider(ModalUtils.getComposedAdapterF actory()));
>>> }
>>> return propertySheetPage;
>>> }
>>>
>>> I can see properties of my selected elements but changes are not
>>> taken into account. It's really hard to find relevant how-to's. I
>>> have checked the editor has been generated the EMF framework but it
>>> does'nt help so much.
>>>
>>> Cheers.
Re: saving properties [message #431219 is a reply to message #431217] Thu, 02 July 2009 15:28 Go to previous message
Ali Koudri is currently offline Ali KoudriFriend
Messages: 118
Registered: July 2009
Senior Member
OK, problem solved this way:

public void commandStackChanged(EventObject event) {
WorkspaceCommandStackImpl stack = (WorkspaceCommandStackImpl)
event.getSource();
Command command = stack.getMostRecentCommand();
if (command instanceof SetCommand)
{
try {
((SetCommand)command).getOwner().eResource().save(null);
} catch (IOException e) {
e.printStackTrace();
}
}
}

thx.

Ed Merks a écrit :
> I'm confused by your problem. Is save failing. Is it doing nothing?
> What have you done to track down what's happening while saving?
>
>
> exquisitus wrote:
>> Editing domain is actually found. I can see change on my view but it's
>> not saved. I mean, although I can see change on my view, changes are
>> not saved between two starts.
>> thx.
>>
>> Ed Merks a écrit :
>>> You're not providing much in the way of context. Set a breakpoint
>>> in
>>> org.eclipse.emf.edit.provider.ItemPropertyDescriptor.setProp ertyValue.
>>> Is the editing domain being found in that method?
>>>
>>>
>>> exquisitus wrote:
>>>> Hi All,
>>>>
>>>> How can I save model changes from property view ?
>>>> this is a sample of my viewer code:
>>>>
>>>> @SuppressWarnings("unchecked")
>>>> @Override
>>>> public Object getAdapter(Class adapter) {
>>>> if (adapter == IPropertySheetPage.class)
>>>> return getPropertySheetPage();
>>>> return super.getAdapter(adapter);
>>>> }
>>>>
>>>> public IPropertySheetPage getPropertySheetPage()
>>>> {
>>>> if (propertySheetPage == null)
>>>> {
>>>> propertySheetPage = new
>>>> ExtendedPropertySheetPage((AdapterFactoryEditingDomain)
>>>> ModalUtils.getEditingDomain());
>>>>
>>>> ((ExtendedPropertySheetPage)propertySheetPage).setPropertySo urceProvider(new
>>>> AdapterFactoryContentProvider(ModalUtils.getComposedAdapterF actory()));
>>>> }
>>>> return propertySheetPage;
>>>> }
>>>>
>>>> I can see properties of my selected elements but changes are not
>>>> taken into account. It's really hard to find relevant how-to's. I
>>>> have checked the editor has been generated the EMF framework but it
>>>> does'nt help so much.
>>>>
>>>> Cheers.
Previous Topic:Accessing attributes in generated code for editor
Next Topic:[CDO] ClassCastException: model class cannot be cast to InternalCDORevision
Goto Forum:
  


Current Time: Thu Dec 12 02:49:50 GMT 2019

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

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

Back to the top