Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IMP » What is a ModelTreeNode category?
What is a ModelTreeNode category? [message #25963] Fri, 28 November 2008 17:06 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I would like to be able to enhance an outline with a 'category'
on labels so that an outline might appear as:
<if> ...
<then> ...
<else> ...

with the ... provided by a standard label provider and the
<then> provided by a prefix.

A plausible approach might be to create a PrefixedModelTreeNode.
However this is a bit klunky since new ModelTreeNode occurs in many
places; factoring creation into a createTreeItem() would help.
A derived ModelTreeNode is actually impossible since nodes are
maintained in an array rather than a list. Gioven the use of an
arraycopy for each addition it is far from clear that the array
gives a performance benefit.

So perhaps the category integer could be annexed by creating an
integer-to-prefix string map; but who else uses categories, so
how can the category integers avoid conflict?

Regards

Ed Willink
Re: What is a ModelTreeNode category? [message #26296 is a reply to message #25963] Mon, 09 February 2009 16:31 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Ed Willink wrote:

[Sorry for the delay in responding; we've been very busy
working on various aspects of the next release over the last
couple of months.]

To answer the subject question, a ModelTreeNode category is a
category associated with a given ModelTreeNode. It's presently
used to permit the grouping of sets of related items in the
Outline view.

> I would like to be able to enhance an outline with a 'category'
> on labels so that an outline might appear as:
> <if> ...
> <then> ...
> <else> ...
>
> with the ... provided by a standard label provider and the
> <then> provided by a prefix.

The issue here is that what gets handed to a LabelProvider is
*not* a ModelTreeNode, but rather the AST that the ModelTreeNode
represents.

I think that you might be able to achieve the effect you want
if you could (optionally) use a different LabelProvider just for
the Outline view, and that LabelProvider could supply the prefix
as well as the rest of the label in your example.

This augmented LabelProvider could always instantiate the "normal"
LabelProvider implementation, and add to whatever it produces.

Does that sound like it addresses your need?

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: What is a ModelTreeNode category? [message #26411 is a reply to message #26296] Tue, 10 February 2009 09:18 Go to previous messageGo to next message
Jin Missing name is currently offline Jin Missing nameFriend
Messages: 100
Registered: July 2009
Senior Member
seem good news. how about the next release?:)


"Robert M. Fuhrer" <rfuhrer@watson.ibm.com>
??????:49905A5E.70304@watson.ibm.com...
> Ed Willink wrote:
>
> [Sorry for the delay in responding; we've been very busy
> working on various aspects of the next release over the last
> couple of months.]
>
> To answer the subject question, a ModelTreeNode category is a
> category associated with a given ModelTreeNode. It's presently
> used to permit the grouping of sets of related items in the
> Outline view.
>
>> I would like to be able to enhance an outline with a 'category'
>> on labels so that an outline might appear as:
>> <if> ...
>> <then> ...
>> <else> ...
>>
>> with the ... provided by a standard label provider and the
>> <then> provided by a prefix.
>
> The issue here is that what gets handed to a LabelProvider is
> *not* a ModelTreeNode, but rather the AST that the ModelTreeNode
> represents.
>
> I think that you might be able to achieve the effect you want
> if you could (optionally) use a different LabelProvider just for
> the Outline view, and that LabelProvider could supply the prefix
> as well as the rest of the label in your example.
>
> This augmented LabelProvider could always instantiate the "normal"
> LabelProvider implementation, and add to whatever it produces.
>
> Does that sound like it addresses your need?
>
> --
> Cheers,
> -- Bob
>
> --------------------------------
> Robert M. Fuhrer
> Research Staff Member
> Programming Technologies Dept.
> IBM T.J. Watson Research Center
>
> IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
> X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: What is a ModelTreeNode category? [message #26446 is a reply to message #26296] Tue, 10 February 2009 17:56 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Robert

> I think that you might be able to achieve the effect you want
> if you could (optionally) use a different LabelProvider just for
> the Outline view, and that LabelProvider could supply the prefix
> as well as the rest of the label in your example.
>
> This augmented LabelProvider could always instantiate the "normal"
> LabelProvider implementation, and add to whatever it produces.
>
> Does that sound like it addresses your need?

My primary concern was what is the semantic definition of a category
and who uses it for what, and so to what extent other usages could hijack
it for other purposes. It would be helpful to find the intended usage documented
near the ModelTreeNode.fCategory declaration.

I discovered empirically that I could indeed create an Integer to
MyFormattingAlgorithm mapping and thereby annotate ModelTreeNode
with a required behaviour. I exploit the empirical observation that
0 is the default so I can start my 'algorithm's at 1.

I dislike my empirical approach, because you may break it in a future
release, and I have exploited the only avenue by which extensions of
my code can extend.

The real problem is that IMP supports extension by services
but ignores extension by inheritance. Thus creation of a derived
of ModelTreeNode is not feasible. If this is really required it would
be helpful for a ModelTreeNode to have a counterpart to the
org.eclipse.swt.widgets.Widget.data Object for application
usage. Arguably this is just a redesignation of category as Object rather
than int. Alternatively/additionally a standard Eclipse idiom such as
Adapters could be permitted.

Regards

Ed Willink
Re: What is a ModelTreeNode category? [message #574794 is a reply to message #25963] Mon, 09 February 2009 16:31 Go to previous message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Ed Willink wrote:

[Sorry for the delay in responding; we've been very busy
working on various aspects of the next release over the last
couple of months.]

To answer the subject question, a ModelTreeNode category is a
category associated with a given ModelTreeNode. It's presently
used to permit the grouping of sets of related items in the
Outline view.

> I would like to be able to enhance an outline with a 'category'
> on labels so that an outline might appear as:
> <if> ...
> <then> ...
> <else> ...
>
> with the ... provided by a standard label provider and the
> <then> provided by a prefix.

The issue here is that what gets handed to a LabelProvider is
*not* a ModelTreeNode, but rather the AST that the ModelTreeNode
represents.

I think that you might be able to achieve the effect you want
if you could (optionally) use a different LabelProvider just for
the Outline view, and that LabelProvider could supply the prefix
as well as the rest of the label in your example.

This augmented LabelProvider could always instantiate the "normal"
LabelProvider implementation, and add to whatever it produces.

Does that sound like it addresses your need?

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: What is a ModelTreeNode category? [message #574835 is a reply to message #26296] Tue, 10 February 2009 09:18 Go to previous message
Jin Missing name is currently offline Jin Missing nameFriend
Messages: 100
Registered: July 2009
Senior Member
seem good news. how about the next release?:)


"Robert M. Fuhrer" <rfuhrer@watson.ibm.com>
??????:49905A5E.70304@watson.ibm.com...
> Ed Willink wrote:
>
> [Sorry for the delay in responding; we've been very busy
> working on various aspects of the next release over the last
> couple of months.]
>
> To answer the subject question, a ModelTreeNode category is a
> category associated with a given ModelTreeNode. It's presently
> used to permit the grouping of sets of related items in the
> Outline view.
>
>> I would like to be able to enhance an outline with a 'category'
>> on labels so that an outline might appear as:
>> <if> ...
>> <then> ...
>> <else> ...
>>
>> with the ... provided by a standard label provider and the
>> <then> provided by a prefix.
>
> The issue here is that what gets handed to a LabelProvider is
> *not* a ModelTreeNode, but rather the AST that the ModelTreeNode
> represents.
>
> I think that you might be able to achieve the effect you want
> if you could (optionally) use a different LabelProvider just for
> the Outline view, and that LabelProvider could supply the prefix
> as well as the rest of the label in your example.
>
> This augmented LabelProvider could always instantiate the "normal"
> LabelProvider implementation, and add to whatever it produces.
>
> Does that sound like it addresses your need?
>
> --
> Cheers,
> -- Bob
>
> --------------------------------
> Robert M. Fuhrer
> Research Staff Member
> Programming Technologies Dept.
> IBM T.J. Watson Research Center
>
> IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
> X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: What is a ModelTreeNode category? [message #574851 is a reply to message #26296] Tue, 10 February 2009 17:56 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Robert

> I think that you might be able to achieve the effect you want
> if you could (optionally) use a different LabelProvider just for
> the Outline view, and that LabelProvider could supply the prefix
> as well as the rest of the label in your example.
>
> This augmented LabelProvider could always instantiate the "normal"
> LabelProvider implementation, and add to whatever it produces.
>
> Does that sound like it addresses your need?

My primary concern was what is the semantic definition of a category
and who uses it for what, and so to what extent other usages could hijack
it for other purposes. It would be helpful to find the intended usage documented
near the ModelTreeNode.fCategory declaration.

I discovered empirically that I could indeed create an Integer to
MyFormattingAlgorithm mapping and thereby annotate ModelTreeNode
with a required behaviour. I exploit the empirical observation that
0 is the default so I can start my 'algorithm's at 1.

I dislike my empirical approach, because you may break it in a future
release, and I have exploited the only avenue by which extensions of
my code can extend.

The real problem is that IMP supports extension by services
but ignores extension by inheritance. Thus creation of a derived
of ModelTreeNode is not feasible. If this is really required it would
be helpful for a ModelTreeNode to have a counterpart to the
org.eclipse.swt.widgets.Widget.data Object for application
usage. Arguably this is just a redesignation of category as Object rather
than int. Alternatively/additionally a standard Eclipse idiom such as
Adapters could be permitted.

Regards

Ed Willink
Previous Topic:Pros and cons with projects xtext and imp
Next Topic:lastest lpg release + IMP = failure
Goto Forum:
  


Current Time: Thu Mar 28 11:37:38 GMT 2024

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

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

Back to the top