Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Launch property edit dialog programmatically
Launch property edit dialog programmatically [message #231836] Sun, 31 May 2009 19:56 Go to next message
Eclipse UserFriend
Originally posted by: ugo.sangiorgi.gmail.com

Hi everybody,
I would like to be able to open a popup everytime I click to edit a
property (direct edit). Altough i know how to launch something at that
point, i cant find out what is the dialog that comes up when i click on
(...) icon at my multi-line property (defined at .genmodel).
I would like to be able to launch THAT dialog programatically for a
given property on my model, how can i do that?

I've already searched at emf group as well, but no clue whatsoever. If
someone could provide me a snippet i would appreciate :)

Thanks in advance!
Ugo
Re: Launch property edit dialog programmatically [message #231871 is a reply to message #231836] Mon, 01 June 2009 10:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Ugo,

Have a look at what
org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
does.


Ugo Sangiorgi wrote:
> Hi everybody,
> I would like to be able to open a popup everytime I click to edit a
> property (direct edit). Altough i know how to launch something at that
> point, i cant find out what is the dialog that comes up when i click
> on (...) icon at my multi-line property (defined at .genmodel).
> I would like to be able to launch THAT dialog programatically for a
> given property on my model, how can i do that?
>
> I've already searched at emf group as well, but no clue whatsoever. If
> someone could provide me a snippet i would appreciate :)
>
> Thanks in advance!
> Ugo


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Launch property edit dialog programmatically [message #231963 is a reply to message #231871] Tue, 02 June 2009 01:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ugo.sangiorgi.gmail.com

Thank you Ed, I know from the EMF/Recipes how to customize the
propertysheetpage, but i'm lost.

I know you are the EMF man, but given that i'm at the
[Node][Label]EditPart's method performDirectEdit(), do I need to create
such PropertyDescriptor and then call createPropertyEditor?

such as:
PropertyDescriptor d = new
PropertyDescriptor(getModel(),itemPropertyDescriptor);

If positive, how do I access itemPropertyDescriptor from an EditPart?
Anyone?

Thank you
Ugo

Ed Merks escreveu:
> Ugo,
>
> Have a look at what
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
> does.
>
>
> Ugo Sangiorgi wrote:
>> Hi everybody,
>> I would like to be able to open a popup everytime I click to edit a
>> property (direct edit). Altough i know how to launch something at that
>> point, i cant find out what is the dialog that comes up when i click
>> on (...) icon at my multi-line property (defined at .genmodel).
>> I would like to be able to launch THAT dialog programatically for a
>> given property on my model, how can i do that?
>>
>> I've already searched at emf group as well, but no clue whatsoever. If
>> someone could provide me a snippet i would appreciate :)
>>
>> Thanks in advance!
>> Ugo
Re: Launch property edit dialog programmatically [message #231987 is a reply to message #231963] Tue, 02 June 2009 10:51 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ugo,

> I know you are the EMF man, but given that i'm at the
> [Node][Label]EditPart's method performDirectEdit(), do I need to
> create such PropertyDescriptor and then call createPropertyEditor?
I suppose you need to open new dialog from there and you can use code from
org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
as an example..

-----------------
Alex Shatalin
Re: Launch property edit dialog programmatically [message #231995 is a reply to message #231987] Tue, 02 June 2009 11:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090208060908060600050206
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Alex,

Yes, the intent was to point Ugo at an example not to suggest he needed
a property descriptor.

protected CellEditor createEDataTypeCellEditor(final EDataType
eDataType, Composite composite)
{
if (itemPropertyDescriptor.isMultiLine(object))
{
return new ExtendedDialogCellEditor(composite,
getEditLabelProvider())
{
protected EDataTypeValueHandler valueHandler = new
EDataTypeValueHandler(eDataType);

@Override
protected Object openDialogBox(Control cellEditorWindow)
{
* InputDialog dialog = new MultiLineInputDialog
(cellEditorWindow.getShell(),
EMFEditUIPlugin.INSTANCE.getString
("_UI_FeatureEditorDialog_title", new Object [] {
getDisplayName(), getEditLabelProvider().getText(object) }),

EMFEditUIPlugin.INSTANCE.getString("_UI_MultiLineInputDialog_message "),
valueHandler.toString(getValue()),
valueHandler);
return dialog.open() == Window.OK ?
valueHandler.toValue(dialog.getValue()) : null;*
}
};
}
return new EDataTypeCellEditor(eDataType, composite);
}



Alex Shatalin wrote:
> Hello Ugo,
>
>> I know you are the EMF man, but given that i'm at the
>> [Node][Label]EditPart's method performDirectEdit(), do I need to
>> create such PropertyDescriptor and then call createPropertyEditor?
> I suppose you need to open new dialog from there and you can use code
> from
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
> as an example..
>
> -----------------
> Alex Shatalin
>
>

--------------090208060908060600050206
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alex,<br>
<br>
Yes, the intent was to point Ugo at an example not to suggest he needed
a property descriptor.  <br>
<blockquote><tt><small>  protected CellEditor
createEDataTypeCellEditor(final EDataType eDataType, Composite
composite)</small><br>
<small>  {</small><br>
<small>    if (itemPropertyDescriptor.isMultiLine(object))</small><br>
<small>    {</small><br>
<small>      return new ExtendedDialogCellEditor(composite,
getEditLabelProvider())</small><br>
<small>      {</small><br>
<small>        protected EDataTypeValueHandler valueHandler = new
EDataTypeValueHandler(eDataType);</small><br>
<br>
<small>        @Override</small><br>
<small>        protected Object openDialogBox(Control
cellEditorWindow)</small><br>
<small>        {</small><br>
<b><small>          InputDialog dialog = new MultiLineInputDialog</small><br>
<small>            (cellEditorWindow.getShell(),</small><br>
<small>             EMFEditUIPlugin.INSTANCE.getString</small><br>
<small>               ("_UI_FeatureEditorDialog_title", new Object []
{ getDisplayName(), getEditLabelProvider().getText(object) }),</small><br>
<small>            
EMFEditUIPlugin.INSTANCE.getString("_UI_MultiLineInputDialog_message "),</small><br>
<small>             valueHandler.toString(getValue()),</small><br>
<small>             valueHandler);</small><br>
<small>          return dialog.open() == Window.OK ?
valueHandler.toValue(dialog.getValue()) : null;</small></b><br>
<small>        }</small><br>
<small>      };</small><br>
<small>    }</small><br>
<small>    return new EDataTypeCellEditor(eDataType, composite);</small><br>
<small>  }</small></tt><br>
</blockquote>
<br>
<br>
Alex Shatalin wrote:
<blockquote cite="mid:3c3172e62d9df8cbb197f2b10f66@news.eclipse.org"
type="cite">Hello Ugo,
<br>
<br>
<blockquote type="cite">I know you are the EMF man, but given that
i'm at the
<br>
[Node][Label]EditPart's method performDirectEdit(), do I need to
<br>
create such PropertyDescriptor and then call createPropertyEditor?
<br>
</blockquote>
I suppose you need to open new dialog from there and you can use code
from
org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
as an example..
<br>
<br>
-----------------
<br>
Alex Shatalin
<br>
<br>
<br>
</blockquote>
</body>
</html>

--------------090208060908060600050206--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Launch property edit dialog programmatically [message #479629 is a reply to message #231995] Tue, 11 August 2009 18:56 Go to previous message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
Thanks Ed and Alex,
that way i need to clone MultiLineInputDialog, InputDialog and
EDataTypeValueHandler. Also i need to pass an EDataType (a EString?)...
i must have got this wrong.

Isnt there a way of getting the property descriptor already in my
element and then just popup the dialog that edits it? (i suppose there
is one created already, right?)

I mean, when i click the "..." icon on my properties view, where this
action belongs to? I just want to do that programmatically. The code i'm
writing is inside my editpart, so its not hard to access the emf model
underneath anyway.

Thank you in advance guys, hope i've clarified
Ugo

Ed Merks escreveu:
> Alex,
>
> Yes, the intent was to point Ugo at an example not to suggest he needed
> a property descriptor.
>
> protected CellEditor createEDataTypeCellEditor(final EDataType
> eDataType, Composite composite)
> {
> if (itemPropertyDescriptor.isMultiLine(object))
> {
> return new ExtendedDialogCellEditor(composite,
> getEditLabelProvider())
> {
> protected EDataTypeValueHandler valueHandler = new
> EDataTypeValueHandler(eDataType);
>
> @Override
> protected Object openDialogBox(Control cellEditorWindow)
> {
> * InputDialog dialog = new MultiLineInputDialog
> (cellEditorWindow.getShell(),
> EMFEditUIPlugin.INSTANCE.getString
> ("_UI_FeatureEditorDialog_title", new Object [] {
> getDisplayName(), getEditLabelProvider().getText(object) }),
>
> EMFEditUIPlugin.INSTANCE.getString("_UI_MultiLineInputDialog_message "),
> valueHandler.toString(getValue()),
> valueHandler);
> return dialog.open() == Window.OK ?
> valueHandler.toValue(dialog.getValue()) : null;*
> }
> };
> }
> return new EDataTypeCellEditor(eDataType, composite);
> }
>
>
>
> Alex Shatalin wrote:
>> Hello Ugo,
>>
>>> I know you are the EMF man, but given that i'm at the
>>> [Node][Label]EditPart's method performDirectEdit(), do I need to
>>> create such PropertyDescriptor and then call createPropertyEditor?
>> I suppose you need to open new dialog from there and you can use code
>> from
>> org.eclipse.emf.edit.ui.provider.PropertyDescriptor.createPr opertyEditor
>> as an example..
>>
>> -----------------
>> Alex Shatalin
>>
>>
Previous Topic:Connection Handles - name for links defined by attribute
Next Topic:Control action from EMF with notation model
Goto Forum:
  


Current Time: Thu Sep 19 06:09:13 GMT 2024

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

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

Back to the top