How to achieve basetype selection in the gmfeditors properties view? [message #166972] |
Sat, 05 January 2008 07:09  |
Eclipse User |
|
|
|
Originally posted by: martin.baus.web.de
Hi,
I'm working on an graphical sql editor and try to make it possible for the
user to select the columntype of a tablecolumn either from some basetypes
or from userdefined types.
The semantic is, that a tablecolumn has a EReference to an interface
iDatatype with containment set to false, because userdefined types (e.g.
distincttypes) can be used in several different columns. But the
basetypes, e.g. decimal(precision,scale) are a kind of primitive types
with additional properties. The problem is that for now, before I can
assign e.g. a decimal as the columntype in the combobox of gmfeditor's
propertiesview, I first have to create an instance of the decimal type.
But I would like to have a selection of all basetypes and all instances of
actual userdefinedtypes.
Here is cutout of my actual view of the metamodel for this:
|===============|
|======| hasColumntype |=========|<|---------------|decimal |
|table |------------------>|iDatatype| |---------------|
|column| 1..1| | |precision : int|
|======| | | |scale : int |
| | |===============|
| |
| | |===============|
|=========|<|---------------|Distincttype |
|---------------|
|name : string |
|===============|
I already tried to model the basetypes as EDatatypes, but then they can't
have additional properties and they cannot inherit from iDatatype, too.
Is there a way to achieve this, preferably by changing the metamodel? Or
is there another trick doing this?
Thanks for your help.
Martin Baus
|
|
|
|
|
|
|
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167269 is a reply to message #167172] |
Tue, 08 January 2008 03:39   |
Eclipse User |
|
|
|
Originally posted by: martin.baus.web.de
Hello Alex,
yes, sorry, I didn't make myself clear. If there isn't another
possibility, the user should create a new instance of
iDatatype<decimal(precision,scale)> or he chooses an already created
instance of a user-defined type, e.g. <Datatype<DistinctType:Euro>.
Maybe a simplified diagram can make this more understandable:
Sofar the user created these instances:
|=========| |==============|
|<Table> | <Column> |<TableColumn> |
|Employees|------------->|Salary |
|=========| |--------------|
|Columntype : ?|
|==============|
|==============|
|<DistinctType>|
|Euro |
|==============|
Now what the user needs to do next is to assign an iDatatype to the
Columntype Reference in the TableColumn "Salary".
For this he should be able to choose in the PropertiesView of the
TableColumn "Salary" in the Columntype Combobox one of the existing
distinct-types (here only "Euro") or one of the basetypes (e.g.
decimal(precision,scale), varchar(length), boolean,...).
Well, at the moment in my implementation, the user could only choose the
"Euro"type, because there are no instances of any basetypes.
The final TableColumn "Salary" could then look like this:
|=================|
|<TableColumn> |
|Salary |
|-----------------|
|Columntype : Euro|
|=================|
or
|=========================|
|<TableColumn> |
|Salary |
|-------------------------|
|Columntype : Decimal(5,2)|
|=========================|
My trouble is, I don't know if there is any possibilty to achieve a
selection of iDatatypes as a combination of user-defined type instances
(e.g. "Euro") and basetype meta-instances (e.g.
"decmal(precision,scale)"). And if this could be done, is it then possible
to assign any properties, e.g. precision and scale, to a basetype?
Thanks for your time.
-------------
Martin Baus
|
|
|
|
Re: How to achieve basetype selection in the gmfeditors propertiesview? [message #167610 is a reply to message #167254] |
Thu, 10 January 2008 11:22  |
Eclipse User |
|
|
|
Hello Tomas,
Well, AFAIK all you need is just load corresponding model into ResourceSet
on editor start. Currently you can do it by using "LoadResource" popup menu
action, but if you need to do it automatically - just modify generated ???DocumentProvider
where new EditingDomain & ResourceSet will be created..
Or did I missed something?
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.04546 seconds