EMMA Coverage Report (generated Mon Sep 29 15:05:28 EDT 2008)
[all classes][org.eclipse.ui.internal.about]

COVERAGE SUMMARY FOR SOURCE FILE [AboutItem.java]

nameclass, %method, %block, %line, %
AboutItem.java100% (1/1)60%  (3/5)19%  (18/93)41%  (7/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AboutItem100% (1/1)60%  (3/5)19%  (18/93)41%  (7/17)
getLinkAt (int): String 0%   (0/1)0%   (0/39)0%   (0/5)
isLinkAt (int): boolean 0%   (0/1)0%   (0/36)0%   (0/5)
AboutItem (String, int [][], String []): void 100% (1/1)100% (12/12)100% (5/5)
getLinkRanges (): int [][] 100% (1/1)100% (3/3)100% (1/1)
getText (): String 100% (1/1)100% (3/3)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2000, 2006 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 *
8 * Contributors:
9 *     IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.ui.internal.about;
12 
13/**
14 * Holds the information for text appearing in the about dialog
15 */
16public class AboutItem {
17    private String text;
18 
19    private int[][] linkRanges;
20 
21    private String[] hrefs;
22 
23    /**
24     * Creates a new about item
25     */
26    public AboutItem(String text, int[][] linkRanges, String[] hrefs) {
27 
28        this.text = text;
29        this.linkRanges = linkRanges;
30        this.hrefs = hrefs;
31    }
32 
33    /**
34     * Returns the link ranges (character locations)
35     */
36    public int[][] getLinkRanges() {
37        return linkRanges;
38    }
39 
40    /**
41     * Returns the text to display
42     */
43    public String getText() {
44        return text;
45    }
46 
47    /**
48     * Returns true if a link is present at the given character location
49     */
50    public boolean isLinkAt(int offset) {
51        // Check if there is a link at the offset
52        for (int i = 0; i < linkRanges.length; i++) {
53            if (offset >= linkRanges[i][0]
54                    && offset < linkRanges[i][0] + linkRanges[i][1]) {
55                return true;
56            }
57        }
58        return false;
59    }
60 
61    /**
62     * Returns the link at the given offset (if there is one),
63     * otherwise returns <code>null</code>.
64     */
65    public String getLinkAt(int offset) {
66        // Check if there is a link at the offset
67        for (int i = 0; i < linkRanges.length; i++) {
68            if (offset >= linkRanges[i][0]
69                    && offset < linkRanges[i][0] + linkRanges[i][1]) {
70                return hrefs[i];
71            }
72        }
73        return null;
74    }
75}

[all classes][org.eclipse.ui.internal.about]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov