Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Synchronization between Property Sheet and Tree View outline
Synchronization between Property Sheet and Tree View outline [message #206229] Mon, 22 September 2008 13:36 Go to next message
Toan is currently offline ToanFriend
Messages: 36
Registered: July 2009
Member
Hello everyone,
I've followed this help
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg13295.html
to create a tree view outline and that works fine. However, I don't know
how to synchronize the property sheet and this tree view outline. In
details, The labels in the tree outline cannot reflect the change of
properties in the property sheet. And when I choose an item in the tree
view outline, the property sheet don't show the corresponding attributes
of the chosen class. Can anyone help me? Thanks in advance.
Toan.
Re: Synchronization between Property Sheet and Tree View outline [message #206246 is a reply to message #206229] Mon, 22 September 2008 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

You will need to configure a propertyConstributer :

<extension
point="org.eclipse.ui.views.properties.tabbed.propertyContributor ">
<?gmfgen generated="false"?>
<propertyContributor
contributorId="de.urszeidler.eclipse.callchain.diagram"

labelProvider=" de.urszeidler.eclipse.callchain.diagram.sheet.CallchainSheet LabelProvider "

typeMapper=" de.urszeidler.eclipse.callchain.diagram.CallchainGMF2EMFType Mapper ">
<propertyCategory category="domain"/>
<propertyCategory category="visual"/>
<propertyCategory category="extra"/>
<propertyCategory category="advanced"/>
</propertyContributor>
</extension>


and a Typemapper :



/*
* (c) urs zeidler
*/
package de.urszeidler.eclipse.callchain.diagram;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
import org.eclipse.ui.views.properties.tabbed.ITypeMapper;

/**
* <p>
* CallchainGMF2EMFTypeMapper
* </p>
* Created : 05.06.2008
* @author urs
* @version $Revision$, $Id$
*/
public class CallchainGMF2EMFTypeMapper extends AbstractTypeMapper
implements
ITypeMapper {
public Class<?> mapType(Object object) {

EObject eObject = adaptObject(object);
if (eObject != null) {
return eObject.getClass();
}
return super.mapType(object);
}
/**
* Returns the EObject associated with the given object. Returns
<code>null</code> if no such object can be found.
*
*
* @param object The object to look up its associated EObject
* @return the EObject associated to the given object, or
<code>null</code> if this object does not have any.
*/
public static EObject adaptObject(Object object)
{
if (object == null)
{
return null;
}
else if (object instanceof EObject)
{
return (EObject) object;
}
else if (object instanceof IAdaptable)
{
// Try IAdaptable
IAdaptable adapted = (IAdaptable) object;
Object eObject = adapted.getAdapter(EObject.class);
if (eObject != null)
{
return (EObject) eObject;
}
}
else
{
// Try registered adapter
Object adapted =
Platform.getAdapterManager().getAdapter(object, EObject.class);
if (adapted != null)
{
return (EObject) adapted;
}
}
return null;
}


}



greetings urs.
Re: Synchronization between Property Sheet and Tree View outline [message #206254 is a reply to message #206246] Mon, 22 September 2008 14:38 Go to previous messageGo to next message
Toan is currently offline ToanFriend
Messages: 36
Registered: July 2009
Member
Hi urs,
Thanks for your answer. I did it but I still don't have the
synchronization between the outline and the property sheet. Besides, when
applying this modification, I also lost the synchronization between the
property sheet and the view which I had before this modification. Can you
please guide me? Thanks.
Toan.
Re: Synchronization between Property Sheet and Tree View outline [message #206277 is a reply to message #206254] Mon, 22 September 2008 15:36 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Toan wrote:

> Hi urs,
> Thanks for your answer. I did it but I still don't have the
> synchronization between the outline and the property sheet. Besides, when
> applying this modification, I also lost the synchronization between the
> property sheet and the view which I had before this modification. Can you
> please guide me? Thanks.
> Toan.

An alternative way would be to allow the property view to accept every
EObject in addition to View/Editpart/NavigatorItem.

I have changed the input template for gmfgen::TypeTabFilter in
/org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions. xpt :

«DEFINE input FOR gmfgen::TypeTabFilter-»
«FOREACH getAllTypes() AS type-»
<input type="«type»"/>
«ENDFOREACH-»
«IF tab.sheet.editorGen.editor.useModelOrientedOutline-»
<input type="org.eclipse.emf.ecore.EObject"/>
«ENDIF-»
«ENDDEFINE»
Re: Synchronization between Property Sheet and Tree View outline [message #206301 is a reply to message #206277] Mon, 22 September 2008 16:20 Go to previous messageGo to next message
Toan is currently offline ToanFriend
Messages: 36
Registered: July 2009
Member
Enrico Schnepel wrote:

> Toan wrote:

>> Hi urs,
>> Thanks for your answer. I did it but I still don't have the
>> synchronization between the outline and the property sheet. Besides, when
>> applying this modification, I also lost the synchronization between the
>> property sheet and the view which I had before this modification. Can you
>> please guide me? Thanks.
>> Toan.

> An alternative way would be to allow the property view to accept every
> EObject in addition to View/Editpart/NavigatorItem.

> I have changed the input template for gmfgen::TypeTabFilter in
> /org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions. xpt :

> «DEFINE input FOR gmfgen::TypeTabFilter-»
> «FOREACH getAllTypes() AS type-»
> <input type="«type»"/>
> «ENDFOREACH-»
> «IF tab.sheet.editorGen.editor.useModelOrientedOutline-»
> <input type="org.eclipse.emf.ecore.EObject"/>
> «ENDIF-»
> «ENDDEFINE»
Hi Enrico,
Thanks for your guidance. I'm sorry but I don't know where to modify
because I cannot find this
/org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions. xpt in the
project.
But I think my problem is not only this because I did add <input
type="<myclass>" manually. And when I choose an Item in the tree outline,
the properties of this class can appear in property sheet but when I
modify these properties, this modification does not affect the label in
the tree view. So I think the problem is in the synchronization between
the tree view outline and the property sheet. Can you please help me?
Thanks.
Toan.
Re: Synchronization between Property Sheet and Tree View outline [message #206308 is a reply to message #206301] Mon, 22 September 2008 16:45 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello Toan,

I don't know which part of our editor modifications do the trick, but it
works for us. We are using a lot of AOP for the modifications - I will have
to dig a bit deeper... maybe tomorrow.

Enrico

Toan wrote:

> Enrico Schnepel wrote:
>
>> Toan wrote:
>
>>> Hi urs,
>>> Thanks for your answer. I did it but I still don't have the
>>> synchronization between the outline and the property sheet. Besides,
>>> when applying this modification, I also lost the synchronization between
>>> the property sheet and the view which I had before this modification.
>>> Can you please guide me? Thanks.
>>> Toan.
>
>> An alternative way would be to allow the property view to accept every
>> EObject in addition to View/Editpart/NavigatorItem.
>
>> I have changed the input template for gmfgen::TypeTabFilter in
>> /org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions. xpt :
>
>> «DEFINE input FOR gmfgen::TypeTabFilter-»
>> «FOREACH getAllTypes() AS type-»
>> <input type="«type»"/>
>> «ENDFOREACH-»
>> «IF tab.sheet.editorGen.editor.useModelOrientedOutline-»
>> <input type="org.eclipse.emf.ecore.EObject"/>
>> «ENDIF-»
>> «ENDDEFINE»
> Hi Enrico,
> Thanks for your guidance. I'm sorry but I don't know where to modify
> because I cannot find this
> /org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions. xpt in the
> project.
> But I think my problem is not only this because I did add <input
> type="<myclass>" manually. And when I choose an Item in the tree outline,
> the properties of this class can appear in property sheet but when I
> modify these properties, this modification does not affect the label in
> the tree view. So I think the problem is in the synchronization between
> the tree view outline and the property sheet. Can you please help me?
> Thanks.
> Toan.
Re: Synchronization between Property Sheet and Tree View outline [message #206429 is a reply to message #206254] Tue, 23 September 2008 08:45 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
Toan schrieb:
> Hi urs,
> Thanks for your answer. I did it but I still don't have the
> synchronization between the outline and the property sheet. Besides,
> when applying this modification, I also lost the synchronization between
> the property sheet and the view which I had before this modification.
> Can you please guide me? Thanks.
> Toan.
>
What kind of property sheet do you use? I expected the tabbed property
sheet. Just like gmf generated one. And then this should work.
So perhaps in your tree viewer is a problem.

>In details, The labels in the tree outline cannot reflect the change
of >properties in the property sheet.

Does you mean that if you change a attribute part of the label, these
changes aren't displayed in the tree ?

greetings, urs.
Re: Synchronization between Property Sheet and Tree View outline [message #206482 is a reply to message #206429] Tue, 23 September 2008 09:32 Go to previous messageGo to next message
Toan is currently offline ToanFriend
Messages: 36
Registered: July 2009
Member
urs zeidler wrote:

> Toan schrieb:
>> Hi urs,
>> Thanks for your answer. I did it but I still don't have the
>> synchronization between the outline and the property sheet. Besides,
>> when applying this modification, I also lost the synchronization between
>> the property sheet and the view which I had before this modification.
>> Can you please guide me? Thanks.
>> Toan.
>>
> What kind of property sheet do you use? I expected the tabbed property
> sheet. Just like gmf generated one. And then this should work.
> So perhaps in your tree viewer is a problem.
Yes, I use the tabbed property sheet generated by gmf.
> >In details, The labels in the tree outline cannot reflect the change
> of >properties in the property sheet.

> Does you mean that if you change a attribute part of the label, these
> changes aren't displayed in the tree ?
Yes, that's what exactly I mean.
Can you please help me? Thanks.
Toan.
> greetings, urs.
Re: Synchronization between Property Sheet and Tree View outline [message #206545 is a reply to message #206482] Tue, 23 September 2008 10:41 Go to previous message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
> Yes, that's what exactly I mean.
I think the emf notification should work by default, so it's looks for
me that your current implantation (of the tree outline) contains an error.


greetings, urs.
Previous Topic:.gmfmap nodes mapping for multiple concrete supertypes
Next Topic:create copy of gmf resource
Goto Forum:
  


Current Time: Wed Jan 27 07:49:23 GMT 2021

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

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

Back to the top