mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 00:35:49 +02:00
Added extension point for completion contributors.
This commit is contained in:
parent
623eeb6f1d
commit
f61e95319a
6 changed files with 174 additions and 1 deletions
|
@ -304,3 +304,7 @@ ExternalSearchEditor.name=External Search Editor
|
|||
|
||||
#--- templates
|
||||
c.contextType.name = C
|
||||
|
||||
# completion
|
||||
|
||||
completionContributors=Code Assist Completion Contributor
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="textHovers" name="%textHoversName"/>
|
||||
<extension-point id="completionContributors" name="%completionContributors" schema="schema/completionContributors.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.adapters">
|
||||
|
@ -1324,4 +1325,12 @@
|
|||
</include>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.cdt.ui.completionContributors">
|
||||
<contributor
|
||||
class="org.eclipse.cdt.internal.ui.text.contentassist.DOMCompletionContributor"
|
||||
id="DOM"
|
||||
priority="1"/>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
119
core/org.eclipse.cdt.ui/schema/completionContributors.exsd
Normal file
119
core/org.eclipse.cdt.ui/schema/completionContributors.exsd
Normal 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>
|
|
@ -66,7 +66,7 @@ public class CCompletionProcessor2 implements IContentAssistProcessor {
|
|||
offset,
|
||||
new ICodeReaderFactory() {
|
||||
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) {
|
||||
return ParserUtil.createReader(path,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue