1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Turned-on API analysis for Visualizer and tweaked previous commits

that broke API stability. 

Change-Id: Idda130776b54f9e984b4179a32532413f2972f5d
Reviewed-on: https://git.eclipse.org/r/25410
Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
Tested-by: Hudson CI
This commit is contained in:
Marc Dumais 2014-04-23 07:05:40 -04:00
parent 2e36f9b4ca
commit 55afd48ec0
8 changed files with 48 additions and 18 deletions

View file

@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.cdt.visualizer.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.visualizer.ui.plugin.CDTVisualizerUIPlugin
Bundle-Vendor: %provider.name
Require-Bundle: org.eclipse.ui,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.visualizer.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -53,8 +53,8 @@ public class GraphicCanvas extends BufferedCanvas
case SWT.MouseEnter:
case SWT.MouseMove:
IGraphicObject obj = getGraphicObject(event.x, event.y);
if (obj != null) {
String tooltip = obj.getTooltip(event.x, event.y);
if (obj instanceof ITooltipProvider) {
String tooltip = ((ITooltipProvider) obj).getTooltip(event.x, event.y);
setToolTipText(tooltip);
}
break;

View file

@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Rectangle;
* Base class for objects that can be displayed and manipulated on a GraphicCanvas.
*/
public class GraphicObject
implements IGraphicObject
implements IGraphicObject, ITooltipProvider
{
// --- members ---
@ -277,6 +277,9 @@ public class GraphicObject
public void paintDecorations(GC gc) {
}
/**
* @since 1.1
*/
@Override
public String getTooltip(int x, int y) {
return null;

View file

@ -7,7 +7,6 @@
*
* Contributors:
* William R. Swanson (Tilera Corporation)
* Xavier Raynaud (Kalray) - Bug 430804
*******************************************************************************/
package org.eclipse.cdt.visualizer.ui.canvas;
@ -32,15 +31,6 @@ public interface IGraphicObject
* If decorations is true, paints optional "decorations" layer.
*/
public void paint(GC gc, boolean decorations);
/**
* Return the tooltip to display when mouse stays on this object.
* It may return <code>null</code> if there is nothing to display.
* @param x the x coordinate
* @param y the y coordinate
* @return the tooltip to display on this object.
*/
public String getTooltip(int x, int y);
/** Returns true if object has decorations to paint. */
public boolean hasDecorations();

View file

@ -0,0 +1,28 @@
/*******************************************************************************
* Copyright (c) 2014 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:
* Marc Dumais (Ericsson) - initial API and implementation
* Xavier Raynaud (Kalray) - Bug 430804
*******************************************************************************/
package org.eclipse.cdt.visualizer.ui.canvas;
/**
* Interface that can be implemented by objects that want to provide tooltips.
* @since 1.1
*/
public interface ITooltipProvider {
/**
* Return the tooltip to display when mouse stays on this object.
* It may return <code>null</code> if there is nothing to display.
* @param x the x coordinate
* @param y the y coordinate
* @return the tooltip to display on this object.
*/
public String getTooltip(int x, int y);
}

View file

@ -89,7 +89,8 @@ public class GUIUtils {
gc.drawText(text, x, y, SWT.DRAW_TRANSPARENT);
}
/** Draws transparent text, with the default alignment (top/left). */
/** Draws transparent text, with the default alignment (top/left).
* @since 1.1*/
static public void drawText(GC gc, String text, Rectangle clip, int x, int y)
{
Rectangle oldClip = gc.getClipping();
@ -112,7 +113,8 @@ public class GUIUtils {
}
}
/** Draws transparent text, with the specified alignments. */
/** Draws transparent text, with the specified alignments.
* @since 1.1*/
static public void drawTextAligned(GC gc, String text, Rectangle clip, int x, int y, boolean left, boolean top)
{
Rectangle oldClip = gc.getClipping();
@ -130,7 +132,8 @@ public class GUIUtils {
y - (int) Math.round(te.y / 2.0), SWT.DRAW_TRANSPARENT);
}
/** Draws transparent text, centered on the specified point. */
/** Draws transparent text, centered on the specified point.
* @since 1.1*/
static public void drawTextCentered(GC gc, String text, Rectangle clip, int x, int y)
{
Rectangle oldClip = gc.getClipping();