1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.text.template.contentassist;
13 import org.eclipse.jface.text.Assert;
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.jface.text.contentassist.ICompletionProposal;
16 import org.eclipse.jface.text.link.LinkedPositionGroup;
17 import org.eclipse.jface.text.link.ProposalPosition;
22 public class VariablePosition extends ProposalPosition {
24 private MultiVariableGuess fGuess;
26 private MultiVariable fVariable;
28 public VariablePosition(IDocument document, int offset, int length,
29 MultiVariableGuess guess, MultiVariable variable) {
30 this(document, offset, length, LinkedPositionGroup.NO_STOP, guess,
34 public VariablePosition(IDocument document, int offset, int length,
35 int sequence, MultiVariableGuess guess, MultiVariable variable) {
36 super(document, offset, length, sequence, null);
37 Assert.isNotNull(guess);
38 Assert.isNotNull(variable);
44 * @see org.eclipse.jface.text.link.ProposalPosition#equals(java.lang.Object)
46 public boolean equals(Object o) {
47 if (o instanceof VariablePosition && super.equals(o)) {
48 return fGuess.equals(((VariablePosition) o).fGuess);
54 * @see org.eclipse.jface.text.link.ProposalPosition#hashCode()
56 public int hashCode() {
57 return super.hashCode() | fGuess.hashCode();
61 * @see org.eclipse.jface.text.link.ProposalPosition#getChoices()
63 public ICompletionProposal[] getChoices() {
64 return fGuess.getProposals(fVariable, offset, length);
70 public MultiVariable getVariable() {