View | Details | Raw Unified | Return to bug 236735 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/forms/widgets/FormToolkit.java (-1 / +19 lines)
Lines 399-405 Link Here
399
	 * @return the rich text widget
399
	 * @return the rich text widget
400
	 */
400
	 */
401
	public FormText createFormText(Composite parent, boolean trackFocus) {
401
	public FormText createFormText(Composite parent, boolean trackFocus) {
402
		FormText engine = new FormText(parent, SWT.WRAP | orientation);
402
		return createFormText(parent, SWT.NONE, trackFocus);
403
	}
404
	
405
	/**
406
	 * Creates a rich text as a part of the form.
407
	 * 
408
	 * @param parent
409
	 *            the rich text parent
410
	 * @param style
411
	 * 			  the form text style
412
	 * @param trackFocus
413
	 *            if <code>true</code>, the toolkit will monitor focus
414
	 *            transfers to ensure that the hyperlink in focus is visible in
415
	 *            the form.
416
	 * @return the rich text widget
417
	 * @since org.eclipse.ui.forms 3.4
418
	 */
419
	public FormText createFormText(Composite parent, int style, boolean trackFocus) {
420
		FormText engine = new FormText(parent, style | SWT.WRAP | orientation);
403
		engine.marginWidth = 1;
421
		engine.marginWidth = 1;
404
		engine.marginHeight = 0;
422
		engine.marginHeight = 0;
405
		engine.setHyperlinkSettings(getHyperlinkGroup());
423
		engine.setHyperlinkSettings(getHyperlinkGroup());
(-)src/org/eclipse/ui/forms/widgets/FormText.java (-5 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 352-357 Link Here
352
	/**
352
	/**
353
	 * Contructs a new form text widget in the provided parent and using the
353
	 * Contructs a new form text widget in the provided parent and using the
354
	 * styles.
354
	 * styles.
355
	 * <p>
356
	 * The only valid style bit for <code>FormText</code> is <code>SWT.NO_FOCUS</code>.
357
	 * This will cause the widget to always refuse focus.
355
	 * 
358
	 * 
356
	 * @param parent
359
	 * @param parent
357
	 *            form text parent control
360
	 *            form text parent control
Lines 407-412 Link Here
407
		});
410
		});
408
		addFocusListener(new FocusListener() {
411
		addFocusListener(new FocusListener() {
409
			public void focusGained(FocusEvent e) {
412
			public void focusGained(FocusEvent e) {
413
				if ((getStyle() & SWT.NO_FOCUS) != 0)
414
					return;
410
				if (!hasFocus) {
415
				if (!hasFocus) {
411
					hasFocus = true;
416
					hasFocus = true;
412
					if (DEBUG_FOCUS) {
417
					if (DEBUG_FOCUS) {
Lines 419-424 Link Here
419
			}
424
			}
420
425
421
			public void focusLost(FocusEvent e) {
426
			public void focusLost(FocusEvent e) {
427
				if ((getStyle() & SWT.NO_FOCUS) != 0)
428
					return;
422
				if (DEBUG_FOCUS) {
429
				if (DEBUG_FOCUS) {
423
					System.out.println("FormText: focus lost"); //$NON-NLS-1$
430
					System.out.println("FormText: focus lost"); //$NON-NLS-1$
424
				}
431
				}
Lines 1322-1328 Link Here
1322
			// select a hyperlink
1329
			// select a hyperlink
1323
			mouseFocus = true;
1330
			mouseFocus = true;
1324
			IHyperlinkSegment segmentUnder = model.findHyperlinkAt(e.x, e.y);
1331
			IHyperlinkSegment segmentUnder = model.findHyperlinkAt(e.x, e.y);
1325
			if (segmentUnder != null) {
1332
			if (segmentUnder != null && (getStyle() & SWT.NO_FOCUS) == 0) {
1326
				IHyperlinkSegment oldLink = getSelectedLink();
1333
				IHyperlinkSegment oldLink = getSelectedLink();
1327
				if (getDisplay().getFocusControl() != this) {
1334
				if (getDisplay().getFocusControl() != this) {
1328
					setFocus();
1335
					setFocus();
Lines 1469-1477 Link Here
1469
						break;
1476
						break;
1470
					valid = setControlFocus(advance, selectable);
1477
					valid = setControlFocus(advance, selectable);
1471
				}
1478
				}
1472
				if (selectable == null)
1479
				if (selectable != null)
1473
					setFocusToNextSibling(this, true);
1474
				else
1475
					ensureVisible(selectable);
1480
					ensureVisible(selectable);
1476
				if (selectable instanceof IHyperlinkSegment) {
1481
				if (selectable instanceof IHyperlinkSegment) {
1477
					enterLink((IHyperlinkSegment) selectable, SWT.NULL);
1482
					enterLink((IHyperlinkSegment) selectable, SWT.NULL);
Lines 1702-1710 Link Here
1702
	 * @see org.eclipse.swt.widgets.Control#setFocus()
1707
	 * @see org.eclipse.swt.widgets.Control#setFocus()
1703
	 */
1708
	 */
1704
	public boolean setFocus() {
1709
	public boolean setFocus() {
1710
		if ((getStyle() & SWT.NO_FOCUS) != 0)
1711
			return false;
1712
		mouseFocus = true;
1705
		FormUtil.setFocusScrollingEnabled(this, false);
1713
		FormUtil.setFocusScrollingEnabled(this, false);
1706
		boolean result = super.setFocus();
1714
		boolean result = super.setFocus();
1715
		mouseFocus = false;
1707
		FormUtil.setFocusScrollingEnabled(this, true);
1716
		FormUtil.setFocusScrollingEnabled(this, true);
1708
		return result;
1717
		return result;
1709
	}
1718
	}
1719
	
1720
	/* (non-Javadoc)
1721
	 * @see org.eclipse.swt.widgets.Control#forceFocus()
1722
	 */
1723
	public boolean forceFocus() {
1724
		if ((getStyle() & SWT.NO_FOCUS) != 0)
1725
			return false;
1726
		return super.forceFocus();
1727
	}
1710
}
1728
}

Return to bug 236735