blob: 64589712356d747dea6e743a7703ad06e5cbba63 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2015 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.acceleo.query.runtime.impl.completion;
import org.eclipse.acceleo.query.runtime.ICompletionProposal;
/**
* A variable {@link ICompletionProposal}.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public class VariableCompletionProposal implements ICompletionProposal {
/**
* The variable name.
*/
private final String varName;
/**
* Constructor.
*
* @param varName
* the variable name
*/
public VariableCompletionProposal(String varName) {
this.varName = varName;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.acceleo.query.runtime.ICompletionProposal#getProposal()
*/
@Override
public String getProposal() {
return varName;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.acceleo.query.runtime.ICompletionProposal#getCursorOffset()
*/
@Override
public int getCursorOffset() {
return varName.length();
}
/**
* {@inheritDoc}
*
* @see org.eclipse.acceleo.query.runtime.ICompletionProposal#getObject()
*/
@Override
public String getObject() {
return varName;
}
/**
* {@inheritDoc}
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getProposal();
}
/**
* {@inheritDoc}
*
* @see org.eclipse.acceleo.query.runtime.ICompletionProposal#getDescription()
*/
@Override
public String getDescription() {
return "Variable " + varName;
}
}