Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Custom editor for ".class"
Custom editor for ".class" [message #948703] Thu, 18 October 2012 09:30 Go to next message
Evgeny Meerson is currently offline Evgeny MeersonFriend
Messages: 3
Registered: October 2012
Junior Member
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 21:48 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1048
Registered: July 2009
Senior Member
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 05:06 Go to previous messageGo to next message
Evgeny Meerson is currently offline Evgeny MeersonFriend
Messages: 3
Registered: October 2012
Junior Member
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 09:25 Go to previous message
Mitesh Aegis is currently offline Mitesh AegisFriend
Messages: 5
Registered: November 2012
Junior Member
Hi,

You have use .java file and open that.



More info:- www.programmingpeopleinc.com
Previous Topic:How to run -splash command in Eclipse
Next Topic:Analyzing Compilation Unit through a java application
Goto Forum:
  


Current Time: Sat Dec 20 02:22:57 GMT 2014

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

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