[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: One filetype two editors two icons

Hi Paul:

thank you very much for your answer.

With that information and Google I was able to figure out how this works.
But, there is still something I am doing wrong. I hope you or someone else can help me.

I just created the basic editor plug-in (which you can find within the wizard File - New - Plug-in Project).

My example plug-in should be able to open files with the extension "xyz". But, not all the "xyz" files, only the ones which have the tag "a" as a root tag. In addition all those "xyz" files (with the mentioned root tag) should get an icon.

So, I edited the plugin.xml which now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.3"?>
<plugin>

   <extension
         point="org.eclipse.ui.editors">
      <editor
            name="Sample XML Editor"
            icon="icons/sample.gif"
            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
            class="contentdescribertest.editors.XMLEditor"
            id="contentdescribertest.editors.XMLEditor">
         <contentTypeBinding
               contentTypeId="ContentDescriberTest.content-type.xyz">
         </contentTypeBinding>
      </editor>
   </extension>

   <extension
         point="org.eclipse.core.runtime.contentTypes">
      <content-type
            base-type="org.eclipse.core.runtime.xml"
            file-extensions="xyz"
            id="ContentDescriberTest.content-type.xyz"
            name="xyz files"
            priority="high">
         <describer
               class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
            <parameter
                  name="element"
                  value="a">
            </parameter>
         </describer>
      </content-type>
   </extension>

</plugin>

I created two "xyz"-files, each with two tags in it: one contains the "a" tag (open- and close tag) and the other file "b".

I would expect my plug-in to just display one file with the icon, but both files get it.

I would say, that there is not much you can do wrong here. So, I am very surprised that it doesn't work. Do you see what I did wrong?

For an answer thank you very much in advance.