1 /*******************************************************************************
2 * Copyright (c) 2007, 2012 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.swt.contentassist;
15 * @author Tuukka Lehtonen
17 public class NamedObjectContentProposal implements INamedObjectContentProposal {
19 private final NamedObject<?> object;
20 private final int position;
22 public NamedObjectContentProposal(NamedObject<?> object, int position) {
24 this.position = position;
28 public INamedObject getNamedObject() {
32 @SuppressWarnings("unchecked")
33 public <T> T getObject() {
34 return (T) object.getObject();
38 public String getContent() {
39 return object.getName().substring(position);
43 public int getCursorPosition() {
44 return object.getName().length();
48 public String getLabel() {
49 return object.getLabel();
53 public String getDescription() {
54 return object.getDescription();
58 public String toString() {
59 return getClass().getSimpleName() + "[" + object.toString() + "]";