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 6119 Details for
Bug 43168
StackOverflowError using key sequence entry widget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to KeySequenceText
org.eclipse.ui.workbench-Bug43168.patch (text/plain), 4.32 KB, created by
Douglas Pollock
on 2003-09-16 15:51:04 EDT
(
hide
)
Description:
Patch to KeySequenceText
Filename:
MIME Type:
Creator:
Douglas Pollock
Created:
2003-09-16 15:51:04 EDT
Size:
4.32 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceText.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceText.java,v >retrieving revision 1.11 >diff -u -r1.11 KeySequenceText.java >--- Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceText.java 12 Sep 2003 17:37:46 -0000 1.11 >+++ Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceText.java 16 Sep 2003 19:46:52 -0000 >@@ -56,6 +56,10 @@ > private KeyStroke temporaryStroke = null; > /** The text widget that is wrapped for this class. */ > private final Text text; >+ /** The listener that makes sure that the text widget remains up-to-date >+ * with regards to external modification of the text (e.g., cut & pasting). >+ */ >+ private final UpdateSequenceListener updateSequenceListener = new UpdateSequenceListener(); > > /** > * Constructs an instance of <code>KeySequenceTextField</code> with the >@@ -92,7 +96,7 @@ > text.addTraverseListener(new FocusTrapListener()); > > // Add an internal modify listener. >- text.addModifyListener(new UpdateSequenceListener()); >+ text.addModifyListener(updateSequenceListener); > } > > /** >@@ -121,7 +125,30 @@ > public final KeySequence getKeySequence() { > return keySequence; > } >+ >+ /** >+ * An accessor for the <code>KeyStroke</code> that is currently held as an >+ * incomplete stroke (i.e., one without a natural key). >+ * @return The incomplete stroke; may be <code>null</code> if there are no >+ * incomplete strokes. >+ */ >+ final KeyStroke getTemporaryStroke() { >+ return temporaryStroke; >+ } >+ >+ /** >+ * An accessor for the underlying text widget used by this entry field. >+ * @return The <code>Text</code> instance; never <code>null</code>. >+ */ >+ final Text getText() { >+ return text; >+ } > >+ /** >+ * Tests whether the current key sequence has a stroke with no natural key. >+ * @return <code>true</code> is there is an incomplete stroke; >+ * <code>false</code> otherwise. >+ */ > public final boolean hasIncompleteStroke() { > return (temporaryStroke != null); > } >@@ -133,7 +160,7 @@ > * @return <code>true</code> if the key stroke has no natural key; > * <code>false</code> otherwise. > */ >- private static final boolean isComplete(final KeyStroke keyStroke) { >+ static final boolean isComplete(final KeyStroke keyStroke) { > if (keyStroke != null) { > final NaturalKey naturalKey = keyStroke.getNaturalKey(); > >@@ -219,7 +246,6 @@ > * formatting > */ > final KeySequence dummySequence; >- > if (keySequence == null) { > if (temporaryStroke == null) { > dummySequence = KeySequence.getInstance(); >@@ -233,9 +259,12 @@ > } > dummySequence = KeySequence.getInstance(keyStrokes); > } >- >+ >+ // We need to update the text, but we don't need to synchronize. >+ text.removeModifyListener(updateSequenceListener); > text.setText(/* TODO "carbon".equals(SWT.getPlatform()) ? KeySupport.formatCarbon(dummySequence) : */ > dummySequence.format()); >+ text.addModifyListener(updateSequenceListener); > > // Update the caret position. > text.setSelection(text.getText().length()); >@@ -397,13 +426,13 @@ > // The original sequence. > final KeySequence originalSequence = getKeySequence(); > final List keyStrokes = new ArrayList(originalSequence.getKeyStrokes()); >- if (temporaryStroke != null) { >- keyStrokes.add(temporaryStroke); >+ if (getTemporaryStroke() != null) { >+ keyStrokes.add(getTemporaryStroke()); > } > final KeySequence sequenceFromStrokes = KeySequence.getInstance(keyStrokes); > > // The new sequence drawn from the text. >- final String contents = text.getText(); >+ final String contents = getText().getText(); > final KeySequence sequenceFromText = KeySequence.getInstance(contents); > > // Check to see if they're the same. >@@ -413,7 +442,7 @@ > while (strokeItr.hasNext()) { > // Make sure that it's a valid sequence. > if (!isComplete((KeyStroke) strokeItr.next())) { >- setKeySequence(getKeySequence(), temporaryStroke); >+ setKeySequence(getKeySequence(), getTemporaryStroke()); > return; > } > } >@@ -421,7 +450,7 @@ > } > } catch (final ParseException e) { > // Abort any cut/paste-driven modifications >- setKeySequence(getKeySequence(), temporaryStroke); >+ setKeySequence(getKeySequence(), getTemporaryStroke()); > } > } > }
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 43168
: 6119