1 11 package org.eclipse.jface.text.link; 12 13 import java.util.Arrays ; 14 15 import org.eclipse.jface.text.IDocument; 16 import org.eclipse.jface.text.contentassist.ICompletionProposal; 17 18 26 public class ProposalPosition extends LinkedPosition { 27 28 31 private ICompletionProposal[] fProposals; 32 33 42 public ProposalPosition(IDocument document, int offset, int length, int sequence, ICompletionProposal[] proposals) { 43 super(document, offset, length, sequence); 44 fProposals= copy(proposals); 45 } 46 47 55 public ProposalPosition(IDocument document, int offset, int length, ICompletionProposal[] proposals) { 56 super(document, offset, length, LinkedPositionGroup.NO_STOP); 57 fProposals= copy(proposals); 58 } 59 60 63 private ICompletionProposal[] copy(ICompletionProposal[] proposals) { 64 if (proposals != null) { 65 ICompletionProposal[] copy= new ICompletionProposal[proposals.length]; 66 System.arraycopy(proposals, 0, copy, 0, proposals.length); 67 return copy; 68 } 69 return null; 70 } 71 72 75 public boolean equals(Object o) { 76 if (o instanceof ProposalPosition) { 77 if (super.equals(o)) { 78 return Arrays.equals(fProposals, ((ProposalPosition)o).fProposals); 79 } 80 } 81 return false; 82 } 83 84 91 public ICompletionProposal[] getChoices() { 92 return fProposals; 93 } 94 95 98 public int hashCode() { 99 return super.hashCode() | (fProposals == null ? 0 : fProposals.hashCode()); 100 } 101 } 102 | Popular Tags |