Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » custom widgets with EMF
custom widgets with EMF [message #417221] Sat, 01 March 2008 22:10 Go to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Hi
Are there any examples of custom widgets being made that are EMF-enabled that one can look at

As a first step, I would like to create a view that has a table and also some text boxes

I have an EMF model that contains a list of children (to be displayed in the table) and some attributes (to be display in the text boxes)

I guess what I am thinking is to make an AdapterFactoryContentProvider that can provide content to the table and the text boxes. I am wondering if there is anything like that out there to look at

Best wishes

Charles
Re: custom widgets with EMF [message #417222 is a reply to message #417221] Sat, 01 March 2008 23:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

I've been looking at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=207324 and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220843 just this weekend.
All the new data binding support seems relevant as well
https://bugs.eclipse.org/bugs/show_bug.cgi?id=75625.


Charles Martin wrote:
> Hi
> Are there any examples of custom widgets being made that are EMF-enabled that one can look at
>
> As a first step, I would like to create a view that has a table and also some text boxes
>
> I have an EMF model that contains a list of children (to be displayed in the table) and some attributes (to be display in the text boxes)
>
> I guess what I am thinking is to make an AdapterFactoryContentProvider that can provide content to the table and the text boxes. I am wondering if there is anything like that out there to look at
>
> Best wishes
>
> Charles
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417230 is a reply to message #417222] Mon, 03 March 2008 05:26 Go to previous messageGo to next message
Ron Bermejo is currently offline Ron BermejoFriend
Messages: 30
Registered: July 2009
Member
Ed Merks wrote:

> Charles,

> I've been looking at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=207324 and
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=220843 just this weekend.
> All the new data binding support seems relevant as well
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=75625.

Hi, Ed, Charles.

Now that you've mentioned databinding, it seems
https://bugs.eclipse.org/bugs/show_bug.cgi?id=144260 might be related,
too, if we want to perform cell editing.


Personally I like the AdapterFactory*Provider approach since we can add
adapter factories via extension points, so my tables can show any type of
data (future-proof = nice:)) . Thus it works well for me in the model->UI
direction.

Databinding adds UI->model updating, validation, but it doesn't seem
"unified" with the AdapterFactory approach. Currently I can only choose
one or the other. (e.g. either use
EMFObservables.observeList+ObservableListContentProvider, or use
AdapterFactoryContentProvider).

I vaguely wish there was a way I could get the best of both worlds, but
right now I have no idea how that API would look like. :)
[/off-topic]

-Ron

> Charles Martin wrote:
>> Hi
>> Are there any examples of custom widgets being made that are EMF-enabled
that one can look at
>>
>> As a first step, I would like to create a view that has a table and also
some text boxes
>>
>> I have an EMF model that contains a list of children (to be displayed in
the table) and some attributes (to be display in the text boxes)
>>
>> I guess what I am thinking is to make an AdapterFactoryContentProvider
that can provide content to the table and the text boxes. I am wondering if
there is anything like that out there to look at
>>
>> Best wishes
>>
>> Charles
>>
Re: custom widgets with EMF [message #417236 is a reply to message #417230] Mon, 03 March 2008 12:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Ron,

There's a lot of content in that bug and unfortunately I don't
understand data binding as well as I should. I was hoping Marcelo and
Dave could dive deeply into it, but that darned book is dragging on
forever. It's dragging on so long that it's starting to look like we'd
better include EMF 2.4 in the appendix (where including EMF 2.3 is
already a lot of work with all the generics). Anyway, enough whining.
It will be a best seller I'm sure!

I wonder if the whole topic is related to
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216748 as well? This
looks a bit like a failed approach, given Boris poked so many holes in
it. Or I wonder if the binding to a table couldn't simply take the
approach of being based on IPropertySource. I'm certainly open to
suggestions and contributions if you have any...


Ron Bermejo wrote:
> Ed Merks wrote:
>
>> Charles,
>
>> I've been looking at
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=207324 and
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=220843 just this
>> weekend. All the new data binding support seems relevant as well
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=75625.
>
> Hi, Ed, Charles.
>
> Now that you've mentioned databinding, it seems
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=144260 might be related,
> too, if we want to perform cell editing.
>
>
> Personally I like the AdapterFactory*Provider approach since we can
> add adapter factories via extension points, so my tables can show any
> type of data (future-proof = nice:)) . Thus it works well for me in
> the model->UI direction.
>
> Databinding adds UI->model updating, validation, but it doesn't seem
> "unified" with the AdapterFactory approach. Currently I can only
> choose one or the other. (e.g. either use
> EMFObservables.observeList+ObservableListContentProvider, or use
> AdapterFactoryContentProvider).
>
> I vaguely wish there was a way I could get the best of both worlds,
> but right now I have no idea how that API would look like. :)
> [/off-topic]
>
> -Ron
>
>> Charles Martin wrote:
>>> Hi
>>> Are there any examples of custom widgets being made that are
>>> EMF-enabled
> that one can look at
>>>
>>> As a first step, I would like to create a view that has a table
>>> and also
> some text boxes
>>>
>>> I have an EMF model that contains a list of children (to be
>>> displayed in
> the table) and some attributes (to be display in the text boxes)
>>>
>>> I guess what I am thinking is to make an
>>> AdapterFactoryContentProvider
> that can provide content to the table and the text boxes. I am
> wondering if there is anything like that out there to look at
>>>
>>> Best wishes
>>>
>>> Charles
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417257 is a reply to message #417236] Tue, 04 March 2008 08:00 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Wow...lots of reading :D

Actually, what I was thinking was something very simple, to handle the static cases I have

(Forgive me if this is repeated in the bugs or just naive)

The current mechanism for binding EMF models to JFace viewers is to add an interface to the specific ItemProviders
For example, in my case, I have

MyTableItemProvider implements ITableItemLabelProvider
(from org.eclipse.emf.edit.provider)

and to add this interface to the supportedTypes:

public MyAppItemProviderAdapterFactory() {
supportedTypes.add(ITableItemLabelProvider.class);
}


The problem is that this only works for the JFace Viewers, and what I want is to construct a View that has multiple JFace viewers in it. Use cases of complex views might include

(a) TableViewer + some Text Fields (what I need)
(b) Two tree Viewers
(c) List Viewer + Tree Viewer
(d) multiple Text Fields

I am assuming, however, that I have a singlke EMF model and that it maps naturally to these Views of the Model.
For example, my MyTable model includes some children and some attributes, and these children map naturally into a table row, and the attributes can be displayed in some text fields. Likewise for the other cases

Now imagine if I could define a custom interface for my view, such as IMyViewContentProvider so that MyTableItemProvider implements it.

IMyViewContentProvider might implement

getTableChildren(Object obj, int colIndex)
getText(Object obj)

My job should be to implement the logic that marshals these calls into the corresponding method on MyTableItemProviders:


getTableChilden(Object obj, int colIndex) {
return this.getChildren(obj, colIndex)
}

and

getText(Object obj) {
if (obj instanceof MyObj) return MyTable.getMyObj().getText()
}


The missing part is that it seems I would need to add my new interface to the AdapterFactoryItemDelegator , and then implement similar logic

...

although it is not entirely clear to me if that is all there is or what that logic should be

It also seems to me that if it is much more complicated than this, then something is off. I would think this is a common problem people have ?
Re: custom widgets with EMF [message #417263 is a reply to message #417257] Tue, 04 March 2008 11:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

Comments below.

Charles Martin wrote:
> Wow...lots of reading :D
>
> Actually, what I was thinking was something very simple, to handle the static cases I have
>
> (Forgive me if this is repeated in the bugs or just naive)
>
> The current mechanism for binding EMF models to JFace viewers is to add an interface to the specific ItemProviders
> For example, in my case, I have
>
> MyTableItemProvider implements ITableItemLabelProvider
> (from org.eclipse.emf.edit.provider)
>
> and to add this interface to the supportedTypes:
>
> public MyAppItemProviderAdapterFactory() {
> supportedTypes.add(ITableItemLabelProvider.class);
> }
>
>
> The problem is that this only works for the JFace Viewers, and what I want is to construct a View that has multiple JFace viewers in it.
Well, you'd use the same approach for each one.
> Use cases of complex views might include
>
> (a) TableViewer + some Text Fields (what I need)
> (b) Two tree Viewers
> (c) List Viewer + Tree Viewer
> (d) multiple Text Fields
>
EMF 2.4 includes support for data binding which is another useful
mechanism that can be applied for binding the values of features onto
specific controls for manipulating, such as text fields.
> I am assuming, however, that I have a singlke EMF model and that it maps naturally to these Views of the Model.
> For example, my MyTable model includes some children and some attributes, and these children map naturally into a table row, and the attributes can be displayed in some text fields. Likewise for the other cases
>
The table and table tree pretty much work like this already. The
regular item providers, without the ITableColumnItemProvider stuff, can
and are used to populate the rows of the table, and the first row can be
used to display the normal text and icons (as in a list or tree) for
those objects. The other columns can be used to display additional
information. With the two classes contributed to JFace, it will be
possible to create a column that corresponds exactly to a property you
can edit in the properties view. I.e., the column shows the value for
the property and supports a cell editor for editing it.
> Now imagine if I could define a custom interface for my view, such as IMyViewContentProvider so that MyTableItemProvider implements it.
>
> IMyViewContentProvider might implement
>
> getTableChildren(Object obj, int colIndex)
> getText(Object obj)
>
> My job should be to implement the logic that marshals these calls into the corresponding method on MyTableItemProviders:
>
>
> getTableChilden(Object obj, int colIndex) {
> return this.getChildren(obj, colIndex)
> }
>
> and
>
> getText(Object obj) {
> if (obj instanceof MyObj) return MyTable.getMyObj().getText()
> }
>
I don't think anything needs to be added to support this case. In fact,
I doubt you'd need to add anything this fancy. The existing item
provider stuff supports the structured viewing, and the combination of
properties support for data binding support deals with the finer grained
controls, like text fields, radio buttons, and so on.
>
> The missing part is that it seems I would need to add my new interface to the AdapterFactoryItemDelegator , and then implement similar logic
>
> ...
>
> although it is not entirely clear to me if that is all there is or what that logic should be
>
> It also seems to me that if it is much more complicated than this, then something is off. I would think this is a common problem people have ?
>
Yep, but I think the pieces are all in place already for it...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417277 is a reply to message #417263] Tue, 04 March 2008 16:11 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
I think I see this now

Let me ask you this, which is kinda related IU guess

Why doesn't the default ITableItemProvider provide some kind of configurable table cell editing?

Or does it?
Re: custom widgets with EMF [message #417278 is a reply to message #417277] Tue, 04 March 2008 16:19 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.
--------------010500030504040006020803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Charles,

EMF.Edit is designed to be platform neutral and hence has no
dependencies on JFace, SWT, or anything else GUI related. The generated
item providers too have no GUI or Eclipse dependencies. Integration
with Eclipse is provided in a layer on top of these. I.e., there is
support for cell editing via the Eclipse properties view, but that's
done in the EMF.Edit.UI layer. With the advent of ColumnViewers and the
support just committed to the platform for using
IPropertySource/IPropertyDescriptors for table columns, this support can
be reused for cell editing in tables simply by defining a property.
It's somewhat involved to provide custom cell editors, but definitely is
doable:

3.1 Recipe: Create your own property editor in a generated
application
< http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_your_own_ property_editor_in_a_generated_application>


Charles Martin wrote:
> I think I see this now
>
> Let me ask you this, which is kinda related IU guess
>
> Why doesn't the default ITableItemProvider provide some kind of configurable table cell editing?
>
> Or does it?
>


--------------010500030504040006020803
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">
Charles,<br>
<br>
EMF.Edit is designed to be platform neutral and hence has no
dependencies on JFace, SWT, or anything else GUI related.&nbsp; The
generated item providers too have no GUI or Eclipse dependencies.&nbsp;
Integration with Eclipse is provided in a layer on top of these.&nbsp; I.e.,
there is support for cell editing via the Eclipse properties view, but
that's done in the EMF.Edit.UI layer.&nbsp; With the advent of ColumnViewers
and the support just committed to the platform for using
IPropertySource/IPropertyDescriptors for table columns, this support
can be reused for cell editing in tables simply by defining a
property.&nbsp; It's somewhat involved to provide custom cell editors, but
definitely is doable:<br>
<blockquote><a
href=" http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_your_own_ property_editor_in_a_generated_application"><span
class="tocnumber">3.1</span> <span class="toctext">Recipe: Create
your own property editor in a generated application</span></a><br>
</blockquote>
<br>
Charles Martin wrote:
<blockquote
cite="mid:28511928.33431204647090606.JavaMail.root@cp1.dzone.com"
type="cite">
<pre wrap="">I think I see this now

Let me ask you this, which is kinda related IU guess

Why doesn't the default ITableItemProvider provide some kind of configurable table cell editing?

Or does it?
</pre>
</blockquote>
<br>
</body>
</html>

--------------010500030504040006020803--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417279 is a reply to message #417278] Tue, 04 March 2008 16:45 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Thanks...I'll have a look at this over the next few days and see if I can get the table cell editing working.

Where can I find out about ColumnViewers? The last time I had editable columns I had to add a selectionListener to the table, and then create custom textEditors on the selection...(i.e from the SWT snippets page)

BTW, is there an EMF snippets page somewhere?

Charles
Re: custom widgets with EMF [message #417280 is a reply to message #417279] Tue, 04 March 2008 16:53 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.
--------------000902080500080205040202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Charles,

Given the new classes in the platform, setting up a column that edits a
property is just a few lines of code:

| {
TreeColumn treeColumn = *new *TreeColumn(tree, SWT.NONE);
treeColumn.setText("Name");
treeColumn.setResizable(*true*);
treeColumn.setWidth(200);
TreeViewerColumn treeViewerColumn = *new *TreeViewerColumn(treeViewerWithColumns, treeColumn);
treeViewerColumn.setLabelProvider(*new *PropertyColumnLabelProvider(adapterFactoryContentProvider, "Name"));
treeViewerColumn.setEditingSupport(*new *PropertyEditingSupport(treeViewerWithColumns, adapterFactoryContentProvider, "Name"));
}|


I'm sure the platform has all kinds of snippets for this kind of thing,
but I don't know where. Tom often posts links to them...


Charles Martin wrote:
> Thanks...I'll have a look at this over the next few days and see if I can get the table cell editing working.
>
> Where can I find out about ColumnViewers? The last time I had editable columns I had to add a selectionListener to the table, and then create custom textEditors on the selection...(i.e from the SWT snippets page)
>
> BTW, is there an EMF snippets page somewhere?
>
> Charles
>


--------------000902080500080205040202
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">
Charles,<br>
<br>
Given the new classes in the platform, setting up a column that edits a
property is just a few lines of code:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </font><font
color="#000000">{</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">TreeColumn&nbsp;treeColumn&nbsp;=&nbsp; </font><font
color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">TreeColumn</font><font
color="#000000">(</font><font color="#000000">tree,&nbsp;SWT.NONE</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">treeColumn.setText</font><font
color="#000000">(</font><font color="#2a00ff">"Name"</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">treeColumn.setResizable</font><font
color="#000000">(</font><font color="#7f0055"><b>true</b></font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">treeColumn.setWidth</font><font
color="#000000">(</font><font color="#990000">200</font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000"> TreeViewerColumn&nbsp;treeViewerColumn&nbsp;=&nb sp; </font><font
color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">TreeViewerColumn</font><font
color="#000000">(</font><font color="#000000">treeViewerWithColumns,&nbsp;treeColumn </font><font
color="#000000">)</font><font color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">treeViewerColumn.setLabelProvider</font><font
color="#000000">(</font><font color="#7f0055"><b>new&nbsp;</b></font><font
color="#000000">PropertyColumnLabelProvider</font><font color="#000000">(</font><font
color="#000000">adapterFactoryContentProvider,&nbsp;</font ><font
color="#2a00ff">"Name"</font><font color="#000000">))</font><font
color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000000">treeViewerColumn.setEditingSupport</font> <font
color="#000000">(</font><font color="#7f0055"><b>new&nbsp;</b></font><font
color="#000000">PropertyEditingSupport</font><font color="#000000">(</font><font
color="#000000"> treeViewerWithColumns,&nbsp;adapterFactoryContentProvide r,&nbsp; </font><font
color="#2a00ff">"Name"</font><font color="#000000">))</font><font
color="#000000">;</font><br>
<font color="#ffffff"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </font><font color="#000000">}</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== --><br>
I'm sure the platform has all kinds of snippets for this kind of thing,
but I don't know where.&nbsp; Tom often posts links to them...<br>
<br>
<br>
Charles Martin wrote:
<blockquote
cite="mid:5130900.33621204649135507.JavaMail.root@cp1.dzone.com"
type="cite">
<pre wrap="">Thanks...I'll have a look at this over the next few days and see if I can get the table cell editing working.

Where can I find out about ColumnViewers? The last time I had editable columns I had to add a selectionListener to the table, and then create custom textEditors on the selection...(i.e from the SWT snippets page)

BTW, is there an EMF snippets page somewhere?

Charles
</pre>
</blockquote>
<br>
</body>
</html>

--------------000902080500080205040202--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417281 is a reply to message #417279] Tue, 04 March 2008 16:57 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Oh, I guess the EMF recipes page is a snippets page

Thanks
Re: custom widgets with EMF [message #417293 is a reply to message #417280] Tue, 04 March 2008 18:18 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
That looks quite helpful...

I assume you also have to follow the EMF recipe to get the editing support?

Or is the PropertyEditingSupport() a default editing implementation?
Re: custom widgets with EMF [message #417295 is a reply to message #417280] Tue, 04 March 2008 18:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ed Merks schrieb:
> Charles,
>
> Given the new classes in the platform, setting up a column that edits a
> property is just a few lines of code:
>
> | {
> TreeColumn treeColumn = *new *TreeColumn(tree, SWT.NONE);
> treeColumn.setText("Name");
> treeColumn.setResizable(*true*);
> treeColumn.setWidth(200);
> TreeViewerColumn treeViewerColumn = *new *TreeViewerColumn(treeViewerWithColumns, treeColumn);
> treeViewerColumn.setLabelProvider(*new *PropertyColumnLabelProvider(adapterFactoryContentProvider, "Name"));
> treeViewerColumn.setEditingSupport(*new *PropertyEditingSupport(treeViewerWithColumns, adapterFactoryContentProvider, "Name"));
> }|
>
>
> I'm sure the platform has all kinds of snippets for this kind of thing,
> but I don't know where. Tom often posts links to them...
>

We have plenty of them ;-) http://wiki.eclipse.org/JFaceSnippets. I
think we have a snippet for all our APIs, if something is missing let me
know and I'll try to create a snippet.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: custom widgets with EMF [message #417296 is a reply to message #417293] Tue, 04 March 2008 18:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

PropertyEditingSupport will delegate the editing callbacks to the
property descriptor so that the same cell editor that's used for editing
properties is used for the column. You'll have to get a very recent
Eclipse I Build to try this out.


Charles Martin wrote:
> That looks quite helpful...
>
> I assume you also have to follow the EMF recipe to get the editing support?
>
> Or is the PropertyEditingSupport() a default editing implementation?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417309 is a reply to message #417296] Wed, 05 March 2008 02:42 Go to previous messageGo to next message
Ron Bermejo is currently offline Ron BermejoFriend
Messages: 30
Registered: July 2009
Member
Ed Merks wrote:

> Charles,

> PropertyEditingSupport will delegate the editing callbacks to the
> property descriptor so that the same cell editor that's used for editing
> properties is used for the column. You'll have to get a very recent
> Eclipse I Build to try this out.

It's in I20080304-1113... Pretty fresh out of the oven :)

These classes should also work fine if you're using Eclipse 3.3.x / EMF
2.3.x.. I'd just copy-paste them as inner classes in my editor/view...

Ron
Re: custom widgets with EMF [message #417354 is a reply to message #417309] Thu, 06 March 2008 08:17 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Wow, this is pretty bleeding edge

Ok, let me ask about one more permutation of the original question.

Suppose I want to build a GUI with several different views of the same EMF model. Is it simply a matter of setting the selection in viewer:

currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true)

to the subset of the model?
Re: custom widgets with EMF [message #417362 is a reply to message #417354] Thu, 06 March 2008 13:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

No, the viewers have an input that control what's displayed. Setting
the selection just controls the selection within the established view's
contents.


Charles Martin wrote:
> Wow, this is pretty bleeding edge
>
> Ok, let me ask about one more permutation of the original question.
>
> Suppose I want to build a GUI with several different views of the same EMF model. Is it simply a matter of setting the selection in viewer:
>
> currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true)
>
> to the subset of the model?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417372 is a reply to message #417362] Thu, 06 March 2008 20:08 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Oops :P

Yeah, that's right. I need to stop posting at 3 am.

Seriously, this EMF stuff is great. I have been able to build a prototype app with almost no coding as compared to Swing. It is great!
Re: custom widgets with EMF [message #417373 is a reply to message #417372] Thu, 06 March 2008 21:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

Obviously I think EMF is pretty cool and I'm glad you think so too. And
unlike most code generators, it supports hand tailoring the code while
still allow you to regenerate it. You get the best of both worlds.
Things like GMF add some pretty sexy stuff on top too...


Charles Martin wrote:
> Oops :P
>
> Yeah, that's right. I need to stop posting at 3 am.
>
> Seriously, this EMF stuff is great. I have been able to build a prototype app with almost no coding as compared to Swing. It is great!
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417408 is a reply to message #417373] Fri, 07 March 2008 22:35 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Actually I have a question about this too...

When I modify my EMF models and regenerate the edit code, I lose some changes that I would like to preserve.

(1) I lose the ITableItemLabelProvider Interface on the ItemProviderAdapaters

(2) I lose the
supportedTypes.add(ITableItemLabelProvider.class);

in the constuctor for the ItemProviderAdapterFactory

Is there a simple way to preserve these?
Re: custom widgets with EMF [message #417409 is a reply to message #417408] Fri, 07 March 2008 23:47 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.
--------------090709090502050005020509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Charlies,

Comments below.

Charles Martin wrote:
> Actually I have a question about this too...
>
> When I modify my EMF models and regenerate the edit code, I lose some changes that I would like to preserve.
>
> (1) I lose the ITableItemLabelProvider Interface on the ItemProviderAdapaters
>
Here's an example:

|/**|
| * <!-- begin-user-doc -->|
| * A representation of the model object '<em><b>EEnum Literal</b></em>'.|
| * *@extends Enumerator*|
| * <!-- end-user-doc -->|||||
| */|
|*public interface *EEnumLiteral *extends *ENamedElement, *Enumerator*|
|{|

> (2) I lose the
> supportedTypes.add(ITableItemLabelProvider.class);
>
> in the constuctor for the ItemProviderAdapterFactory
>
> Is there a simple way to preserve these?
>
You can add "NOT" to the @generated to avoid it ever being regenerated
again.


--------------090709090502050005020509
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">
Charlies,<br>
<br>
Comments below.<br>
<br>
Charles Martin wrote:
<blockquote
cite="mid:28381931.34761204929374307.JavaMail.root@cp1.dzone.com"
type="cite">
<pre wrap="">Actually I have a question about this too...

When I modify my EMF models and regenerate the edit code, I lose some changes that I would like to preserve.

(1) I lose the ITableItemLabelProvider Interface on the ItemProviderAdapaters
</pre>
</blockquote>
Here's an example:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== --><!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top">
<blockquote><code><font color="#3f5fbf">/**</font></code><br>
<code><font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font
color="#7f7f9f">&lt;!--&nbsp;begin-user-doc&nbsp;--&gt; </font></code><br>
<code><font color="#ffffff">&nbsp;</font><font color="#3f5fbf"> *&nbsp;A&nbsp;representation&nbsp;of&nbsp;th e&nbsp;model&nbsp;object&nbsp;' </font><font
color="#7f7f9f">&lt;em&gt;&lt;b&gt;</font ><font color="#3f5fbf">EEnum&nbsp;Literal</font><font
color="#7f7f9f">&lt;/b&gt;&lt;/em&gt;</font ><font color="#3f5fbf">'.</font></code><br>
<code><font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;<b>@extends&nbsp;Enumerator </b></font></code><br>
<code><font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font
color="#7f7f9f">&lt;!--&nbsp;end-user-doc&nbsp;--&gt; </font></code><code></code><code><font
color="#3f5fbf"></font></code><br>
<code><font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*/</font></code><br>
<code><font color="#7f0055"><b>public&nbsp;interface&nbsp;</b ></font><font
color="#000000">EEnumLiteral&nbsp;</font><font color="#7f0055"><b>extends&nbsp;</b></font><font
color="#000000">ENamedElement,&nbsp;<b>Enumerator</b ></font></code><br>
<code><font color="#000000">{</font></code></blockquote>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== -->
<blockquote
cite="mid:28381931.34761204929374307.JavaMail.root@cp1.dzone.com"
type="cite">
<pre wrap="">
(2) I lose the
supportedTypes.add(ITableItemLabelProvider.class);

in the constuctor for the ItemProviderAdapterFactory

Is there a simple way to preserve these?
</pre>
</blockquote>
You can add "NOT" to the @generated to avoid it ever being regenerated
again.<br>
<br>
</body>
</html>

--------------090709090502050005020509--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417416 is a reply to message #417409] Mon, 10 March 2008 00:19 Go to previous messageGo to next message
Jim Steel is currently offline Jim SteelFriend
Messages: 54
Registered: July 2009
Member
Hi Charles,

I had this problem recently. What I did (and what I understand from Ed's
answer) is just use @generated NOT, on the ItemProvider class in (1) and
in the ItemProviderAdapterFactory constructor for (2).

One trick that I found, in the case of (1), though, is that when you
change your metamodel, you need to be careful about the ItemProvider
classes when you regenerate, because the @generated NOT applies to the
whole class, not just the declaration/extends/inherits line.

If the metamodel change effects the class with the additional Item/Label
Provider interfaces, then you need to regenerate the ItemProvider fully,
in order to get generated methods like addXPropertyDescriptor(), then
re-add the additional interfaces to the inherits clause. Its a pain, but
not having the property descriptor methods is (potentially) worse.

If Ed or someone else wants to tell me a better way, I'm happy to hear it.

Cheers,

Jim.




Ed Merks wrote:
> Charlies,
>
> Comments below.
>
> Charles Martin wrote:
>> Actually I have a question about this too...
>>
>> When I modify my EMF models and regenerate the edit code, I lose some changes that I would like to preserve.
>>
>> (1) I lose the ITableItemLabelProvider Interface on the ItemProviderAdapaters
>>
> Here's an example:
>
> |/**|
> | * <!-- begin-user-doc -->|
> | * A representation of the model object '<em><b>EEnum Literal</b></em>'.|
> | * *@extends Enumerator*|
> | * <!-- end-user-doc -->|||||
> | */|
> |*public interface *EEnumLiteral *extends *ENamedElement, *Enumerator*|
> |{|
>
>> (2) I lose the
>> supportedTypes.add(ITableItemLabelProvider.class);
>>
>> in the constuctor for the ItemProviderAdapterFactory
>>
>> Is there a simple way to preserve these?
>>
> You can add "NOT" to the @generated to avoid it ever being regenerated
> again.
>
Re: custom widgets with EMF [message #417418 is a reply to message #417416] Mon, 10 March 2008 12:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Jim,

Comments below.

Jim Steel wrote:
>
> Hi Charles,
>
> I had this problem recently. What I did (and what I understand from
> Ed's answer) is just use @generated NOT, on the ItemProvider class in
> (1) and in the ItemProviderAdapterFactory constructor for (2).
An @generated NOT (as opposed to say @generated not) on a class or
interface has special meaning. It blocks all merging for the entire
class Just using "@generated not" just blocks merging for the
class/interface itself, but not for the nested contents. Using
@extends/@implements is much better, since all merging behavior is
preserved. It's also important when building a model from @model
annotations, since it will instruct the JavaEcoreBuilder that the
classes/interfaces mentioned in the @extends are not part of the model....
>
> One trick that I found, in the case of (1), though, is that when you
> change your metamodel, you need to be careful about the ItemProvider
> classes when you regenerate, because the @generated NOT applies to the
> whole class, not just the declaration/extends/inherits line.
Yes. That's generally a bad thing. So use it with caution.
>
> If the metamodel change effects the class with the additional
> Item/Label Provider interfaces, then you need to regenerate the
> ItemProvider fully, in order to get generated methods like
> addXPropertyDescriptor(), then re-add the additional interfaces to the
> inherits clause. Its a pain, but not having the property descriptor
> methods is (potentially) worse.
>
> If Ed or someone else wants to tell me a better way, I'm happy to hear
> it.
I think I tried to explain the better way with @extends. Using
@generated NOT on and interface or class is pretty much the worst way
for the reasons you've spelled out.
>
> Cheers,
>
> Jim.
>
>
>
>
> Ed Merks wrote:
>> Charlies,
>>
>> Comments below.
>>
>> Charles Martin wrote:
>>> Actually I have a question about this too...
>>>
>>> When I modify my EMF models and regenerate the edit code, I lose
>>> some changes that I would like to preserve.
>>> (1) I lose the ITableItemLabelProvider Interface on the
>>> ItemProviderAdapaters
>>>
>> Here's an example:
>>
>> |/**|
>> | * <!-- begin-user-doc -->|
>> | * A representation of the model object '<em><b>EEnum
>> Literal</b></em>'.|
>> | * *@extends Enumerator*|
>> | * <!-- end-user-doc -->|||||
>> | */|
>> |*public interface *EEnumLiteral *extends *ENamedElement,
>> *Enumerator*|
>> |{|
>>
>>> (2) I lose the supportedTypes.add(ITableItemLabelProvider.class);
>>>
>>> in the constuctor for the ItemProviderAdapterFactory
>>>
>>> Is there a simple way to preserve these?
>>>
>> You can add "NOT" to the @generated to avoid it ever being
>> regenerated again.
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417448 is a reply to message #417416] Mon, 10 March 2008 22:22 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Great feedback, thanks

So it looks like there are 5 possible answers to my question:

@generated NOT (do not use, turns off all merging/code generation, which is neeeded?)

@generated not (useful - turns merging off for class and interface, but not nested classes ? Not 100% what is changed, what is not?)

@extends (best choice--preserves all merging behavior)

@implements (? what does this do?)

@generated (change by hand - pain in the rear)

I can't say I fully understand the differences...is there a good place where this is documented? I'll check the book (of course)
Re: custom widgets with EMF [message #417450 is a reply to message #417448] Mon, 10 March 2008 23:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

Comments below.

Charles Martin wrote:
> Great feedback, thanks
>
> So it looks like there are 5 possible answers to my question:
>
> @generated NOT (do not use, turns off all merging/code generation, which is neeeded?)
>
Use only if you intend to maintain all code in this file by hand.
> @generated not (useful - turns merging off for class and interface, but not nested classes ? Not 100% what is changed, what is not?)
>
Use this to control by hand everything related to extends/implements for
this class header.
> @extends (best choice--preserves all merging behavior)
>
All changes to the class' super types will be reflected in the generated
result. There will be no confusion over what's in the model and what's
added by hand for interfaces with @model annotations.
> @implements (? what does this do?)
>
Same as @extends but in a class it's an "implements" clause that appears
rather than an "extends" one as appears in the interface. The two are
synonyms to reflect the variations in the Java syntax for class and
interface.
> @generated (change by hand - pain in the rear)
>
> I can't say I fully understand the differences...is there a good place where this is documented? I'll check the book (of course)
>
Yes, the book of course. Anything other than @generated followed by
whitespace is not the same as @generated all by itself. Only @generated
without something else will be replaced with generated results.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417486 is a reply to message #417450] Thu, 13 March 2008 05:32 Go to previous messageGo to next message
Charles H Martin is currently offline Charles H MartinFriend
Messages: 79
Registered: July 2009
Member
Some more questions about custom widgets...

Is there a natural way to map part of an EMF model to a Table ColumnHeader, so that the header will change when the EMF model changes?
Re: custom widgets with EMF [message #417496 is a reply to message #417486] Thu, 13 March 2008 12:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Charles,

In some of the sample code of one of those bugzillas I collected the
union of the properties of the elements being shown in the table,
created a column for each uniquely identified property, and made the
column name the display name of that property. There are no label
provider APIs in JFace (at least I think there aren't) for controlling
the title titles. It seems most common that the column titles are fixed
and only the values within the table changes...

Charles Martin wrote:
> Some more questions about custom widgets...
>
> Is there a natural way to map part of an EMF model to a Table ColumnHeader, so that the header will change when the EMF model changes?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #417502 is a reply to message #417496] Thu, 13 March 2008 12:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ed Merks schrieb:
> Charles,
>
> In some of the sample code of one of those bugzillas I collected the
> union of the properties of the elements being shown in the table,
> created a column for each uniquely identified property, and made the
> column name the display name of that property. There are no label
> provider APIs in JFace (at least I think there aren't) for controlling
> the title titles. It seems most common that the column titles are fixed

That's correct, we don't have an API. The best idea IMHO would be to
write an TableColumnTextObservable and use databinding.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: custom widgets with EMF [message #425874 is a reply to message #417362] Wed, 10 December 2008 17:30 Go to previous messageGo to next message
Jonas Wolf is currently offline Jonas WolfFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

I'd like to step in here again, because I think the question about
several different views on one model was not answered yet.
But this is what I am currently looking for. How to do this?
Any hints, links or snippets are highly appreciated.
Thanks in advance and sorry for being stupid if this question is already
answered somewhere or just trivial.

jonas

Ed Merks wrote:
> Charles,
>
> No, the viewers have an input that control what's displayed. Setting
> the selection just controls the selection within the established view's
> contents.
>
>
> Charles Martin wrote:
>> Wow, this is pretty bleeding edge
>>
>> Ok, let me ask about one more permutation of the original question.
>>
>> Suppose I want to build a GUI with several different views of the same
>> EMF model. Is it simply a matter of setting the selection in viewer:
>>
>> currentViewer.setSelection(new
>> StructuredSelection(theSelection.toArray()), true)
>>
>> to the subset of the model?
>>
Re: custom widgets with EMF [message #425878 is a reply to message #425874] Wed, 10 December 2008 19:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Jonas,

Are you having a specific problem? It would help to provide some
details of what you're trying to achieve...

Generally the content/label provider delegates via the adapter factory
to item providers, so to specialize what a view shows, you'd specialize
the item providers. If you want multiple different "views" you'd need
multiple specialized factories that create different specialized item
providers. XSDSemanticItemProviderAdapterFactory is a specific example
of a specialized "semantic" verses "concrete syntax" view of the XSD
model...


Jonas Wolf wrote:
> Hi,
>
> I'd like to step in here again, because I think the question about
> several different views on one model was not answered yet.
> But this is what I am currently looking for. How to do this?
> Any hints, links or snippets are highly appreciated.
> Thanks in advance and sorry for being stupid if this question is
> already answered somewhere or just trivial.
>
> jonas
>
> Ed Merks wrote:
>> Charles,
>>
>> No, the viewers have an input that control what's displayed. Setting
>> the selection just controls the selection within the established
>> view's contents.
>>
>>
>> Charles Martin wrote:
>>> Wow, this is pretty bleeding edge
>>>
>>> Ok, let me ask about one more permutation of the original question.
>>>
>>> Suppose I want to build a GUI with several different views of the
>>> same EMF model. Is it simply a matter of setting the selection in
>>> viewer:
>>>
>>> currentViewer.setSelection(new
>>> StructuredSelection(theSelection.toArray()), true)
>>>
>>> to the subset of the model?
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #425881 is a reply to message #425878] Wed, 10 December 2008 22:17 Go to previous messageGo to next message
Jonas Wolf is currently offline Jonas WolfFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

thanks for the fast reply. I just liked to know the general way to go.
I think you answered my question, but just to see, if I got you right:
I got an EMF model.
I'd like to have an multipage editor where on one page one part of the
model is displayed/edited.
On the other page another part of the model is displayed/edited.
To do that I need one editing domain?
But two different item providers/factories?
I could e.g. create two different ComposedAdapterFactory objects for the
content and label providers for the JFace viewers?
Like in:
viewer.setContentProvider(new
AdapterFactoryContentProvider(myAdapterFactory));
where myAdapterFactory has the according AdapterFactory registered.

I had a brief look at the XSDSemanticItemProviderAdapterFactory and
XSDItemProviderAdapterFactory. Are these the different factories for the
two different views?
Is this sufficient information for my questions? I will try to create some
snippets this week, if it is helpful.
Thanks again.

jonas
Re: custom widgets with EMF [message #425883 is a reply to message #425881] Wed, 10 December 2008 23:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Jonas,

Comments below.

Jonas Wolf wrote:
> Hi,
>
> thanks for the fast reply. I just liked to know the general way to go.
> I think you answered my question, but just to see, if I got you right:
> I got an EMF model.
> I'd like to have an multipage editor where on one page one part of the
> model is displayed/edited.
> On the other page another part of the model is displayed/edited. To
> do that I need one editing domain?
You always should have only one editing domain.
> But two different item providers/factories?
What you described might well be just views with different input objects
all based on a simple common factory.
> I could e.g. create two different ComposedAdapterFactory objects for
> the content and label providers for the JFace viewers?
> Like in:
> viewer.setContentProvider(new
> AdapterFactoryContentProvider(myAdapterFactory));
> where myAdapterFactory has the according AdapterFactory registered.
>
> I had a brief look at the XSDSemanticItemProviderAdapterFactory and
> XSDItemProviderAdapterFactory. Are these the different factories for
> the two different views?
Yes, in the Sample XSD Editor, you'll see it's used to provide the view
on the Semantics tab.
> Is this sufficient information for my questions? I will try to create
> some snippets this week, if it is helpful.
Try-and-see is the best approach. Be sure to check out all the tabs in
the default generated editor and understand what they are doing based on
selections in the outline view...
> Thanks again.
>
> jonas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: custom widgets with EMF [message #425937 is a reply to message #425883] Fri, 12 December 2008 14:21 Go to previous message
Jonas Wolf is currently offline Jonas WolfFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

thanks for the hint to check how the outline view and the selection is done.
This answered a lot of questions.
thanks

jonas


Ed Merks wrote:
> Jonas,
>
> Comments below.
>
> Jonas Wolf wrote:
>> Hi,
>>
>> thanks for the fast reply. I just liked to know the general way to go.
>> I think you answered my question, but just to see, if I got you right:
>> I got an EMF model.
>> I'd like to have an multipage editor where on one page one part of the
>> model is displayed/edited.
>> On the other page another part of the model is displayed/edited. To
>> do that I need one editing domain?
> You always should have only one editing domain.
>> But two different item providers/factories?
> What you described might well be just views with different input objects
> all based on a simple common factory.
>> I could e.g. create two different ComposedAdapterFactory objects for
>> the content and label providers for the JFace viewers?
>> Like in:
>> viewer.setContentProvider(new
>> AdapterFactoryContentProvider(myAdapterFactory));
>> where myAdapterFactory has the according AdapterFactory registered.
>>
>> I had a brief look at the XSDSemanticItemProviderAdapterFactory and
>> XSDItemProviderAdapterFactory. Are these the different factories for
>> the two different views?
> Yes, in the Sample XSD Editor, you'll see it's used to provide the view
> on the Semantics tab.
>> Is this sufficient information for my questions? I will try to create
>> some snippets this week, if it is helpful.
> Try-and-see is the best approach. Be sure to check out all the tabs in
> the default generated editor and understand what they are doing based on
> selections in the outline view...
>> Thanks again.
>>
>> jonas
>>
Previous Topic:[CDO/EMF] Missing serialized package: myPackage.ecore
Next Topic:Problem with multiple ecore EMF model
Goto Forum:
  


Current Time: Tue Apr 23 17:50:10 GMT 2024

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

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

Back to the top