2

I have a flowchart editor for which xml file is the input. in the plugin.xml i have specified the extension as xml for my editor but it is opening in the default xml editor. what makes the file opening in my editor ? i want to do this in my plugin development. after i launch my plugin there is no preference or open with context menu. and i want to keep my editor as default for xml files

asked Sep 26, 2012 at 3:00

2 Answers 2

2

Check the file's Open With context menu, and the defaults on the File Associations preference page.

answered Sep 26, 2012 at 3:01
Sign up to request clarification or add additional context in comments.

3 Comments

window --> preferences --> general --> Editors --> file associations --> *.xml
there is no preferences in my plugin i want my editor as to be default always
Then take a closer look at the extension point for registering your editor. It allows an editor to declare itself as the default.
2

Eclipse provides a mechanism to programmatically identify file types based on their actual content. The org. eclipse. core. contenttype. contentTypes extension point can be used to define a content type described by a "describer," which is a class capable of recognizing specific types of content given an input stream. Editors designed to work with a specific content type can be bound to it instead of a file extension.

We need to specify the content type in the plugin.xml like below

<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type base-type="org.eclipse.core.runtime.xml"
 file-extensions="xml"
 id="ca.ecliptical.examples.contenttype.apples"
 name="Apples File"
 priority="normal">
 <describer class="org.eclipse.core.runtime.content
 .XMLRootElementContentDescriber">
 <parameter name="element"
 value="apples">
 </parameter>
 </describer>
</content-type>

below is the references and it works fine

http://www.developer.com/java/data/article.php/3648736/Eclipse-Tip-Define-Custom-Content-Types-to-Identify-Your-Data-Files.htm

answered Sep 27, 2012 at 9:57

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.