Skip to content

Commit aad325a

Browse files
author
zhourenjian
committed
Fixed a bug on Tree's double click listeners
Forbid selecting text when draggin.
1 parent e9a82bf commit aad325a

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Decorations.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,16 @@ void setSystemMenu () {
20792079
*/
20802080
titleBar = document.createElement("DIV");
20812081
titleBar.className = "shell-title-bar";
2082+
/**
2083+
* @j2sNative
2084+
if (typeof this.titleBar.style.MozUserSelect != "undefined") {
2085+
this.titleBar.style.MozUserSelect = "none";
2086+
} else if (typeof this.titleBar.style.KhtmlUserSelect != "undefined") {
2087+
this.titleBar.style.KhtmlUserSelect = "none";
2088+
} else {
2089+
this.titleBar.onselectstart = function () { return false; };
2090+
}
2091+
*/ {}
20822092

20832093
if ((style & SWT.BORDER) == 0 || (style & SWT.RESIZE) != 0) {
20842094
shellIcon = document.createElement("DIV");

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/MenuItem.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ public void run() {
286286
this.handle.oncontextmenu = function () {
287287
return false;
288288
};
289+
if (typeof this.handle.style.MozUserSelect != "undefined") {
290+
this.handle.style.MozUserSelect = "none";
291+
} else if (typeof this.handle.style.KhtmlUserSelect != "undefined") {
292+
this.handle.style.KhtmlUserSelect = "none";
293+
}
289294
*/ {}
290295
}
291296

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/MessageBox.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ protected Button createButton(final int btnStyle, String btnLabel, boolean force
347347
if ((style & btnStyle) != 0 || forced) {
348348
btn = new Button(buttonPanel, SWT.PUSH);
349349
btn.setText(btnLabel);
350-
GridData gridData = new GridData(75, 24);
350+
GridData gridData = new GridData();
351+
gridData.widthHint = 75;
352+
gridData.minimumHeight = 24;
351353
//gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_CENTER;
352354
btn.setLayoutData(gridData);
353355
btn.addSelectionListener(new SelectionAdapter() {

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/TreeItem.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,13 @@ public void run() {
305305
e.item = TreeItem.this;
306306
e.widget = TreeItem.this;
307307
parent.sendEvent(e);
308+
e = new Event();
309+
e.display = display;
310+
e.type = SWT.MouseDoubleClick;
311+
e.detail = SWT.NONE;
312+
e.item = TreeItem.this;
313+
e.widget = TreeItem.this;
314+
parent.sendEvent(e);
308315
toReturn(false);
309316
}
310317
};
@@ -313,6 +320,14 @@ public void run() {
313320
toReturn(false);
314321
}
315322
};
323+
/**
324+
* @j2sNative
325+
* if (typeof text.style.MozUserSelect != "undefined") {
326+
* text.style.MozUserSelect = "none";
327+
* } else if (typeof text.style.KhtmlUserSelect != "undefined") {
328+
* text.style.KhtmlUserSelect = "none";
329+
* }
330+
*/ {}
316331
}
317332
static TreeItem checkNull (TreeItem item) {
318333
if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);

0 commit comments

Comments
 (0)