Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80275 Details for
Bug 89610
[KeyBindings] preference page: IllegalArgumentException using KeySequenceText delete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
prevents possible NPE
patch-89610_V02.txt (text/plain), 3.26 KB, created by
Tim Mok
on 2007-10-12 15:17:35 EDT
(
hide
)
Description:
prevents possible NPE
Filename:
MIME Type:
Creator:
Tim Mok
Created:
2007-10-12 15:17:35 EDT
Size:
3.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/bindings/keys/KeySequenceText.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/bindings/keys/KeySequenceText.java,v >retrieving revision 1.14 >diff -u -r1.14 KeySequenceText.java >--- src/org/eclipse/jface/bindings/keys/KeySequenceText.java 1 Jun 2007 16:05:14 -0000 1.14 >+++ src/org/eclipse/jface/bindings/keys/KeySequenceText.java 5 Oct 2007 17:19:48 -0000 >@@ -76,6 +76,8 @@ > * The key strokes from which to delete. This list must not > * be <code>null</code>, and must represent a valid key > * sequence. >+ * @return An array of keystrokes minus the keystrokes that were >+ * deleted. > */ > private final KeyStroke[] deleteKeyStroke(final KeyStroke[] keyStrokes) { > clearInsertionIndex(); >@@ -144,7 +146,7 @@ > */ > private KeyStroke[] handleKeyDown(Event event, KeyStroke[] keyStrokes) { > // Is it an unmodified backspace character? >- if ((event.character == SWT.BS) && (event.stateMask == 0)) { >+ if ((event.character == SWT.BS || event.character == SWT.DEL) && (event.stateMask == 0)) { > return deleteKeyStroke(keyStrokes); > } > >@@ -614,6 +616,10 @@ > * @param allowIncomplete > * Whether incomplete strokes should be allowed to exist in the > * list after the deletion. >+ * @param deletedKeyStrokes >+ * The list of keystrokes that were deleted by this operation. >+ * Declared as final since it will hold a reference to the new >+ * keyStroke array that has deleted the selected keystrokes. > * @return The index at which a subsequent insert should occur. This index > * only has meaning to the <code>insertStrokeAt</code> method. > */ >@@ -660,6 +666,8 @@ > */ > int endStrokeIndex; > if (start == end) { >+ // return the current keystrokes, nothing has to be deleted >+ deletedKeyStrokes[0] = keyStrokes; > return startStrokeIndex; > } > >@@ -676,10 +684,15 @@ > * Remove the strokes that are touched by the selection. Keep track of > * the first stroke removed. > */ >- final int newLength = endStrokeIndex - startStrokeIndex + 1; >+ final int newLength = keyStrokesLength >+ - (endStrokeIndex - startStrokeIndex + 1); > deletedKeyStrokes[0] = new KeyStroke[newLength]; > final KeyStroke startStroke = keyStrokes[startStrokeIndex]; >- System.arraycopy(keyStrokes, 0, keyStrokes, 0, newLength); >+ KeyStroke keyStrokeResult[] = new KeyStroke[newLength]; >+ System.arraycopy(keyStrokes, 0, keyStrokeResult, 0, startStrokeIndex); >+ System.arraycopy(keyStrokes, endStrokeIndex + 1, keyStrokeResult, >+ startStrokeIndex, keyStrokesLength - endStrokeIndex - 1); >+ System.arraycopy(keyStrokeResult, 0, deletedKeyStrokes[0], 0, newLength); > > /* > * Allow the first stroke removed to be replaced by an incomplete >@@ -696,7 +709,7 @@ > startStrokeIndex); > added[startStrokeIndex] = incompleteStroke; > System.arraycopy(deletedKeyStrokes[0], startStrokeIndex, added, >- startStrokeIndex + 1, newLength); >+ startStrokeIndex + 1, newLength - startStrokeIndex); > deletedKeyStrokes[0] = added; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 89610
:
19349
|
79669
| 80275