If you are looking at the source code of the TransitionEditPart class where the connection label is computed, you will noticed that the right part is used to show the "Effect" of the Transition : and you need to define an OpaqueBehavior as the effect property of the Transition :

    private void updateNameLabel()
    {
        String trigger = computeTrigger();
        String guard = computeGuard();
        String effect = computeEffect();

        String result = "";
        if (trigger != null)
        {
            result = result.concat(trigger);
        }
        if (guard != null)
        {
            result = result.concat("[").concat(guard).concat("]");
        }
        if (effect != null)
        {
            result = result.concat("/").concat(effect);
        }

        // When none information are provided, we just show the name of the Transition
        if ("".equals(result))
        {
            result = ((Transition) getEObject()).getName();
        }

        ((Label) ((TransitionFigure) getFigure()).getNameEdgeObjectFigure()).setText(result);
    }

    private String computeTrigger()
    {
        String triggerText = null;
        for (Trigger trigger : ((Transition) getEObject()).getTriggers())
        {
            String triggerValue = trigger.getEvent() != null ? trigger.getEvent().getName() : null;
            if (triggerValue != null && triggerValue.length() > 0)
            {
                triggerText = triggerText == null ? triggerValue : triggerText.concat(", ").concat(triggerValue);
            }
        }
        return triggerText;

    }

    private String computeGuard()
    {
        Constraint guard = ((Transition) getEObject()).getGuard();
        if (guard != null && guard.getSpecification() != null)
        {
            return guard.getSpecification().stringValue();
        }
        return null;

    }

    private String computeEffect()
    {
        String label = "";
        Behavior effect = ((Transition) getEObject()).getEffect();
        if (effect != null)
        {
            if (effect instanceof OpaqueBehavior) // display the body of the action
            {
                for (Iterator iterator = ((OpaqueBehavior) effect).getBodies().iterator(); iterator
                        .hasNext();) {
                    String body = (String) iterator.next();
                    label = label.concat(body);
                    if (iterator.hasNext()) label = label.concat(" "); // insert space as a delimiter; '\n' would be another option
                }
            }
            else
            {
                return effect.getName(); // display action/behavior name only
            }
        }
        return label.equals("") ? null : label;
    }




Tursun Wali a écrit :
Stephane, Jacques :
Yeah , you guys are right . Now I made it .
With this way , I can put  full _expression_  (Name and value of Guard condition) on Transitions .
Thanks Leute .
However ,  within  "[glob_v==0]/Zuend"  , I am able to set  left part of "/"  namely "[glob_v==0]" .
Do you have good idea about   right part  .

Kindly,
Tom

_______________________________________________ Topcased-users mailing list [email protected] http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users

-- 
Jacques LESCOT
Solutions et Technologies
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 06 60
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com



_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users

Reply via email to