I've been trying develop my custom plugin for Eclipse, and basically I want to make is a "richer" version on the current TextHover. I don't know what widget(?) Eclipse uses to display the hovering text, but I want to use something different, like SWT Image or SWT Browser.
Most of the tutorials that I've read suggest that I have to implement my own Java Editor to do this, but I don't want the user to switch to my custom editor just for a simple feature (and I don't want to implement a whole editor).
Some Tests:
I've already created two Eclipse Plugin Projects. The first one is a extension for the JavaEditorTextHovers, and with this project I managed to show some custom Strings when hovering some random texts, but wasn't able to change the hover appearance. The second project was a editor plugin. With this last one I managed to get a Browser to appear when hovering a random text(this tutorial helped me), but again, this editor had nothing, no syntax coloring, no rules, etc., and for the previous reasons, I couldn't accept this has a solution.
Maybe if there was way to change the (or set a new) SourceViewerConfiguration of the current editor I could pass my custom SourceViewerConfiguration, but I'm not sure if this is possible.
Related
I am currently using a bunch of eclipse, jface libraries to build a small editor. I am using eclipse's SourceViewer for it. I am trying to highlight/change the color of parts of my code in eclipse however I don't think I can use the concept of damager, repairer and PresentationReconciler because I want to highlight lines of code based on user selection. So if a user selects some code I can get the selected code by using
SourceViewer.getSelectionProvider().getSelection();
Which would return an ISelection and thats what I want to "Highlight". I am currently able to create Annotations which essentially creates squigglies under the text the user selects I would rather change the color of the selected text. Would much appreciate any help.
edit:
I am not developing as an eclipse plugin but as a standalone application using the plugin api's.
I'm developing an Eclipse plug-in, mostly as a learning exercise, in which I have a wizard page. In this wizard page I would like to have a small text area that behaves like a code editor with the appropriate content assist and information hovers etc, much like the breakpoint properties wizard has for adding conditions.
I'm new to plug-in development and I may not have quite picked up the vocabulary, so I'm not having much luck searching for examples. Can someone please point me in the right direction?
I assume that you are looking for an embeddable Java source editor - and with that you hit a difficult topic.
The source viewer mentioned by Chris Gerken is called JDISourceViewer. It is instantiated and configured in JavaBreakpointConditionEditor::createControl.
If you cannot find the mentioned classes, or if you want to experiment with them, then open the Plug-ins view, find the org.eclipse.jdt.debug.ui plug-in and select Import As > Source Project from the context menu.
Unfortunately - in the beginning - the (Java) editors weren't designed to be embedded outside of the editor area and many editor participants (e.g. actions, formatter, etc) still expect an IEditorPart. Hence it is a quirky and complicated endeavour to use an editor in a dialog or the like.
Moreover, the Java source editing infrastructure is not exposed as public API. It isn't meant to be used by clients and can change at any time without prior notice. You will see respective warnings in yoyur code. For a learning exercise, however, that shouldn't matter much.
I'm building a preferences editor for my Eclipse RCP application using the existing IWorkbenchPreferencePage framework (see http://www.eclipse.org/articles/Article-Field-Editors/field_editors.html for a good tutorial).
It has editors for a number of different types of data:
BooleanFieldEditor
IntegerFieldEditor
StringFieldEditor
RadioGroupFieldEditor
ColorFieldEditor
FontFieldEditor
DirectoryFieldEditor
FileFieldEditor
PathEditor
However, one thing which doesn't seem to exist is a nice DateFieldEditor (ideally with a button to bring up a calendar to allow choosing of a particular date).
So my question is, does such a org.eclipse.jface.preference.FieldEditor subclass exist, either in standard JFace or in a 3rd party plugin or project?
Alternatively, even a SWT calendar component would be useful, because I could build the rest on top of that pretty easily.
JFace doesn't have such a FieldEditor. But there is an official feature request for a DateFieldEditor that even has a basic implementation attached to it. At the very least you could use that as a template to create your own field editor, if it doesn't work for you as is.
I need to get the name of class that represents the Java SWT/JFace UI component which is currently displayed and highlighted by mouse cursor.
For example, i wish to get something like "org.eclipse.swt.widgets.Table" when my cursor is pointing to any displayed SWT Table control, etc.
Tell me, is there a plugin for Eclipse IDE, or any another utility, which allows to do this?
In this way I want to simplify the process of writing UI-tests for Eclipse-RCP plugin project. Searching for class name and path manually anytime when this needed is very discouraging.
Get hold of the current display Display.getDefault() and call getCursorControl(), once you have the Control call control.getClass().getName().
Install SWT Spy: http://www.eclipse.org/swt/tools.php
SWT Spy is the correct tool to use. However, the mentioned page is not updated.
From Eclipse 4.7 SWT Spy is included in Eclipse PDE. So you can get it by downloading the Eclipse for RCP and RAP.
To launch SWT Spy, press: CTRL + ALT + SHIFT + F9
In case of doubts, please see: http://www.vogella.com/tutorials/EclipseCodeAccess/article.html#swt-spy
I'm trying to create a GUI with netbean, and I've created a tool bar with different icon. What I want to do is this: When you mouse over one of the button I want a little text bubble to appear with text that I will have specified.
I've been searching the web for a while, and all I could find was something about this package: "org.openide.awt" wich contains (in theory from what I've read) NotificationDisplayer.
If this thing really works with java and netbeans well, I can't get it to work. All I need to know is does this package is actually netbean/java compatible, or better, if there is a simpler way to display a text bubble.
A tool tip?
The JComponent API has support for that.
Check if this is what you need:
How to Use Tool Bars
ie: