From f61e95319a33f7eb39398e4854a6080767cbf49a Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Tue, 8 Mar 2005 19:46:46 +0000 Subject: [PATCH] Added extension point for completion contributors. --- core/org.eclipse.cdt.ui/plugin.properties | 4 + core/org.eclipse.cdt.ui/plugin.xml | 9 ++ .../schema/completionContributors.exsd | 119 ++++++++++++++++++ .../contentassist/CCompletionProcessor2.java | 2 +- .../DOMCompletionContributor.java | 23 ++++ .../contentassist/ICompletionContributor.java | 18 +++ 6 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 core/org.eclipse.cdt.ui/schema/completionContributors.exsd create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/contentassist/ICompletionContributor.java diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index fdedc7c2f21..88d0ed99407 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -304,3 +304,7 @@ ExternalSearchEditor.name=External Search Editor #--- templates c.contextType.name = C + +# completion + +completionContributors=Code Assist Completion Contributor diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index d9faafff4b6..0d72eab2f20 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -44,6 +44,7 @@ + @@ -1324,4 +1325,12 @@ + + + + diff --git a/core/org.eclipse.cdt.ui/schema/completionContributors.exsd b/core/org.eclipse.cdt.ui/schema/completionContributors.exsd new file mode 100644 index 00000000000..31e7289ba5c --- /dev/null +++ b/core/org.eclipse.cdt.ui/schema/completionContributors.exsd @@ -0,0 +1,119 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + + + + + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java index 35791f4ffe8..2a83e74029c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java @@ -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, diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java new file mode 100644 index 00000000000..bc601211fe5 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java @@ -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; + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/contentassist/ICompletionContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/contentassist/ICompletionContributor.java new file mode 100644 index 00000000000..a528ebd3cc4 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/contentassist/ICompletionContributor.java @@ -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); + +}