01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.tests.views.properties.tabbed.override;
11:
12: import org.eclipse.jface.viewers.ISelection;
13: import org.eclipse.ui.tests.views.properties.tabbed.model.Element;
14:
15: /**
16: * The selection in the override tests view.
17: *
18: * @author Anthony Hunter
19: * @since 3.4
20: */
21: public class OverrideTestsSelection implements ISelection {
22:
23: private Element element;
24:
25: /**
26: * Constructor for OverrideTestsSelection
27: *
28: * @param newElement
29: * the selected element.
30: */
31: public OverrideTestsSelection(Element newElement) {
32: this .element = newElement;
33: }
34:
35: /**
36: * Get the selected element.
37: *
38: * @return the selected element.
39: */
40: public Element getElement() {
41: return element;
42: }
43:
44: /*
45: * (non-Javadoc)
46: *
47: * @see org.eclipse.jface.viewers.ISelection#isEmpty()
48: */
49: public boolean isEmpty() {
50: /*
51: * Since we want to display UI when there is no selection (empty
52: * selection), we need to return false to isEmpty().
53: */
54: return false;
55: }
56:
57: /*
58: * (non-Javadoc)
59: *
60: * @see java.lang.Object#toString()
61: */
62: public String toString() {
63: return getElement().getName();
64: }
65:
66: }
|