我创建了一个自定义eclipse插件,用于生成XML文件(JDBC,CSV,LDAP)。 现在我尝试为每种文件类型创建特定的内容辅助。目前,无论当前打开哪种文件类型,我的插件项目都会向我提供全方位的建议。我想知道如何将某个内容提议类分配给我的某个文件类型。
如果有任何帮助,下面是我的plugin.xml类。
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.newWizards">
<category
id="com.euclideanspace.spad.builder.category.wizards"
name="IDome">
</category>
<wizard
icon="icons/xml.png"
category="com.euclideanspace.spad.builder.category.wizards"
class="idome.xmlgenerator.wizards.BuilderDataModel"
id="builder.wizard.new.custom"
name="Model">
</wizard>
<category
id="com.euclideanspace.spad.builder.category.wizards"
name="IDome">
</category>
<wizard
icon="icons/xml.png"
category="com.euclideanspace.spad.builder.category.wizards"
class="idome.xmlgenerator.wizards.BuilderJDBC"
id="builder.wizard.new.custom"
name="JDBC">
</wizard>
<category
id="com.euclideanspace.spad.builder.category.wizards"
name="IDome">
</category>
<wizard
icon="icons/xml.png"
category="com.euclideanspace.spad.builder.category.wizards"
class="idome.xmlgenerator.wizards.BuilderLDAP"
id="WorkingBackup.wizard2"
name="LDAP">
</wizard>
<category
id="com.euclideanspace.spad.builder.category.wizards"
name="IDome">
</category>
<wizard
icon="icons/xml.png"
category="com.euclideanspace.spad.builder.category.wizards"
class="idome.xmlgenerator.wizards.BuilderImport"
id="WorkingBackup.wizard3"
name="ImportCSV">
</wizard>
<category
id="com.euclideanspace.spad.builder.category.wizards"
name="IDome">
</category>
<wizard
icon="icons/xml.png"
category="com.euclideanspace.spad.builder.category.wizards"
class="idome.xmlgenerator.wizards.BuilderExport"
id="WorkingBackup.wizard4"
name="ExportCSV">
</wizard>
</extension>
<extension
id="idome.xml.generator.contentassist"
point="org.eclipse.wst.sse.ui.completionProposal">
<proposalCategory
id="idome.xml.generator.contentassist"
name="XML Content Assist">
</proposalCategory>
<proposalComputer
activate="true"
categoryId="idome.xml.generator.contentassist"
class="idome.xmlgenerator.contentassist.ContentBlocks"
id="idome.xml.generator.contentassist.contentblocks">
<contentType id="org.eclipse.core.runtime.xml"/>
</proposalComputer>
<proposalComputer
activate="true"
categoryId="idome.xml.generator.contentassist"
class="idome.xmlgenerator.contentassist.TaskCompletionProcessor"
id="idome.xml.generator.contentassist.taskcompletionprocessor">
<contentType id="org.eclipse.core.runtime.xml"/>
</proposalComputer>
<proposalComputer
activate="true"
categoryId="idome.xml.generator.contentassist"
class="idome.xmlgenerator.contentassist.queryAssist"
id="idome.xml.generator.contentassist.attributeassist.tableassist">
<contentType id="org.eclipse.core.runtime.xml"/>
</proposalComputer>
<proposalComputer
activate="true"
categoryId="idome.xml.generator.contentassist"
class="idome.xmlgenerator.contentassist.AttributesList"
id="idome.xml.generator.contentassist.attributeslist">
<contentType id="org.eclipse.core.runtime.xml"/>
</proposalComputer>
<proposalComputer
activate="true"
categoryId="idome.xml.generator.contentassist"
class="idome.xmlgenerator.contentassist.AttributesAssist"
id="idome.xml.generator.contentassist.attributeassist">
<contentType id="org.eclipse.core.runtime.xml"/>
</proposalComputer>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="idomexmlgenerator.editors.TaskTextEditor"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
extensions="xml"
icon="icons/sample.gif"
id="idomexmlgenerator.editors.XMLEditor"
name="Sample XML Editor">
</editor>
</extension>
</plugin>
答案 0 :(得分:0)
首先,您必须实际分离您的文件类型,以便您不会将它们全部视为通用XML文件。定义一些content types。一旦定义了这些内容,您就可以以不同方式关联提案计算机。