1 11 package org.eclipse.jdt.internal.ui.text.template.contentassist; 12 13 import org.eclipse.core.runtime.Assert; 14 15 import org.eclipse.jface.text.IDocument; 16 import org.eclipse.jface.text.contentassist.ICompletionProposal; 17 import org.eclipse.jface.text.link.LinkedPositionGroup; 18 import org.eclipse.jface.text.link.ProposalPosition; 19 20 21 24 public class VariablePosition extends ProposalPosition { 25 26 private MultiVariableGuess fGuess; 27 private MultiVariable fVariable; 28 29 public VariablePosition(IDocument document, int offset, int length, MultiVariableGuess guess, MultiVariable variable) { 30 this(document, offset, length, LinkedPositionGroup.NO_STOP, guess, variable); 31 } 32 33 public VariablePosition(IDocument document, int offset, int length, int sequence, MultiVariableGuess guess, MultiVariable variable) { 34 super(document, offset, length, sequence, null); 35 Assert.isNotNull(guess); 36 Assert.isNotNull(variable); 37 fVariable= variable; 38 fGuess= guess; 39 } 40 41 42 45 public boolean equals(Object o) { 46 if (o instanceof VariablePosition && super.equals(o)) { 47 return fGuess.equals(((VariablePosition) o).fGuess); 48 } 49 return false; 50 } 51 52 55 public int hashCode() { 56 return super.hashCode() | fGuess.hashCode(); 57 } 58 59 62 public ICompletionProposal[] getChoices() { 63 return fGuess.getProposals(fVariable, offset, length); 64 } 65 66 71 public MultiVariable getVariable() { 72 return fVariable; 73 } 74 75 } 76 | Popular Tags |