1 /**********************************************************************
2 * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
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
7 * $Id: SyncMessageReturn.java,v 1.2 2006/09/20 20:56:25 ewchan Exp $
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
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
.drawings
.ISDPreferences
;
19 * The message return graph node implementation.<br>
20 * This class differs on the SynMessage class only on the drawing line style (dashed instead of plain line).<br>
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>
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>
28 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage SyncMessage for usage example
32 public class SyncMessageReturn
extends SyncMessage
{
35 * The associated message(the message it is the return).
37 protected SyncMessage message
= null;
39 public static final String SYNC_MESS_RET_TAG
= "SyncMessageRet"; //$NON-NLS-1$
41 public SyncMessageReturn() {
42 prefId
= ISDPreferences
.PREF_SYNC_MESS_RET
;
46 * Set the associated message (the message it is the return).<br>
47 * Setting the association will activate the navigation in the default sequence diagram implementation to the
48 * message when the user right click on this message return.<br>
50 * @param parentMessage the message to associate
52 public void setMessage(SyncMessage parentMessage
) {
53 message
= parentMessage
;
54 message
.setMessageReturn(this);
58 * Returns the syncMessage associated to this SyncMessageReturn
60 * @return the associated message
62 public SyncMessage
getMessage() {
67 public void draw(IGC context
) {
70 int oldStyle
= context
.getLineStyle();
71 // Message return are dashed
72 context
.setLineStyle(context
.getLineDotStyle());
73 // Draw it selected?*/
75 context
.setBackground(Frame
.getUserPref().getBackGroundColor(prefId
));
76 context
.setForeground(Frame
.getUserPref().getForeGroundColor(prefId
));
79 // restore the context
80 context
.setLineStyle(oldStyle
);
84 public String
getArrayId() {
85 return SYNC_MESS_RET_TAG
;