Eclipse - Extend default visual editor with custom widgets - eclipse

I'm using Eclipse as default IDE. In Eclipse there is a visual editor available to insert HTML tags in your *.html files. I'm using a lot of DOJO in my current project and want to add these widgets to the palette view. I assumed that there would be an option to add custom widgets/tags easily(palette's contextmenu or something), but this is not (yet) implemented. Does somebody knows if there is an option to add custom widgets in Eclipse?
I've already Googled a lot and didn't found where I am looking for.
ps. I don't want to use other editors(Maqetta, WDT-plugin, ...).

Related

In an eclipse plugin: How can I programmatically highlight lines of codes in the java 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 )

Jface TreeViewer nodes Link with files

I writing an eclipse plugin to analyze files for some defects, I get the list of java files, their classes and methods in a jface tree view, I need to open the file in the editor when I double click on the file node of the tree view.
please help me with this.
thanks,
Shasinda
You should either use a common navigator framework with corresponding filters that already has the link and open function built-in for Eclipse Resources, however, is much trickier to set up - see the blog post series starting with http://cvalcarcel.wordpress.com/2009/07/08/writing-an-eclipse-plug-in-part-1-what-im-going-to-do/
Alternatively, you could add a double click listener that opens an editor (or checks existing editors of the current workbenchpage) by looking the open editors. For the basic idea, see the corresponding Eclipse FAQ entry.
Use IDE.openEditor to open the editor.

How to capture CTRL+CLICK in a custom Text Editor

I got a custom editor by subclassing TextEditor in Eclipse plugin. I am trying to implement a CTRL+CLICK action(like 'open declaration' in java editor) in my custom editor. But I cannot figure out how to capture CTRL+CLICK. I tried to add a KeyListener to the editor's sourceViewer in its constructor or initialzeEditor(), which didn't work. Has anyone have an idea how to do this?
Thank.
Take a look at
extension point 'org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'
classes org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector, org.eclipse.jface.text.hyperlink.IHyperlinkDetector and org.eclipse.jface.text.hyperlink.IHyperlink
If you need detailed examples, then take a look at plugin.xml of org.eclipse.jdt.ui. (You can get the source for org.eclipse.jdt.ui either from CVS or from Eclipse Classic SDK install)

Eclipse look & feel customization

I need to customize the look & feel of my RCP application.
I took a look at Eclipse Presentation API and I suppose it allows to customize everything in workbench except controls.
So is there any solution to customize controls?
I made some research work and implemented some ad-hoc SWT cunstomization using control canvas drawning. May be there are better solutions?
In Swing you can use Synth theme. It would be great if some 'skin' framework exists for SWT.
One way of customizing an RCP app is by using a plugin_customization.ini file. Like this:
Create a new file called "plugin_customization.ini" in the root of your project.
If you have not already done so, create a product configuration and define a Product.
In your plugin's manifest editor, on the "Extensions" tab, locate the "org.eclipse.core.runtime.products" extension, expand the node, right click on your product node and select "New > property" from the context menu.
Enter "preferenceCustomization" in the "name" field and "plugin_customization.ini" in the "value" field.
Select "File > Save" from the main menu.
You can then customize a lot of things simply by editing plugin_customization.ini file. For example, adding the following line
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
will give you rounded tabs on your views and editors (similar to those that Eclipse IDE has) instead of the default ones.
You can find other constants that you can use in IWorkbenchPreferenceConstants javadoc.
Also, check out the Eclipse skins project, if you haven't already.
There is also the possibility to use CSS to change the look & feel of your app, but that is still in development and can be buggy
As for customizing the SWT controls themselves, the only way to do that (apart from small customizations such as changing the background colour of a control etc.) is by creating your own custom controls by extending Canvas or Composite, but you already know that. Keep in mind that the point of SWT is to use native controls, so if you desire the ability to completely customize your controls, perhaps using Swing would be a better option. However, if you're going to use Swing, it may be better to use another RCP entirely - namely, NetBeans RCP. I haven't tried it out yet, but I know that whereas Eclipse RCP uses SWT as a widget toolkit, NetBeans RCP relies on Swing, so that may save you from some headaches regarding compatibility problems and so on.
The new Eclipse 4 work contains plugins that allow the L&F to be customized using CSS. These plugins can be run in a 3.7 Eclipse environment. See Kai's blog for a presentation on the subject: http://www.toedter.com/blog/?p=477
The Eclipse 4 Styling Tutorial has a slide (p.66) on where to get an 3.7 based RCP example.

Is there a color picker plugin for Eclipse?

I'm using Eclipse Galileo PDT for my work. I also use it to edit my CSS files.
Is there a plugin that lets me pick a color (from a palette or even anywhere from the screen) and which returns the HEX value of that color into my CSS file?
Jspresso Colors 'n Fonts
Just select any java string literal and right click on it to open the contextual popup menu... then select Jspresso>Choose Color... or select Jspresso>Choose Font...
Supports also tooltip : fly over your string literal to display the current color or font... and activate hyperlink to open the editor popup !
Aptana Studio has really great support for CSS. CSS color picking is easy, you can grab a color from anywhere on the screen.
You can install Aptana as a plug into an existing Eclipse installation.
http://docs.aptana.com/docs/index.php/Plugging_Aptana_into_an_existing_Eclipse_configuration
I would recommend to use external software: http://www.colorschemer.com/online.html
You can integrate it into Eclipse.
I have used this plugin called colors in both Galymeade and I just dropped into Galileo.
http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1281.html you can copy the color code to/from clipboard or editor. Slider bar for coloring, color picker etc. I used it to edit css files on a recent project. Good Luck.
You might want to check out the second example at http://eclipsescript.org/#example-scripts.
I created a Groovy Monkey script that opens Eclipse's color picker. It was inspired by what fornwall pointed at (second example of Eclipse Script plugin). It's also able to recognize if current selection is a color so it can be selected it in the picker.
The script is on gist.github, instructions included.
Having a shortcut key for a script is not (yet?) possible in Groovy Monkey, but Crtl+Alt+M runs the last executed script.
A good plugin to consider is the Designerator Color Plugin from the Designerator project. It contributes a Colors view as explained in this blog post. No need to install the whole software, the color view is in a separate feature that can be installed by itself.
The Sampler plugin could also be of interest. However it does not show a color picker dialog where one can select a color, it only has the color picker tool for selecting a color from the screen.
There are a few plugins at the Eclipse plugins site that might meet your needs.
CSS Designer looks promising:
JointLogic CSS Designer is an Eclipse plugin that provides CSS authoring facilities like - CSS Styles view, CSS declaration designer with preview and web-oriented color picker. It integrates with Eclipse Web Tools Platform (WTP) to allow CSS authoring while editing CSS and HTML files.
Here's a screesnhot from the homepage: