Composite linkPnl = new Composite(main, SWT.NONE);
linkPnl.setLayout(new GridLayout(4, false));
linkPnl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
Link lnk = new Link(linkPnl, SWT.NONE);
lnk.setText("<a>" + Messages.SingleBandEditorPage_ReverseColorLabel + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
lnk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
reverseColors = !reverseColors;
if (getCurrentSelection() != null){
Object x = ((IStructuredSelection)cmbPalette.getSelection()).getFirstElement();
if (x instanceof BrewerPalette){
BrewerPalette palette = (BrewerPalette) ((IStructuredSelection)cmbPalette.getSelection()).getFirstElement();
getCurrentSelection().setColorPalette(palette, reverseColors);
}else if (x instanceof PredefinedColorRule){
ColorMap cm = ((PredefinedColorRule)x).getColorMap();
if (cm != null && getCurrentSelection() != null){
//flip colors
if (reverseColors){
ColorMap reverse = new ColorMapImpl();
for (int i = 0; i < cm.getColorMapEntries().length; i ++){
ColorMapEntry entry = cm.getColorMapEntries()[i];
ColorMapEntry clone = new ColorMapEntryImpl();
clone.setColor(cm.getColorMapEntry(cm.getColorMapEntries().length - 1 - i).getColor());
clone.setLabel(entry.getLabel());
clone.setQuantity(entry.getQuantity());
clone.setOpacity(entry.getOpacity());
reverse.addColorMapEntry(clone);
}
cm = reverse;
}
getCurrentSelection().init(cm);
}
}
}
}
});
Label lblSep = new Label(linkPnl, SWT.SEPARATOR | SWT.VERTICAL);
GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
gd.heightHint = 10;
lblSep.setLayoutData(gd);
lnk = new Link(linkPnl, SWT.NONE);
lnk.setText("<a>" + Messages.SingleBandEditorPage_FormatExportLink + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
lnk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getFormat();
}
});
Link lnk2 = new Link(linkPnl, SWT.NONE);
lnk2.setText("<a>" + Messages.SingleBandEditorPage_OneClickExportLink + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
lnk2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
lnk2.setToolTipText(Messages.SingleBandEditorPage_OneClickTooltip);
lnk2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
oneClickExport();
}
});