I'm new to eclipse but I want to prototype something. The APIs are a bit of a maze. I would like to programmatically place (and then move/remove) an icon on a given line in the editor, preferably in the margins.
Here's an example:
Does anyone have an idea, or a good strategy for implementing something that?
Take a look at the following extension point org.eclipse.ui.workbench.texteditor.rulerColumns
Related
I'm writing a plugin for the Eclipse IDE that adds a custom marker annotation to highlight portions of the code. Currently, I use textStylePreferenceValue="BOX" in the org.eclipse.ui.editors.markerAnnotationSpecification and get a changed background color that ends at the line-break for each line. That introduces a lot of visual noise, and I would like to have the color to extend to the whole width of the editor. How can I achieve this?
If this is not possible at the moment, what would be the next steps to add this functionality to the platform?
This is what I have:
This is what I want:
After researching further, it seems that this is not possible at the moment, at least not easily. The relevant Eclipse sub-project seems to be "platform.text" (https://github.com/eclipse/eclipse.platform.text/). The possible textStylePreferenceValues are defined in the class "org.eclipse.ui.texteditor.AnnotationPreference", and how to paint them is defined in the class "org.eclipse.jface.text.source.AnnotationPainter".
A low level solution could be to use a LineBackgroundListener together with the StyledText object of the editor.
I am trying to develop an eclipse plugin that does some documentation check on java code and highlights some lines of code in the editor.
To achieve my goal, I DON'T want to create a new editor in eclipse, I simply want to extend the default java editor to draw a line under (or highlight) the methods that do not satisfy some set of predetermined requirements.
Do I need to create a PresentationReconciler? If yes, how do I make the JDT or workbench use my reconciler.
I have never done plugin development and this is my first attempt.
Several starting points for you:
Annotations are an UI feature of JFace's text editor that allows you to visually mark some places in an open editor.
Markers are a Workbench feature, more high-level. They are generic "objects that may be associated with Workbench resources", and they can display in several places: in text editors (as annotations) or in the Problems view, for example.
Depending on what you want to do, you would plug in your plug-in into extension points related to either of those.
The Eclipse Java editor is located in the org.eclipse.jdt.internal.ui.javaeditor.JavaEditor package.
The "internal" in the package name means that the Eclipse development team can change how the Java editor works with new revisions.
Try this help page: Juno Help on syntax highlighting
At the end of the page, it describes how to dynamically add a PresentationReconciler, which is used for syntax highlighting. See if that fits the problem that you want to solve.
I assume you already have a plugin project.
In your plugin.xml, open the tab Extensions, click Add..., search for org.eclipse.ui.editors, then you should see a template named Editor, which will produce a simple xml editor to experiment and play with. Also, you will be able to see the needed structure to define a custom editor.
Hope this helps...
I don't know if you still have a need for this, but you are going to want to use Annotations to keep track of what parts of the editor you need to highlight.
For actually doing the graphical effect of highlighting, you could do syntax highlighting via a PresentationReconciler, but I have no experience with that.
We used a technique we borrowed from http://editbox.sourceforge.net/, replacing the background image of the editor Shell. Its open source, so check it out. (Our code might also help -- its at https://github.com/IDE4edu/EclipseEditorOverlay )
I would like to create my own Launch Button. When You click right mouse button on your project, then "Run As.." - you have some possibilities like Java Applet, Java Application or for example JUnitTest. I would like to create my own button, something like "Trololo Application" with it's own run configuration. I suppose it must be plugin, the only thing I found on the Net is this article http://www.eclipse.org/articles/Article-Launch-Framework/launch.html . But it looks quite difficult and I'm not sure if it can do what I want to do. Any other, faster ideas or tutorial how to do this?
Or maybe it's not possible?
The essential bit is the org.eclipse.debug.core.launchConfigurationTypes extension point. The rest are just bells and whistles, like icons.
(Of course, you probably still want some mechanism to actually configure your own launch configurations.)
I'm developing an Eclipse Plugin Editor that has a Flyout Palette with several tools in it (like selection and so on).
I was wondering how to add a special tool (let's call it "hand tool") that scrolls the page in the same way the "hand tool" of the Acrobat Reader scrolls the page of a PDF document.
I'm googling for some ideas of how to tackle this problem, but with no success, so far. Could you please give me some hint?
Thanks in advance :)
I assume you are using GEF? My answer may be trivial, but i'm trying to throw in some ideas.
org.eclipse.draw2d.Viewport class has pair of getViewLocation()/setViewLocation() metods. It seems that using them you can scroll your view as desired.
Now you'll need a tool. Explore the hierarchy of org.eclipse.gef.tools.AbstractTool descendans to find some examples of desired behavior and create your own tool class for your functionality.
I use an older plugin called Veloeclipse for editing Velocity templates in Eclipse. There's been no development on this since 2009, which isn't a problem because it's mainly just for syntax highlighting and format validation. The really annoying thing about it, however, is that when I try to do Show In to view the current Velocity template within my Package Explorer or Project Explorer, the only available option is Properties. That's not really useful. I really need to be able to get to the file in one of the regular explorer views.
So I have sort of two questions:
Is there a way to configure this without having to monkey with any code? A configuration file or something? I've grepped through my Eclipse installation and haven't seen anything, but I'm hoping that there's something I'm missing.
So assuming that the answer to my first question is no, how do I go about modifying the plugin code so that it will show more than the Properties view in the Show In menu? Most of what I found on the plugin development wiki comes from the other direction: how to make your view or perspective appear in the Show In menu.
Any help with this would be hugely appreciated!
Try to check the plugin source code. it might do something different than other editors. What I mean is that the show in menu item that you have there is not the usual extension point but a hard coded context menu option.