1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Added extension point for completion contributors.

This commit is contained in:
Doug Schaefer 2005-03-08 19:46:46 +00:00
parent 623eeb6f1d
commit f61e95319a
6 changed files with 174 additions and 1 deletions

View file

@ -304,3 +304,7 @@ ExternalSearchEditor.name=External Search Editor
#--- templates #--- templates
c.contextType.name = C c.contextType.name = C
# completion
completionContributors=Code Assist Completion Contributor

View file

@ -44,6 +44,7 @@
<!-- Purpose: Provide a perspective specific text hovering for CEditor files --> <!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
<!-- =========================================================================== --> <!-- =========================================================================== -->
<extension-point id="textHovers" name="%textHoversName"/> <extension-point id="textHovers" name="%textHoversName"/>
<extension-point id="completionContributors" name="%completionContributors" schema="schema/completionContributors.exsd"/>
<extension <extension
point="org.eclipse.core.runtime.adapters"> point="org.eclipse.core.runtime.adapters">
@ -1324,4 +1325,12 @@
</include> </include>
</extension> </extension>
<extension
point="org.eclipse.cdt.ui.completionContributors">
<contributor
class="org.eclipse.cdt.internal.ui.text.contentassist.DOMCompletionContributor"
id="DOM"
priority="1"/>
</extension>
</plugin> </plugin>

View file

@ -0,0 +1,119 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.cdt.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.cdt.ui" id="completionContributor" name="%completionContributor"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="contributor"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="contributor">
<complexType>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.ui.text.contentassist.ICompletionContributor"/>
</appInfo>
</annotation>
</attribute>
<attribute name="priority" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View file

@ -66,7 +66,7 @@ public class CCompletionProcessor2 implements IContentAssistProcessor {
offset, offset,
new ICodeReaderFactory() { new ICodeReaderFactory() {
public CodeReader createCodeReaderForTranslationUnit(String path) { public CodeReader createCodeReaderForTranslationUnit(String path) {
return new CodeReader(viewer.getDocument().get().toCharArray()); return new CodeReader(path, viewer.getDocument().get().toCharArray());
} }
public CodeReader createCodeReaderForInclusion(String path) { public CodeReader createCodeReaderForInclusion(String path) {
return ParserUtil.createReader(path, return ParserUtil.createReader(path,

View file

@ -0,0 +1,23 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
**********************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
public class DOMCompletionContributor implements ICompletionContributor {
public ICompletionProposal[] contributeCompletionProposals(
ITextViewer viewer, int offset, ASTCompletionNode node) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
**********************************************************************/
package org.eclipse.cdt.ui.text.contentassist;
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
public interface ICompletionContributor {
ICompletionProposal[] contributeCompletionProposals(ITextViewer viewer, int offset, ASTCompletionNode node);
}