Skip to main content



      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 07:42 Go to next message
Eclipse UserFriend
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 07:45] by Moderator

Re: How to hide custom editor until user explicitly sets it [message #560169 is a reply to message #559923] Tue, 21 September 2010 08:28 Go to previous messageGo to next message
Eclipse UserFriend
Any Idea?
Re: How to hide custom editor until user explicitly sets it [message #1741264 is a reply to message #560169] Wed, 24 August 2016 05:28 Go to previous message
Eclipse UserFriend
I have the same problem as when setting by default is made by program.
Re: How to hide custom editor until user explicitly sets it [message #1741304 is a reply to message #560169] Wed, 24 August 2016 05:28 Go to previous message
Eclipse UserFriend
I have the same problem as when setting by default is made by program.
Previous Topic:ShellEd and corrupt Search Dialog
Next Topic:news.eclipse.org is shutting down.
Goto Forum:
  


Current Time: Wed Jul 23 08:13:45 EDT 2025

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

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

Back to the top