Java Doc and API clean up of TMF UML Sequence diagram framework
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / SyncMessageReturn.java
1 /**********************************************************************
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
15
16 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
17 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
18
19 /**
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>
24 * <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>
27 *
28 *
29 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage SyncMessage for usage example
30 * @version 1.0
31 * @author sveyrier
32 *
33 */
34 public class SyncMessageReturn extends SyncMessage {
35
36 // ------------------------------------------------------------------------
37 // Constants
38 // ------------------------------------------------------------------------
39 /**
40 * The graphNode ID
41 */
42 public static final String SYNC_MESS_RET_TAG = "SyncMessageRet"; //$NON-NLS-1$
43
44 // ------------------------------------------------------------------------
45 // Attributes
46 // ------------------------------------------------------------------------
47 /**
48 * The associated message(the message it is the return).
49 */
50 protected SyncMessage message = null;
51
52 // ------------------------------------------------------------------------
53 // Constractors
54 // ------------------------------------------------------------------------
55
56 /**
57 * Default constructor
58 */
59 public SyncMessageReturn() {
60 prefId = ISDPreferences.PREF_SYNC_MESS_RET;
61 }
62
63 // ------------------------------------------------------------------------
64 // Methods
65 // ------------------------------------------------------------------------
66 /**
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>
70 *
71 * @param parentMessage the message to associate
72 */
73 public void setMessage(SyncMessage parentMessage) {
74 message = parentMessage;
75 message.setMessageReturn(this);
76 }
77
78 /**
79 * Returns the syncMessage associated to this SyncMessageReturn
80 *
81 * @return the associated message
82 */
83 public SyncMessage getMessage() {
84 return message;
85 }
86
87 /*
88 * (non-Javadoc)
89 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
90 */
91 @Override
92 public void draw(IGC context) {
93 if (!isVisible()) {
94 return;
95 }
96 int oldStyle = context.getLineStyle();
97 // Message return are dashed
98 context.setLineStyle(context.getLineDotStyle());
99 // Draw it selected?
100 if (!isSelected()) {
101 context.setBackground(Frame.getUserPref().getBackGroundColor(prefId));
102 context.setForeground(Frame.getUserPref().getForeGroundColor(prefId));
103 }
104 super.draw(context);
105 // restore the context
106 context.setLineStyle(oldStyle);
107 }
108
109 /*
110 * (non-Javadoc)
111 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#getArrayId()
112 */
113 @Override
114 public String getArrayId() {
115 return SYNC_MESS_RET_TAG;
116 }
117 }
This page took 0.036111 seconds and 6 git commands to generate.