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 net.sourceforge.phpdt.internal.ui.text.java.JavaCompletionProposal;
16 import org.eclipse.jface.text.TypedPosition;
17 import org.eclipse.jface.text.contentassist.ICompletionProposal;
22 public class ProposalPosition extends TypedPosition {
24 /** The choices available for this position, fChoices[0] is the original type. */
25 private final ICompletionProposal[] fChoices;
28 * @see java.lang.Object#equals(java.lang.Object)
30 public boolean equals(Object o) {
31 if (o instanceof ProposalPosition) {
32 if (super.equals(o)) {
33 return Arrays.equals(fChoices, ((ProposalPosition)o).fChoices);
44 public ProposalPosition(int offset, int length, String type, ICompletionProposal[] choices) {
45 super(offset, length, type);
46 fChoices= new ICompletionProposal[choices.length];
47 System.arraycopy(choices, 0, fChoices, 0, choices.length);
52 * @return an array of choices, including the initial one. Clients must not modify it.
54 public ICompletionProposal[] getChoices() {
55 updateChoicePositions();
62 private void updateChoicePositions() {
63 for (int i= 0; i < fChoices.length; i++) {
64 // if (fChoices[i] instanceof JavaCompletionProposal)
65 // ((JavaCompletionProposal)fChoices[i]).setReplacementOffset(offset);