特定内容有助于eclipse插件中的自定义XML文件类型

时间:2023-02-05 09:06:38

I have created a custom eclipse plugin for generating XML files (JDBC, CSV, LDAP). Now I an trying to create specific content assistance for each file type. At the moment my plug in project provides me with the full range of suggestions no matter which file type is currently open. I want to know how to assign a certain content proposal class to one of my file types.

我创建了一个自定义eclipse插件,用于生成XML文件(JDBC,CSV,LDAP)。现在我尝试为每种文件类型创建特定的内容辅助。目前,无论当前打开哪种文件类型,我的插件项目都会为我提供全方位的建议。我想知道如何将某个内容提议类分配给我的某个文件类型。

Below is my plugin.xml class if it is of any assistance.

下面是我的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>

1 个解决方案

#1


0  

First you have to actually separate your file types so that you're not treating them all as generic XML files. Define some content types. Once you have those defined, you'll be able to associate your proposal computers differently.

首先,您必须实际分离文件类型,这样您就不会将它们全部视为通用XML文件。定义一些内容类型。一旦定义了这些,您就可以以不同方式关联提案计算机。

#1


0  

First you have to actually separate your file types so that you're not treating them all as generic XML files. Define some content types. Once you have those defined, you'll be able to associate your proposal computers differently.

首先,您必须实际分离文件类型,这样您就不会将它们全部视为通用XML文件。定义一些内容类型。一旦定义了这些,您就可以以不同方式关联提案计算机。