1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 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.link;
13 import java.util.Arrays;
15 import org.eclipse.jface.text.TypedPosition;
16 import org.eclipse.jface.text.contentassist.ICompletionProposal;
21 public class ProposalPosition extends TypedPosition {
24 * The choices available for this position, fChoices[0] is the original
27 private final ICompletionProposal[] fChoices;
30 * @see java.lang.Object#equals(java.lang.Object)
32 public boolean equals(Object o) {
33 if (o instanceof ProposalPosition) {
34 if (super.equals(o)) {
35 return Arrays.equals(fChoices, ((ProposalPosition) o).fChoices);
46 public ProposalPosition(int offset, int length, String type,
47 ICompletionProposal[] choices) {
48 super(offset, length, type);
49 fChoices = new ICompletionProposal[choices.length];
50 System.arraycopy(choices, 0, fChoices, 0, choices.length);
55 * @return an array of choices, including the initial one. Clients must not
58 public ICompletionProposal[] getChoices() {
59 updateChoicePositions();
66 private void updateChoicePositions() {
67 for (int i = 0; i < fChoices.length; i++) {
68 // if (fChoices[i] instanceof JavaCompletionProposal)
69 // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset);