Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Custom editor for ".class"
Custom editor for ".class" [message #948703] Thu, 18 October 2012 05:30 Go to next message
Eclipse UserFriend
Hi

I need to create new editor for class files located in jar file.
Build path contains jar file.

I configured plugin.xml

I have a.b.c.MyClassEditor that extends MyJavaEditor

Editor extension point
<editor name="My Class Editor" 
icon="icons/my_class_editor.png" 
			class="a.b.c.MyClassEditor"			 
			default="true"
			id="a.b.c.MyClassEditor">
			<contentTypeBinding contentTypeId="a.b.c.contenttype.myClassFile" />
		</editor>		


Content type extension point
	  <content-type id="a.b.c.contenttype.myClassFile"
			file-extensions="class" 
		  	base-type="org.eclipse.jdt.core.javaClass"
			name="My Class" 
			priority="high">			
			<describer class="a.b.b.myContentDescriber">
			</describer>
		 </content-type>



When I try to open ".class" file the editor that opens is org.eclipse.jdt.ui.ClassFileEditor instead of mine.

I debugged the code and saw that
In ContentTypeCatalog the method internalFindContentTypesFor found 2 suitable content types (javaClass and my) and every time returns javaClass content type as default and as I wanted that my content will be returned.

[/code]

I also have My Java Source Editor for ".java" files, it is configured in same way, but here it works perfectly.

Content type extension point
  <content-type id="a.b.c.contenttype.myJavaFile"
		  	base-type="org.eclipse.jdt.core.javaSource"		  
			file-extensions="java" 
			name="My Java File" 			
			priority="high">			
			<describer class="a.b.b.myContentDescriber">
                        </describer>
		 </content-type>


Editor extension point

<editor name="My Java Editor" 
			icon="icons/my_java_editor.png" 
			class="a.b.c.MyJavaEditor"
			id="a.b.c.MyJavaEditor">
			<contentTypeBinding contentTypeId="a.b.c.contenttype.myJavaFile" />
		</editor>




What is wrong?

Thank you
Evgeny
Re: Custom editor for ".class" [message #949285 is a reply to message #948703] Thu, 18 October 2012 17:48 Go to previous messageGo to next message
Eclipse UserFriend
Extensions are not meant to override each other, they can only add new stuff.
It seems in case of .java your "lucky" and in case of .class you're not.

But: what do you see when you right-click > open with ... ?
Re: Custom editor for ".class" [message #949576 is a reply to message #949285] Fri, 19 October 2012 01:06 Go to previous messageGo to next message
Eclipse UserFriend
Option "open with" does not exist for ".class" file.
Eclipse uses different logic to open java source and to open java class. (My debug expirience: it uses different comparators)

I want to open some class files (the classes that contains specific annotation) with my editor and others with eclipse default editor.
Re: Custom editor for ".class" [message #986372 is a reply to message #949576] Tue, 20 November 2012 04:25 Go to previous message
Eclipse UserFriend
Hi,

You have use .java file and open that.

Previous Topic:How to run -splash command in Eclipse
Next Topic:Analyzing Compilation Unit through a java application
Goto Forum:
  


Current Time: Fri May 16 23:34:37 EDT 2025

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

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

Back to the top