KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > contentassist > JavaDebugCompletionProposalCollector


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.contentassist;
12
13 import java.util.Arrays JavaDoc;
14
15 import org.eclipse.jdt.core.CompletionProposal;
16 import org.eclipse.jdt.core.IJavaProject;
17 import org.eclipse.jdt.internal.debug.eval.ast.engine.ArrayRuntimeContext;
18 import org.eclipse.jdt.ui.text.java.CompletionProposalCollector;
19
20 /**
21  * Proposal collector that filters the special local variable used for content
22  * assist on arrays.
23  *
24  * @since 3.2
25  */

26 public class JavaDebugCompletionProposalCollector extends CompletionProposalCollector {
27     
28     private static final char[] fgHiddenLocal = ArrayRuntimeContext.ARRAY_THIS_VARIABLE.toCharArray();
29
30     /**
31      * Constructs a proposal collector on the given project.
32      *
33      * @param project
34      */

35     public JavaDebugCompletionProposalCollector(IJavaProject project) {
36         super(project);
37     }
38
39     /* (non-Javadoc)
40      * @see org.eclipse.jdt.ui.text.java.CompletionProposalCollector#isFiltered(org.eclipse.jdt.core.CompletionProposal)
41      */

42     protected boolean isFiltered(CompletionProposal proposal) {
43         if (proposal.getKind() == CompletionProposal.LOCAL_VARIABLE_REF) {
44             if (Arrays.equals(proposal.getName(), fgHiddenLocal)) {
45                 return true;
46             }
47         }
48         return super.isFiltered(proposal);
49     }
50
51
52 }
53
Popular Tags