Change slot's enumeration literal

General discussions about code engineering

Moderator: Moderators

Change slot's enumeration literal

Postby jonas.schuderer@siemens.com » Wed Dec 05, 2012 6:44 am

Hi,
I'm looking for a way to change the value of a property "proper" of class Enumeration with its Literals "a", "b" and "c".
Situation is as follows: I have a checkbox "check" and a button "click". on clicking the button i want the checkbox to be checked for selection and if it is selected I want "proper"'s value to be changed to "a".
What I tried is
Code: Select all
click.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
  if(check.isSelected())
   {
   for(Property property : properties)
   {
     String propName = property.getName();
       Slot slot = StereotypesHelper.getSlot(mem, property, false, false);
                Object value = ModelHelper.getValueBySlot(slot);
                if(value instanceof EnumerationLiteral){
    EnumerationLiteral lit = (EnumerationLiteral) value;
     if(propName.equals("proper") )
        {
      StereotypesHelper.setStereotypePropertyValue(mem, stereotype, "a", lit);
                     }
                }
   }
   }});

However, this doesn't affect the EnumerationLiteral.
Can you help me out?
Thx in andvance
Jonas
jonas.schuderer@siemens.com
Forum Beginner
Forum Beginner
 
Posts: 31
Posts Rating:0
Joined: Wed Dec 07, 2011 1:44 am

Re: Change slot's enumeration literal

Postby marlel » Fri Dec 07, 2012 5:55 am

Hello,

Please attach the sample project with explanation.
Best regards,
Martynas
marlel
No Magic
No Magic
 
Posts: 386
Posts Rating:25
Joined: Wed Jul 11, 2012 2:31 am


Return to Code engineering

Who is online

Users browsing this forum: No registered users and 0 guests