Eclipse RCP color picker

There is a color control in the Eclipse preferences on each syntax underline settings page. It consists of a colored button.

color select button

which opens a dialog box

color picker dialog

I want to use these components in my RCP application, but I cannot find out what they are or if they are even available.

I assume the button may be a regular button. That would be easy to build. But I want not to build the dialogue itself.

Can someone tell me where to find this component?

PS: I already saw this question , but it does not offer a "native" Eclipse solution.

+4
source share
2 answers

I came across this myself now (when searching for something completely different). This is org.eclipse.jface.preference.ColorFieldEditor .

+5
source

Instead, you can directly use the org.eclipse.jface.preference.ColorSelector class. Below is a snippet on how to use.

 final ColorSelector colorSelector = new ColorSelector(shell); colorSelector.getButton().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { System.out.println(" selected color :: " + colorSelector.getColorValue()); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); 
0
source

All Articles