This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | TypedTextinterceptor needs method to get Replaced Text. | ||
---|---|---|---|
Product: | editor | Reporter: | Milutin Kristofic <mkristofic> |
Component: | -- Other -- | Assignee: | Milutin Kristofic <mkristofic> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
patch for getReplacedText Api
patch for getReplacedText Api |
Description
Milutin Kristofic
2013-01-24 15:00:26 UTC
Created attachment 130592 [details]
patch for getReplacedText Api
I propose new method getReplacedText. I changed implementation to obtain replacedText during creation of interceptor.
Example for use, this would enable in java selecting text and pressing quote to give text in quotes.
--- a/java.editor/src/org/netbeans/modules/editor/java/TypingCompletion.java
+++ b/java.editor/src/org/netbeans/modules/editor/java/TypingCompletion.java
@@ -259,7 +259,11 @@
}
if ((completablePosition && !insideString) || eol) {
- context.setText(context.getText() + context.getText(), 1);
+ if (context.getReplacedText() != null) {
+ context.setText(context.getText() + context.getReplacedText() + context.getText(), context.getReplacedText().length() + 1);
+ } else {
+ context.setText(context.getText() + context.getText(), 1);
+ }
}
return -1;
}
Created attachment 130593 [details]
patch for getReplacedText Api
new patch - fixed changes.xml
Integrated into 'main-golden', will be available in build *201301310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5405efa8ac8a User: Milutin Kristofic <mkristofic@netbeans.org> Log: #225293 - TypedTextinterceptor needs method to get Replaced Text. |