Showing posts with label Eclipse tips. Show all posts
Showing posts with label Eclipse tips. Show all posts

Sunday, January 8, 2017

Tip: Eclipse plugins error - prerequisite build errors

I've faced this issue many times with eclipse.

Even though we have all the plugins and their dependencies defined correctly, still eclipse shows the errors by saying the prerequisite has to be build first.

It's frustrating since I have not made any changes in the project from the last time.

Okay, so the solution for this is:

1. Identify the root prerequisite plugin which eclipse is complaining about.
2. Close that root plugin
3. Re-open it
4. Do clean build for all projects



Thursday, November 14, 2013

Ampersand (&) is not shown on tooltips in Eclipse

To show '&' as part of tooltip information, You need to follow the rules of doubling an ampersand when you want a single ampersand for tool tip text.  All platforms follow this rule and strip out the underscore.

Example:
String tooltip = "Hello & World"; => Hello && World"

Look at the code below.

import org.eclipse.jface.window.DefaultToolTip;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;


public class MyToolTip extends DefaultToolTip {

public MyToolTip(Control control) {
super(control);
}

@Override
protected String getText(Event event) {
int x = event.x;
int y = event.y;

String tooltip = "Hello & World"; //only for test
//TODO: build tooltip info here.
if (tooltip.contains("&")) {
tooltip = tooltip.replace("&", "&&"); //without double ampersand replacement tooltip info will be shown as 'Hello _World' by replacing & by _.
}
return tooltip;
}
}