1 /**********************************************************************
2 * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM - Initial API and implementation
10 * Bernd Hufmann - Updated for TMF
11 **********************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
;
15 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IGC
;
16 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.ISDPreferences
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.SDViewPref
;
20 * The message return graph node implementation.<br>
21 * This class differs on the SynMessage class only on the drawing line style (dashed instead of plain line).<br>
22 * Message return are generally associated to a message. This means, they are connected to the same lifelines than the
23 * associated message but in the opposite direction and for a different event occurrence.<br>
25 * WARNING: The association validity is not checked, it is not necessary to provide a valid association, not even needed
26 * to set an association to drawn a message with a message return style.<br>
29 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage SyncMessage for usage example
34 public class SyncMessageReturn
extends SyncMessage
{
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
42 public static final String SYNC_MESS_RET_TAG
= "SyncMessageRet"; //$NON-NLS-1$
44 // ------------------------------------------------------------------------
46 // ------------------------------------------------------------------------
48 * The associated message(the message it is the return).
50 private SyncMessage fMessage
= null;
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
59 public SyncMessageReturn() {
60 setColorPrefId(ISDPreferences
.PREF_SYNC_MESS_RET
);
63 // ------------------------------------------------------------------------
65 // ------------------------------------------------------------------------
67 * Set the associated message (the message it is the return).<br>
68 * Setting the association will activate the navigation in the default sequence diagram implementation to the
69 * message when the user right click on this message return.<br>
71 * @param parentMessage the message to associate
73 public void setMessage(SyncMessage parentMessage
) {
74 fMessage
= parentMessage
;
75 fMessage
.setMessageReturn(this);
79 * Returns the syncMessage associated to this SyncMessageReturn
81 * @return the associated message
83 public SyncMessage
getMessage() {
88 public void draw(IGC context
) {
93 ISDPreferences pref
= SDViewPref
.getInstance();
95 int oldStyle
= context
.getLineStyle();
96 // Message return are dashed
97 context
.setLineStyle(context
.getLineDotStyle());
100 context
.setBackground(pref
.getBackGroundColor(getColorPrefId()));
101 context
.setForeground(pref
.getForeGroundColor(getColorPrefId()));
104 // restore the context
105 context
.setLineStyle(oldStyle
);
109 public String
getArrayId() {
110 return SYNC_MESS_RET_TAG
;