org.eclipse.ui.forms.events.IHyperlinkListener Java Examples

The following examples show how to use org.eclipse.ui.forms.events.IHyperlinkListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SWTHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Return a Label that acts as a hyperlink
 * 
 * @param parent
 *            parent control
 * @param text
 *            text to display
 * @param lis
 *            hyperlink listener that is called on Mouse click
 * @return a Label
 */
public static Label createHyperlink(final Composite parent, final String text,
	final IHyperlinkListener lis){
	final Label ret = new Label(parent, SWT.NONE);
	ret.setText(text);
	ret.setForeground(UiDesk.getColorRegistry().get(Messages.SWTHelper_blue)); //$NON-NLS-1$
	ret.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDown(final MouseEvent e){
			if (lis != null) {
				lis.linkActivated(new HyperlinkEvent(ret, ret, text, e.stateMask));
			}
		}
		
	});
	return ret;
}
 
Example #2
Source File: WidgetFactory.java    From elexis-3-core with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Hyperlink in der Form erzeugen
 * 
 * @param text
 *            Angezeigter und anklickbarer Text
 * @param lis
 *            HyperlinkListener oder (einfacher) HyperlinkAdapter, der die Klicks verarbeiten
 *            kann
 */
public Hyperlink createHyperlink(String text, IHyperlinkListener lis){
	Hyperlink ret = tk.createHyperlink(form.getBody(), text, SWT.WRAP);
	ret.addHyperlinkListener(lis);
	return ret;
}