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