How to hide custom editor until user explicitly sets it [message #559923] |
Mon, 20 September 2010 11:42 |
daisydale85 Messages: 38 Registered: August 2010 |
Member |
|
|
Hi,
I have a custom editor that detects file with extension, say for example, .abc. I have associated custom editor to this file extension. The editor is also bound to a content type.
Since the editor is still in development phase, I want to use text editor as the default editor for files with .abc extension.
<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
id="test.ui.testContentType"
describer="test.ui.testContentDescriber"
default-charset="UTF-8"
base-type="org.eclipse.core.runtime.text"
file-extensions="abc"
name="test content type"
priority="high">
</content-type>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
id="test.ui.TestEditor"
class="test.ui.editor.TestEditor"
default="false"
extensions="abc"
icon="icons/sample.png"
name="Test Editor">
<contentTypeBinding
contentTypeId="test.ui.testContentType">
</contentTypeBinding>
</editor>
</extension>
When user tries to open the file, I need that file to be opened in text editor. I checked the Windows->Preferences->General->Editor->File Associations
I can see that both text editor and the "Test Editor" are associated to the file extension. I have set the "default" value to "false" and also tried by setting the "priority" value in Contenttype to "normal" and "low". But still, the file is being opened in "Test Editor" itself. If I set the text editor as default editor from "File Associations" section in Preferences, it is working fine. File will get opened in text editor only. But I need to do the same programmatically.
Somewhere I saw something like you can use IEditorRegistry.setDefaultEditor to set default editor but I dont know from where to call that.
Any help will be highly appreciated.
Thanks,
Daisy.
[Updated on: Mon, 20 September 2010 11:45] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03830 seconds