Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save Button not activated on property change
Save Button not activated on property change [message #414331] Wed, 31 October 2007 14:57 Go to next message
biju is currently offline bijuFriend
Messages: 13
Registered: July 2009
Junior Member
Hi All,


I am displaying my emf model objects as a tree using a jface
TreeViewer in a View. I am using the "property view" to show the
properties of the objects in my tree. I am also able to edit it in
"property view" but on edit the 'save button' is not getting enabled and
the changes is not made to my model.

I have created adapter factories and editing domain in my view
and is also passing it to ExtendedPropertySheetPage.

What I might have missed to do..? Any Ideas..?


Thanks for any help , Biju
Re: Save Button not activated on property change [message #414334 is a reply to message #414331] Wed, 31 October 2007 15:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Biju,

Do you have something hooked up to the command stack to listen to
commands being executed like the generated editor has?


biju wrote:
> Hi All,
>
>
> I am displaying my emf model objects as a tree using a jface
> TreeViewer in a View. I am using the "property view" to show the
> properties of the objects in my tree. I am also able to edit it in
> "property view" but on edit the 'save button' is not getting enabled
> and the changes is not made to my model.
>
> I have created adapter factories and editing domain in my view
> and is also passing it to ExtendedPropertySheetPage.
>
> What I might have missed to do..? Any Ideas..?
>
>
> Thanks for any help , Biju


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save Button not activated on property change [message #414342 is a reply to message #414334] Thu, 01 November 2007 06:50 Go to previous messageGo to next message
biju is currently offline bijuFriend
Messages: 13
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------090302050706070302060906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

hi Ed Merks,

Thanks for your reply,

Yes I am hooking a CommandStackListener same as in generated
editor(copy paste from generated editor) which is added as an
attachment. But the "commandStackChanged" call back method is not
getting called on editing in the properties view and save button is not
getting enabled. What might be worng..?

Thanks for the help, Biju

Ed Merks wrote:
> Biju,
>
> Do you have something hooked up to the command stack to listen to
> commands being executed like the generated editor has?
>
>
> biju wrote:
>> Hi All,
>>
>>
>> I am displaying my emf model objects as a tree using a jface
>> TreeViewer in a View. I am using the "property view" to show the
>> properties of the objects in my tree. I am also able to edit it in
>> "property view" but on edit the 'save button' is not getting enabled
>> and the changes is not made to my model.
>>
>> I have created adapter factories and editing domain in my view
>> and is also passing it to ExtendedPropertySheetPage.
>>
>> What I might have missed to do..? Any Ideas..?
>>
>>
>> Thanks for any help , Biju


--------------090302050706070302060906
Content-Type: text/plain;
name="code.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="code.txt"

protected void initializeEditingDomain() {
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Reg istry.INSTANCE);

adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new MaterialsItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

BasicCommandStack commandStack = new BasicCommandStack();

commandStack.addCommandStackListener
(new CommandStackListener() {
public void commandStackChanged(final EventObject event) {
viewer.getControl().getDisplay().asyncExec
(new Runnable() {
public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);

Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
if (mostRecentCommand != null) {
setSelectionToViewer(mostRecentCommand.getAffectedObjects()) ;
}
if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
propertySheetPage.refresh();
}
}
});
}
});
editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap());
}
--------------090302050706070302060906--
Re: Save Button not activated on property change [message #414344 is a reply to message #414334] Thu, 01 November 2007 09:29 Go to previous messageGo to next message
biju is currently offline bijuFriend
Messages: 13
Registered: July 2009
Junior Member
Hi Ed Merks,

On Inspecting the hierarchy of the generated Editor , I
found it is also an ISaveablePart. So do I need to implement the
ISaveablePart interface in my view to solve my problem..?

Thanks for your help Biju

Ed Merks wrote:
> Biju,
>
> Do you have something hooked up to the command stack to listen to
> commands being executed like the generated editor has?
>
>
> biju wrote:
>> Hi All,
>>
>>
>> I am displaying my emf model objects as a tree using a jface
>> TreeViewer in a View. I am using the "property view" to show the
>> properties of the objects in my tree. I am also able to edit it in
>> "property view" but on edit the 'save button' is not getting enabled
>> and the changes is not made to my model.
>>
>> I have created adapter factories and editing domain in my view
>> and is also passing it to ExtendedPropertySheetPage.
>>
>> What I might have missed to do..? Any Ideas..?
>>
>>
>> Thanks for any help , Biju
Re: Save Button not activated on property change [message #414347 is a reply to message #414344] Thu, 01 November 2007 11:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000807040106000404080506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Biju,

Yes, your part needs to be save able. Also keep in mind that this
method in ItemPropertyDescriptor needs to be able to find the editing
domain in order to be able to access its command stack so make sure
that's working properly.

public EditingDomain getEditingDomain(Object object)
{
EObject eObject = (EObject)object;
EditingDomain result =
AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
if (result == null)
{
if (adapterFactory instanceof IEditingDomainProvider)
{
result =
((IEditingDomainProvider)adapterFactory).getEditingDomain();
}

if (result == null && adapterFactory instanceof
ComposeableAdapterFactory)
{
AdapterFactory rootAdapterFactory =
((ComposeableAdapterFactory)adapterFactory).getRootAdapterFa ctory();
if (rootAdapterFactory instanceof IEditingDomainProvider)
{
result =
((IEditingDomainProvider)rootAdapterFactory).getEditingDomai n();
}
}
}
return result;
}

If you aren't using the resource set form the editor domain or you are
setting your own to the editing doma, you'll want to add an adapter that
implements IEditingDomainProvider to your resource set.

biju wrote:
> Hi Ed Merks,
>
> On Inspecting the hierarchy of the generated Editor , I
> found it is also an ISaveablePart. So do I need to implement the
> ISaveablePart interface in my view to solve my problem..?
>
> Thanks for your help Biju
>
> Ed Merks wrote:
>> Biju,
>>
>> Do you have something hooked up to the command stack to listen to
>> commands being executed like the generated editor has?
>>
>>
>> biju wrote:
>>> Hi All,
>>>
>>>
>>> I am displaying my emf model objects as a tree using a jface
>>> TreeViewer in a View. I am using the "property view" to show the
>>> properties of the objects in my tree. I am also able to edit it in
>>> "property view" but on edit the 'save button' is not getting enabled
>>> and the changes is not made to my model.
>>>
>>> I have created adapter factories and editing domain in my view
>>> and is also passing it to ExtendedPropertySheetPage.
>>>
>>> What I might have missed to do..? Any Ideas..?
>>>
>>>
>>> Thanks for any help , Biju


--------------000807040106000404080506
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">
Biju,<br>
<br>
Yes, your part needs to be save able.&nbsp; Also keep in mind that this
method in ItemPropertyDescriptor needs to be able to find the editing
domain in order to be able to access its command stack so make sure
that's working properly.&nbsp; <br>
<blockquote><small>&nbsp; public EditingDomain getEditingDomain(Object
object)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; EObject eObject = (EObject)object;<br>
&nbsp;&nbsp;&nbsp; EditingDomain result =
AdapterFactoryEditingDomain.getEditingDomainFor(eObject);<br >
&nbsp;&nbsp;&nbsp; if (result == null)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (adapterFactory instanceof IEditingDomainProvider)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; result =
((IEditingDomainProvider)adapterFactory).getEditingDomain(); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (result == null &amp;&amp; adapterFactory instanceof
ComposeableAdapterFactory)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; AdapterFactory rootAdapterFactory =
((ComposeableAdapterFactory)adapterFactory).getRootAdapterFa ctory(); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (rootAdapterFactory instanceof IEditingDomainProvider)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; result =
((IEditingDomainProvider)rootAdapterFactory).getEditingDomai n(); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; return result;<br>
&nbsp; }</small><br>
</blockquote>
If you aren't using the resource set form the editor domain or you are
setting your own to the editing doma, you'll want to add an adapter
that implements IEditingDomainProvider to your resource set.<br>
<br>
biju wrote:
<blockquote cite="mid:fgc69i$bgt$1@build.eclipse.org" type="cite">Hi Ed
Merks,
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; On Inspecting the hierarchy of the generated Editor , I
found it is also an ISaveablePart. So do I need to implement the
ISaveablePart interface in my view to solve my problem..?
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Thanks for your help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Biju
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Biju,
<br>
<br>
Do you have something hooked up to the command stack to listen to
commands being executed like the generated editor has?
<br>
<br>
<br>
biju wrote:
<br>
<blockquote type="cite">Hi All,
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am displaying my emf model objects as a tree using a jface
TreeViewer in a View. I am using the "property view" to show the
properties of the objects in my tree. I am also able to edit it in
"property view" but on edit the 'save button' is not getting enabled
and the changes is not made to my model.
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have created adapter factories and editing domain in my view
and is also passing it to ExtendedPropertySheetPage.
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What I might have missed to do..? Any Ideas..?
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thanks for any help ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; Biju
<br>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------000807040106000404080506--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save Button not activated on property change [message #414348 is a reply to message #414347] Thu, 01 November 2007 13:58 Go to previous messageGo to next message
biju is currently offline bijuFriend
Messages: 13
Registered: July 2009
Junior Member
Hi Ed Merks,

Thanks for your reply,

Its working now, I made my view part save able and the save
functionality is working. I am having another problem now , that is
after editing the properties of a selected node in the view, the
selection of the node is gone. It happens after editing any property in
property sheet.

I am investigating on this, mean while do you have any Idea
what might be wrong.

Thanks for the help Biju

Ed Merks wrote:
> Biju,
>
> Yes, your part needs to be save able. Also keep in mind that this
> method in ItemPropertyDescriptor needs to be able to find the editing
> domain in order to be able to access its command stack so make sure
> that's working properly.
>
> public EditingDomain getEditingDomain(Object object)
> {
> EObject eObject = (EObject)object;
> EditingDomain result =
> AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
> if (result == null)
> {
> if (adapterFactory instanceof IEditingDomainProvider)
> {
> result =
> ((IEditingDomainProvider)adapterFactory).getEditingDomain();
> }
>
> if (result == null && adapterFactory instanceof
> ComposeableAdapterFactory)
> {
> AdapterFactory rootAdapterFactory =
> ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFa ctory();
> if (rootAdapterFactory instanceof IEditingDomainProvider)
> {
> result =
> ((IEditingDomainProvider)rootAdapterFactory).getEditingDomai n();
> }
> }
> }
> return result;
> }
>
> If you aren't using the resource set form the editor domain or you are
> setting your own to the editing doma, you'll want to add an adapter that
> implements IEditingDomainProvider to your resource set.
>
> biju wrote:
>> Hi Ed Merks,
>>
>> On Inspecting the hierarchy of the generated Editor , I
>> found it is also an ISaveablePart. So do I need to implement the
>> ISaveablePart interface in my view to solve my problem..?
>>
>> Thanks for your help Biju
>>
>> Ed Merks wrote:
>>> Biju,
>>>
>>> Do you have something hooked up to the command stack to listen to
>>> commands being executed like the generated editor has?
>>>
>>>
>>> biju wrote:
>>>> Hi All,
>>>>
>>>>
>>>> I am displaying my emf model objects as a tree using a jface
>>>> TreeViewer in a View. I am using the "property view" to show the
>>>> properties of the objects in my tree. I am also able to edit it in
>>>> "property view" but on edit the 'save button' is not getting enabled
>>>> and the changes is not made to my model.
>>>>
>>>> I have created adapter factories and editing domain in my view
>>>> and is also passing it to ExtendedPropertySheetPage.
>>>>
>>>> What I might have missed to do..? Any Ideas..?
>>>>
>>>>
>>>> Thanks for any help , Biju
>
Re: Save Button not activated on property change [message #414349 is a reply to message #414348] Thu, 01 November 2007 14:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Biju,

In the generated editor, the selection is set to match the
"affectedObjects" returned by the command and setSelectionToViewer is
called to make that selection so maybe something is going wrong in how
you've hooked up this behavior...


biju wrote:
> Hi Ed Merks,
>
> Thanks for your reply,
>
> Its working now, I made my view part save able and the
> save functionality is working. I am having another problem now , that
> is after editing the properties of a selected node in the view, the
> selection of the node is gone. It happens after editing any property
> in property sheet.
>
> I am investigating on this, mean while do you have any
> Idea what might be wrong.
>
> Thanks for the help Biju
>
> Ed Merks wrote:
>> Biju,
>>
>> Yes, your part needs to be save able. Also keep in mind that this
>> method in ItemPropertyDescriptor needs to be able to find the editing
>> domain in order to be able to access its command stack so make sure
>> that's working properly.
>> public EditingDomain getEditingDomain(Object object)
>> {
>> EObject eObject = (EObject)object;
>> EditingDomain result =
>> AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
>> if (result == null)
>> {
>> if (adapterFactory instanceof IEditingDomainProvider)
>> {
>> result =
>> ((IEditingDomainProvider)adapterFactory).getEditingDomain();
>> }
>>
>> if (result == null && adapterFactory instanceof
>> ComposeableAdapterFactory)
>> {
>> AdapterFactory rootAdapterFactory =
>> ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFa ctory();
>> if (rootAdapterFactory instanceof IEditingDomainProvider)
>> {
>> result =
>> ((IEditingDomainProvider)rootAdapterFactory).getEditingDomai n();
>> }
>> }
>> }
>> return result;
>> }
>>
>> If you aren't using the resource set form the editor domain or you
>> are setting your own to the editing doma, you'll want to add an
>> adapter that implements IEditingDomainProvider to your resource set.
>>
>> biju wrote:
>>> Hi Ed Merks,
>>>
>>> On Inspecting the hierarchy of the generated Editor , I
>>> found it is also an ISaveablePart. So do I need to implement the
>>> ISaveablePart interface in my view to solve my problem..?
>>>
>>> Thanks for your help Biju
>>>
>>> Ed Merks wrote:
>>>> Biju,
>>>>
>>>> Do you have something hooked up to the command stack to listen to
>>>> commands being executed like the generated editor has?
>>>>
>>>>
>>>> biju wrote:
>>>>> Hi All,
>>>>>
>>>>>
>>>>> I am displaying my emf model objects as a tree using a jface
>>>>> TreeViewer in a View. I am using the "property view" to show the
>>>>> properties of the objects in my tree. I am also able to edit it in
>>>>> "property view" but on edit the 'save button' is not getting
>>>>> enabled and the changes is not made to my model.
>>>>>
>>>>> I have created adapter factories and editing domain in my
>>>>> view and is also passing it to ExtendedPropertySheetPage.
>>>>>
>>>>> What I might have missed to do..? Any Ideas..?
>>>>>
>>>>>
>>>>> Thanks for any help , Biju
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save Button not activated on property change [message #414364 is a reply to message #414349] Fri, 02 November 2007 12:00 Go to previous message
biju is currently offline bijuFriend
Messages: 13
Registered: July 2009
Junior Member
Hi Ed Merks,

Thanks for your valuable help

Its working now.. On selecting a node in my tree viewer, the
PropertyView gets the selectionChanged event, where I was changing the
selection to the child of the actually selected node, by creating my own
selection(Which is my requirement). So in setSelectionToViewer() call on
commandStackChanged() call back the selection of this child was set to
my TreeViewer which actually was not in the tree.

I tried hiding the setSelectionToViewer() call from
commandStackChanged() call back and Its working fine now.

Thanks again, Biju
Ed Merks wrote:
> Biju,
>
> In the generated editor, the selection is set to match the
> "affectedObjects" returned by the command and setSelectionToViewer is
> called to make that selection so maybe something is going wrong in how
> you've hooked up this behavior...
>
>
> biju wrote:
>> Hi Ed Merks,
>>
>> Thanks for your reply,
>>
>> Its working now, I made my view part save able and the
>> save functionality is working. I am having another problem now , that
>> is after editing the properties of a selected node in the view, the
>> selection of the node is gone. It happens after editing any property
>> in property sheet.
>>
>> I am investigating on this, mean while do you have any
>> Idea what might be wrong.
>>
>> Thanks for the help Biju
>>
>> Ed Merks wrote:
>>> Biju,
>>>
>>> Yes, your part needs to be save able. Also keep in mind that this
>>> method in ItemPropertyDescriptor needs to be able to find the editing
>>> domain in order to be able to access its command stack so make sure
>>> that's working properly.
>>> public EditingDomain getEditingDomain(Object object)
>>> {
>>> EObject eObject = (EObject)object;
>>> EditingDomain result =
>>> AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
>>> if (result == null)
>>> {
>>> if (adapterFactory instanceof IEditingDomainProvider)
>>> {
>>> result =
>>> ((IEditingDomainProvider)adapterFactory).getEditingDomain();
>>> }
>>>
>>> if (result == null && adapterFactory instanceof
>>> ComposeableAdapterFactory)
>>> {
>>> AdapterFactory rootAdapterFactory =
>>> ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFa ctory();
>>> if (rootAdapterFactory instanceof IEditingDomainProvider)
>>> {
>>> result =
>>> ((IEditingDomainProvider)rootAdapterFactory).getEditingDomai n();
>>> }
>>> }
>>> }
>>> return result;
>>> }
>>>
>>> If you aren't using the resource set form the editor domain or you
>>> are setting your own to the editing doma, you'll want to add an
>>> adapter that implements IEditingDomainProvider to your resource set.
>>>
>>> biju wrote:
>>>> Hi Ed Merks,
>>>>
>>>> On Inspecting the hierarchy of the generated Editor , I
>>>> found it is also an ISaveablePart. So do I need to implement the
>>>> ISaveablePart interface in my view to solve my problem..?
>>>>
>>>> Thanks for your help Biju
>>>>
>>>> Ed Merks wrote:
>>>>> Biju,
>>>>>
>>>>> Do you have something hooked up to the command stack to listen to
>>>>> commands being executed like the generated editor has?
>>>>>
>>>>>
>>>>> biju wrote:
>>>>>> Hi All,
>>>>>>
>>>>>>
>>>>>> I am displaying my emf model objects as a tree using a jface
>>>>>> TreeViewer in a View. I am using the "property view" to show the
>>>>>> properties of the objects in my tree. I am also able to edit it in
>>>>>> "property view" but on edit the 'save button' is not getting
>>>>>> enabled and the changes is not made to my model.
>>>>>>
>>>>>> I have created adapter factories and editing domain in my
>>>>>> view and is also passing it to ExtendedPropertySheetPage.
>>>>>>
>>>>>> What I might have missed to do..? Any Ideas..?
>>>>>>
>>>>>>
>>>>>> Thanks for any help , Biju
>>>
Previous Topic:Re: simple ecore model editor crashes on Eclipse 3.3.x+EMF2.3@leopard
Next Topic:How to use EStore?
Goto Forum:
  


Current Time: Thu Apr 25 09:25:34 GMT 2024

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

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

Back to the top