Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Extending the default java editor
Extending the default java editor [message #927020] Sat, 29 September 2012 07:03 Go to next message
Sebastien Jahan is currently offline Sebastien JahanFriend
Messages: 4
Registered: September 2012
Junior Member
Hi everyone,

I'm quite a newbie on developing Eclipse's plugin and so, i'd like to start with best practices and good advice!
I'd like to create a plugin that enhance the Eclipse's default java editor with some new features of mine.
Basically, i'd like to be able to switch the editor to read-only mode, and when it is read-only mode, to display it properly to the user: let's say, i'd like to get the border of the editor in red instead of grey (or any default color).

First of all, is this possible?
And next, which is the best way to get it working? I found out there is ClassFileEditor class in org.eclipse.jdt.internal.ui.javaeditor: is extending it the proper way to do what i want to do?

Thank you by advance and have a very good day Razz
SJ.

[Updated on: Sat, 29 September 2012 07:15]

Report message to a moderator

Re: Extending the default java editor [message #927450 is a reply to message #927020] Sat, 29 September 2012 17:27 Go to previous messageGo to next message
Sebastien Jahan is currently offline Sebastien JahanFriend
Messages: 4
Registered: September 2012
Junior Member
Let's get more specific. I finally rethink it a little bit.
I should be able to set my controls not only on the default java editor but on every editor that appears in Eclipse. For each file that's open, i want to be able to lock the edition mode or not, and if the file is meant to be locked, i would like to be able to change the user interface color of the editor to notice the user.

I think extending the java editor is no longer the good way since i would have to extend each possible editor running in Eclipse...
So here is my real question now: is it possible to get an event when a user open file or switch between opened editors? If so, what can i do on editors that i get from that event? Will i be able to slightly change the UI, or at least set them to read-only?

Thank you by advance,
SJ.
Re: Extending the default java editor [message #928289 is a reply to message #927450] Sun, 30 September 2012 14:01 Go to previous messageGo to next message
Sebastien Jahan is currently offline Sebastien JahanFriend
Messages: 4
Registered: September 2012
Junior Member
I managed to get the current active editor at start or at any change of active editor using listeners! That's a good first point to me.
I'll start digging on the next point but if someone knew the answer, that would save me some time!

I'd like to know if this is possible to set an editor to read-only mode. I found out there is a method to get the status of the editor, but none to set it... Is it based on the file status on the filesystem? If so, i could have to switch it from the plugin and refresh the editor, but is this the proper way to proceed?

Thank you by advance,
SJ.
Re: Extending the default java editor [message #929051 is a reply to message #928289] Mon, 01 October 2012 07:11 Go to previous messageGo to next message
Sebastien Jahan is currently offline Sebastien JahanFriend
Messages: 4
Registered: September 2012
Junior Member
Let me refine my question.
I successfully set an editor to read-only mode through accessing its IFile object and setting it to read-only.

So i remain with two questions:

* One problem remains with read-only mode. When i set a file and its editor to read-only mode, if i try to type something in it, Eclipse is asking me if i want to make the file writable. I wish my plugin keeps the entire control on my files, do you know if there is a way to prevent this popup?

* As far as i searched, i didn't find a way to edit the look of the editor component. According to if the editor is read-only or not, i'd like to change the look. If the editor is read-write, i'd like to keep it the usual way. If read-only, i'd like to make it visible, like getting a red border, or a pink/light red background. I have to do that for any editor that opens in Eclipse, so i have to edit each editor on the fly. Do you think it's possible?

Thank you by advance,

SJ.
Re: Extending the default java editor [message #969783 is a reply to message #929051] Sat, 03 November 2012 14:50 Go to previous message
Luiz Goncalves is currently offline Luiz GoncalvesFriend
Messages: 1
Registered: November 2012
Junior Member
Hi Sebastien!

I'm trying to create a plugin that do not permit to type any character in a portion of a code, for example, in a comment text that is initiated by //. I'd like to change color when a portion of code is "locked".

I read your post and it seems that it´s in the same way of my needs. Did you have success? Can you help me?
Previous Topic:Use osgi.java.profile in headless PDE build
Next Topic:PLUG-INS how can I remove my plugin from runtime-EclipseApplication
Goto Forum:
  


Current Time: Thu Apr 25 22:16:16 GMT 2024

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

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

Back to the top