Project

General

Profile

Download (1.21 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 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
 *******************************************************************************/
11
package org.eclipse.draw2d;
12

    
13
/**
14
 * The base class for accessible objects which provides accesibilty clients with
15
 * a unique ID.
16
 */
17
public class AccessibleBase {
18

    
19
	/**
20
	 * Returns the id of this accessible object using {@link Object#hashCode()}.
21
	 * 
22
	 * @return the id
23
	 */
24
	public final int getAccessibleID() {
25
		/*
26
		 * This assumes that the native implementation of hashCode in Object is
27
		 * to return the pointer to the Object, which should be U-unique.
28
		 */
29
		int value = super.hashCode();
30
		/*
31
		 * Values -3, -2, and -1 are reserved by SWT's ACC class to have special
32
		 * meaning. Therefore, a child cannot have this value.
33
		 */
34
		if (value < 0)
35
			value -= 4;
36
		return value;
37
	}
38

    
39
}
(12-12/171)