Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » New file extension for Web Tools xml editor
New file extension for Web Tools xml editor [message #736094] Thu, 13 October 2011 15:03 Go to next message
batorpiotr is currently offline batorpiotrFriend
Messages: 3
Registered: October 2011
Junior Member
Hi all,

I want to associate Web Tools XML editor with new file extension. I'm trying do it this way:

<!--The org.eclipse.wst.xml.core.xmlsource content type is only for
		handling some special cases of ill-formed xml in a reasonable
		manner, and should not be emulated by clients. The two content
		types are often used interchangeably by the XML component, but
		please use org.eclipse.core.runtime.xml instead. -->
	<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
		<sourceViewerConfiguration
			class="org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML"
			target="hadesclipse.editor.hml" />
		<contentOutlineConfiguration
			class="org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration"
			target="hadesclipse.editor.hml" />
		<quickOutlineConfiguration
			class="org.eclipse.wst.xml.ui.internal.quickoutline.XMLQuickOutlineConfiguration"
			target="hadesclipse.editor.hml" />
		<propertySheetConfiguration
			class="org.eclipse.wst.xml.ui.views.properties.XMLPropertySheetConfiguration"
			target="hadesclipse.editor.hml" />
		<documentationTextHover
        	class="org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor"
        	target="hadesclipse.editor.hml">
  		</documentationTextHover>
  		<doubleClickStrategy
        	class="org.eclipse.wst.xml.ui.internal.doubleclick.XMLDoubleClickStrategy"
        	target="hadesclipse.editor.hml">
  		</doubleClickStrategy>
		<provisionalConfiguration
			type="sourceeditingtexttools"
			class="org.eclipse.wst.xml.ui.internal.provisional.XMLSourceEditingTextTools"
			target="hadesclipse.editor.hml" />
		<provisionalConfiguration
			type="characterpairmatcher"
			class="org.eclipse.wst.xml.ui.internal.text.XMLDocumentRegionEdgeMatcher"
			target="hadesclipse.editor.hml" />
		<provisionalConfiguration
			type="foldingstrategy"
			class="org.eclipse.wst.xml.ui.internal.projection.XMLFoldingStrategy"
			target="hadesclipse.editor.hml" />
		<provisionalConfiguration
			type="org.eclipse.jface.text.quickassist.IQuickAssistProcessor"
			class="org.eclipse.wst.xml.ui.internal.correction.XMLQuickAssistProcessor"
			target="hadesclipse.editor.hml" />
		<provisionalConfiguration
			type="autoeditstrategy"
			class="org.eclipse.wst.xml.ui.internal.autoedit.StructuredAutoEditStrategyXML"
			target="hadesclipse.editor.hml" />
		<provisionalDefinition
			type="preferencepages"
			value="org.eclipse.wst.xml.ui.preferences.xml.xml, org.eclipse.wst.sse.ui.preferences.xml.source, org.eclipse.wst.sse.ui.preferences.xml.templates, org.eclipse.wst.sse.ui.preferences.xml.colors, org.eclipse.wst.sse.ui.preferences.xml.contentassist"
			target="hadesclipse.editor.hml" />
		<provisionalDefinition
			type="spellingregions"
			value="XML_COMMENT_TEXT, XML_CONTENT, XML_DEFAULT"
			target="hadesclipse.editor.hml" />
		<provisionalDefinition
			type="activecontexts"
			value="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.navigation, org.eclipse.wst.xml.cleanup, org.eclipse.wst.xml.selection, org.eclipse.wst.xml.dependencies, org.eclipse.wst.xml.grammar, org.eclipse.wst.xml.expand, org.eclipse.wst.xml.occurrences, org.eclipse.wst.sse.comments"
        	target="hadesclipse.editor.hml" />
	</extension>
		
   <extension
         point="org.eclipse.ui.editors">
   
      <editor
			contributorClass="org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorActionBarContributor"
			class="org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart"
            icon="icons/sample.gif"
            id="hadesclipse.editors.HMLEditor"
            name="HMLEditor">
            <contentTypeBinding
        		 contentTypeId="hadesclipse.editor.hml"/>
       </editor> 		 			
   </extension>
   
   	<!-- HML model content type -->
	<extension point="org.eclipse.core.contenttype.contentTypes"> 
      <content-type id="hadesclipse.editor.hml"
       base-type="org.eclipse.core.runtime.xml"    
       name="HML model"  
       file-extensions="hml"
       priority="high">
      </content-type> 
   </extension> 
   



Syntax Colouring, formatting and code folding works, but i have no idea why code completion does not works.When I'm pressing ctrl+spacebar in the left bootom corner shows "No completions avaible". Shoud I add something to plugin.xml ?

please help.
Re: New file extension for Web Tools xml editor [message #736118 is a reply to message #736094] Thu, 13 October 2011 15:53 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Is the root issue being able to open the XML Editor on your own filename extension? If so, and those files are valid XML, you can just add a new file-association, or content type whose base type is XML, using the org.eclipse.core.contenttype.contentTypes extension point.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: New file extension for Web Tools xml editor [message #736156 is a reply to message #736118] Thu, 13 October 2011 17:23 Go to previous messageGo to next message
batorpiotr is currently offline batorpiotrFriend
Messages: 3
Registered: October 2011
Junior Member
Nitin Dahyabhai wrote on Thu, 13 October 2011 11:53
... you can just add a new file-association, or content type whose base type is XML, using the org.eclipse.core.contenttype.contentTypes extension point.


I think I'm doing this:

        ...

   	<!-- HML model content type -->
	<extension point="org.eclipse.core.contenttype.contentTypes"> 
      <content-type id="hadesclipse.editor.hml"
       base-type="org.eclipse.core.runtime.xml"    
       name="HML model"  
       file-extensions="hml"
       priority="high">
      </content-type> 
   </extension> 



and editor is associated with *.hml files, but code assistance don't work

[Updated on: Thu, 13 October 2011 17:40]

Report message to a moderator

Re: New file extension for Web Tools xml editor [message #736233 is a reply to message #736156] Thu, 13 October 2011 20:56 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Does it work for a file with identical contents named *.xml?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: New file extension for Web Tools xml editor [message #736258 is a reply to message #736233] Thu, 13 October 2011 21:29 Go to previous messageGo to next message
batorpiotr is currently offline batorpiotrFriend
Messages: 3
Registered: October 2011
Junior Member
Nitin Dahyabhai wrote on Thu, 13 October 2011 16:56
Does it work for a file with identical contents named *.xml?


Yes
Re: New file extension for Web Tools xml editor [message #748207 is a reply to message #736258] Mon, 24 October 2011 15:03 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Just to make sure I'm not missing anything obvious, your file does refer to a schema or DTD, right?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:How to get bundle org.eclipse.jpt.core 2.3.0?
Next Topic:How to create a dynamic web project from existing source folders?
Goto Forum:
  


Current Time: Tue Apr 16 08:26:17 GMT 2024

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

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

Back to the top