lttng: Update copyright headers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / SyncMessageReturn.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
73005152
BH
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
73005152
BH
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
15
16import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
df0b8ff4 17import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
3145ec83 18import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
73005152
BH
19
20/**
21 * The message return graph node implementation.<br>
22 * This class differs on the SynMessage class only on the drawing line style (dashed instead of plain line).<br>
23 * Message return are generally associated to a message. This means, they are connected to the same lifelines than the
24 * associated message but in the opposite direction and for a different event occurrence.<br>
25 * <br>
26 * WARNING: The association validity is not checked, it is not necessary to provide a valid association, not even needed
27 * to set an association to drawn a message with a message return style.<br>
28 *
29 *
30 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage SyncMessage for usage example
df0b8ff4 31 * @version 1.0
73005152
BH
32 * @author sveyrier
33 *
34 */
35public class SyncMessageReturn extends SyncMessage {
36
df0b8ff4
BH
37 // ------------------------------------------------------------------------
38 // Constants
39 // ------------------------------------------------------------------------
40 /**
41 * The graphNode ID
42 */
43 public static final String SYNC_MESS_RET_TAG = "SyncMessageRet"; //$NON-NLS-1$
44
45 // ------------------------------------------------------------------------
46 // Attributes
47 // ------------------------------------------------------------------------
73005152
BH
48 /**
49 * The associated message(the message it is the return).
50 */
eb63f5ff 51 protected SyncMessage fMessage = null;
73005152 52
df0b8ff4
BH
53 // ------------------------------------------------------------------------
54 // Constractors
55 // ------------------------------------------------------------------------
56
57 /**
58 * Default constructor
59 */
73005152 60 public SyncMessageReturn() {
eb63f5ff 61 fPrefId = ISDPreferences.PREF_SYNC_MESS_RET;
73005152
BH
62 }
63
df0b8ff4
BH
64 // ------------------------------------------------------------------------
65 // Methods
66 // ------------------------------------------------------------------------
73005152
BH
67 /**
68 * Set the associated message (the message it is the return).<br>
69 * Setting the association will activate the navigation in the default sequence diagram implementation to the
70 * message when the user right click on this message return.<br>
71 *
72 * @param parentMessage the message to associate
73 */
74 public void setMessage(SyncMessage parentMessage) {
eb63f5ff
BH
75 fMessage = parentMessage;
76 fMessage.setMessageReturn(this);
73005152
BH
77 }
78
79 /**
80 * Returns the syncMessage associated to this SyncMessageReturn
81 *
82 * @return the associated message
83 */
84 public SyncMessage getMessage() {
eb63f5ff 85 return fMessage;
73005152
BH
86 }
87
df0b8ff4
BH
88 /*
89 * (non-Javadoc)
90 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
91 */
73005152
BH
92 @Override
93 public void draw(IGC context) {
df0b8ff4 94 if (!isVisible()) {
73005152 95 return;
df0b8ff4 96 }
3145ec83
BH
97
98 ISDPreferences pref = SDViewPref.getInstance();
99
73005152
BH
100 int oldStyle = context.getLineStyle();
101 // Message return are dashed
102 context.setLineStyle(context.getLineDotStyle());
df0b8ff4 103 // Draw it selected?
73005152 104 if (!isSelected()) {
3145ec83
BH
105 context.setBackground(pref.getBackGroundColor(fPrefId));
106 context.setForeground(pref.getForeGroundColor(fPrefId));
73005152
BH
107 }
108 super.draw(context);
109 // restore the context
110 context.setLineStyle(oldStyle);
111 }
112
df0b8ff4
BH
113 /*
114 * (non-Javadoc)
115 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#getArrayId()
116 */
73005152
BH
117 @Override
118 public String getArrayId() {
119 return SYNC_MESS_RET_TAG;
120 }
121}
This page took 0.036794 seconds and 5 git commands to generate.