# Java Completion Proposal Computer

###### Identifier:

org.eclipse.jdt.ui.javaCompletionProposalComputer

###### Since:

3.2

###### Description:

This extension point allows to contribute Java completion proposal computers to participate in the content assist process of the Java editor.

This extension point supports the `<enablement>` element. The default variable is the containing `org.eclipse.jdt.core.IJavaProject`.
Defined variables for `<with>` expressions are:

- "project": type `org.eclipse.jdt.core.IJavaProject`; the current project (same as the default variable)

###### Configuration Markup:

<!ELEMENT extension (javaCompletionProposalComputer | proposalCategory)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #REQUIRED

name CDATA #IMPLIED>

- point - a fully qualified identifier of the target extension point
- id - the proposal category id
- name - an optional name of the extension instance

<!ELEMENT javaCompletionProposalComputer (partition)*>

<!ATTLIST javaCompletionProposalComputer

class CDATA #REQUIRED

activate (true | false) "false"

categoryId IDREF "org.eclipse.jdt.ui.defaultProposalCategory"

needsSortingAfterFiltering (true | false) "false"

requiresUIThread (true | false) "true">

A proposal computer contribution. If no partition types are specified, the computer is added to all partition types.

- class - the name of the class that implements the contributed computer. The class must be public and implement `org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer` and must have a public 0-argument constructor.
- activate - if the attribute is set to "true" it will force this plug-in to be loaded on content assist invocation. @since 3.8.1 activation will not happen if the enablement expression for the category is not met.
- categoryId - the id of a `proposalCategory`
- needsSortingAfterFiltering - if the attribute is set to "true" it forces the content assist processor to resort the list of proposals every time a new token is entered or removed to the completion prefix. @since 3.8
- requiresUIThread - Whether the given extension requires to run in UI Thread. If extension doesn't require to run in UI Thread to work, this should be set to "false". It's recommended for an extension to not require UI Thread and have this set to "false" in order to improve performance. If "false", the completion proposal may run in a non-UI Thread, in parallel with other completion computers. If "true", the completion proposal will run in UI Thread, freezing the UI while computing, and in sequence with other completion computers that also require UI Thread. @since 3.16

<!ELEMENT partition EMPTY>

<!ATTLIST partition

type (__dftl_partition_content_type|__java_singleline_comment|__java_multiline_comment|__java_javadoc|__java_string|__java_character|__java_multiline_string) >

- type - a Java partition type for which the specified computer can provide completion proposals. See `IDocument.DEFAULT_CONTENT_TYPE` and `IJavaPartitions` for valid values.

<!ELEMENT proposalCategory (enablement?)>

<!ATTLIST proposalCategory

icon CDATA #IMPLIED>

A proposal category contribution defines categories of proposals used to group them in the UI.

- icon - an optional icon of the category, which can be displayed in the user preferences

###### Examples:

The following is an example of a Java completion proposal computer contribution:

     <extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
       id="textual_proposals"
       name="Text Proposals">
       <proposalCategory icon="icons/wordcompletions.svg"/>
     </extension>
     <extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
       id="WordCompletionProposalComputer"
       name="Word Completion Proposal Computer">
       <javaCompletionProposalComputer
          class="org.eclipse.jdt.internal.ui.text.java.HippieProposalComputer"
          categoryId="org.eclipse.ui.texteditor.textual_proposals">
          <partition type="__java_javadoc"/>
       </javaCompletionProposalComputer>
     </extension>

###### API Information:

The contributed class must extend `org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer`

###### Supplied Implementation:

see `org.eclipse.jdt.internal.ui.text.java.HippieProposalComputer` for an example.

Copyright (c) 2006, 2013 IBM Corporation and others.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html/ SPDX-License-Identifier: EPL-2.0