Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich2011-10-24 18:15:06 +0000
committerFelipe Heidrich2011-10-24 18:15:06 +0000
commitf4fbfd3e131c5a52ff6ee5d5bba387f7d4c17179 (patch)
tree8cb86fafb4d85cc1ae16096e241e1771e84c419c
parent4b2d3d2eba1b045073432cda19982074b0d3196f (diff)
parent68d7cfe683b4fbe8251c3ec3c40cde54611cdd44 (diff)
downloadeclipse.platform.swt-f4fbfd3e131c5a52ff6ee5d5bba387f7d4c17179.tar.gz
eclipse.platform.swt-f4fbfd3e131c5a52ff6ee5d5bba387f7d4c17179.tar.xz
eclipse.platform.swt-f4fbfd3e131c5a52ff6ee5d5bba387f7d4c17179.zip
merging with master
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java84
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java286
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java278
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpChannel.java119
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpHeaderVisitor.java47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISeekableStream.java61
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIUploadChannel.java51
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java82
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/version.txt2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java237
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java3
-rw-r--r--bundles/org.eclipse.swt/buildSWT.xml80
-rw-r--r--bundles/org.eclipse.swt/buildnotes_swt.html12
-rw-r--r--examples/org.eclipse.swt.examples/src/examples_control.properties12
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java9
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java2
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet254.java2
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet358.java69
43 files changed, 1237 insertions, 497 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
index 0cf345d1a9..8442d20531 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -2331,7 +2331,8 @@ public class Accessible {
/* Get the default keyboard shortcut from the OS. */
code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut);
if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID
- if (accessibleListeners.size() == 0) return code;
+ /* Process TabFolder even if there are no apps listening. */
+ if (accessibleListeners.size() == 0 && !(control instanceof TabFolder)) return code;
if (code == COM.S_OK) {
int /*long*/[] pKeyboardShortcut = new int /*long*/[1];
COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF);
@@ -2347,6 +2348,10 @@ public class Accessible {
AccessibleEvent event = new AccessibleEvent(this);
event.childID = osToChildID(v.lVal);
event.result = osKeyboardShortcut;
+ /* SWT TabFolders use Ctrl+PageDown to switch pages (not Ctrl+Tab). */
+ if (v.lVal == COM.CHILDID_SELF && control instanceof TabFolder) {
+ event.result = SWT.getMessage ("SWT_SwitchPage_Shortcut"); //$NON-NLS-1$
+ }
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getKeyboardShortcut(event);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
index f9f31b7a0c..27413a2f50 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
@@ -1034,12 +1034,12 @@ void initAccessible() {
if (text != null) {
char mnemonic = _findMnemonic(text);
if (mnemonic != '\0') {
- shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
+ shortcut = SWT.getMessage ("SWT_Page_Mnemonic", new Object[] {new Character(mnemonic)}); //$NON-NLS-1$
}
}
}
if (childID == ACC.CHILDID_SELF) {
- shortcut = "Ctrl+PageDown"; //$NON-NLS-1$
+ shortcut = SWT.getMessage ("SWT_SwitchPage_Shortcut"); //$NON-NLS-1$
}
e.result = shortcut;
}
@@ -1064,6 +1064,7 @@ void initAccessible() {
childID = items.length + MAXIMIZE_CHILD_ID;
} else {
Rectangle location = getBounds();
+ location.x = location.y = 0;
location.height = location.height - getClientArea().height;
if (location.contains(testPoint)) {
childID = ACC.CHILDID_SELF;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
index cd00023a27..d95bb65698 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java
@@ -769,7 +769,7 @@ public void replaceTextRange(int start, int replaceLength, String newText){
// inform listeners
StyledTextEvent event = new StyledTextEvent(this);
- event.type = StyledText.TextChanging;
+ event.type = ST.TextChanging;
event.start = start;
event.replaceLineCount = lineCount(start, replaceLength);
event.text = newText;
@@ -784,7 +784,7 @@ public void replaceTextRange(int start, int replaceLength, String newText){
insert(start, newText);
// inform listeners
event = new StyledTextEvent(this);
- event.type = StyledText.TextChanged;
+ event.type = ST.TextChanged;
sendTextEvent(event);
}
/**
@@ -809,7 +809,7 @@ public void setText (String text){
expandExp = 1;
indexLines();
StyledTextEvent event = new StyledTextEvent(this);
- event.type = StyledText.TextSet;
+ event.type = ST.TextSet;
event.text = "";
sendTextEvent(event);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java
index 77276975cc..771fcf8017 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java
@@ -136,5 +136,89 @@ public class ST {
* @since 3.2
*/
public static final int BULLET_CUSTOM = 1 << 5;
+
+ /**
+ * The ExtendedModify event type (value is 3000).
+ *
+ * @since 3.8
+ */
+ public static final int ExtendedModify = 3000;
+
+ /**
+ * The LineGetBackground event type (value is 3001).
+ *
+ * @since 3.8
+ */
+ public static final int LineGetBackground = 3001;
+
+ /**
+ * The LineGetStyle event type (value is 3002).
+ *
+ * @since 3.8
+ */
+ public static final int LineGetStyle = 3002;
+
+ /**
+ * The TextChanging event type (value is 3003).
+ *
+ * @since 3.8
+ */
+ public static final int TextChanging = 3003;
+
+ /**
+ * The TextSet event type (value is 3004).
+ *
+ * @since 3.8
+ */
+ public static final int TextSet = 3004;
+
+ /**
+ * The VerifyKey event type (value is 3005).
+ *
+ * @since 3.8
+ */
+ public static final int VerifyKey = 3005;
+
+ /**
+ * The TextChanged event type (value is 3006).
+ *
+ * @since 3.8
+ */
+ public static final int TextChanged = 3006;
+
+ /**
+ * The LineGetSegments event type (value is 3007).
+ *
+ * @since 3.8
+ */
+ public static final int LineGetSegments = 3007;
+
+ /**
+ * The PaintObject event type (value is 3008).
+ *
+ * @since 3.8
+ */
+ public static final int PaintObject = 3008;
+
+ /**
+ * The WordNext event type (value is 3009).
+ *
+ * @since 3.8
+ */
+ public static final int WordNext = 3009;
+
+ /**
+ * The WordPrevious event type (value is 3010).
+ *
+ * @since 3.8
+ */
+ public static final int WordPrevious = 3010;
+
+ /**
+ * The CaretMoved event type (value is 3011).
+ *
+ * @since 3.8
+ */
+ public static final int CaretMoved = 3011;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index 250f2d7284..8001a64cdc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -87,20 +87,6 @@ public class StyledText extends Canvas {
static final int DEFAULT_HEIGHT = 64;
static final int V_SCROLL_RATE = 50;
static final int H_SCROLL_RATE = 10;
-
- static final int ExtendedModify = 3000;
- static final int LineGetBackground = 3001;
- static final int LineGetStyle = 3002;
- static final int TextChanging = 3003;
- static final int TextSet = 3004;
- static final int VerifyKey = 3005;
- static final int TextChanged = 3006;
- static final int LineGetSegments = 3007;
- static final int PaintObject = 3008;
- static final int WordNext = 3009;
- static final int WordPrevious = 3010;
- static final int CaretMoved = 3011;
-
static final int PREVIOUS_OFFSET_TRAILING = 0;
static final int OFFSET_LEADING = 1;
@@ -112,6 +98,8 @@ public class StyledText extends Canvas {
TextChangeListener textChangeListener; // listener for TextChanging, TextChanged and TextSet events from StyledTextContent
int verticalScrollOffset = 0; // pixel based
int horizontalScrollOffset = 0; // pixel based
+ boolean alwaysShowScroll = true;
+ int ignoreResize = 0;
int topIndex = 0; // top visible line
int topIndexY;
int clientAreaHeight = 0; // the client area height. Needed to calculate content width for new visible lines during Resize callback
@@ -259,7 +247,7 @@ public class StyledText extends Canvas {
fontData = styledText.getFont().getFontData()[0];
tabLength = styledText.tabLength;
int lineCount = printerRenderer.lineCount;
- if (styledText.isListening(LineGetBackground) || (styledText.isBidi() && styledText.isListening(LineGetSegments)) || styledText.isListening(LineGetStyle)) {
+ if (styledText.isListening(ST.LineGetBackground) || (styledText.isBidi() && styledText.isListening(ST.LineGetSegments)) || styledText.isListening(ST.LineGetStyle)) {
StyledTextContent content = printerRenderer.content;
for (int i = 0; i < lineCount; i++) {
String line = content.getLine(i);
@@ -1295,7 +1283,7 @@ public void addExtendedModifyListener(ExtendedModifyListener extendedModifyListe
checkWidget();
if (extendedModifyListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
StyledTextListener typedListener = new StyledTextListener(extendedModifyListener);
- addListener(ExtendedModify, typedListener);
+ addListener(ST.ExtendedModify, typedListener);
}
/**
* Adds a bidirectional segment listener.
@@ -1325,7 +1313,7 @@ public void addExtendedModifyListener(ExtendedModifyListener extendedModifyListe
public void addBidiSegmentListener(BidiSegmentListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(LineGetSegments, new StyledTextListener(listener));
+ addListener(ST.LineGetSegments, new StyledTextListener(listener));
}
/**
* Adds a caret listener. CaretEvent is sent when the caret offset changes.
@@ -1344,7 +1332,7 @@ public void addBidiSegmentListener(BidiSegmentListener listener) {
public void addCaretListener(CaretListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(CaretMoved, new StyledTextListener(listener));
+ addListener(ST.CaretMoved, new StyledTextListener(listener));
}
/**
* Adds a line background listener. A LineGetBackground event is sent by the
@@ -1362,10 +1350,10 @@ public void addCaretListener(CaretListener listener) {
public void addLineBackgroundListener(LineBackgroundListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (!isListening(LineGetBackground)) {
+ if (!isListening(ST.LineGetBackground)) {
renderer.clearLineBackground(0, content.getLineCount());
}
- addListener(LineGetBackground, new StyledTextListener(listener));
+ addListener(ST.LineGetBackground, new StyledTextListener(listener));
}
/**
* Adds a line style listener. A LineGetStyle event is sent by the widget to
@@ -1383,11 +1371,11 @@ public void addLineBackgroundListener(LineBackgroundListener listener) {
public void addLineStyleListener(LineStyleListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (!isListening(LineGetStyle)) {
+ if (!isListening(ST.LineGetStyle)) {
setStyleRanges(0, 0, null, null, true);
renderer.clearLineStyle(0, content.getLineCount());
}
- addListener(LineGetStyle, new StyledTextListener(listener));
+ addListener(ST.LineGetStyle, new StyledTextListener(listener));
setCaretLocation();
}
/**
@@ -1429,7 +1417,7 @@ public void addModifyListener(ModifyListener modifyListener) {
public void addPaintObjectListener(PaintObjectListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(PaintObject, new StyledTextListener(listener));
+ addListener(ST.PaintObject, new StyledTextListener(listener));
}
/**
* Adds a selection listener. A Selection event is sent by the widget when the
@@ -1476,7 +1464,7 @@ public void addSelectionListener(SelectionListener listener) {
public void addVerifyKeyListener(VerifyKeyListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(VerifyKey, new StyledTextListener(listener));
+ addListener(ST.VerifyKey, new StyledTextListener(listener));
}
/**
* Adds a verify listener. A Verify event is sent by the widget when the widget text
@@ -1521,8 +1509,8 @@ public void addVerifyListener(VerifyListener verifyListener) {
public void addWordMovementListener(MovementListener movementListener) {
checkWidget();
if (movementListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addListener(WordNext, new StyledTextListener(movementListener));
- addListener(WordPrevious, new StyledTextListener(movementListener));
+ addListener(ST.WordNext, new StyledTextListener(movementListener));
+ addListener(ST.WordPrevious, new StyledTextListener(movementListener));
}
/**
* Appends a string to the text at the end of the widget.
@@ -1627,8 +1615,11 @@ void calculateTopIndex(int delta) {
}
}
if (topIndex != oldTopIndex || oldTopIndexY != topIndexY) {
+ int width = renderer.getWidth();
renderer.calculateClientArea();
- setScrollBars(false);
+ if (width != renderer.getWidth()) {
+ setScrollBars(false);
+ }
}
}
/**
@@ -1835,6 +1826,26 @@ public int getAlignment() {
checkWidget();
return alignment;
}
+/**
+ * Returns the Always Show Scrollbars flag. True if the scrollbars are
+ * always shown even if they are not required. False if the scrollbars are only
+ * visible when some part of the content needs to be scrolled to be seen.
+ * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
+ * horizontal and vertical directions.
+ *
+ * @return the Always Show Scrollbars flag value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.8
+ */
+public boolean getAlwaysShowScrollBars() {
+ checkWidget();
+ return alwaysShowScroll;
+}
int getAvailableHeightAbove(int height) {
int maxHeight = verticalScrollOffset;
if (maxHeight == -1) {
@@ -3936,7 +3947,7 @@ public Color getLineBackground(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- return isListening(LineGetBackground) ? null : renderer.getLineBackground(index, null);
+ return isListening(ST.LineGetBackground) ? null : renderer.getLineBackground(index, null);
}
/**
* Returns the bullet of the line at the given index.
@@ -3960,7 +3971,7 @@ public Bullet getLineBullet(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- return isListening(LineGetStyle) ? null : renderer.getLineBullet(index, null);
+ return isListening(ST.LineGetStyle) ? null : renderer.getLineBullet(index, null);
}
/**
* Returns the line background data for the given line or null if
@@ -3972,7 +3983,7 @@ public Bullet getLineBullet(int index) {
* @return line background data for the given line.
*/
StyledTextEvent getLineBackgroundData(int lineOffset, String line) {
- return sendLineEvent(LineGetBackground, lineOffset, line);
+ return sendLineEvent(ST.LineGetBackground, lineOffset, line);
}
/**
* Gets the number of text lines.
@@ -4091,7 +4102,7 @@ public int getLineIndent(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- return isListening(LineGetStyle) ? 0 : renderer.getLineIndent(index, indent);
+ return isListening(ST.LineGetStyle) ? 0 : renderer.getLineIndent(index, indent);
}
/**
* Returns whether the line at the given index is justified.
@@ -4117,7 +4128,7 @@ public boolean getLineJustify(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- return isListening(LineGetStyle) ? false : renderer.getLineJustify(index, justify);
+ return isListening(ST.LineGetStyle) ? false : renderer.getLineJustify(index, justify);
}
/**
* Returns the line spacing of the widget.
@@ -4151,7 +4162,7 @@ public int getLineSpacing() {
* line start and end after line end
*/
StyledTextEvent getLineStyleData(int lineOffset, String line) {
- return sendLineEvent(LineGetStyle, lineOffset, line);
+ return sendLineEvent(ST.LineGetStyle, lineOffset, line);
}
/**
* Returns the top pixel, relative to the client area, of a given line.
@@ -4246,7 +4257,7 @@ public int[] getLineTabStops(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- if (isListening(LineGetStyle)) return null;
+ if (isListening(ST.LineGetStyle)) return null;
int[] tabs = renderer.getLineTabStops(index, null);
if (tabs == null) tabs = this.tabs;
if (tabs == null) return new int [] {renderer.tabWidth};
@@ -4278,7 +4289,7 @@ public int getLineWrapIndent(int index) {
if (index < 0 || index > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- return isListening(LineGetStyle) ? 0 : renderer.getLineWrapIndent(index, wrapIndent);
+ return isListening(ST.LineGetStyle) ? 0 : renderer.getLineWrapIndent(index, wrapIndent);
}
/**
* Returns the left margin.
@@ -4539,7 +4550,7 @@ String getPlatformDelimitedText(TextWriter writer) {
*/
public int[] getRanges() {
checkWidget();
- if (!isListening(LineGetStyle)) {
+ if (!isListening(ST.LineGetStyle)) {
int[] ranges = renderer.getRanges(0, content.getCharCount());
if (ranges != null) return ranges;
}
@@ -4581,7 +4592,7 @@ public int[] getRanges(int start, int length) {
if (start > end || start < 0 || end > contentLength) {
SWT.error(SWT.ERROR_INVALID_RANGE);
}
- if (!isListening(LineGetStyle)) {
+ if (!isListening(ST.LineGetStyle)) {
int[] ranges = renderer.getRanges(start, length);
if (ranges != null) return ranges;
}
@@ -4756,12 +4767,12 @@ public String getSelectionText() {
}
StyledTextEvent getBidiSegments(int lineOffset, String line) {
if (!isBidi()) return null;
- if (!isListening(LineGetSegments)) {
+ if (!isListening(ST.LineGetSegments)) {
StyledTextEvent event = new StyledTextEvent(content);
event.segments = getBidiSegmentsCompatibility(line, lineOffset);
return event;
}
- StyledTextEvent event = sendLineEvent(LineGetSegments, lineOffset, line);
+ StyledTextEvent event = sendLineEvent(ST.LineGetSegments, lineOffset, line);
if (event == null || event.segments == null || event.segments.length == 0) return null;
int lineLength = line.length();
int[] segments = event.segments;
@@ -4875,7 +4886,7 @@ public StyleRange getStyleRangeAtOffset(int offset) {
if (offset < 0 || offset >= getCharCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- if (!isListening(LineGetStyle)) {
+ if (!isListening(ST.LineGetStyle)) {
StyleRange[] ranges = renderer.getStyleRanges(offset, 1, true);
if (ranges != null) return ranges[0];
}
@@ -5022,7 +5033,7 @@ public StyleRange[] getStyleRanges(int start, int length, boolean includeRanges)
if (start > end || start < 0 || end > contentLength) {
SWT.error(SWT.ERROR_INVALID_RANGE);
}
- if (!isListening(LineGetStyle)) {
+ if (!isListening(ST.LineGetStyle)) {
StyleRange[] ranges = renderer.getStyleRanges(start, length, includeRanges);
if (ranges != null) return ranges;
}
@@ -5336,7 +5347,7 @@ int getWordNext (int offset, int movement, boolean ignoreListener) {
}
}
if (ignoreListener) return newOffset;
- return sendWordBoundaryEvent(WordNext, movement, offset, newOffset, lineText, lineOffset);
+ return sendWordBoundaryEvent(ST.WordNext, movement, offset, newOffset, lineText, lineOffset);
}
int getWordPrevious(int offset, int movement) {
return getWordPrevious(offset, movement, false);
@@ -5365,7 +5376,7 @@ int getWordPrevious(int offset, int movement, boolean ignoreListener) {
}
}
if (ignoreListener) return newOffset;
- return sendWordBoundaryEvent(WordPrevious, movement, offset, newOffset, lineText, lineOffset);
+ return sendWordBoundaryEvent(ST.WordPrevious, movement, offset, newOffset, lineText, lineOffset);
}
/**
* Returns whether the widget wraps lines.
@@ -5933,7 +5944,7 @@ void handleKeyDown(Event event) {
verifyEvent.keyLocation = event.keyLocation;
verifyEvent.stateMask = event.stateMask;
verifyEvent.doit = true;
- notifyListeners(VerifyKey, verifyEvent);
+ notifyListeners(ST.VerifyKey, verifyEvent);
if (verifyEvent.doit) {
if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL && event.keyCode == SWT.SHIFT && isBidiCaret()) {
newOrientation = event.keyLocation == SWT.LEFT ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT;
@@ -6119,19 +6130,9 @@ void handleResize(Event event) {
Rectangle clientArea = getClientArea();
clientAreaHeight = clientArea.height;
clientAreaWidth = clientArea.width;
- /* Redraw the old or new right/bottom margin if needed */
- if (oldWidth != clientAreaWidth) {
- if (rightMargin > 0) {
- int x = (oldWidth < clientAreaWidth ? oldWidth : clientAreaWidth) - rightMargin;
- super.redraw(x, 0, rightMargin, oldHeight, false);
- }
- }
- if (oldHeight != clientAreaHeight) {
- if (bottomMargin > 0) {
- int y = (oldHeight < clientAreaHeight ? oldHeight : clientAreaHeight) - bottomMargin;
- super.redraw(0, y, oldWidth, bottomMargin, false);
- }
- }
+ if (!alwaysShowScroll && ignoreResize != 0) return;
+
+ redrawMargins(oldHeight, oldWidth);
if (wordWrap) {
if (oldWidth != clientAreaWidth) {
renderer.reset(0, content.getLineCount());
@@ -6708,7 +6709,7 @@ void initializeAccessible() {
public void getTextAttributes(AccessibleTextAttributeEvent e) {
StyledText st = StyledText.this;
int contentLength = st.getCharCount();
- if (!isListening(LineGetStyle) && st.renderer.styleCount == 0) {
+ if (!isListening(ST.LineGetStyle) && st.renderer.styleCount == 0) {
e.start = 0;
e.end = contentLength;
e.textStyle = new TextStyle(st.getFont(), st.foreground, st.background);
@@ -7149,7 +7150,7 @@ void modifyContent(Event event, boolean updateCaret) {
if (event.doit) {
StyledTextEvent styledTextEvent = null;
int replacedLength = event.end - event.start;
- if (isListening(ExtendedModify)) {
+ if (isListening(ST.ExtendedModify)) {
styledTextEvent = new StyledTextEvent(content);
styledTextEvent.start = event.start;
styledTextEvent.end = event.start + event.text.length();
@@ -7186,13 +7187,13 @@ void modifyContent(Event event, boolean updateCaret) {
showCaret();
}
notifyListeners(SWT.Modify, event);
- if (isListening(ExtendedModify)) {
- notifyListeners(ExtendedModify, styledTextEvent);
+ if (isListening(ST.ExtendedModify)) {
+ notifyListeners(ST.ExtendedModify, styledTextEvent);
}
}
}
void paintObject(GC gc, int x, int y, int ascent, int descent, StyleRange style, Bullet bullet, int bulletIndex) {
- if (isListening(PaintObject)) {
+ if (isListening(ST.PaintObject)) {
StyledTextEvent event = new StyledTextEvent (content) ;
event.gc = gc;
event.x = x;
@@ -7202,7 +7203,7 @@ void paintObject(GC gc, int x, int y, int ascent, int descent, StyleRange style,
event.style = style;
event.bullet = bullet;
event.bulletIndex = bulletIndex;
- notifyListeners(PaintObject, event);
+ notifyListeners(ST.PaintObject, event);
}
}
/**
@@ -7420,6 +7421,21 @@ void redrawLinesBullet (int[] redrawLines) {
super.redraw(0, y, width, height, false);
}
}
+void redrawMargins(int oldHeight, int oldWidth) {
+ /* Redraw the old or new right/bottom margin if needed */
+ if (oldWidth != clientAreaWidth) {
+ if (rightMargin > 0) {
+ int x = (oldWidth < clientAreaWidth ? oldWidth : clientAreaWidth) - rightMargin;
+ super.redraw(x, 0, rightMargin, oldHeight, false);
+ }
+ }
+ if (oldHeight != clientAreaHeight) {
+ if (bottomMargin > 0) {
+ int y = (oldHeight < clientAreaHeight ? oldHeight : clientAreaHeight) - bottomMargin;
+ super.redraw(0, y, oldWidth, bottomMargin, false);
+ }
+ }
+}
/**
* Redraws the specified text range.
*
@@ -7475,7 +7491,7 @@ public void redrawRange(int start, int length, boolean clearBackground) {
public void removeBidiSegmentListener(BidiSegmentListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(LineGetSegments, listener);
+ removeListener(ST.LineGetSegments, listener);
}
/**
* Removes the specified caret listener.
@@ -7495,7 +7511,7 @@ public void removeBidiSegmentListener(BidiSegmentListener listener) {
public void removeCaretListener(CaretListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(CaretMoved, listener);
+ removeListener(ST.CaretMoved, listener);
}
/**
* Removes the specified extended modify listener.
@@ -7513,7 +7529,7 @@ public void removeCaretListener(CaretListener listener) {
public void removeExtendedModifyListener(ExtendedModifyListener extendedModifyListener) {
checkWidget();
if (extendedModifyListener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(ExtendedModify, extendedModifyListener);
+ removeListener(ST.ExtendedModify, extendedModifyListener);
}
/**
* Removes the specified line background listener.
@@ -7531,7 +7547,7 @@ public void removeExtendedModifyListener(ExtendedModifyListener extendedModifyLi
public void removeLineBackgroundListener(LineBackgroundListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(LineGetBackground, listener);
+ removeListener(ST.LineGetBackground, listener);
}
/**
* Removes the specified line style listener.
@@ -7549,7 +7565,7 @@ public void removeLineBackgroundListener(LineBackgroundListener listener) {
public void removeLineStyleListener(LineStyleListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(LineGetStyle, listener);
+ removeListener(ST.LineGetStyle, listener);
setCaretLocation();
}
/**
@@ -7587,7 +7603,7 @@ public void removeModifyListener(ModifyListener modifyListener) {
public void removePaintObjectListener(PaintObjectListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(PaintObject, listener);
+ removeListener(ST.PaintObject, listener);
}
/**
* Removes the listener from the collection of listeners who will
@@ -7644,7 +7660,7 @@ public void removeVerifyListener(VerifyListener verifyListener) {
*/
public void removeVerifyKeyListener(VerifyKeyListener listener) {
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(VerifyKey, listener);
+ removeListener(ST.VerifyKey, listener);
}
/**
* Removes the specified word movement listener.
@@ -7669,8 +7685,8 @@ public void removeVerifyKeyListener(VerifyKeyListener listener) {
public void removeWordMovementListener(MovementListener listener) {
checkWidget();
if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(WordNext, listener);
- removeListener(WordPrevious, listener);
+ removeListener(ST.WordNext, listener);
+ removeListener(ST.WordPrevious, listener);
}
/**
* Replaces the styles in the given range with new styles. This method
@@ -7708,7 +7724,7 @@ public void removeWordMovementListener(MovementListener listener) {
*/
public void replaceStyleRanges(int start, int length, StyleRange[] ranges) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (ranges == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
setStyleRanges(start, length, null, ranges, false);
}
@@ -8154,6 +8170,28 @@ public void setAlignment(int alignment) {
super.redraw();
}
/**
+ * Set the Always Show Scrollbars flag. True if the scrollbars are
+ * always shown even if they are not required. False if the scrollbars are only
+ * visible when some part of the content needs to be scrolled to be seen.
+ * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
+ * horizontal and vertical directions.
+ *
+ * @param show true to show the scrollbars even when not required, false to show scrollbars only when required
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.8
+ */
+public void setAlwaysShowScrollBars(boolean show) {
+ checkWidget();
+ if (show == alwaysShowScroll) return;
+ alwaysShowScroll = show;
+ setScrollBars(true);
+}
+/**
* @see Control#setBackground(Color)
*/
public void setBackground(Color color) {
@@ -8448,10 +8486,10 @@ public void setCaretOffset(int offset) {
void setCaretOffset(int offset, int alignment) {
if (caretOffset != offset) {
caretOffset = offset;
- if (isListening(CaretMoved)) {
+ if (isListening(ST.CaretMoved)) {
StyledTextEvent event = new StyledTextEvent(content);
event.end = caretOffset;
- notifyListeners(CaretMoved, event);
+ notifyListeners(ST.CaretMoved, event);
}
}
if (alignment != SWT.DEFAULT) {
@@ -8834,7 +8872,7 @@ public void setLeftMargin (int leftMargin) {
*/
public void setLineAlignment(int startLine, int lineCount, int alignment) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -8885,7 +8923,7 @@ public void setLineAlignment(int startLine, int lineCount, int alignment) {
*/
public void setLineBackground(int startLine, int lineCount, Color background) {
checkWidget();
- if (isListening(LineGetBackground)) return;
+ if (isListening(ST.LineGetBackground)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -8930,7 +8968,7 @@ public void setLineBackground(int startLine, int lineCount, Color background) {
*/
public void setLineBullet(int startLine, int lineCount, Bullet bullet) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -8984,7 +9022,7 @@ void setVariableLineHeight () {
*/
public void setLineIndent(int startLine, int lineCount, int indent) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -9033,7 +9071,7 @@ public void setLineIndent(int startLine, int lineCount, int indent) {
*/
public void setLineJustify(int startLine, int lineCount, boolean justify) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -9100,7 +9138,7 @@ public void setLineSpacing(int lineSpacing) {
*/
public void setLineTabStops(int startLine, int lineCount, int[] tabStops) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -9157,7 +9195,7 @@ public void setLineTabStops(int startLine, int lineCount, int[] tabStops) {
*/
public void setLineWrapIndent(int startLine, int lineCount, int wrapIndent) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (startLine < 0 || startLine + lineCount > content.getLineCount()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
@@ -9271,6 +9309,17 @@ public void setRightMargin (int rightMargin) {
checkWidget();
setMargins(leftMargin, topMargin, rightMargin, bottomMargin);
}
+void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
+ int inactive = 1;
+ if (clientArea < maximum) {
+ bar.setMaximum(maximum - margin);
+ bar.setThumb(clientArea - margin);
+ bar.setPageIncrement(clientArea - margin);
+ if (!alwaysShowScroll) bar.setVisible(true);
+ } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
+ bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
+ }
+}
/**
* Adjusts the maximum and the page size of the scroll bars to
* reflect content width/length changes.
@@ -9278,49 +9327,32 @@ public void setRightMargin (int rightMargin) {
* @param vertical indicates if the vertical scrollbar also needs to be set
*/
void setScrollBars(boolean vertical) {
- int inactive = 1;
- if (vertical || !isFixedLineHeight()) {
- ScrollBar verticalBar = getVerticalBar();
- if (verticalBar != null) {
- int maximum = renderer.getHeight();
- // only set the real values if the scroll bar can be used
- // (ie. because the thumb size is less than the scroll maximum)
- // avoids flashing on Motif, fixes 1G7RE1J and 1G5SE92
- if (clientAreaHeight < maximum) {
- verticalBar.setMaximum(maximum - topMargin - bottomMargin);
- verticalBar.setThumb(clientAreaHeight - topMargin - bottomMargin);
- verticalBar.setPageIncrement(clientAreaHeight - topMargin - bottomMargin);
- } else if (verticalBar.getThumb() != inactive || verticalBar.getMaximum() != inactive) {
- verticalBar.setValues(
- verticalBar.getSelection(),
- verticalBar.getMinimum(),
- inactive,
- inactive,
- verticalBar.getIncrement(),
- inactive);
+ ignoreResize++;
+ if (!isFixedLineHeight() || !alwaysShowScroll) vertical = true;
+ ScrollBar verticalBar = vertical ? getVerticalBar() : null;
+ ScrollBar horizontalBar = getHorizontalBar();
+ int oldHeight = clientAreaHeight;
+ int oldWidth = clientAreaWidth;
+ if (!alwaysShowScroll) {
+ if (verticalBar != null) verticalBar.setVisible(false);
+ if (horizontalBar != null) horizontalBar.setVisible(false);
+ }
+ if (verticalBar != null) {
+ setScrollBar(verticalBar, clientAreaHeight, renderer.getHeight(), topMargin + bottomMargin);
+ }
+ if (horizontalBar != null) {
+ setScrollBar(horizontalBar, clientAreaWidth, renderer.getWidth(), leftMargin + rightMargin);
+ if (!alwaysShowScroll && horizontalBar.getVisible() && verticalBar != null) {
+ setScrollBar(verticalBar, clientAreaHeight, renderer.getHeight(), topMargin + bottomMargin);
+ if (verticalBar.getVisible()) {
+ setScrollBar(horizontalBar, clientAreaWidth, renderer.getWidth(), leftMargin + rightMargin);
}
}
}
- ScrollBar horizontalBar = getHorizontalBar();
- if (horizontalBar != null && horizontalBar.getVisible()) {
- int maximum = renderer.getWidth();
- // only set the real values if the scroll bar can be used
- // (ie. because the thumb size is less than the scroll maximum)
- // avoids flashing on Motif, fixes 1G7RE1J and 1G5SE92
- if (clientAreaWidth < maximum) {
- horizontalBar.setMaximum(maximum - leftMargin - rightMargin);
- horizontalBar.setThumb(clientAreaWidth - leftMargin - rightMargin);
- horizontalBar.setPageIncrement(clientAreaWidth - leftMargin - rightMargin);
- } else if (horizontalBar.getThumb() != inactive || horizontalBar.getMaximum() != inactive) {
- horizontalBar.setValues(
- horizontalBar.getSelection(),
- horizontalBar.getMinimum(),
- inactive,
- inactive,
- horizontalBar.getIncrement(),
- inactive);
- }
+ if (!alwaysShowScroll) {
+ redrawMargins(oldHeight, oldWidth);
}
+ ignoreResize--;
}
/**
* Sets the selection to the given position and scrolls it into view. Equivalent to setSelection(start,start).
@@ -9553,7 +9585,7 @@ public void setSelectionRange(int start, int length) {
*/
public void setStyleRange(StyleRange range) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (range != null) {
if (range.isUnstyled()) {
setStyleRanges(range.start, range.length, null, null, false);
@@ -9601,7 +9633,7 @@ public void setStyleRange(StyleRange range) {
*/
public void setStyleRanges(int start, int length, int[] ranges, StyleRange[] styles) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (ranges == null || styles == null) {
setStyleRanges(start, length, null, null, false);
} else {
@@ -9643,7 +9675,7 @@ public void setStyleRanges(int start, int length, int[] ranges, StyleRange[] sty
*/
public void setStyleRanges(int[] ranges, StyleRange[] styles) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (ranges == null || styles == null) {
setStyleRanges(0, 0, null, null, true);
} else {
@@ -9769,7 +9801,7 @@ void setStyleRanges(int start, int length, int[] ranges, StyleRange[] styles, bo
*/
public void setStyleRanges(StyleRange[] ranges) {
checkWidget();
- if (isListening(LineGetStyle)) return;
+ if (isListening(ST.LineGetStyle)) return;
if (ranges == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
setStyleRanges(0, 0, null, ranges, true);
}
@@ -9865,7 +9897,7 @@ public void setText(String text) {
notifyListeners(SWT.Verify, event);
if (event.doit) {
StyledTextEvent styledTextEvent = null;
- if (isListening(ExtendedModify)) {
+ if (isListening(ST.ExtendedModify)) {
styledTextEvent = new StyledTextEvent(content);
styledTextEvent.start = event.start;
styledTextEvent.end = event.start + event.text.length();
@@ -9874,7 +9906,7 @@ public void setText(String text) {
content.setText(event.text);
notifyListeners(SWT.Modify, event);
if (styledTextEvent != null) {
- notifyListeners(ExtendedModify, styledTextEvent);
+ notifyListeners(ST.ExtendedModify, styledTextEvent);
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java
index d9f026b5dd..3403000c55 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java
@@ -28,22 +28,22 @@ StyledTextListener(SWTEventListener listener) {
public void handleEvent(Event e) {
switch (e.type) {
- case StyledText.ExtendedModify:
+ case ST.ExtendedModify:
ExtendedModifyEvent extendedModifyEvent = new ExtendedModifyEvent((StyledTextEvent) e);
((ExtendedModifyListener) eventListener).modifyText(extendedModifyEvent);
break;
- case StyledText.LineGetBackground:
+ case ST.LineGetBackground:
LineBackgroundEvent lineBgEvent = new LineBackgroundEvent((StyledTextEvent) e);
((LineBackgroundListener) eventListener).lineGetBackground(lineBgEvent);
((StyledTextEvent) e).lineBackground = lineBgEvent.lineBackground;
break;
- case StyledText.LineGetSegments:
+ case ST.LineGetSegments:
BidiSegmentEvent segmentEvent = new BidiSegmentEvent((StyledTextEvent) e);
((BidiSegmentListener) eventListener).lineGetSegments(segmentEvent);
((StyledTextEvent) e).segments = segmentEvent.segments;
((StyledTextEvent) e).segmentsChars = segmentEvent.segmentsChars;
break;
- case StyledText.LineGetStyle:
+ case ST.LineGetStyle:
LineStyleEvent lineStyleEvent = new LineStyleEvent((StyledTextEvent) e);
((LineStyleListener) eventListener).lineGetStyle(lineStyleEvent);
((StyledTextEvent) e).ranges = lineStyleEvent.ranges;
@@ -56,42 +56,42 @@ public void handleEvent(Event e) {
((StyledTextEvent) e).bulletIndex = lineStyleEvent.bulletIndex;
((StyledTextEvent) e).tabStops = lineStyleEvent.tabStops;
break;
- case StyledText.PaintObject:
+ case ST.PaintObject:
PaintObjectEvent paintObjectEvent = new PaintObjectEvent((StyledTextEvent) e);
((PaintObjectListener) eventListener).paintObject(paintObjectEvent);
break;
- case StyledText.VerifyKey:
+ case ST.VerifyKey:
VerifyEvent verifyEvent = new VerifyEvent(e);
((VerifyKeyListener) eventListener).verifyKey(verifyEvent);
e.doit = verifyEvent.doit;
break;
- case StyledText.TextChanged: {
+ case ST.TextChanged: {
TextChangedEvent textChangedEvent = new TextChangedEvent((StyledTextContent) e.data);
((TextChangeListener) eventListener).textChanged(textChangedEvent);
break;
}
- case StyledText.TextChanging:
+ case ST.TextChanging:
TextChangingEvent textChangingEvent = new TextChangingEvent((StyledTextContent) e.data, (StyledTextEvent) e);
((TextChangeListener) eventListener).textChanging(textChangingEvent);
break;
- case StyledText.TextSet: {
+ case ST.TextSet: {
TextChangedEvent textChangedEvent = new TextChangedEvent((StyledTextContent) e.data);
((TextChangeListener) eventListener).textSet(textChangedEvent);
break;
}
- case StyledText.WordNext: {
+ case ST.WordNext: {
MovementEvent wordBoundaryEvent = new MovementEvent((StyledTextEvent) e);
((MovementListener) eventListener).getNextOffset(wordBoundaryEvent);
((StyledTextEvent) e).end = wordBoundaryEvent.newOffset;
break;
}
- case StyledText.WordPrevious: {
+ case ST.WordPrevious: {
MovementEvent wordBoundaryEvent = new MovementEvent((StyledTextEvent) e);
((MovementListener) eventListener).getPreviousOffset(wordBoundaryEvent);
((StyledTextEvent) e).end = wordBoundaryEvent.newOffset;
break;
}
- case StyledText.CaretMoved: {
+ case ST.CaretMoved: {
CaretEvent caretEvent = new CaretEvent((StyledTextEvent) e);
((CaretListener) eventListener).caretMoved(caretEvent);
((StyledTextEvent) e).end = caretEvent.caretOffset;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
index 1e5ec46838..484f719ea0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1210,6 +1210,31 @@ fail:
}
#endif
+#if (!defined(NO__1VtblCall__IIIJ) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIJ) && defined(JNI64))
+#ifndef JNI64
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlong arg3);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlong arg3)
+#else
+extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlong arg3);
+JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IJIJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlong arg3)
+#endif
+{
+ jint rc = 0;
+#ifndef JNI64
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IIIJ_FUNC);
+#else
+ XPCOM_NATIVE_ENTER(env, that, _1VtblCall__IJIJ_FUNC);
+#endif
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jintLong, jint, jlong))(*(jintLong **)arg1)[arg0])(arg1, arg2, arg3);
+#ifndef JNI64
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IIIJ_FUNC);
+#else
+ XPCOM_NATIVE_EXIT(env, that, _1VtblCall__IJIJ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
#if (!defined(NO__1VtblCall__IIIJJ) && !defined(JNI64)) || (!defined(NO__1VtblCall__IJIJJ) && defined(JNI64))
#ifndef JNI64
extern "C" JNIEXPORT jint JNICALL XPCOM_NATIVE(_1VtblCall__IIIJJ)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jint arg2, jlong arg3, jlong arg4);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
index f0ac6ad2af..82abbf78b7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int XPCOM_nativeFunctionCount = 226;
-int XPCOM_nativeFunctionCallCount[226];
+int XPCOM_nativeFunctionCount = 227;
+int XPCOM_nativeFunctionCallCount[227];
char * XPCOM_nativeFunctionNames[] = {
#ifndef JNI64
"_1Call__I",
@@ -219,6 +219,11 @@ char * XPCOM_nativeFunctionNames[] = {
"_1VtblCall__IJII_3J",
#endif
#ifndef JNI64
+ "_1VtblCall__IIIJ",
+#else
+ "_1VtblCall__IJIJ",
+#endif
+#ifndef JNI64
"_1VtblCall__IIIJJ",
#else
"_1VtblCall__IJIJJ",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
index eef0e1bcb9..f51bdc96ca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -227,6 +227,11 @@ typedef enum {
_1VtblCall__IJII_3J_FUNC,
#endif
#ifndef JNI64
+ _1VtblCall__IIIJ_FUNC,
+#else
+ _1VtblCall__IJIJ_FUNC,
+#endif
+#ifndef JNI64
_1VtblCall__IIIJJ_FUNC,
#else
_1VtblCall__IJIJJ_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
index 150635f476..12721e336a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java
@@ -46,7 +46,7 @@ class Mozilla extends WebBrowser {
int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT;
int registerFunctionsOnState = 0;
int refCount, lastKeyCode, lastCharCode, authCount;
- int /*long*/ request;
+ int /*long*/ request, badCertRequest;
Point location, size;
boolean visible, isChild, ignoreDispose, isRetrievingBadCert, isViewingErrorPage, ignoreAllMessages, untrustedText;
boolean updateLastNavigateUrl;
@@ -83,7 +83,8 @@ class Mozilla extends WebBrowser {
static final char SEPARATOR_OS = System.getProperty ("file.separator").charAt (0); //$NON-NLS-1$
static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
static final String DISPOSE_LISTENER_HOOKED = "org.eclipse.swt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$
- static final String HEADER_CONTENTTYPE = "Content-Type"; //$NON-NLS-1
+ static final String HEADER_CONTENTLENGTH = "content-length"; //$NON-NLS-1
+ static final String HEADER_CONTENTTYPE = "content-type"; //$NON-NLS-1
static final String MIMETYPE_FORMURLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
static final String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$
static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
@@ -2513,6 +2514,10 @@ void onDispose (Display display) {
locationListeners = oldLocationListeners;
}
+ if (badCertRequest != 0) {
+ new nsISupports (badCertRequest).Release ();
+ }
+
int rc = webBrowser.RemoveWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
if (rc != XPCOM.NS_OK) error (rc);
@@ -2592,6 +2597,150 @@ void Deactivate () {
webBrowserFocus.Release ();
}
+void navigate (int /*long*/ requestHandle) {
+ nsIRequest request = new nsIRequest (requestHandle);
+
+ /* get the request post data, if any */
+ int /*long*/[] result = new int /*long*/[1];
+ byte[] postData = null;
+ final Vector headers = new Vector ();
+ int rc = request.QueryInterface (nsIUploadChannel.NS_IUPLOADCHANNEL_IID, result);
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIUploadChannel uploadChannel = new nsIUploadChannel (result[0]);
+ result[0] = 0;
+ rc = uploadChannel.GetUploadStream (result);
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIInputStream inputStream = new nsIInputStream (result[0]);
+ result[0] = 0;
+ rc = inputStream.QueryInterface (nsISeekableStream.NS_ISEEKABLESTREAM_IID, result);
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsISeekableStream seekableStream = new nsISeekableStream (result[0]);
+ result[0] = 0;
+ long[] initialOffset = new long[1];
+ rc = seekableStream.Tell (initialOffset);
+ if (rc == XPCOM.NS_OK) {
+ rc = seekableStream.Seek (nsISeekableStream.NS_SEEK_SET, 0);
+ if (rc == XPCOM.NS_OK) {
+ int[] available = new int[1];
+ rc = inputStream.Available (available);
+ if (rc == XPCOM.NS_OK) {
+ int length = available[0];
+ byte[] bytes = new byte[length];
+ int[] retVal = new int[1];
+ rc = inputStream.Read (bytes, length, retVal);
+ if (rc == XPCOM.NS_OK) {
+ int start = 0;
+ for (int i = 0; i < length; i++) {
+ if (bytes[i] == 13) {
+ byte[] current = new byte[i - start];
+ System.arraycopy (bytes, start, current, 0, i - start);
+ String string = new String (current).trim ();
+ if (string.length () != 0) {
+ headers.add (string);
+ } else {
+ start = i + 2; /* skip \r\n */
+ postData = new byte[length - start];
+ System.arraycopy (bytes, start, postData, 0, length - start);
+ break;
+ }
+ start = i;
+ }
+ }
+ }
+ }
+ }
+ seekableStream.Seek (nsISeekableStream.NS_SEEK_SET, initialOffset[0]);
+ }
+ seekableStream.Release ();
+ }
+ inputStream.Release ();
+ }
+ uploadChannel.Release ();
+ }
+
+ /* get the request headers */
+ XPCOMObject visitor = new XPCOMObject (new int[] {2, 0, 0, 2}) {
+ int refCount = 0;
+ public int /*long*/ method0 (int /*long*/[] args) {
+ /* QueryInterface */
+ int /*long*/ riid = args[0];
+ int /*long*/ ppvObject = args[1];
+ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID) || guid.Equals (nsIHttpHeaderVisitor.NS_IHTTPHEADERVISITOR_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {getAddress ()}, C.PTR_SIZEOF);
+ refCount++;
+ return XPCOM.NS_OK;
+ }
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+ return XPCOM.NS_ERROR_NO_INTERFACE;
+ }
+ public int /*long*/ method1 (int /*long*/[] args) {
+ /* AddRef */
+ return ++refCount;
+ }
+ public int /*long*/ method2 (int /*long*/[] args) {
+ /* Release */
+ if (--refCount == 0) dispose ();
+ return refCount;
+ }
+ public int /*long*/ method3 (int /*long*/[] args) {
+ /* VisitHeader */
+ int /*long*/ aHeader = args[0];
+ int /*long*/ aValue = args[1];
+
+ int length = XPCOM.nsEmbedCString_Length (aHeader);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aHeader);
+ byte[] dest = new byte[length];
+ XPCOM.memmove (dest, buffer, length);
+ String header = new String (dest);
+
+ length = XPCOM.nsEmbedCString_Length (aValue);
+ buffer = XPCOM.nsEmbedCString_get (aValue);
+ dest = new byte[length];
+ XPCOM.memmove (dest, buffer, length);
+ String value = new String (dest);
+
+ headers.add(header + ':' + value);
+ return XPCOM.NS_OK;
+ }
+ };
+
+ new nsISupports (visitor.getAddress ()).AddRef ();
+ rc = request.QueryInterface (nsIHttpChannel.NS_IHTTPCHANNEL_IID, result);
+ if (rc == XPCOM.NS_OK && result[0] != 0) {
+ nsIHttpChannel httpChannel = new nsIHttpChannel (result[0]);
+ result[0] = 0;
+ httpChannel.VisitRequestHeaders (visitor.getAddress ());
+ httpChannel.Release ();
+ }
+ new nsISupports (visitor.getAddress ()).Release ();
+
+ String[] headersArray = null;
+ int size = headers.size ();
+ if (size > 0) {
+ headersArray = new String[size];
+ headers.copyInto (headersArray);
+ }
+
+ /* a request's name often (but not always) is its url */
+ String url = lastNavigateURL;
+ int /*long*/ name = XPCOM.nsEmbedCString_new ();
+ rc = request.GetName (name);
+ if (rc == XPCOM.NS_OK) {
+ int length = XPCOM.nsEmbedCString_Length (name);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (name);
+ byte[] bytes = new byte[length];
+ XPCOM.memmove (bytes, buffer, length);
+ String value = new String (bytes);
+ if (value.indexOf (":/") != -1) url = value; //$NON-NLS-1$
+ }
+ XPCOM.nsEmbedCString_delete (name);
+
+ setUrl (url, postData, headersArray);
+}
+
void onResize () {
Rectangle rect = browser.getClientArea ();
int width = Math.max (1, rect.width);
@@ -2781,6 +2930,14 @@ public boolean setText (String html, boolean trusted) {
}
public boolean setUrl (String url, String postData, String[] headers) {
+ byte[] postDataBytes = null;
+ if (postData != null) {
+ postDataBytes = MozillaDelegate.wcsToMbcs (null, postData, false);
+ }
+ return setUrl (url, postDataBytes, headers);
+}
+
+boolean setUrl (String url, byte[] postData, String[] headers) {
htmlBytes = null;
int /*long*/[] result = new int /*long*/[1];
@@ -2813,18 +2970,35 @@ public boolean setUrl (String url, String postData, String[] headers) {
componentManager.Release();
if (rc == XPCOM.NS_OK && result[0] != 0) { /* nsIMIMEInputStream is not in mozilla 1.4 */
- byte[] bytes = MozillaDelegate.wcsToMbcs (null, postData, false);
- dataStream = new InputStream (bytes);
+ dataStream = new InputStream (postData);
dataStream.AddRef ();
postDataStream = new nsIMIMEInputStream (result[0]);
rc = postDataStream.SetData (dataStream.getAddress ());
if (rc != XPCOM.NS_OK) error (rc);
- rc = postDataStream.SetAddContentLength (1);
- if (rc != XPCOM.NS_OK) error (rc);
- byte[] name = MozillaDelegate.wcsToMbcs (null, HEADER_CONTENTTYPE, true);
- byte[] value = MozillaDelegate.wcsToMbcs (null, MIMETYPE_FORMURLENCODED, true);
- rc = postDataStream.AddHeader (name, value);
+
+ boolean foundLength = false;
+ boolean foundType = false;
+ if (headers != null) {
+ for (int i = 0; i < headers.length; i++) {
+ int index = headers[i].indexOf (':');
+ if (index != -1) {
+ String name = headers[i].substring (0, index).trim ().toLowerCase ();
+ if (name.equals (HEADER_CONTENTLENGTH)) {
+ foundLength = true;
+ } else if (name.equals (HEADER_CONTENTTYPE)) {
+ foundType = true;
+ }
+ }
+ }
+ }
+ rc = postDataStream.SetAddContentLength (foundLength ? 0 : 1);
if (rc != XPCOM.NS_OK) error (rc);
+ if (!foundType) {
+ byte[] name = MozillaDelegate.wcsToMbcs (null, HEADER_CONTENTTYPE, true);
+ byte[] value = MozillaDelegate.wcsToMbcs (null, MIMETYPE_FORMURLENCODED, true);
+ rc = postDataStream.AddHeader (name, value);
+ if (rc != XPCOM.NS_OK) error (rc);
+ }
}
result[0] = 0;
}
@@ -3182,7 +3356,6 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateF
* callbacks on the channel so that our nsIBadCertListener2 will be invoked.
*/
if (isRetrievingBadCert) {
- isRetrievingBadCert = false;
nsIRequest request = new nsIRequest (aRequest);
int rc = request.QueryInterface (nsIChannel.NS_ICHANNEL_IID, result);
if (rc != XPCOM.NS_OK) error (rc);
@@ -3214,6 +3387,37 @@ int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateF
registerFunctionsOnState = nsIWebProgressListener.STATE_TRANSFERRING;
updateLastNavigateUrl = true;
} else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
+ if (isRetrievingBadCert) {
+ isRetrievingBadCert = false;
+ return XPCOM.NS_OK;
+ }
+
+ /*
+ * If a site with a bad certificate is being encountered for the first time
+ * then store the request for future reference, set the isRetrievingBadCert
+ * flag and re-navigate to the site so that notification callbacks can be
+ * hooked on it to get its certificate info.
+ */
+ switch (aStatus) {
+ case XPCOM.SSL_ERROR_BAD_CERT_DOMAIN:
+ case XPCOM.SEC_ERROR_CA_CERT_INVALID:
+ case XPCOM.SEC_ERROR_EXPIRED_CERTIFICATE:
+ case XPCOM.SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
+ case XPCOM.SEC_ERROR_INADEQUATE_KEY_USAGE:
+ case XPCOM.SEC_ERROR_UNKNOWN_ISSUER:
+ case XPCOM.SEC_ERROR_UNTRUSTED_CERT:
+ case XPCOM.SEC_ERROR_UNTRUSTED_ISSUER: {
+ new nsISupports (aRequest).AddRef ();
+ if (badCertRequest != 0) {
+ new nsISupports (badCertRequest).Release ();
+ }
+ badCertRequest = aRequest;
+ isRetrievingBadCert = true;
+ navigate (aRequest);
+ return XPCOM.NS_OK;
+ }
+ }
+
/*
* If this page's nsIDOMWindow handle is still in unhookedDOMWindows then
* add its DOM listeners now. It's possible for this to happen since
@@ -3954,7 +4158,7 @@ int OnStartURIOpen (int /*long*/ aURI, int /*long*/ retval) {
if (value.indexOf ("aboutCertError.xhtml") != -1 || (isViewingErrorPage && value.indexOf ("javascript:showSecuritySection") != -1)) { //$NON-NLS-1$ //$NON-NLS-2$
XPCOM.memmove (retval, new int[] {1}, 4); /* PRBool */
isRetrievingBadCert = true;
- setUrl (lastNavigateURL, null, null);
+ setUrl (lastNavigateURL, (byte[])null, null);
return XPCOM.NS_OK;
}
isViewingErrorPage = value.indexOf ("netError.xhtml") != -1; //$NON-NLS-1$
@@ -4616,33 +4820,35 @@ int NotifyCertProblem (int /*long*/ socketInfo, int /*long*/ status, int /*long*
browser.getDisplay().asyncExec(new Runnable() {
public void run() {
if (browser.isDisposed ()) return;
- if (!url.equals (lastNavigateURL)) return; /* user has navigated elsewhere */
-
- String message = Compatibility.getMessage ("SWT_InvalidCert_Message", new String[] {urlPort}); //$NON-NLS-1$
- if (new PromptDialog (browser.getShell ()).invalidCert (browser, message, finalProblems, cert)) {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
- result[0] = 0;
- byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CERTOVERRIDE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, nsICertOverrideService.NS_ICERTOVERRIDESERVICE_IID, result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
- serviceManager.Release ();
-
- nsICertOverrideService overrideService = new nsICertOverrideService (result[0]);
- result[0] = 0;
- byte[] hostBytes = MozillaDelegate.wcsToMbcs (null, host, false);
- int /*long*/ hostString = XPCOM.nsEmbedCString_new (hostBytes, hostBytes.length);
- rc = overrideService.RememberValidityOverride (hostString, port, cert.getAddress (), finalFlags, 1);
- browser.setUrl (url);
- XPCOM.nsEmbedCString_delete (hostString);
- overrideService.Release ();
+ if (url.equals (lastNavigateURL)) {
+ String message = Compatibility.getMessage ("SWT_InvalidCert_Message", new String[] {urlPort}); //$NON-NLS-1$
+ if (new PromptDialog (browser.getShell ()).invalidCert (browser, message, finalProblems, cert)) {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CERTOVERRIDE_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsICertOverrideService.NS_ICERTOVERRIDESERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsICertOverrideService overrideService = new nsICertOverrideService (result[0]);
+ result[0] = 0;
+ byte[] hostBytes = MozillaDelegate.wcsToMbcs (null, host, false);
+ int /*long*/ hostString = XPCOM.nsEmbedCString_new (hostBytes, hostBytes.length);
+ rc = overrideService.RememberValidityOverride (hostString, port, cert.getAddress (), finalFlags, 1);
+ navigate (badCertRequest);
+ XPCOM.nsEmbedCString_delete (hostString);
+ overrideService.Release ();
+ }
}
cert.Release ();
+ new nsISupports (badCertRequest).Release ();
+ badCertRequest = 0;
}
});
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java
index 7f1d718a43..c641a2409b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java
@@ -21,17 +21,6 @@ class PromptService2 {
XPCOMObject promptService2;
int refCount = 0;
- static final String[] certErrorCodes = new String[] {
- "ssl_error_bad_cert_domain",
- "sec_error_ca_cert_invalid",
- "sec_error_expired_certificate",
- "sec_error_expired_issuer_certificate",
- "sec_error_inadequate_key_usage",
- "sec_error_unknown_issuer",
- "sec_error_untrusted_cert",
- "sec_error_untrusted_issuer",
- }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
-
PromptService2 () {
createCOMInterfaces ();
}
@@ -173,22 +162,12 @@ int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText)
String textLabel = new String (dest);
/*
- * If mozilla is showing its errors with dialogs (as opposed to pages) then the only
- * opportunity to detect that a page has an invalid certificate, without receiving
- * all notification callbacks on the channel, is to detect the displaying of an alert
- * whose message contains an internal cert error code. If a such a message is
- * detected then instead of showing it, re-navigate to the page with the invalid
- * certificate so that the browser's nsIBadCertListener2 will be invoked.
+ * If mozilla is re-navigating to a page with a bad certificate in order
+ * to get its certificate info then do not show cert error message alerts.
*/
if (browser != null) {
- for (int i = 0; i < certErrorCodes.length; i++) {
- if (textLabel.indexOf (certErrorCodes[i]) != -1) {
- Mozilla mozilla = (Mozilla)browser.webBrowser;
- mozilla.isRetrievingBadCert = true;
- browser.setUrl (mozilla.lastNavigateURL);
- return XPCOM.NS_OK;
- }
- }
+ Mozilla mozilla = (Mozilla)browser.webBrowser;
+ if (mozilla.isRetrievingBadCert) return XPCOM.NS_OK;
}
Shell shell = browser == null ? new Shell () : browser.getShell ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
index 3d8d084526..203fc0ce16 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
@@ -132,6 +132,14 @@ public class XPCOM extends C {
public static final int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3;
public static final int NS_ERROR_FILE_NOT_FOUND = 0x80520012;
public static final int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001;
+ public static final int SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE = 0x805A1FE2;
+ public static final int SEC_ERROR_CA_CERT_INVALID = 0x805A1FDC;
+ public static final int SEC_ERROR_EXPIRED_CERTIFICATE = 0x805A1FF5;
+ public static final int SEC_ERROR_INADEQUATE_KEY_USAGE = 0x805A1FA6;
+ public static final int SEC_ERROR_UNKNOWN_ISSUER = 0x805A1FF3;
+ public static final int SEC_ERROR_UNTRUSTED_CERT = 0x805A1FEB;
+ public static final int SEC_ERROR_UNTRUSTED_ISSUER = 0x805A1FEC;
+ public static final int SSL_ERROR_BAD_CERT_DOMAIN = 0x805A2FF4;
public static final native int nsDynamicFunctionLoad_sizeof ();
@@ -663,6 +671,15 @@ static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1)
lock.unlock();
}
}
+static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1);
+static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1) {
+ lock.lock();
+ try {
+ return _VtblCall(fnNumber, ppVtbl, arg0, arg1);
+ } finally {
+ lock.unlock();
+ }
+}
static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1);
static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpChannel.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpChannel.java
new file mode 100644
index 0000000000..eb19f2a696
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpChannel.java
@@ -0,0 +1,119 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+public class nsIHttpChannel extends nsIChannel {
+
+ static final int LAST_METHOD_ID = nsIChannel.LAST_METHOD_ID + 19;
+
+ public static final String NS_IHTTPCHANNEL_IID_STR =
+ "9277fe09-f0cc-4cd9-bbce-581dd94b0260";
+
+ public static final nsID NS_IHTTPCHANNEL_IID =
+ new nsID(NS_IHTTPCHANNEL_IID_STR);
+
+ public nsIHttpChannel(int /*long*/ address) {
+ super(address);
+ }
+
+ public int GetRequestMethod(int /*long*/ aRequestMethod) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 1, getAddress(), aRequestMethod);
+ }
+
+ public int SetRequestMethod(int /*long*/ aRequestMethod) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 2, getAddress(), aRequestMethod);
+ }
+
+ public int GetReferrer(int /*long*/[] aReferrer) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 3, getAddress(), aReferrer);
+ }
+
+ public int SetReferrer(int /*long*/ aReferrer) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 4, getAddress(), aReferrer);
+ }
+
+ public int GetRequestHeader(int /*long*/ aHeader, int /*long*/ _retval) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 5, getAddress(), aHeader, _retval);
+ }
+
+ public int SetRequestHeader(int /*long*/ aHeader, int /*long*/ aValue, int aMerge) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 6, getAddress(), aHeader, aValue, aMerge);
+ }
+
+ public int VisitRequestHeaders(int /*long*/ aVisitor) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 7, getAddress(), aVisitor);
+ }
+
+ public int GetAllowPipelining(int[] aAllowPipelining) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 8, getAddress(), aAllowPipelining);
+ }
+
+ public int SetAllowPipelining(int aAllowPipelining) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 9, getAddress(), aAllowPipelining);
+ }
+
+ public int GetRedirectionLimit(int[] aRedirectionLimit) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 10, getAddress(), aRedirectionLimit);
+ }
+
+ public int SetRedirectionLimit(int aRedirectionLimit) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 11, getAddress(), aRedirectionLimit);
+ }
+
+ public int GetResponseStatus(int[] aResponseStatus) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 12, getAddress(), aResponseStatus);
+ }
+
+ public int GetResponseStatusText(int /*long*/ aResponseStatusText) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 13, getAddress(), aResponseStatusText);
+ }
+
+ public int GetRequestSucceeded(int[] aRequestSucceeded) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 14, getAddress(), aRequestSucceeded);
+ }
+
+ public int GetResponseHeader(int /*long*/ header, int /*long*/ _retval) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 15, getAddress(), header, _retval);
+ }
+
+ public int SetResponseHeader(int /*long*/ header, int /*long*/ value, int merge) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 16, getAddress(), header, value, merge);
+ }
+
+ public int VisitResponseHeaders(int /*long*/ aVisitor) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 17, getAddress(), aVisitor);
+ }
+
+ public int IsNoStoreResponse(int[] _retval) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 18, getAddress(), _retval);
+ }
+
+ public int IsNoCacheResponse(int[] _retval) {
+ return XPCOM.VtblCall(nsIChannel.LAST_METHOD_ID + 19, getAddress(), _retval);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpHeaderVisitor.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpHeaderVisitor.java
new file mode 100644
index 0000000000..556a5e22c8
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHttpHeaderVisitor.java
@@ -0,0 +1,47 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+public class nsIHttpHeaderVisitor extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1;
+
+ public static final String NS_IHTTPHEADERVISITOR_IID_STR =
+ "0cf40717-d7c1-4a94-8c1e-d6c9734101bb";
+
+ public static final nsID NS_IHTTPHEADERVISITOR_IID =
+ new nsID(NS_IHTTPHEADERVISITOR_IID_STR);
+
+ public nsIHttpHeaderVisitor(int /*long*/ address) {
+ super(address);
+ }
+
+ public int VisitHeader(int /*long*/ aHeader, int /*long*/ aValue) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aHeader, aValue);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISeekableStream.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISeekableStream.java
new file mode 100644
index 0000000000..32a49203cf
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsISeekableStream.java
@@ -0,0 +1,61 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+public class nsISeekableStream extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3;
+
+ public static final String NS_ISEEKABLESTREAM_IID_STR =
+ "8429d350-1040-4661-8b71-f2a6ba455980";
+
+ public static final nsID NS_ISEEKABLESTREAM_IID =
+ new nsID(NS_ISEEKABLESTREAM_IID_STR);
+
+ public nsISeekableStream(int /*long*/ address) {
+ super(address);
+ }
+
+ public static final int NS_SEEK_SET = 0;
+
+ public static final int NS_SEEK_CUR = 1;
+
+ public static final int NS_SEEK_END = 2;
+
+ public int Seek(int whence, long offset) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), whence, offset);
+ }
+
+ public int Tell(long[] _retval) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval);
+ }
+
+ public int SetEOF() {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress());
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIUploadChannel.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIUploadChannel.java
new file mode 100644
index 0000000000..08807366f7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIUploadChannel.java
@@ -0,0 +1,51 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by Netscape are Copyright (C) 1998-1999
+ * Netscape Communications Corporation. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * IBM
+ * - Binding to permit interfacing between Mozilla and SWT
+ * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
+ *
+ * ***** END LICENSE BLOCK ***** */
+package org.eclipse.swt.internal.mozilla;
+
+public class nsIUploadChannel extends nsISupports {
+
+ static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2;
+
+ public static final String NS_IUPLOADCHANNEL_IID_STR =
+ "ddf633d8-e9a4-439d-ad88-de636fd9bb75";
+
+ public static final nsID NS_IUPLOADCHANNEL_IID =
+ new nsID(NS_IUPLOADCHANNEL_IID_STR);
+
+ public nsIUploadChannel(int /*long*/ address) {
+ super(address);
+ }
+
+ public int SetUploadStream(int /*long*/ aStream, int /*long*/ aContentType, int aContentLength) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aStream, aContentType, aContentLength);
+ }
+
+ public int GetUploadStream(int /*long*/[] aUploadStream) {
+ return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aUploadStream);
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java
index a046f47012..78c4f7282f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2me/org/eclipse/swt/internal/Library.java
@@ -22,7 +22,7 @@ public class Library {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- static int MINOR_VERSION = 806;
+ static int MINOR_VERSION = 808;
/**
* SWT revision number (must be >= 0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
index 9984aef06c..43a6fd51e7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
@@ -24,7 +24,7 @@ public class Library {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- static int MINOR_VERSION = 806;
+ static int MINOR_VERSION = 808;
/**
* SWT revision number (must be >= 0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 61bbdce18f..dfe86c15ed 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -17420,6 +17420,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1pango_1attr_1weight_1new)
}
#endif
+#ifndef NO__1pango_1attribute_1copy
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1pango_1attribute_1copy)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1pango_1attribute_1copy_FUNC);
+ rc = (jintLong)pango_attribute_copy((const PangoAttribute *)arg0);
+ OS_NATIVE_EXIT(env, that, _1pango_1attribute_1copy_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1pango_1cairo_1context_1get_1font_1options
JNIEXPORT jintLong JNICALL OS_NATIVE(_1pango_1cairo_1context_1get_1font_1options)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 2c78396ae2..0f233ad5a2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1397;
-int OS_nativeFunctionCallCount[1397];
+int OS_nativeFunctionCount = 1398;
+int OS_nativeFunctionCallCount[1398];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -1408,6 +1408,7 @@ char * OS_nativeFunctionNames[] = {
"_1pango_1attr_1underline_1color_1new",
"_1pango_1attr_1underline_1new",
"_1pango_1attr_1weight_1new",
+ "_1pango_1attribute_1copy",
"_1pango_1cairo_1context_1get_1font_1options",
"_1pango_1cairo_1context_1set_1font_1options",
"_1pango_1cairo_1create_1layout",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 67de14abc2..b47f2c6c58 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1416,6 +1416,7 @@ typedef enum {
_1pango_1attr_1underline_1color_1new_FUNC,
_1pango_1attr_1underline_1new_FUNC,
_1pango_1attr_1weight_1new_FUNC,
+ _1pango_1attribute_1copy_FUNC,
_1pango_1cairo_1context_1get_1font_1options_FUNC,
_1pango_1cairo_1context_1set_1font_1options_FUNC,
_1pango_1cairo_1create_1layout_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 32c93634cf..32f995ea98 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -14138,6 +14138,16 @@ public static final native void memmove(PangoLayoutRun dest, int /*long*/ src, i
* @param size cast=(size_t)
*/
public static final native void memmove(PangoLogAttr dest, int /*long*/ src, int /*long*/ size);
+/** @param attribute cast=(const PangoAttribute *) */
+public static final native int /*long*/ _pango_attribute_copy (int /*long*/ attribute);
+public static final int /*long*/ pango_attribute_copy (int /*long*/ attribute) {
+ lock.lock();
+ try {
+ return _pango_attribute_copy(attribute);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native int /*long*/ _pango_attr_background_new (short red, short green, short blue);
public static final int /*long*/ pango_attr_background_new (short red, short green, short blue) {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
index c2ad756b94..a604233c71 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
@@ -74,6 +74,7 @@
#define NO_DEVMODEW
#define NO_DOCINFO
#define NO_DWM_BLURBEHIND
+#define NO_DTTOPTS
#define NO_EMR
#define NO_EMREXTCREATEFONTINDIRECTW
#define NO_EXTLOGFONTW
@@ -248,6 +249,7 @@
#define NO_DuplicateHandle
#define NO_DwmEnableBlurBehindWindow
#define NO_DwmExtendFrameIntoClientArea
+#define NO_DTTOPTS_1sizeof
#define NO_EnableScrollBar
#define NO_EndBufferedPaint
#define NO_EndDoc
@@ -745,6 +747,7 @@ typedef struct _DWM_BLURBEHIND {
} DWM_BLURBEHIND, *PDWM_BLURBEHIND;
#endif
+#ifndef _WIN32_WCE
#ifndef DTT_CALLBACK_PROC
typedef
int
@@ -778,6 +781,7 @@ typedef struct _DTTOPTS
LPARAM lParam;
} DTTOPTS, *PDTTOPTS;
#endif
+#endif /* _WIN32_WCE */
#if (_WIN32_IE <= 0x0600)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 952c776dc1..c473e5299c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -39,8 +39,9 @@ class WebKit extends WebBrowser {
static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
static final String CHARSET_UTF8 = "UTF-8"; //$NON-NLS-1$
static final String CLASSNAME_EXTERNAL = "External"; //$NON-NLS-1$
- static final String ENCODING_FORM = "Content-Type: application/x-www-form-urlencoded"; //$NON-NLS-1$
static final String FUNCTIONNAME_CALLJAVA = "callJava"; //$NON-NLS-1$
+ static final String HEADER_CONTENTTYPE = "content-type"; //$NON-NLS-1$
+ static final String MIMETYPE_FORMURLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
static final String OBJECTNAME_EXTERNAL = "external"; //$NON-NLS-1$
static final String PROPERTY_LENGTH = "length"; //$NON-NLS-1$
static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
@@ -1748,10 +1749,23 @@ int /*long*/ webkit_resource_request_starting (int /*long*/ web_view, int /*long
WebKitGTK.soup_message_body_flatten (body);
if (headers == null) headers = new String[0];
- String[] temp = new String[headers.length + 1];
- System.arraycopy (headers, 0, temp, 0, headers.length);
- temp[headers.length] = ENCODING_FORM;
- headers = temp;
+ boolean found = false;
+ for (int i = 0; i < headers.length; i++) {
+ int index = headers[i].indexOf (':');
+ if (index != -1) {
+ String name = headers[i].substring (0, index).trim ().toLowerCase ();
+ if (name.equals (HEADER_CONTENTTYPE)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ String[] temp = new String[headers.length + 1];
+ System.arraycopy (headers, 0, temp, 0, headers.length);
+ temp[headers.length] = HEADER_CONTENTTYPE + ':' + MIMETYPE_FORMURLENCODED;
+ headers = temp;
+ }
postData = null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
index f2c639f663..e09b7514d6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TrayItem.java
@@ -43,6 +43,7 @@ public class TrayItem extends Item {
boolean visible = true, highlight;
NSStatusItem item;
NSImageView view;
+ Image highlightImage;
/**
* Constructs a new instance of this class given its parent
@@ -168,6 +169,11 @@ void destroyWidget () {
releaseHandle ();
}
+public Image getHighlightImage () {
+ checkWidget();
+ return highlightImage;
+}
+
Point getLocation () {
NSRect rect = view.frame();
NSRect windowRect = view.window().frame();
@@ -264,6 +270,10 @@ void releaseWidget () {
super.releaseWidget ();
NSStatusBar statusBar = NSStatusBar.systemStatusBar();
statusBar.removeStatusItem(item);
+ if (toolTip != null) toolTip.item = null;
+ toolTip = null;
+ toolTipText = null;
+ highlightImage = null;
}
/**
@@ -335,31 +345,14 @@ public void setImage (Image image) {
checkWidget ();
if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
super.setImage (image);
- float /*double*/ width = 0;
- if (image == null) {
- view.setImage (null);
- } else {
- /*
- * Feature in Cocoa. If the NSImage object being set into the view is
- * the same NSImage object that is already there then the new image is
- * not taken. This results in the view's image not changing even if the
- * NSImage object's content has changed since it was last set into the
- * view. The workaround is to temporarily set the view's image to null
- * so that the new image will then be taken.
- */
- NSImage current = view.image ();
- if (current != null && current.id == image.handle.id) {
- view.setImage (null);
- item.setLength (0);
- }
- view.setImage (image.handle);
- if (visible) {
- NSSize size = image.handle.size ();
- view.setFrameSize (size);
- width = OS.NSSquareStatusItemLength;
- }
- }
- item.setLength (width);
+ updateImage ();
+}
+
+public void setHighlightImage (Image image) {
+ checkWidget ();
+ if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ highlightImage = image;
+ updateImage ();
}
/**
@@ -440,8 +433,7 @@ public void setVisible (boolean visible) {
if (isDisposed ()) return;
}
this.visible = visible;
- float /*double*/ width = image != null && visible ? OS.NSSquareStatusItemLength : 0;
- item.setLength(width);
+ updateImage ();
if (!visible) sendEvent (SWT.Hide);
}
@@ -496,6 +488,7 @@ boolean shouldShowMenu (NSEvent event) {
void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
NSEvent nsEvent = new NSEvent(theEvent);
highlight = true;
+ updateImage();
view.setNeedsDisplay(true);
if (shouldShowMenu(nsEvent)) displayMenu();
}
@@ -503,7 +496,11 @@ void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
void mouseDragged(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
NSEvent nsEvent = new NSEvent(theEvent);
NSRect frame = view.frame();
+ boolean oldHighlight = highlight;
highlight = OS.NSPointInRect(nsEvent.locationInWindow(), frame);
+ if (oldHighlight != highlight) {
+ updateImage ();
+ }
view.setNeedsDisplay(true);
if (shouldShowMenu(nsEvent)) displayMenu();
}
@@ -514,8 +511,9 @@ void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
if (nsEvent.type() == OS.NSLeftMouseUp) {
sendSelectionEvent(nsEvent.clickCount() == 2 ? SWT.DefaultSelection : SWT.Selection);
}
+ highlight = false;
+ updateImage ();
}
- highlight = false;
view.setNeedsDisplay(true);
}
@@ -535,4 +533,32 @@ void drawRect(int /*long*/ id, int /*long*/ sel, NSRect rect) {
item.drawStatusBarBackgroundInRect(rect, highlight);
super.drawRect(id, sel, rect);
}
+
+void updateImage () {
+ float /*double*/ width = 0;
+ Image image = this.image;
+ if (highlight && highlightImage != null) image = highlightImage;
+ if (image == null) {
+ view.setImage (null);
+ } else {
+ /*
+ * Feature in Cocoa. If the NSImage object being set into the view is
+ * the same NSImage object that is already there then the new image is
+ * not taken. This results in the view's image not changing even if the
+ * NSImage object's content has changed since it was last set into the
+ * view. The workaround is to temporarily set the view's image to null
+ * so that the new image will then be taken.
+ */
+ NSImage current = view.image ();
+ if (current != null && current.id == image.handle.id) {
+ view.setImage (null);
+ item.setLength (0);
+ }
+ view.setImage (image.handle);
+ if (visible) {
+ width = OS.NSSquareStatusItemLength;
+ }
+ }
+ item.setLength (width);
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
index 0afe8d43b3..5a3362cb36 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=3
-min_ver=806
-comma_ver=3,8,0,6
+min_ver=808
+comma_ver=3,8,0,8
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
index d2dea0ad41..c2ba5fe5d9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
@@ -4142,7 +4142,24 @@ static String findErrorText (int code) {
public static String getMessage(String key) {
return Compatibility.getMessage(key);
}
-
+
+/**
+ * Returns the NLS'ed message for the given arguments.
+ *
+ * @param key the key to look up
+ * @param args the parameters to insert into the message
+ * @return the message for the given parameterized key
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key or args are null</li>
+ * </ul>
+ *
+ * @since 3.8
+ */
+public static String getMessage(String key, Object[] args) {
+ return Compatibility.getMessage(key, args);
+}
+
/**
* Returns the SWT platform name.
* Examples: "win32", "motif", "gtk", "photon", "carbon", "cocoa", "wpf"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
index 180aea9874..996521c937 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
@@ -1 +1 @@
-version 3.806
+version 3.808
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
index d212d17971..a5c0a0f9f4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
@@ -65,6 +65,8 @@ SWT_Minimize=Minimize
SWT_Maximize=Maximize
SWT_Restore=Restore
SWT_ShowList=Show List
+SWT_Page_Mnemonic=Alt+{0}
+SWT_SwitchPage_Shortcut=Ctrl+PageDown
SWT_FileDownload=File Download
SWT_Download_Error=Error occurred, download not completed
SWT_Download_File=Download: {0}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
index 11adbc6364..f18341fd1b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java
@@ -54,7 +54,7 @@ public final class TextLayout extends Resource {
int[] tabs;
StyleItem[] styles;
int stylesCount;
- int /*long*/ layout, context, attrList;
+ int /*long*/ layout, context, attrList, selAttrList;
int[] invalidOffsets;
static final char LTR_MARK = '\u200E', RTL_MARK = '\u200F', ZWS = '\u200B', ZWNBS = '\uFEFF';
@@ -85,9 +85,7 @@ public TextLayout (Device device) {
OS.pango_layout_set_font_description(layout, device.systemFont.handle);
OS.pango_layout_set_wrap(layout, OS.PANGO_WRAP_WORD_CHAR);
OS.pango_layout_set_tabs(layout, device.emptyTab);
- if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) {
- OS.pango_layout_set_auto_dir(layout, false);
- }
+ OS.pango_layout_set_auto_dir(layout, false);
text = "";
wrapWidth = ascent = descent = -1;
styles = new StyleItem[2];
@@ -109,6 +107,7 @@ void computeRuns () {
if (stylesCount == 2 && styles[0].style == null && ascent == -1 && descent == -1 && segments == null) return;
int /*long*/ ptr = OS.pango_layout_get_text(layout);
attrList = OS.pango_attr_list_new();
+ selAttrList = OS.pango_attr_list_new();
PangoAttribute attribute = new PangoAttribute();
char[] chars = null;
int segementsLength = segmentsText.length();
@@ -136,12 +135,14 @@ void computeRuns () {
attribute.end_index = bytePos + offset + 3;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
attr = OS.pango_attr_shape_new (rect, rect);
OS.memmove (attribute, attr, PangoAttribute.sizeof);
attribute.start_index = bytePos + offset + 3;
attribute.end_index = bytePos + offset + 6;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
int pos = (int)/*64*/OS.g_utf16_pointer_to_offset(ptr, ptr + bytePos);
chars[pos + lineIndex * 2] = ZWS;
chars[pos + lineIndex * 2 + 1] = ZWNBS;
@@ -196,6 +197,7 @@ void computeRuns () {
attribute.end_index = byteEnd;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
}
if (style.underline) {
int underlineStyle = OS.PANGO_UNDERLINE_NONE;
@@ -208,9 +210,7 @@ void computeRuns () {
break;
case SWT.UNDERLINE_SQUIGGLE:
case SWT.UNDERLINE_ERROR:
- if (OS.GTK_VERSION >= OS.VERSION(2, 4, 0)) {
- underlineStyle = OS.PANGO_UNDERLINE_ERROR;
- }
+ underlineStyle = OS.PANGO_UNDERLINE_ERROR;
break;
case SWT.UNDERLINE_LINK: {
if (style.foreground == null) {
@@ -221,28 +221,46 @@ void computeRuns () {
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
}
- if (style.underlineColor == null) {
- underlineStyle = OS.PANGO_UNDERLINE_SINGLE;
- }
+ underlineStyle = OS.PANGO_UNDERLINE_SINGLE;
break;
}
}
- if (underlineStyle != OS.PANGO_UNDERLINE_NONE && style.underlineColor == null) {
- int /*long*/ attr = OS.pango_attr_underline_new(underlineStyle);
+ int /*long*/ attr = OS.pango_attr_underline_new(underlineStyle);
+ OS.memmove(attribute, attr, PangoAttribute.sizeof);
+ attribute.start_index = byteStart;
+ attribute.end_index = byteEnd;
+ OS.memmove(attr, attribute, PangoAttribute.sizeof);
+ OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
+ if (style.underlineColor != null) {
+ GdkColor fg = style.underlineColor.handle;
+ attr = OS.pango_attr_underline_color_new(fg.red, fg.green, fg.blue);
OS.memmove(attribute, attr, PangoAttribute.sizeof);
attribute.start_index = byteStart;
attribute.end_index = byteEnd;
OS.memmove(attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
}
}
- if (style.strikeout && style.strikeoutColor == null) {
+ if (style.strikeout) {
int /*long*/ attr = OS.pango_attr_strikethrough_new(true);
OS.memmove(attribute, attr, PangoAttribute.sizeof);
attribute.start_index = byteStart;
attribute.end_index = byteEnd;
OS.memmove(attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
+ if (style.strikeoutColor != null) {
+ GdkColor fg = style.strikeoutColor.handle;
+ attr = OS.pango_attr_strikethrough_color_new(fg.red, fg.green, fg.blue);
+ OS.memmove(attribute, attr, PangoAttribute.sizeof);
+ attribute.start_index = byteStart;
+ attribute.end_index = byteEnd;
+ OS.memmove(attr, attribute, PangoAttribute.sizeof);
+ OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
+ }
}
Color foreground = style.foreground;
if (foreground != null && !foreground.isDisposed()) {
@@ -276,6 +294,7 @@ void computeRuns () {
attribute.end_index = byteEnd;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
}
int rise = style.rise;
if (rise != 0) {
@@ -285,6 +304,7 @@ void computeRuns () {
attribute.end_index = byteEnd;
OS.memmove (attr, attribute, PangoAttribute.sizeof);
OS.pango_attr_list_insert(attrList, attr);
+ OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr));
}
}
OS.pango_layout_set_attributes(layout, attrList);
@@ -417,7 +437,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
int /*long*/ ptr = OS.pango_layout_get_text(layout);
int /*long*/ iter = OS.pango_layout_get_iter(layout);
if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
Cairo.cairo_save(cairo);
GdkColor color = selectionBackground.handle;
Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
@@ -455,8 +475,8 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
if (ascent != -1 && descent != -1) {
height = Math.max (height, ascent + descent);
}
- int width = (flags & SWT.FULL_SELECTION) != 0 ? 0x7fffffff : height / 3;
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ int width = (flags & SWT.FULL_SELECTION) != 0 ? 0x7fff : height / 3;
+ if (cairo != 0) {
Cairo.cairo_rectangle(cairo, lineX, lineY, width, height);
Cairo.cairo_fill(cairo);
} else {
@@ -467,7 +487,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
} while (lineIndex < lineCount);
OS.pango_layout_iter_free(iter);
if (attrs[0] != 0) OS.g_free(attrs[0]);
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
Cairo.cairo_restore(cairo);
} else {
OS.gdk_gc_set_foreground(gc.handle, data.foreground);
@@ -475,7 +495,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
}
if (length == 0) return;
if (!hasSelection) {
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
if ((data.style & SWT.MIRRORED) != 0) {
Cairo.cairo_save(cairo);
Cairo.cairo_scale(cairo, -1, 1);
@@ -501,7 +521,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
boolean fullSelection = selectionStart == 0 && selectionEnd == length - 1;
if (fullSelection) {
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
int /*long*/ ptr = OS.pango_layout_get_text(layout);
if ((data.style & SWT.MIRRORED) != 0) {
Cairo.cairo_save(cairo);
@@ -523,7 +543,7 @@ public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Colo
int strlen = OS.strlen(ptr);
byteSelStart = Math.min(byteSelStart, strlen);
byteSelEnd = Math.min(byteSelEnd, strlen);
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
if ((data.style & SWT.MIRRORED) != 0) {
Cairo.cairo_save(cairo);
Cairo.cairo_scale(cairo, -1, 1);
@@ -573,7 +593,9 @@ void drawWithCairo(GC gc, int x, int y, int start, int end, boolean fullSelectio
}
Cairo.cairo_set_source_rgba(cairo, (fg.red & 0xFFFF) / (float)0xFFFF, (fg.green & 0xFFFF) / (float)0xFFFF, (fg.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
Cairo.cairo_move_to(cairo, x, y);
+ OS.pango_layout_set_attributes(layout, selAttrList);
OS.pango_cairo_show_layout(cairo, layout);
+ OS.pango_layout_set_attributes(layout, attrList);
drawBorder(gc, x, y, fg);
Cairo.cairo_restore(cairo);
}
@@ -584,7 +606,7 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
int /*long*/ gdkGC = gc.handle;
int /*long*/ ptr = OS.pango_layout_get_text(layout);
GdkGCValues gcValues = null;
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
Cairo.cairo_save(cairo);
}
for (int i = 0; i < stylesCount - 1; i++) {
@@ -620,7 +642,7 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
case SWT.BORDER_DASH: dashes = width != 0 ? GC.LINE_DASH : GC.LINE_DASH_ZERO; break;
case SWT.BORDER_DOT: dashes = width != 0 ? GC.LINE_DOT : GC.LINE_DOT_ZERO; break;
}
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
Cairo.cairo_set_line_width(cairo, width);
if (dashes != null) {
@@ -666,178 +688,13 @@ void drawBorder(GC gc, int x, int y, GdkColor selectionColor) {
OS.gdk_region_destroy(rgn);
}
}
-
- boolean drawUnderline = false;
- if (style.underline && style.underlineColor != null) drawUnderline = true;
- if (style.underline && (style.underlineStyle == SWT.UNDERLINE_ERROR || style.underlineStyle == SWT.UNDERLINE_SQUIGGLE)&& OS.GTK_VERSION < OS.VERSION(2, 4, 0)) drawUnderline = true;
- if (drawUnderline && !style.isAdherentUnderline(styles[i+1].style)) {
- int start = styles[i].start;
- for (int j = i; j > 0 && style.isAdherentUnderline(styles[j-1].style); j--) {
- start = styles[j - 1].start;
- }
- start = translateOffset(start);
- int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
- int[] ranges = new int[]{byteStart, byteEnd};
- int /*long*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
- if (rgn != 0) {
- int[] nRects = new int[1];
- int /*long*/[] rects = new int /*long*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
- GdkRectangle rect = new GdkRectangle();
- GdkColor color = null;
- if (color == null && style.underlineColor != null) color = style.underlineColor.handle;
- if (color == null && selectionColor != null) color = selectionColor;
- if (color == null && style.foreground != null) color = style.foreground.handle;
- if (color == null) color = data.foreground;
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
- } else {
- if (gcValues == null) {
- gcValues = new GdkGCValues();
- OS.gdk_gc_get_values(gdkGC, gcValues);
- }
- OS.gdk_gc_set_foreground(gdkGC, color);
- }
- int underlinePosition = -1;
- int underlineThickness = 1;
- if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
- Font font = style.font;
- if (font == null) font = this.font;
- if (font == null) font = device.systemFont;
- int /*long*/ lang = OS.pango_context_get_language(context);
- int /*long*/ metrics = OS.pango_context_get_metrics(context, font.handle, lang);
- underlinePosition = OS.PANGO_PIXELS(OS.pango_font_metrics_get_underline_position(metrics));
- underlineThickness = OS.PANGO_PIXELS(OS.pango_font_metrics_get_underline_thickness(metrics));
- OS.pango_font_metrics_unref(metrics);
- }
- for (int j=0; j<nRects[0]; j++) {
- OS.memmove(rect, rects[0] + (j * GdkRectangle.sizeof), GdkRectangle.sizeof);
- int offset = getOffset(rect.x - x, rect.y - y, null);
- int lineIndex = getLineIndex(offset);
- FontMetrics metrics = getLineMetrics(lineIndex);
- int underlineY = rect.y + metrics.ascent - underlinePosition - style.rise;
- switch (style.underlineStyle) {
- case SWT.UNDERLINE_SQUIGGLE:
- case SWT.UNDERLINE_ERROR: {
- int squigglyThickness = underlineThickness;
- int squigglyHeight = 2 * squigglyThickness;
- int squigglyY = Math.min(underlineY, rect.y + rect.height - squigglyHeight - 1);
- int[] points = computePolyline(rect.x, squigglyY, rect.x + rect.width, squigglyY + squigglyHeight);
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_set_line_width(cairo, squigglyThickness);
- Cairo.cairo_set_line_cap(cairo, Cairo.CAIRO_LINE_CAP_BUTT);
- Cairo.cairo_set_line_join(cairo, Cairo.CAIRO_LINE_JOIN_MITER);
- if (points.length > 0) {
- double xOffset = 0.5, yOffset = 0.5;
- Cairo.cairo_move_to(cairo, points[0] + xOffset, points[1] + yOffset);
- for (int k = 2; k < points.length; k += 2) {
- Cairo.cairo_line_to(cairo, points[k] + xOffset, points[k + 1] + yOffset);
- }
- Cairo.cairo_stroke(cairo);
- }
- } else {
- OS.gdk_gc_set_line_attributes(gdkGC, squigglyThickness, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
- OS.gdk_draw_lines(data.drawable, gdkGC, points, points.length / 2);
- }
- break;
- }
- case SWT.UNDERLINE_DOUBLE:
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_rectangle(cairo, rect.x, underlineY + underlineThickness * 2, rect.width, underlineThickness);
- Cairo.cairo_fill(cairo);
- } else {
- OS.gdk_draw_rectangle(data.drawable, gdkGC, 1, rect.x, underlineY + underlineThickness * 2, rect.width, underlineThickness);
- }
- //FALLTHROUGH
- case SWT.UNDERLINE_LINK:
- case SWT.UNDERLINE_SINGLE:
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_rectangle(cairo, rect.x, underlineY, rect.width, underlineThickness);
- Cairo.cairo_fill(cairo);
- } else {
- OS.gdk_draw_rectangle(data.drawable, gdkGC, 1, rect.x, underlineY, rect.width, underlineThickness);
- }
- break;
- }
- }
- if (rects[0] != 0) OS.g_free(rects[0]);
- OS.gdk_region_destroy(rgn);
- }
- }
-
- boolean drawStrikeout = false;
- if (style.strikeout && style.strikeoutColor != null) drawStrikeout = true;
- if (drawStrikeout && !style.isAdherentStrikeout(styles[i+1].style)) {
- int start = styles[i].start;
- for (int j = i; j > 0 && style.isAdherentStrikeout(styles[j-1].style); j--) {
- start = styles[j - 1].start;
- }
- start = translateOffset(start);
- int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (int)/*64*/(OS.g_utf16_offset_to_pointer(ptr, end + 1) - ptr);
- int[] ranges = new int[]{byteStart, byteEnd};
- int /*long*/ rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges, ranges.length / 2);
- if (rgn != 0) {
- int[] nRects = new int[1];
- int /*long*/[] rects = new int /*long*/[1];
- OS.gdk_region_get_rectangles(rgn, rects, nRects);
- GdkRectangle rect = new GdkRectangle();
- GdkColor color = null;
- if (color == null && style.strikeoutColor != null) color = style.strikeoutColor.handle;
- if (color == null && selectionColor != null) color = selectionColor;
- if (color == null && style.foreground != null) color = style.foreground.handle;
- if (color == null) color = data.foreground;
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF, data.alpha / (float)0xFF);
- } else {
- if (gcValues == null) {
- gcValues = new GdkGCValues();
- OS.gdk_gc_get_values(gdkGC, gcValues);
- }
- OS.gdk_gc_set_foreground(gdkGC, color);
- }
- int strikeoutPosition = -1;
- int strikeoutThickness = 1;
- if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
- Font font = style.font;
- if (font == null) font = this.font;
- if (font == null) font = device.systemFont;
- int /*long*/ lang = OS.pango_context_get_language(context);
- int /*long*/ metrics = OS.pango_context_get_metrics(context, font.handle, lang);
- strikeoutPosition = OS.PANGO_PIXELS(OS.pango_font_metrics_get_strikethrough_position(metrics));
- strikeoutThickness = OS.PANGO_PIXELS(OS.pango_font_metrics_get_strikethrough_thickness(metrics));
- OS.pango_font_metrics_unref(metrics);
- }
- for (int j=0; j<nRects[0]; j++) {
- OS.memmove(rect, rects[0] + (j * GdkRectangle.sizeof), GdkRectangle.sizeof);
- int strikeoutY = rect.y + rect.height / 2 - style.rise;
- if (OS.GTK_VERSION >= OS.VERSION(2, 6, 0)) {
- int offset = getOffset(rect.x - x, rect.y - y, null);
- int lineIndex = getLineIndex(offset);
- FontMetrics metrics = getLineMetrics(lineIndex);
- strikeoutY = rect.y + metrics.ascent - strikeoutPosition - style.rise;
- }
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
- Cairo.cairo_rectangle(cairo, rect.x, strikeoutY, rect.width, strikeoutThickness);
- Cairo.cairo_fill(cairo);
- } else {
- OS.gdk_draw_rectangle(data.drawable, gdkGC, 1, rect.x, strikeoutY, rect.width, strikeoutThickness);
- }
- }
- if (rects[0] != 0) OS.g_free(rects[0]);
- OS.gdk_region_destroy(rgn);
- }
- }
}
if (gcValues != null) {
int mask = OS.GDK_GC_FOREGROUND | OS.GDK_GC_LINE_WIDTH | OS.GDK_GC_LINE_STYLE | OS.GDK_GC_CAP_STYLE | OS.GDK_GC_JOIN_STYLE;
OS.gdk_gc_set_values(gdkGC, gcValues, mask);
data.state &= ~GC.LINE_STYLE;
}
- if (cairo != 0 && OS.GTK_VERSION >= OS.VERSION(2, 8, 0)) {
+ if (cairo != 0) {
Cairo.cairo_restore(cairo);
}
}
@@ -847,6 +704,10 @@ void freeRuns() {
OS.pango_layout_set_attributes(layout, 0);
OS.pango_attr_list_unref(attrList);
attrList = 0;
+ if (selAttrList != 0) {
+ OS.pango_attr_list_unref(selAttrList);
+ selAttrList = 0;
+ }
invalidOffsets = null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
index b9558a4b83..44e4b82380 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
@@ -43,6 +43,7 @@ public class TrayItem extends Item {
int /*long*/ imageHandle;
int /*long*/ tooltipsHandle;
ImageList imageList;
+ Image highlightImage;
/**
* Constructs a new instance of this class given its parent
@@ -220,6 +221,11 @@ public Tray getParent () {
return parent;
}
+public Image getHighlightImage () {
+ checkWidget ();
+ return highlightImage;
+}
+
/**
* Returns the receiver's tool tip, or null if it has
* not been set.
@@ -397,6 +403,7 @@ void releaseWidget () {
if (imageList != null) imageList.dispose ();
imageList = null;
toolTipText = null;
+ highlightImage = null;
}
/**
@@ -451,6 +458,12 @@ public void removeSelectionListener (SelectionListener listener) {
eventTable.unhook (SWT.DefaultSelection, listener);
}
+public void setHighlightImage (Image image) {
+ checkWidget ();
+ if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ highlightImage = image;
+}
+
/**
* Sets the receiver's image.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
index 3688135061..dbd91a4403 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
@@ -2604,6 +2604,18 @@ StyleItem[] itemize () {
scriptState.uBidiLevel = 1;
scriptState.fArabicNumContext = true;
}
+
+ /*
+ * In the version of Usp10.h that SWT is compiled the fReserved field is declared
+ * as a bitfield size 8. In newer versions of the Uniscribe, the first bit of fReserved
+ * was used to implement the fMergeNeutralItems feature which can be used to increase
+ * performance by reducing the number of SCRIPT_ITEM returned by ScriptItemize.
+ *
+ * Note: This code is wrong on a big endian machine.
+ */
+ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ scriptControl.fReserved = 0x1;
+ }
OS.ScriptApplyDigitSubstitution(null, scriptControl, scriptState);
int /*long*/ hHeap = OS.GetProcessHeap();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
index 2f03875289..f469bcdd25 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
@@ -869,6 +869,16 @@ LRESULT WM_GETDLGCODE (int /*long*/ wParam, int /*long*/ lParam) {
return new LRESULT (OS.DLGC_BUTTON | OS.DLGC_WANTARROWS);
}
+LRESULT WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) {
+ /*
+ * Ensure that there is an accessible object created for this
+ * control because support for publishing the keyboard shortcut
+ * for page switching is implemented in the accessibility package.
+ */
+ if (accessible == null) accessible = new_Accessible (this);
+ return super.WM_GETOBJECT (wParam, lParam);
+}
+
LRESULT WM_KEYDOWN (int /*long*/ wParam, int /*long*/ lParam) {
LRESULT result = super.WM_KEYDOWN (wParam, lParam);
if (result != null) return result;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
index 8f77963cb0..130fc8d2de 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
@@ -805,8 +805,9 @@ public void setText (String string) {
* mnemonic characters and replace doubled mnemonics
* with spaces.
*/
+ boolean replace = !OS.IsWinCE && OS.WIN32_VERSION <= OS.VERSION (4, 10);
int /*long*/ hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, true), true);
+ TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, replace), true);
int byteCount = buffer.length () * TCHAR.sizeof;
int /*long*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (pszText, buffer, byteCount);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java
index c9e45d6ac7..a4ba1a0a61 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java
@@ -39,7 +39,7 @@ import org.eclipse.swt.internal.win32.*;
public class TrayItem extends Item {
Tray parent;
int id;
- Image image2;
+ Image image2, highlightImage;
ToolTip toolTip;
String toolTipText;
boolean visible = true;
@@ -161,6 +161,24 @@ void destroyWidget () {
}
/**
+ * Returns the receiver's highlight image if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's highlight image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.8
+ */
+public Image getHighlightImage () {
+ checkWidget ();
+ return highlightImage;
+}
+
+/**
* Returns the receiver's parent, which must be a <code>Tray</code>.
*
* @return the receiver's parent
@@ -320,6 +338,7 @@ void releaseWidget () {
toolTip = null;
if (image2 != null) image2.dispose ();
image2 = null;
+ highlightImage = null;
toolTipText = null;
NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA ();
iconData.cbSize = NOTIFYICONDATA.sizeof;
@@ -381,6 +400,27 @@ public void removeMenuDetectListener (MenuDetectListener listener) {
}
/**
+ * Sets the receiver's highlight image.
+ *
+ * @param image the new highlight image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @since 3.8
+ */
+public void setHighlightImage (Image image) {
+ checkWidget ();
+ if (image != null && image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ highlightImage = image;
+}
+
+/**
* Sets the receiver's image.
*
* @param image the new image
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
index 42a43f8106..8e76cb9d5c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
@@ -659,8 +659,9 @@ public void setText (String string) {
* mnemonic characters and replace doubled mnemonics
* with spaces.
*/
+ boolean replace = !OS.IsWinCE && OS.WIN32_VERSION <= OS.VERSION (4, 10);
int /*long*/ hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, true), true);
+ TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, replace), true);
int byteCount = buffer.length () * TCHAR.sizeof;
int /*long*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (pszText, buffer, byteCount);
diff --git a/bundles/org.eclipse.swt/buildSWT.xml b/bundles/org.eclipse.swt/buildSWT.xml
index 1e2c9b01d8..94bd436b45 100644
--- a/bundles/org.eclipse.swt/buildSWT.xml
+++ b/bundles/org.eclipse.swt/buildSWT.xml
@@ -34,7 +34,7 @@
<property name="repo.src" value="../../../eclipse.platform.swt"/>
<property name="repo.bin" value="../../../eclipse.platform.swt.binaries"/>
- <property name="repo.releng" value="../../../eclipse.platform.releng"/>
+ <property name="repo.releng" value="../../../eclipse.platform.releng.maps"/>
<property name="src_common" value="'bundles/org.eclipse.swt/Eclipse SWT/common/library' 'bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library' 'bundles/org.eclipse.swt/Eclipse SWT PI/common/library'"/>
<property name="src_win32" value="${src_common} 'bundles/org.eclipse.swt/Eclipse SWT PI/win32/library' 'bundles/org.eclipse.swt/Eclipse SWT AWT/win32/library' 'bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/library' 'bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/library'"/>
@@ -50,6 +50,7 @@
<property name="file_make_common" value="bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak"/>
<property name="file_version" value="bundles/org.eclipse.swt/Eclipse SWT/common/version.txt"/>
<property name="file_build_notes" value="bundles/org.eclipse.swt/buildnotes_swt.html"/>
+ <property name="file_swt_map" value="maps/org.eclipse.releng/maps/swt.map"/>
<target name="check_libraries" depends="get_version">
<antcall target="check_fragment_libraries">
@@ -588,28 +589,9 @@
<replace file="${repo.src}/${file_build_notes}" token="${match_line}" value="${match_line}${body}"/>
</target>
- <target name="cvs_tag">
- <condition property="CVS_TAG" value="" else="-r${TAG}">
- <equals arg1="${TAG}" arg2="master"/>
- </condition>
- </target>
-
<!-- Set swt_tag to the current tag in the swt map file -->
- <target name="get_tag" unless="swt_tag" depends="cvs_tag">
- <property name="tmpdir" value="${tmphome}"/>
- <!--property name="map" value="${repo.releng}/bundles/org.eclipse.releng/maps/swt.map"/-->
- <property name="map" value="org.eclipse.releng/maps/swt.map"/>
- <property name="cvsRsh" value="plink"/>
- <property name="cvsRoot" value=":ext:fheidric@dev.eclipse.org:/cvsroot/eclipse"/>
- <cvs cvsRoot="${cvsRoot}" cvsrsh="${cvsRsh}" failonerror="true" dest="${tmpdir}">
- <commandline>
- <argument value="checkout"/>
- <argument line="${CVS_TAG}"/>
- <argument value="${map}"/>
- </commandline>
- </cvs>
-
- <loadfile property="swt_tag" srcfile="${tmpdir}/${map}">
+ <target name="get_tag" unless="swt_tag">
+ <loadfile property="swt_tag" srcfile="${repo.releng}/${file_swt_map}">
<filterchain>
<tokenfilter delimoutput="">
<containsstring contains="plugin@org.eclipse.swt=GIT,tag="/>
@@ -731,30 +713,19 @@
<antcall target="update_swt_map"/>
</target>
- <target name="update_swt_map" depends="cvs_tag">
- <property name="tmpdir" value="${tmphome}"/>
- <property name="cvsRsh" value="plink"/>
- <property name="cvsRoot" value=":ext:fheidric@dev.eclipse.org:/cvsroot/eclipse"/>
- <!-- download the map file -->
- <property name="map" value="org.eclipse.releng/maps/swt.map"/>
- <cvs cvsRoot="${cvsRoot}" cvsrsh="${cvsRsh}" failonerror="true" dest="${tmpdir}">
- <commandline>
- <argument value="checkout"/>
- <argument line="${CVS_TAG}"/>
- <argument value="${map}"/>
- </commandline>
- </cvs>
-
+ <target name="update_swt_map" depends="get_new_tag">
<!-- update and commit map file -->
- <replaceregexp file="${tmpdir}/${map}" match="=v\d\d\d\d[a-z]?" replace="=v${swt_new_tag}" byline="true"/>
- <cvs cvsRoot="${cvsRoot}" cvsrsh="${cvsRsh}" failonerror="true" dest="${tmpdir}">
- <commandline>
- <argument value="commit"/>
- <argument value="-m"/>
- <argument value="'new version v${swt_new_tag}'"/>
- <argument value="${map}"/>
- </commandline>
- </cvs>
+ <replaceregexp file="${repo.releng}/${file_swt_map}" match="=v\d\d\d\d[a-z]?" replace="=v${swt_new_tag}" byline="true"/>
+
+ <exec dir="${repo.releng}" executable="git" failonerror="true">
+ <arg line="add '${file_swt_map}'"/>
+ </exec>
+ <exec dir="${repo.releng}" executable="git" failonerror="true">
+ <arg line="status"/>
+ </exec>
+ <exec dir="${repo.releng}" executable="git" failonerror="true">
+ <arg line="commit -m 'SWT contribution v${swt_new_tag}'"/>
+ </exec>
</target>
<target name="check_sha1_file" unless="natives_changed">
@@ -1076,6 +1047,16 @@
<exec dir="../../../../${TAG}/eclipse.platform.swt.binaries" executable="git" failonerror="true" timeout="900000">
<arg line="reset --hard origin/${TAG}"/>
</exec>
+ <antcall target="init_repo">
+ <param name="repo" value="eclipse.platform.releng.maps"/>
+ <param name="repo.exists" value="repo.releng.exists"/>
+ </antcall>
+ <exec dir="../../../../${TAG}/eclipse.platform.releng.maps" executable="git" failonerror="true">
+ <arg line="fetch"/>
+ </exec>
+ <exec dir="../../../../${TAG}/eclipse.platform.releng.maps" executable="git" failonerror="true">
+ <arg line="reset --hard origin/${TAG}"/>
+ </exec>
</target>
<target name="push_remote">
@@ -1097,6 +1078,15 @@
<exec dir="../../../../${TAG}/eclipse.platform.swt.binaries" executable="git" failonerror="true">
<arg line="push origin ${TAG}"/>
</exec>
+ <exec dir="../../../../${TAG}/eclipse.platform.releng.maps" executable="git" failonerror="true">
+ <arg line="fetch"/>
+ </exec>
+ <exec dir="../../../../${TAG}/eclipse.platform.releng.maps" executable="git" failonerror="true">
+ <arg line="rebase origin/${TAG}"/>
+ </exec>
+ <exec dir="../../../../${TAG}/eclipse.platform.releng.maps" executable="git" failonerror="true">
+ <arg line="push origin ${TAG}"/>
+ </exec>
<exec dir="${repo.src}" executable="git" failonerror="true">
<arg line="push --tags"/>
</exec>
diff --git a/bundles/org.eclipse.swt/buildnotes_swt.html b/bundles/org.eclipse.swt/buildnotes_swt.html
index 620a82a304..b06bd05442 100644
--- a/bundles/org.eclipse.swt/buildnotes_swt.html
+++ b/bundles/org.eclipse.swt/buildnotes_swt.html
@@ -11,6 +11,18 @@
Eclipse Platform Build Notes<br>
SWT</h1>
+<h2>SWT Build 3808 - Tuesday October 25, 2011</h2>
+
+<blockquote>
+<a href=https://bugs.eclipse.org/bugs/buglist.cgi?bug_file_loc=;bug_file_loc_type=allwordssubstr;bug_id=;bugidtype=include;chfield=resolution;target_milestone=;chfieldfrom=2011-10-17+16%3A16%3A01+-0400;chfieldto=2011-10-24+13%3A19%3A16+%2B0000;chfieldvalue=FIXED;classification=Eclipse;component=SWT;email1=;email2=;emailtype1=substring;emailtype2=substring;field-1-0-0=classification;field-1-1-0=product;field-1-2-0=component;field0-0-0=noop;keywords=;keywords_type=allwords;long_desc=;long_desc_type=allwordssubstr;product=Platform;query_format=advanced;remaction=;short_desc=;short_desc_type=allwordssubstr;status_whiteboard=;status_whiteboard_type=allwordssubstr;type-1-0-0=anyexact;type-1-1-0=anyexact;type-1-2-0=anyexact;type0-0-0=noop;value-1-0-0=Eclipse;value-1-1-0=Platform;value-1-2-0=SWT;value0-0-0=;votes=;query_based_on=>Bugs fixed</a>
+</blockquote>
+
+<h2>SWT Build 3807 - Tuesday October 18, 2011</h2>
+
+<blockquote>
+<a href=https://bugs.eclipse.org/bugs/buglist.cgi?bug_file_loc=;bug_file_loc_type=allwordssubstr;bug_id=;bugidtype=include;chfield=resolution;target_milestone=;chfieldfrom=2011-10-07+17%3A25%3A00+-0400;chfieldto=2011-10-17+20%3A15%3A59+%2B0000;chfieldvalue=FIXED;classification=Eclipse;component=SWT;email1=;email2=;emailtype1=substring;emailtype2=substring;field-1-0-0=classification;field-1-1-0=product;field-1-2-0=component;field0-0-0=noop;keywords=;keywords_type=allwords;long_desc=;long_desc_type=allwordssubstr;product=Platform;query_format=advanced;remaction=;short_desc=;short_desc_type=allwordssubstr;status_whiteboard=;status_whiteboard_type=allwordssubstr;type-1-0-0=anyexact;type-1-1-0=anyexact;type-1-2-0=anyexact;type0-0-0=noop;value-1-0-0=Eclipse;value-1-1-0=Platform;value-1-2-0=SWT;value0-0-0=;votes=;query_based_on=>Bugs fixed</a>
+</blockquote>
+
<h2>SWT Build 3806a - Saturday October 08, 2011</h2>
<blockquote>
diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties
index bebd27b75b..520fd4f69e 100644
--- a/examples/org.eclipse.swt.examples/src/examples_control.properties
+++ b/examples/org.eclipse.swt.examples/src/examples_control.properties
@@ -211,13 +211,13 @@ Strikeout = Strikeout
Fill_X = Horizontal Fill
Fill_Y = Vertical Fill
Pack_Columns = Pack Columns
-TabItem1_0 = Tab 0
-TabItem1_1 = Tab 1
-TabItem1_2 = Tab 2
+TabItem1_0 = Tab &0
+TabItem1_1 = Tab &1
+TabItem1_2 = Tab &2
TabItem_content = TabItem Content
-CTabItem1_0 = CTabItem 0
-CTabItem1_1 = CTabItem 1
-CTabItem1_2 = CTabItem 2 has a long name
+CTabItem1_0 = CTabItem &0
+CTabItem1_1 = CTabItem &1
+CTabItem1_2 = CTabItem &2 has a long name
CItem_Colors = CTabItem Colors
CTabItem_content = CTabItem Content
Set_Simple_Tabs = Simple Tabs
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java
index 314a925b06..b52865ac8b 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java
@@ -28,6 +28,11 @@ public static void main(String[] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Image image = new Image (display, 16, 16);
+ Image image2 = new Image (display, 16, 16);
+ GC gc = new GC(image2);
+ gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
+ gc.fillRectangle(image2.getBounds());
+ gc.dispose();
final Tray tray = display.getSystemTray ();
if (tray == null) {
System.out.println ("The system tray is not available");
@@ -70,7 +75,8 @@ public static void main(String[] args) {
menu.setVisible (true);
}
});
- item.setImage (image);
+ item.setImage (image2);
+ item.setHighlightImage (image);
}
shell.setBounds(50, 50, 300, 200);
shell.open ();
@@ -78,6 +84,7 @@ public static void main(String[] args) {
if (!display.readAndDispatch ()) display.sleep ();
}
image.dispose ();
+ image2.dispose ();
display.dispose ();
}
}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java
index 75f1ec9fcf..302ee1c1f3 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet253.java
@@ -11,7 +11,7 @@
package org.eclipse.swt.snippets;
/*
- * Table example snippet: compute the visible rows in a table
+ * Table example snippet: compute the number of visible rows in a table
*
* For a list of all SWT example snippets see
* http://www.eclipse.org/swt/snippets/
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet254.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet254.java
index a6d3c25405..f73313d709 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet254.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet254.java
@@ -11,7 +11,7 @@
package org.eclipse.swt.snippets;
/*
- * Tree example snippet: compute the visible rows in a tree
+ * Tree example snippet: compute the number of visible rows in a tree
*
* For a list of all SWT example snippets see
* http://www.eclipse.org/swt/snippets/
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet358.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet358.java
new file mode 100644
index 0000000000..d6abf68f31
--- /dev/null
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet358.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This Example Content is intended to demonstrate
+ * usage of Eclipse technology. It is provided to you under the terms and
+ * conditions of the Eclipse Distribution License v1.0 which is available
+ * at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.snippets;
+
+/*
+ * Tree example snippet: determine which TreeItems are visible in a Tree's viewport
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+
+public class Snippet358 {
+
+public static void main(String [] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout ());
+ final Tree tree = new Tree(shell, SWT.NONE);
+ tree.setLayoutData(new GridData(200, 200));
+ for (int i = 0; i < 9; i++) {
+ TreeItem item = new TreeItem(tree, SWT.NONE);
+ item.setText("root-level item " + i);
+ for (int j = 0; j < 9; j++) {
+ new TreeItem(item, SWT.NONE).setText("item " + i + "-" + j);
+ }
+ }
+
+ Button button = new Button(shell, SWT.PUSH);
+ button.setText("Print item visibilities");
+ button.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ Rectangle treeBounds = new Rectangle(0, 0, 0, 0);
+ Point treeSize = tree.getSize();
+ treeBounds.width = treeSize.x;
+ treeBounds.height = treeSize.y;
+ TreeItem[] rootItems = tree.getItems();
+ for (int i = 0; i < rootItems.length; i++) {
+ TreeItem rootItem = rootItems[i];
+ System.out.println(rootItem.getText() + " is at least partially visible? " + treeBounds.intersects(rootItem.getBounds()));
+ TreeItem[] childItems = rootItem.getItems();
+ for (int j = 0; j < childItems.length; j++) {
+ TreeItem childItem = childItems[j];
+ System.out.println(childItem.getText() + " is at least partially visible? " + treeBounds.intersects(childItem.getBounds()));
+ }
+ }
+ }
+ });
+
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose ();
+}
+
+}

Back to the top