Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf215f4

Browse files
author
zhourenjian
committed
Fixed bug that resetting Link's text will clear registered listeners
1 parentca0aea2 commitdf215f4

File tree

1 file changed

+29
-3
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+29
-3
lines changed

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

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public void run() {
343343
}
344344
};
345345
for (inti =0;i <anchors.length;i++) {
346-
anchors[i].href ="#";
346+
anchors[i].href =OS.isIE ?"#" :"#";
347347
anchors[i].target ="_self";
348348
Clazz.addEvent(anchors[i],"click",hLinkSelectionHandler);
349349
Clazz.addEvent(anchors[i],"dblclick",hLinkSelectionHandler);
@@ -539,7 +539,7 @@ String parse (String string, Object handle) {
539539
}
540540
if (anchor !=null) {
541541
if ("#".equals(ids[linkIndex])) {
542-
anchor.href ="#";
542+
anchor.href =OS.isIE ?"#" :"#";
543543
anchor.target ="_self";
544544
}else {
545545
anchor.href =ids[linkIndex];
@@ -843,8 +843,34 @@ public void setText (String string) {
843843
text =string;
844844
textSizeCached =false;
845845
anchors =newElement[0];
846+
847+
if (hLinkSelectionHandler !=null) {// already hook
848+
// try to unhook it before clear all childNodes
849+
for (inti =0;i <anchors.length;i++) {
850+
Elementanchor =anchors[i];
851+
Clazz.removeEvent(anchor,"click",hLinkSelectionHandler);
852+
Clazz.removeEvent(anchor,"dblclick",hLinkSelectionHandler);
853+
if (ids !=null) {
854+
if ("#".equals(ids[i])) {
855+
anchor.href =OS.isIE ?"#" :"#"diff-383c03855dd2e58a02cb293978464bd933301cc778ed8974d28c772abc1da512-845-856-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">
856+
anchor.target ="_self";
857+
}else {
858+
anchor.href =ids[i];
859+
anchor.target ="_blank";
860+
}
861+
}
862+
}
863+
}
846864
OS.clearChildren(handle);
847865
parse (string,handle);
866+
if (hLinkSelectionHandler !=null) {
867+
for (inti =0;i <anchors.length;i++) {
868+
anchors[i].href =OS.isIE ?"#" :"#"diff-383c03855dd2e58a02cb293978464bd933301cc778ed8974d28c772abc1da512-847-869-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">
869+
anchors[i].target ="_self";
870+
Clazz.addEvent(anchors[i],"click",hLinkSelectionHandler);
871+
Clazz.addEvent(anchors[i],"dblclick",hLinkSelectionHandler);
872+
}
873+
}
848874
/*
849875
if (OS.COMCTL32_MAJOR >= 6) {
850876
TCHAR buffer = new TCHAR (getCodePage (), string, true);
@@ -891,7 +917,7 @@ void unhookSelection() {
891917
Clazz.removeEvent(anchor,"dblclick",hLinkSelectionHandler);
892918
if (ids !=null) {
893919
if ("#".equals(ids[i])) {
894-
anchor.href ="#";
920+
anchor.href =OS.isIE ?"#" :"#";
895921
anchor.target ="_self";
896922
}else {
897923
anchor.href =ids[i];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp