Skip to main content


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 messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
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 09:28 Go to previous message
Yves LEDUC is currently offline Yves LEDUCFriend
Messages: 56
Registered: May 2015
Member
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 09:28 Go to previous message
Yves LEDUC is currently offline Yves LEDUCFriend
Messages: 56
Registered: May 2015
Member
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: Thu Apr 25 18:52:27 GMT 2024

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

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

Back to the top