Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Change Property(How to change a property ... of a property)
Change Property [message #1700540] Fri, 03 July 2015 12:07 Go to next message
Markus Schuss is currently offline Markus SchussFriend
Messages: 6
Registered: May 2015
Junior Member
Hi,

I created a class which has a property called configuration (with a couple of reals, integers and so on as I cannot assign them to the class directly it seems) which represent the default parameters for that class.
Next I created a second class which has a property of that class type and now I want to change the configuration (basically calling the constructor with different values than the default ones).
Could anyone explain to me how because I can't seem to figure that one out.

Thanks in advance
Markus
Re: Change Property [message #1700551 is a reply to message #1700540] Fri, 03 July 2015 13:40 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Markus,

If you have a class named "MyConfiguration" with attributes like, say,

+ aReal : Real
+ anotherReal : Real
+ anInteger : Integer
etc.

and a class Foo that has a property like

+ configuration : MyConfiguration

then Foo::configuration can have a defaultValue that is an
InstanceValue referencing an InstanceSpecification in which:

* MyConfiguration is a classifier of the instance spec
* the instance spec has a Slot for each of the properties of
MyConfiguration for which
you want it to provide a value
* each slot of the InstanceSpecification has an appropriate value
specification, such
as LiteralReal, LiteralInteger, even more InstanceValues for
properties of class type

The instance specification would be defined in the same package as the
Foo class.

I'm going out on a limb guessing at what you're actually trying to do.
You may need to be more specific in the description of your problem.

HTH,

Christian


On 2015-07-03 12:07:17 +0000, Markus Schuss said:

> Hi,
>
> I created a class which has a property called configuration (with a
> couple of reals, integers and so on as I cannot assign them to the
> class directly it seems) which represent the default parameters for
> that class.
> Next I created a second class which has a property of that class type
> and now I want to change the configuration (basically calling the
> constructor with different values than the default ones).
> Could anyone explain to me how because I can't seem to figure that one out.
>
> Thanks in advance
> Markus
Re: Change Property [message #1700638 is a reply to message #1700551] Mon, 06 July 2015 05:04 Go to previous messageGo to next message
Markus Schuss is currently offline Markus SchussFriend
Messages: 6
Registered: May 2015
Junior Member
Thanks for your reply,

My main problem is that the class Foo as well as MyConfiguration would reside in a read only library (from a plugin). I merely create a class which then has a property of type Foo (which then has a property configuration) which I can't seem to change anything of (since read only). My main question was if there is a way to overwrite a defaultValue (maybe that is what you are trying to explain, if so I may not have understood you properly, sorry).

Thanks in advance
Markus
Re: Change Property [message #1700680 is a reply to message #1700638] Mon, 06 July 2015 12:35 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Markus,

Okay, that sounds like something different.

A subclass can redefine an inherited to property to change various of
its attributes, including type, multiplicity, derivedness, and also the
default value.

So, if class Foo has an attribute myConfig of type MyConfiguration, a
subclass SubFoo having a generalization relationship to Foo can define
an attribute myConfig that redefines Foo::myConfig (actually
referencing it in the 'redefines' table in the property sheet). Then
SubFoo::myConfig can define its own defaultValue that supersedes the
inherited defaultValue.

HTH,

Christian

On 2015-07-06 05:04:59 +0000, Markus Schuss said:

> Thanks for your reply,
>
> My main problem is that the class Foo as well as MyConfiguration would
> reside in a read only library (from a plugin). I merely create a class
> which then has a property of type Foo (which then has a property
> configuration) which I can't seem to change anything of (since read
> only). My main question was if there is a way to overwrite a
> defaultValue (maybe that is what you are trying to explain, if so I may
> not have understood you properly, sorry).
>
> Thanks in advance
> Markus
Previous Topic:customizing appearance of Properties view
Next Topic:Error when trying to reimplement BlockPropertyCompositeEditPart
Goto Forum:
  


Current Time: Thu Apr 18 23:06:46 GMT 2024

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

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

Back to the top