1 /**********************************************************************
2 * Copyright (c) 2005, 2006 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
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
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.core
;
16 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.IGC
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.ISDPreferences
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.preferences
.SDViewPref
;
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>
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>
30 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage SyncMessage for usage example
35 public class SyncMessageReturn
extends SyncMessage
{
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
43 public static final String SYNC_MESS_RET_TAG
= "SyncMessageRet"; //$NON-NLS-1$
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
49 * The associated message(the message it is the return).
51 protected SyncMessage fMessage
= null;
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
60 public SyncMessageReturn() {
61 fPrefId
= ISDPreferences
.PREF_SYNC_MESS_RET
;
64 // ------------------------------------------------------------------------
66 // ------------------------------------------------------------------------
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>
72 * @param parentMessage the message to associate
74 public void setMessage(SyncMessage parentMessage
) {
75 fMessage
= parentMessage
;
76 fMessage
.setMessageReturn(this);
80 * Returns the syncMessage associated to this SyncMessageReturn
82 * @return the associated message
84 public SyncMessage
getMessage() {
90 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
93 public void draw(IGC context
) {
98 ISDPreferences pref
= SDViewPref
.getInstance();
100 int oldStyle
= context
.getLineStyle();
101 // Message return are dashed
102 context
.setLineStyle(context
.getLineDotStyle());
105 context
.setBackground(pref
.getBackGroundColor(fPrefId
));
106 context
.setForeground(pref
.getForeGroundColor(fPrefId
));
109 // restore the context
110 context
.setLineStyle(oldStyle
);
115 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage#getArrayId()
118 public String
getArrayId() {
119 return SYNC_MESS_RET_TAG
;