/**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
* below, a scale to visually locate the value in a time range (usually the minimum an maximum elapsed time in the whole
* diagram)
* </p>
- *
+ *
* @version 1.0
* @author sveyrier
*/
*/
private static int fScaleLength = 100;
/**
- * The text to display
+ * The text to display
*/
protected String fMessage;
/**
/**
* Creates a drawable tool tip instance.
- *
+ *
* @param parent The parent composite.
*/
public DrawableToolTip(Composite parent) {
// ------------------------------------------------------------------------
/**
* Returns the message to display.
- *
+ *
* @return the message to display.
*/
public String getText() {
/**
* Returns teh current time to display.
- *
+ *
* @return the current time to display
*/
public String getAccessibleText() {
/**
* Returns the horizontal margin.
- *
+ *
* @return the horizontal margin.
*/
protected static int getHorizontalMargin() {
/**
* Sets the horizontal margin.
- *
+ *
* @param margin The margin to set.
*/
protected static void setHorizontalMargin(int margin) {
/**
* Returns the vertical margin.
- *
+ *
* @return the vertical margin.
*/
protected static int getVerticalMargin() {
/**
* Sets the vertical margin.
- *
+ *
* @param margin The margin to set.
*/
protected static void setVerticalMargin(int margin) {
/**
* Returns the text scale margin.
- *
+ *
* @return the text scale margin.
*/
protected static int getTextScaleMargin() {
/**
* Returns the scale length.
- *
+ *
* @return the scale length.
*/
protected static int getScaleLength() {
/**
* Sets the scale length.
- *
+ *
* @param scaleLength The scale length to set.
*/
protected static void setScaleLength(int scaleLength) {
fScaleLength = scaleLength;
}
-
+
/**
* Display the tooltip using the given time range(min,max) the current value and the time unit The tooltip will stay
* on screen until it is told otherwise
- *
+ *
* @param value the current in the scale
* @param min the scale min
* @param max the scale max
+ * @since 2.0
*/
public void showToolTip(ITmfTimestamp value, ITmfTimestamp min, ITmfTimestamp max) {
- fMinMaxRange = new TmfTimeRange(min.clone(), max.clone());
- fCurrentValue = value.clone();
+ fMinMaxRange = new TmfTimeRange(min, max);
+ fCurrentValue = value;
int w = fToolTipShell.getBounds().width;
int h = fToolTipShell.getBounds().height;
* Disposes the system resource used by this kind of toolTips (a colors array essentially)
*/
public void dispose() {
- for (int i = 0; i < fColors.length; i++)
+ for (int i = 0; i < fColors.length; i++) {
fColors[i].dispose();
+ }
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
int step = fScaleLength / 10;
// double gr = (max - min) / 10;
- ITmfTimestamp minMaxdelta = (TmfTimestamp) fMinMaxRange.getEndTime().getDelta(fMinMaxRange.getStartTime());
+ ITmfTimestamp minMaxdelta = fMinMaxRange.getEndTime().getDelta(fMinMaxRange.getStartTime());
double gr = (minMaxdelta.getValue()) / (double) 10;
// double delta = currentValue-min;
- ITmfTimestamp delta = (TmfTimestamp) fCurrentValue.getDelta(fMinMaxRange.getStartTime());
+ ITmfTimestamp delta = fCurrentValue.getDelta(fMinMaxRange.getStartTime());
long absDelta = Math.abs(delta.getValue());
-
+
int colIndex = 0;
if (gr != 0) {
// colIndex = Math.round((float)(Math.log(1+delta)/gr));