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

Collapse All | Expand All

(-)src/org/eclipse/ui/forms/widgets/FormText.java (-4 / +22 lines)
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