Community
Participate
Working Groups
master Link#setEnabled(boolean) does not update the color of the text without a redraw() call from the client. The color of the link is correctly updated. import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.Shell; public class SnippetDisableLink { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); final Link link = new Link(shell, SWT.NONE); link.setText("This a very simple <A>link widget</A>."); final Button button = new Button(shell, SWT.PUSH); button.setText("Enable/Disable"); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean enable = !link.getEnabled(); System.out.println("enabled: " + enable); link.setEnabled(enable); } }); Button redraw = new Button(shell, SWT.PUSH); redraw.setText("Redraw"); redraw.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { link.redraw(); } }); shell.pack (); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
In JDT, this can be seen on the Java Compiler properties page of a Java project: When you toggle 'Enable project specific settings', the link in the "Use compliance from ..." checkbox is not redrawn (unless you force it e.g. by resizing the dialog).
Interesting (bug in win32 IMO), thanks for the snippet. Fixed http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=64d29b632ce5e80bcbbf72b8860873b3b0700575
Thanks for the quick fix! I already considered releasing a workaround in a new piece of code, but I can omit that now.