|
Lines 8-14
Link Here
|
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
| 10 |
* Martin Donnelly (m2a3@eircom.net) - patch (see Bugzilla #145997) |
10 |
* Martin Donnelly (m2a3@eircom.net) - patch (see Bugzilla #145997) |
| 11 |
* Ling Hao - Fix for Bug 284393 |
|
|
| 12 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 13 |
package org.eclipse.ui.forms.widgets; |
12 |
package org.eclipse.ui.forms.widgets; |
| 14 |
|
13 |
|
|
Lines 18-23
Link Here
|
| 18 |
import java.util.Hashtable; |
17 |
import java.util.Hashtable; |
| 19 |
|
18 |
|
| 20 |
import org.eclipse.core.runtime.ListenerList; |
19 |
import org.eclipse.core.runtime.ListenerList; |
|
|
20 |
|
| 21 |
import org.eclipse.swt.SWT; |
21 |
import org.eclipse.swt.SWT; |
| 22 |
import org.eclipse.swt.SWTException; |
22 |
import org.eclipse.swt.SWTException; |
| 23 |
import org.eclipse.swt.accessibility.ACC; |
23 |
import org.eclipse.swt.accessibility.ACC; |
|
Lines 61-66
Link Here
|
| 61 |
import org.eclipse.swt.widgets.Menu; |
61 |
import org.eclipse.swt.widgets.Menu; |
| 62 |
import org.eclipse.swt.widgets.MenuItem; |
62 |
import org.eclipse.swt.widgets.MenuItem; |
| 63 |
import org.eclipse.swt.widgets.TypedListener; |
63 |
import org.eclipse.swt.widgets.TypedListener; |
|
|
64 |
|
| 64 |
import org.eclipse.ui.forms.HyperlinkSettings; |
65 |
import org.eclipse.ui.forms.HyperlinkSettings; |
| 65 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
66 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
| 66 |
import org.eclipse.ui.forms.events.IHyperlinkListener; |
67 |
import org.eclipse.ui.forms.events.IHyperlinkListener; |
|
Lines 363-369
Link Here
|
| 363 |
* the widget style |
364 |
* the widget style |
| 364 |
*/ |
365 |
*/ |
| 365 |
public FormText(Composite parent, int style) { |
366 |
public FormText(Composite parent, int style) { |
| 366 |
super(parent, SWT.DOUBLE_BUFFERED | SWT.WRAP | style); |
367 |
super(parent, SWT.NO_BACKGROUND | SWT.WRAP | style); |
| 367 |
setLayout(new FormTextLayout()); |
368 |
setLayout(new FormTextLayout()); |
| 368 |
model = new FormTextModel(); |
369 |
model = new FormTextModel(); |
| 369 |
addDisposeListener(new DisposeListener() { |
370 |
addDisposeListener(new DisposeListener() { |
|
Lines 1574-1580
Link Here
|
| 1574 |
} |
1575 |
} |
| 1575 |
|
1576 |
|
| 1576 |
private void repaint(GC gc, int x, int y, int width, int height) { |
1577 |
private void repaint(GC gc, int x, int y, int width, int height) { |
| 1577 |
Rectangle repaintRegion = new Rectangle(0, 0, getSize().x, getSize().y); |
1578 |
Image textBuffer = new Image(getDisplay(), width, height); |
|
|
1579 |
Color bg = getBackground(); |
| 1580 |
Color fg = getForeground(); |
| 1581 |
if (!getEnabled()) { |
| 1582 |
bg = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); |
| 1583 |
fg = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); |
| 1584 |
} |
| 1585 |
GC textGC = new GC(textBuffer, gc.getStyle()); |
| 1586 |
textGC.setForeground(fg); |
| 1587 |
textGC.setBackground(bg); |
| 1588 |
textGC.setFont(getFont()); |
| 1589 |
textGC.fillRectangle(0, 0, width, height); |
| 1590 |
Rectangle repaintRegion = new Rectangle(x, y, width, height); |
| 1578 |
|
1591 |
|
| 1579 |
Paragraph[] paragraphs = model.getParagraphs(); |
1592 |
Paragraph[] paragraphs = model.getParagraphs(); |
| 1580 |
IHyperlinkSegment selectedLink = getSelectedLink(); |
1593 |
IHyperlinkSegment selectedLink = getSelectedLink(); |
|
Lines 1583-1593
Link Here
|
| 1583 |
for (int i = 0; i < paragraphs.length; i++) { |
1596 |
for (int i = 0; i < paragraphs.length; i++) { |
| 1584 |
Paragraph p = paragraphs[i]; |
1597 |
Paragraph p = paragraphs[i]; |
| 1585 |
p |
1598 |
p |
| 1586 |
.paint(gc, repaintRegion, resourceTable, selectedLink, |
1599 |
.paint(textGC, repaintRegion, resourceTable, selectedLink, |
| 1587 |
selData); |
1600 |
selData); |
| 1588 |
} |
1601 |
} |
| 1589 |
if (hasFocus && !model.hasFocusSegments()) |
1602 |
if (hasFocus && !model.hasFocusSegments()) |
| 1590 |
gc.drawFocus(x, y, width, height); |
1603 |
textGC.drawFocus(x, y, width, height); |
|
|
1604 |
textGC.dispose(); |
| 1605 |
gc.drawImage(textBuffer, x, y); |
| 1606 |
textBuffer.dispose(); |
| 1591 |
} |
1607 |
} |
| 1592 |
|
1608 |
|
| 1593 |
private int getParagraphSpacing(int lineHeight) { |
1609 |
private int getParagraphSpacing(int lineHeight) { |