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: HotSpot.java,v 1.2 2006/09/20 20:56:27 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
.IImage
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.uml2sd
.drawings
.ISDPreferences
;
22 public class HotSpot
extends GraphNode
{
24 protected BasicExecutionOccurrence execOcc
= null;
25 protected int occurrence
= 0;
26 protected IImage image
= null;
29 * The grahNode ID constant
31 public static final String GLYPH
= "Glyph"; //$NON-NLS-1$
34 prefId
= ISDPreferences
.PREF_EXEC
;
37 public void setImage(IImage img
) {
44 return execOcc
.getX() - 3;
53 return execOcc
.getY();
59 public int getWidth() {
61 return execOcc
.getWidth() + 7;
67 public int getHeight() {
69 return execOcc
.getWidth() + 10;
75 * Set the lifeline on which the execution occurrence appears.
77 * @param theLifeline - the parent lifeline
79 public void setExecution(BasicExecutionOccurrence occ
) {
81 execOcc
.addNode(this);
85 * Get the lifeline on which the execution occurrence appears.
87 * @return - the parent lifeline
89 public BasicExecutionOccurrence
getExecOcc() {
93 public int getOccurrence() {
97 public void setOccurrence(int occ
) {
102 public void draw(IGC context
) {
104 // The execution occurrence is selected
105 // if the owning lifeline is selected
106 if (isSelected() || (execOcc
!= null && execOcc
.isSelected()) || (execOcc
!= null && execOcc
.getLifeline() != null && execOcc
.getLifeline().isSelected())) {
107 context
.setBackground(Frame
.getUserPref().getBackGroundColorSelection());
108 context
.setForeground(Frame
.getUserPref().getForeGroundColorSelection());
110 context
.setBackground(Frame
.getUserPref().getBackGroundColor(ISDPreferences
.PREF_EXEC
));
111 context
.setForeground(Frame
.getUserPref().getForeGroundColor(ISDPreferences
.PREF_EXEC
));
113 context
.drawImage(image
, getX(), getY(), getWidth(), getHeight());
117 public String
getArrayId() {
122 public boolean isVisible(int x
, int y
, int width
, int height
) {
127 public boolean contains(int _x
, int _y
) {
130 int width
= getWidth();
131 int height
= getHeight();
133 if (Frame
.contains(x
, y
, width
, height
, _x
, _y
)) {