Skip to content

Instantly share code, notes, and snippets.

@fbricon
Created November 27, 2013 11:28
Show Gist options
  • Save fbricon/7674232 to your computer and use it in GitHub Desktop.
Save fbricon/7674232 to your computer and use it in GitHub Desktop.
todo : add a f*** warning to a link
private void createLink(Composite composite) {
// warningArea = new Composite(composite, SWT.NONE);
// warningArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
//
// Label warningImg = new Label(warningArea, SWT.NONE);
// warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
link = new Link(composite, SWT.NONE);
link.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
addOutOfDateProjects();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
addOutOfDateProjects();
}
});
}
private void updateLink(int outOfDateProjectCount) {
boolean visibility = true;
if(outOfDateProjectCount == 0) {
visibility = false;
} else if(outOfDateProjectCount > 1) {
link.setText(outOfDateProjectCount
+ " unselected projects are out of date and should be updated. <A>Click here</A> to include them."); //$NON-NLS-1$//$NON-NLS-2$
} else {
link.setText("One unselected project is out of date and should be updated. <A>Click here</A> to include it."); //$NON-NLS-1$//$NON-NLS-2$
}
link.setVisible(visibility);
link.getParent().layout(new Control[] {link});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment