Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » How to hide custom editor until user explicitly sets it(How to set text editor as default editor programmatically)
icon5.gif  How to hide custom editor until user explicitly sets it [message #559923] Mon, 20 September 2010 11:42 Go to next message
daisydale85 is currently offline daisydale85Friend
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

Re: How to hide custom editor until user explicitly sets it [message #560169 is a reply to message #559923] Tue, 21 September 2010 12:28 Go to previous message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Any Idea?
Previous Topic:Triggering full build on buildpath change
Next Topic:Data/control flow analysis
Goto Forum:
  


Current Time: Thu Dec 18 17:33:30 GMT 2014

Powered by FUDForum. Page generated in 0.01576 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software