Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Properties view add buttons
Properties view add buttons [message #199829] Fri, 01 August 2008 12:34 Go to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

Hallo,
Is there any way to put buttons instead of cells in the properties view
and of course get notification for pressing them.
Best Regards,
Stanislav
Re: Properties view add buttons [message #199879 is a reply to message #199829] Fri, 01 August 2008 13:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31164
Registered: July 2009
Senior Member
Stanislav,

Have a look at
http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_your_own_ property_editor_in_a_generated_application
and also at DialogCellEditor.


Stanislav wrote:
> Hallo,
> Is there any way to put buttons instead of cells in the properties
> view and of course get notification for pressing them.
> Best Regards,
> Stanislav
>
Re: Properties view add buttons [message #199887 is a reply to message #199879] Fri, 01 August 2008 14:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

It looks as nice solution but unfortunately my diagram never even execute
the editor code generated by the .genmodel. How can I force it to work?
Re: Properties view add buttons [message #199901 is a reply to message #199887] Fri, 01 August 2008 14:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31164
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040707030704030709080802
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Stanislav,

In the editor you have, find where it creates the properties view and
apply this same solution there. It's created like this in the base
class of the generated GMF editor so I imagine you'll need to override
that. I've not looked closely at the details...

/* (non-Javadoc)
* @see
org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Cla ss)
*/
public Object getAdapter(Class type) {
if (type == IPropertySheetPage.class) {
return new PropertiesBrowserPage(this);
}
return super.getAdapter(type);
}


Stanislav wrote:
> It looks as nice solution but unfortunately my diagram never even
> execute the editor code generated by the .genmodel. How can I force it
> to work?
>

--------------040707030704030709080802
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Stanislav,<br>
<br>
In the editor you have, find where it creates the properties view and
apply this same solution there.
Re: Properties view add buttons [message #199910 is a reply to message #199901] Fri, 01 August 2008 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

Thanks Ed
i found where the view is created so i only have to implement the solution.
Re: Properties view add buttons [message #200097 is a reply to message #199910] Mon, 04 August 2008 12:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

Hi,
As i said i founded where the properties view is created but i just can't
get my properties to show in a customed way. every thing is fine before
the method setPropertySourceProvider which in my opinion doesn't even
executes. I don't get any exception but the properties view is blank. Can
you please help me.
Re: Properties view add buttons [message #200105 is a reply to message #200097] Mon, 04 August 2008 12:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31164
Registered: July 2009
Senior Member
Stanislav,

My psychic debugging skills have limits. The debugger is your best
friend. You've looked in the Error Log view? You've set breakpoints on
your property source provider's method to see what's being called. If
you set breakpoints in the default one that works, you can see what code
paths get you there and hence can look at how those function when you
inject your alternative.


Stanislav wrote:
> Hi,
> As i said i founded where the properties view is created but i just
> can't get my properties to show in a customed way. every thing is fine
> before the method setPropertySourceProvider which in my opinion
> doesn't even executes. I don't get any exception but the properties
> view is blank. Can you please help me.
>
Re: Properties view add buttons [message #200142 is a reply to message #200105] Mon, 04 August 2008 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

propertySheetPage.setPropertySourceProvider
(new AdapterFactoryContentProvider(adapterFactory)
{
@Override
protected IPropertySource createPropertySource(Object object,
IItemPropertySource itemPropertySource)
{
return
new PropertySource(object, itemPropertySource)
{
@Override
protected IPropertyDescriptor
createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor)
{
return
new PropertyDescriptor(object, itemPropertyDescriptor)
{
@Override
public CellEditor createPropertyEditor(Composite
composite)
{
// Test for your case based on the feature or the
type of the feature.
// See the super method for details.
//
Object feature =
temPropertyDescriptor.getFeature(this.object);
return super.createPropertyEditor(composite);
}
};
}
};
}
});
}
Sorry for wasting your time but i really got stuck. In this code where and
how should i call the overridden methods. Because as my inspections showed
that they are never called?
Re: Properties view add buttons [message #200165 is a reply to message #200142] Mon, 04 August 2008 15:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31164
Registered: July 2009
Senior Member
Stanislav,

Did you override getAdatper? Where is this "set" being called?


Stanislav wrote:
> propertySheetPage.setPropertySourceProvider
> (new AdapterFactoryContentProvider(adapterFactory)
> {
> @Override
> protected IPropertySource createPropertySource(Object
> object, IItemPropertySource itemPropertySource)
> {
> return new PropertySource(object,
> itemPropertySource)
> {
> @Override
> protected IPropertyDescriptor
> createPropertyDescriptor(IItemPropertyDescriptor itemPropertyDescriptor)
> {
> return new
> PropertyDescriptor(object, itemPropertyDescriptor)
> {
> @Override
> public CellEditor createPropertyEditor(Composite
> composite)
> {
> // Test for your case based on the feature or
> the type of the feature.
> // See the super method for details.
> //
> Object feature =
> temPropertyDescriptor.getFeature(this.object);
> return super.createPropertyEditor(composite);
> }
> };
> }
> };
> }
> });
> }
> Sorry for wasting your time but i really got stuck. In this code where
> and how should i call the overridden methods. Because as my
> inspections showed that they are never called?
Re: Properties view add buttons [message #200171 is a reply to message #200165] Mon, 04 August 2008 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

Yes in the main edir class of *.diagram.part. and this is the overridden
getAdapter
@Override
public Object getAdapter(Class type) {
if (type.equals(IPropertySheetPage.class)) {
MindmapEditor editor = new MindmapEditor();
return editor.getPropertySheetPage();
} else
return super.getAdapter(type);
}
and the set method i called inside getPropertySheetPage();
Re: Properties view add buttons [message #200185 is a reply to message #200171] Mon, 04 August 2008 16:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31164
Registered: July 2009
Senior Member
Stanislav,

Comments below.


Stanislav wrote:
> Yes in the main edir class of *.diagram.part. and this is the
> overridden getAdapter
> @Override
> public Object getAdapter(Class type) {
> if (type.equals(IPropertySheetPage.class)) {
> MindmapEditor editor = new MindmapEditor();
This looks like bad news. You need to create a new property sheet page
here, not create some editor and then try to reuse that other editor's
property sheet page for this editor. Copy the code that's in your base
class and try change how the new PropertiesBrowserPage(this) is
initialized. I can't help you with that because I don't know how these
tabbed properties views work. So I'll just stop answering your
questions and assume that someone with GMF knowledge will help.
> return editor.getPropertySheetPage();
> } else
> return super.getAdapter(type);
> }
> and the set method i called inside getPropertySheetPage();
>
Re: Properties view add buttons [message #200209 is a reply to message #200185] Mon, 04 August 2008 17:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

Thank you a lot for your help.
And if anyone else knows something about my problem?
Re: Properties view add buttons [message #200294 is a reply to message #200185] Tue, 05 August 2008 07:03 Go to previous message
Eclipse UserFriend
Originally posted by: sk_stani.gbg.bg

I think I solved the case. There is class *PropertySection where we have
if (af != null) {
IItemPropertySource ips = (IItemPropertySource) af.adapt(object,
IItemPropertySource.class);
if (ips != null) {
return new PropertySource(object, ips);
}
}
just change of return new PropertySource(object, ips); with
return new CustomizedPropertySource(object, ips);
and then you can try the second part of the article
http://eclipser-blog.blogspot.com/2007/10/custom-property-so urce-for-emf.html
Previous Topic:element drawn in the compartment and outside compartment
Next Topic:implementing ILayoutNodeProvider - best practices
Goto Forum:
  


Current Time: Sat Jun 06 11:58:17 GMT 2020

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

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

Back to the top