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.

View | Details | Raw Unified | Return to bug 221993
Collapse All | Expand All

(-)a/api.search/apichanges.xml (+21 lines)
Lines 105-110 Link Here
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
    <changes>
107
    <changes>
108
        <change id="ReplaceHistory">
109
            <api name="api.search"/>
110
            <summary>Added ReplacePattern and replace history to SearchHistory class</summary>
111
            <version major="1" minor="1.8"/>
112
            <date day="20" month="11" year="2012"/>
113
            <author login="mkristofic"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
                <p>
117
                    Search History has two new methods: addReplace() and getReplacePatterns().
118
                    It has one more property name ADD_TO_REPLACE for firing changes in replacepatternlist.
119
                    Replace implementation is identical to Search history with Search Patterns..
120
                </p>
121
                <p> 
122
                    New ReplacePattern has two variables - replaceExpression and preserveCase. It is a wrap class for replace expression.
123
                </p>
124
            </description>
125
            <class package="org.netbeans.api.search" name="ReplacePattern"/>
126
            <class package="org.netbeans.api.search" name="SearchHistory"/>
127
        </change>
128
        
108
        <change id="SearchResultsDisplayer-closed">
129
        <change id="SearchResultsDisplayer-closed">
109
            <api name="api.search"/>
130
            <api name="api.search"/>
110
            <summary>Added method SearchResultsDisplayer.closed()</summary>
131
            <summary>Added method SearchResultsDisplayer.closed()</summary>
(-)a/api.search/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.search
2
OpenIDE-Module: org.netbeans.api.search
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/search/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/search/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.7
4
OpenIDE-Module-Specification-Version: 1.8
5
5
(-)a/api.search/src/org/netbeans/api/search/SearchPattern.java (-134 / +44 lines)
Lines 44-232 Link Here
44
package org.netbeans.api.search;
44
package org.netbeans.api.search;
45
45
46
/**
46
/**
47
 * Pattern describes the search conditions
47
 * Pattern describes the replace conditions
48
 *
48
 * @since 1.8
49
 * @author Martin Roskanin
50
 */
49
 */
51
public final class SearchPattern {
50
public final class ReplacePattern {
52
51
53
    /**
52
    private String replaceExpression;
54
     * SearchExpression - a text to search
53
    private boolean preserveCase;
55
     */
54
    
56
    private String searchExpression;
55
    private ReplacePattern(String replaceExpression, boolean preserveCase) {
57
    /**
56
        this.replaceExpression = replaceExpression;
58
     * if true, only whole words were searched
57
        this.preserveCase = preserveCase;
59
     */
60
    private boolean wholeWords;
61
    /**
62
     * if true, case sensitive search was preformed
63
     */
64
    private boolean matchCase;
65
    /**
66
     * if true, regular expression search was performed
67
     */
68
    private boolean regExp;
69
70
    /**
71
     * Creates a new instance of SearchPattern
72
     *
73
     * @param searchExpression a searched text
74
     * @param wholeWords if true, only whole words were searched
75
     * @param matchCase if true, case sensitive search was preformed
76
     * @param regExp if true, regular expression search was performed
77
     */
78
    private SearchPattern(String searchExpression, boolean wholeWords,
79
            boolean matchCase, boolean regExp) {
80
        this.searchExpression = searchExpression;
81
        this.wholeWords = wholeWords;
82
        this.matchCase = matchCase;
83
        this.regExp = regExp;
84
    }
58
    }
85
59
86
    /**
60
    /**
87
     * Creates a new SearchPattern in accordance with given parameters
61
     * Creates a new ReplacePattern in accordance with given parameters
88
     *
62
     *
89
     * @param searchExpression non-null String of a searched text
63
     * @param searchExpression non-null String of a searched text
90
     * @param wholeWords if true, only whole words were searched
64
     * @param wholeWords if true, only whole words were searched
91
     * @param matchCase if true, case sensitive search was preformed
92
     * @param regExp if true, regular expression search was performed
93
     * @return a new SearchPattern in accordance with given parameters
94
     */
65
     */
95
    public static SearchPattern create(String searchExpression, boolean wholeWords,
66
    public static ReplacePattern create(String replaceExpression, boolean preserveCase) {
96
            boolean matchCase, boolean regExp) {
67
        return new ReplacePattern(replaceExpression, preserveCase);
97
        return new SearchPattern(searchExpression, wholeWords, matchCase, regExp);
68
    }
69
    
70
    public String getReplaceExpression() {
71
        return replaceExpression;
98
    }
72
    }
99
73
100
    /**
74
    public boolean isPreserveCase() {
101
     * @return searchExpression
75
        return preserveCase;
102
     */
103
    public String getSearchExpression() {
104
        return searchExpression;
105
    }
76
    }
106
77
    
107
    /**
108
     * @return true if the wholeWords parameter was used during search
109
     * performing
110
     */
111
    public boolean isWholeWords() {
112
        return wholeWords;
113
    }
114
115
    /**
116
     * @return true if the matchCase parameter was used during search performing
117
     */
118
    public boolean isMatchCase() {
119
        return matchCase;
120
    }
121
122
    /**
123
     * @return true if the regExp parameter was used during search performing
124
     */
125
    public boolean isRegExp() {
126
        return regExp;
127
    }
128
129
    @Override
78
    @Override
130
    public boolean equals(Object obj) {
79
    public boolean equals(Object obj) {
131
        if (!(obj instanceof SearchPattern)) {
80
        if (!(obj instanceof ReplacePattern)) {
132
            return false;
81
            return false;
133
        }
82
        }
134
        SearchPattern sp = (SearchPattern) obj;
83
        ReplacePattern sp = (ReplacePattern) obj;
135
        return (this.searchExpression.equals(sp.getSearchExpression())
84
        return (this.replaceExpression.equals(sp.getReplaceExpression())
136
                && this.wholeWords == sp.isWholeWords()
85
                && this.preserveCase == sp.isPreserveCase());
137
                && this.matchCase == sp.isMatchCase()
138
                && this.regExp == sp.isRegExp());
139
    }
86
    }
140
87
141
    @Override
88
    @Override
142
    public int hashCode() {
89
    public int hashCode() {
143
        int result = 17;
90
        int result = 17;
144
        result = 37 * result + (this.wholeWords ? 1 : 0);
91
        result = 37 * result + (this.preserveCase ? 1 : 0);
145
        result = 37 * result + (this.matchCase ? 1 : 0);
92
        result = 37 * result + this.replaceExpression.hashCode();
146
        result = 37 * result + (this.regExp ? 1 : 0);
147
        result = 37 * result + this.searchExpression.hashCode();
148
        return result;
93
        return result;
149
    }
94
    }
150
95
151
    /**
96
    /**
152
     * Create new instance with "search expression" set to passed value, and
97
     * Create new instance with "replace expression" set to passed value, and
153
     * other values copied from this instance.
98
     * other values copied from this instance.
154
     *
99
     *
155
     */
100
     */
156
    public SearchPattern changeSearchExpression(String expression) {
101
    public ReplacePattern changeReplaceExpression(String expression) {
157
        if ((expression == null && this.searchExpression == null)
102
        if ((expression == null && this.replaceExpression == null)
158
                || (expression != null
103
                || (expression != null
159
                && expression.equals(this.searchExpression))) {
104
                && expression.equals(this.replaceExpression))) {
160
            return this;
105
            return this;
161
        } else {
106
        } else {
162
            return SearchPattern.create(expression, wholeWords,
107
            return ReplacePattern.create(expression, preserveCase);
163
                    matchCase, regExp);
164
        }
108
        }
165
    }
109
    }
166
110
167
    /**
111
    /**
168
     * Create new instance with "whole words" set to passed value, and other
112
     * Create new instance with "preserve case" set to passed value, and other
169
     * values copied from this instance.
113
     * values copied from this instance.
170
     *
114
     *
171
     */
115
     */
172
    public SearchPattern changeWholeWords(boolean wholeWords) {
116
    public ReplacePattern changePreserveCase(boolean preserveCase) {
173
        if (this.wholeWords == wholeWords) {
117
        if (this.preserveCase == preserveCase) {
174
            return this;
118
            return this;
175
        } else {
119
        } else {
176
            return SearchPattern.create(searchExpression, wholeWords,
120
            return ReplacePattern.create(replaceExpression, preserveCase);
177
                    matchCase, regExp);
178
        }
179
    }
180
181
    /**
182
     * Create new instance with "match case" set to passed value, and other
183
     * values copied from this instance.
184
     *
185
     */
186
    public SearchPattern changeMatchCase(boolean matchCase) {
187
        if (this.matchCase == matchCase) {
188
            return this;
189
        } else {
190
            return SearchPattern.create(searchExpression, wholeWords,
191
                    matchCase, regExp);
192
        }
193
    }
194
195
    /**
196
     * Create new instance with "regular expression" set to passed value, and
197
     * other values copied from this instance.
198
     *
199
     */
200
    public SearchPattern changeRegExp(boolean regExp) {
201
        if (this.regExp == regExp) {
202
            return this;
203
        } else {
204
            return SearchPattern.create(searchExpression, wholeWords,
205
                    matchCase, regExp);
206
        }
121
        }
207
    }
122
    }
208
    
123
    
209
    String toCanonicalString() {
124
    String toCanonicalString() {
210
        char m = isMatchCase() ? 'M' : 'm';
125
        char p = isPreserveCase()? 'P' : 'p';
211
        char r = isRegExp() ? 'R' : 'r';
126
        return "" + p + "-" + getReplaceExpression(); //NOI18N
212
        char w = isWholeWords() ? 'W' : 'w';
213
        return "" + m + r + w + "-" + getSearchExpression();
214
    }
127
    }
215
128
216
    static SearchPattern parseSearchPattern(String canonicalString) {
129
    static ReplacePattern parsePattern(String canonicalString) {
217
        //format mrw-findwhat
130
        //format p-replaceWith
218
        if (canonicalString == null
131
        if (canonicalString == null
219
                || Character.toUpperCase(canonicalString.charAt(0)) != 'M'
132
                || Character.toUpperCase(canonicalString.charAt(0)) != 'P'
220
                || Character.toUpperCase(canonicalString.charAt(1)) != 'R'
133
                || canonicalString.charAt(1) != '-') {
221
                || Character.toUpperCase(canonicalString.charAt(2)) != 'W'
222
                || canonicalString.charAt(3) != '-') {
223
            return null;
134
            return null;
224
        }
135
        }
225
        boolean matchCase = Character.isUpperCase(canonicalString.charAt(0));
136
        
226
        boolean regExp = Character.isUpperCase(canonicalString.charAt(1));
137
        boolean preserveCase = Character.isUpperCase(canonicalString.charAt(0));
227
        boolean wholeWords = Character.isUpperCase(canonicalString.charAt(2));
138
        String replaceWith = canonicalString.substring(2);
228
        String findWhat = canonicalString.substring(4);
139
        return new ReplacePattern(replaceWith, preserveCase);
229
        return new SearchPattern(findWhat, wholeWords, matchCase, regExp);
230
    }
140
    }
231
141
232
}
142
}
(-)a/api.search/src/org/netbeans/api/search/SearchHistory.java (-4 / +61 lines)
Lines 79-89 Link Here
79
    private static final int MAX_SEARCH_PATTERNS_ITEMS = 10;
79
    private static final int MAX_SEARCH_PATTERNS_ITEMS = 10;
80
80
81
    /** Limit for stored pattern length */
81
    /** Limit for stored pattern length */
82
    private static final int MAX_PATTERN_LENGHT = 16384; // 16 kB
82
    private static final int MAX_PATTERN_LENGTH = 16384; // 16 kB
83
83
84
    /** Shareable SearchPattern history. It is a List of SearchPatterns */
84
    /** Shareable SearchPattern history. It is a List of SearchPatterns */
85
    private List<SearchPattern> searchPatternsList
85
    private List<SearchPattern> searchPatternsList
86
            = new ArrayList<SearchPattern>(MAX_SEARCH_PATTERNS_ITEMS);
86
            = new ArrayList<SearchPattern>(MAX_SEARCH_PATTERNS_ITEMS);
87
    
88
    private List<ReplacePattern> replacePatternsList = new ArrayList<ReplacePattern>(MAX_SEARCH_PATTERNS_ITEMS);
87
89
88
    /** Singleton instance */
90
    /** Singleton instance */
89
    private static SearchHistory INSTANCE = null;
91
    private static SearchHistory INSTANCE = null;
Lines 103-114 Link Here
103
     *  newValue - added pattern
105
     *  newValue - added pattern
104
     */
106
     */
105
    public final static String ADD_TO_HISTORY = "add-to-history"; //NOI18N
107
    public final static String ADD_TO_HISTORY = "add-to-history"; //NOI18N
108
    
109
    /** Property name for adding replace pattern that was not in history
110
     *  Firing:
111
     *  oldValue - null
112
     *  newValue - added pattern
113
     * @since 1.8
114
     */
115
    public final static String ADD_TO_REPLACE = "add-to-replace"; //NOI18N
106
116
107
    /** Preferences node for storing history info */
117
    /** Preferences node for storing history info */
108
    private static Preferences prefs;
118
    private static Preferences prefs;
109
    /** Name of preferences node where we persist history */
119
    /** Name of preferences node where we persist history */
110
    private static final String PREFS_NODE = "SearchHistory";  //NOI18N
120
    private static final String PREFS_NODE = "SearchHistory";  //NOI18N
111
    private static final String PROP_SEARCH_PATTERN_PREFIX = "search_";  //NOI18N
121
    private static final String PROP_SEARCH_PATTERN_PREFIX = "search_";  //NOI18N
122
    private static final String PROP_REPLACE_PATTERN_PREFIX = "replace_";  //NOI18N
112
123
113
    /** Creates a new instance of SearchHistory */
124
    /** Creates a new instance of SearchHistory */
114
    private SearchHistory() {
125
    private SearchHistory() {
Lines 129-137 Link Here
129
     */
140
     */
130
    private void load () {
141
    private void load () {
131
        for(int i=0; i < MAX_SEARCH_PATTERNS_ITEMS; i++){
142
        for(int i=0; i < MAX_SEARCH_PATTERNS_ITEMS; i++){
132
            SearchPattern pattern = SearchPattern.parseSearchPattern(prefs.get(PROP_SEARCH_PATTERN_PREFIX + i, null));
143
            SearchPattern pattern = SearchPattern.parsePattern(prefs.get(PROP_SEARCH_PATTERN_PREFIX + i, null));
133
            if (pattern != null)
144
            if (pattern != null) {
134
                searchPatternsList.add(pattern);
145
                searchPatternsList.add(pattern);
146
            }
147
        }
148
        
149
        for(int i=0; i < MAX_SEARCH_PATTERNS_ITEMS; i++){
150
            ReplacePattern pattern = ReplacePattern.parsePattern(prefs.get(PROP_REPLACE_PATTERN_PREFIX + i, null));
151
            if (pattern != null) {
152
                replacePatternsList.add(pattern);
153
            }
135
        }
154
        }
136
    }
155
    }
137
156
Lines 185-197 Link Here
185
        return Collections.unmodifiableList(searchPatternsList);
204
        return Collections.unmodifiableList(searchPatternsList);
186
    }
205
    }
187
    
206
    
207
    /** @return unmodifiable List of ReplacePatterns
208
     *  @since 1.8
209
     */
210
    public synchronized List<ReplacePattern> getReplacePatterns(){
211
        return Collections.unmodifiableList(replacePatternsList);
212
    }
213
    
188
    /** Adds SearchPattern to SearchHistory
214
    /** Adds SearchPattern to SearchHistory
189
     *  @param pattern the SearchPattern to add
215
     *  @param pattern the SearchPattern to add
190
     */
216
     */
191
    public synchronized void add(SearchPattern pattern) { 
217
    public synchronized void add(SearchPattern pattern) { 
192
        if (pattern == null || pattern.getSearchExpression() == null || pattern.getSearchExpression().length() == 0
218
        if (pattern == null || pattern.getSearchExpression() == null || pattern.getSearchExpression().length() == 0
193
                || (searchPatternsList.size() > 0 && pattern.equals(searchPatternsList.get(0))
219
                || (searchPatternsList.size() > 0 && pattern.equals(searchPatternsList.get(0))
194
                || pattern.getSearchExpression().length() > MAX_PATTERN_LENGHT)) {
220
                || pattern.getSearchExpression().length() > MAX_PATTERN_LENGTH)) {
195
            return;
221
            return;
196
        }
222
        }
197
        
223
        
Lines 215-220 Link Here
215
        }
241
        }
216
    }
242
    }
217
    
243
    
244
    /** Adds ReplacePattern to ReplaceHistory
245
     *  @param pattern the ReplacePattern to add
246
     *  @since 1.8
247
     */
248
    public synchronized void addReplace(ReplacePattern pattern) { 
249
        if (pattern == null || pattern.getReplaceExpression() == null || pattern.getReplaceExpression().length() == 0
250
                || (replacePatternsList.size() > 0 && pattern.equals(replacePatternsList.get(0))
251
                || pattern.getReplaceExpression().length() > MAX_PATTERN_LENGTH)) {
252
            return;
253
        }
254
        
255
        for (int i = 0; i < replacePatternsList.size(); i++) {
256
            if (pattern.getReplaceExpression().equals(replacePatternsList.get(i).getReplaceExpression())) {
257
                replacePatternsList.remove(i);
258
                break;
259
            }
260
        }
261
        
262
        if (replacePatternsList.size() == MAX_SEARCH_PATTERNS_ITEMS){
263
            replacePatternsList.remove(MAX_SEARCH_PATTERNS_ITEMS-1);
264
        }
265
        replacePatternsList.add(0, pattern);
266
        
267
        for(int i=0;i < replacePatternsList.size();i++){
268
            prefs.put(PROP_REPLACE_PATTERN_PREFIX + i, replacePatternsList.get(i).toCanonicalString());
269
        }
270
        if (pcs != null) {
271
            pcs.firePropertyChange(ADD_TO_REPLACE, null, pattern);
272
        }
273
    }
274
    
218
    /**
275
    /**
219
     * Store last used file name pattern.
276
     * Store last used file name pattern.
220
     *
277
     *
(-)a/api.search/src/org/netbeans/api/search/SearchPattern.java (-2 / +2 lines)
Lines 210-219 Link Here
210
        char m = isMatchCase() ? 'M' : 'm';
210
        char m = isMatchCase() ? 'M' : 'm';
211
        char r = isRegExp() ? 'R' : 'r';
211
        char r = isRegExp() ? 'R' : 'r';
212
        char w = isWholeWords() ? 'W' : 'w';
212
        char w = isWholeWords() ? 'W' : 'w';
213
        return "" + m + r + w + "-" + getSearchExpression();
213
        return "" + m + r + w + "-" + getSearchExpression(); //NOI18N
214
    }
214
    }
215
215
216
    static SearchPattern parseSearchPattern(String canonicalString) {
216
    static SearchPattern parsePattern(String canonicalString) {
217
        //format mrw-findwhat
217
        //format mrw-findwhat
218
        if (canonicalString == null
218
        if (canonicalString == null
219
                || Character.toUpperCase(canonicalString.charAt(0)) != 'M'
219
                || Character.toUpperCase(canonicalString.charAt(0)) != 'M'
(-)a/o.openidex.util/test/unit/src/org/openidex/search/SearchPatternTest.java (-17 / +18 lines)
Lines 39-72 Link Here
39
 *
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
41
 */
42
package org.openidex.search;
42
package org.netbeans.api.search;
43
43
44
import org.junit.AfterClass;
45
import org.junit.Test;
44
import org.junit.Test;
46
import static org.junit.Assert.*;
45
import static org.junit.Assert.*;
47
import org.junit.BeforeClass;
48
46
49
/**
47
50
 *
48
public class ReplacePatternTest {
51
 * @author mito
52
 */
53
public class SearchPatternTest {
54
    
49
    
55
    @Test
50
    @Test
56
    public void testManuallyParse() throws Exception {
51
    public void testManuallyParse() throws Exception {
57
        String canString= "MrW-Test";
52
        String canString= "P-Test";
58
        SearchPattern sp = SearchPattern.parseSearchPattern(canString);
53
        ReplacePattern rp = ReplacePattern.parsePattern(canString);
59
        assertTrue(sp.isMatchCase());
54
        assertTrue(rp.isPreserveCase());
60
        assertFalse(sp.isRegExp());
55
        assertEquals("Test", rp.getReplaceExpression());
61
        assertTrue(sp.isWholeWords());
56
        
62
        assertEquals("Test", sp.getSearchExpression());
57
        canString= "p--Test2";
58
        rp = ReplacePattern.parsePattern(canString);
59
        assertFalse(rp.isPreserveCase());
60
        assertEquals("-Test2", rp.getReplaceExpression());
63
    }
61
    }
64
62
65
    @Test
63
    @Test
66
    public void testManuallyCanString() throws Exception {
64
    public void testManuallyCanString() throws Exception {
67
        SearchPattern sp = SearchPattern.create("ta", true, false, true);
65
        ReplacePattern rp = ReplacePattern.create("ta", true);
68
        String canString = sp.toCanonicalString();
66
        String canString = rp.toCanonicalString();
67
        assertEquals("P-ta", canString);
69
        
68
        
70
        assertEquals("mRW-ta", canString);
69
        rp = ReplacePattern.create("pa", false);
70
        canString = rp.toCanonicalString();
71
        assertEquals("p-pa", canString);
71
    }
72
    }
72
}
73
}
(-)a/api.search/test/unit/src/org/netbeans/api/search/provider/impl/SearchHistoryTest.java (-1 / +1 lines)
Lines 42-48 Link Here
42
 * made subject to such option by the copyright holder.
42
 * made subject to such option by the copyright holder.
43
 */
43
 */
44
44
45
package org.netbeans.api.search.provider.impl;
45
package org.netbeans.api.search;
46
46
47
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeEvent;
48
import java.beans.PropertyChangeListener;
48
import java.beans.PropertyChangeListener;
(-)a/o.openidex.util/test/unit/src/org/openidex/search/SearchPatternTest.java (-8 / +2 lines)
Lines 39-61 Link Here
39
 *
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
41
 */
42
package org.openidex.search;
42
package org.netbeans.api.search;
43
43
44
import org.junit.AfterClass;
45
import org.junit.Test;
44
import org.junit.Test;
46
import static org.junit.Assert.*;
45
import static org.junit.Assert.*;
47
import org.junit.BeforeClass;
48
46
49
/**
50
 *
51
 * @author mito
52
 */
53
public class SearchPatternTest {
47
public class SearchPatternTest {
54
    
48
    
55
    @Test
49
    @Test
56
    public void testManuallyParse() throws Exception {
50
    public void testManuallyParse() throws Exception {
57
        String canString= "MrW-Test";
51
        String canString= "MrW-Test";
58
        SearchPattern sp = SearchPattern.parseSearchPattern(canString);
52
        SearchPattern sp = SearchPattern.parsePattern(canString);
59
        assertTrue(sp.isMatchCase());
53
        assertTrue(sp.isMatchCase());
60
        assertFalse(sp.isRegExp());
54
        assertFalse(sp.isRegExp());
61
        assertTrue(sp.isWholeWords());
55
        assertTrue(sp.isWholeWords());
(-)a/editor.lib2/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.editor.lib2/1
2
OpenIDE-Module: org.netbeans.modules.editor.lib2/1
3
OpenIDE-Module-Implementation-Version: 39
3
OpenIDE-Module-Implementation-Version: 40
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/lib2/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/lib2/Bundle.properties
5
OpenIDE-Module-Layer: org/netbeans/modules/editor/lib2/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/editor/lib2/resources/layer.xml
6
OpenIDE-Module-Needs: org.netbeans.modules.editor.actions
6
OpenIDE-Module-Needs: org.netbeans.modules.editor.actions
(-)a/editor.lib2/src/org/netbeans/modules/editor/lib2/search/EditorFindSupport.java (+58 lines)
Lines 137-144 Link Here
137
137
138
    /** It's public only to keep backwards compatibility of the FindSupport class. */
138
    /** It's public only to keep backwards compatibility of the FindSupport class. */
139
    public static final String FIND_HISTORY_PROP = "find-history-prop"; //NOI18N
139
    public static final String FIND_HISTORY_PROP = "find-history-prop"; //NOI18N
140
    public static final String REPLACE_HISTORY_PROP = "replace-history-prop"; //NOI18N
140
    /** It's public only to keep backwards compatibility of the FindSupport class. */
141
    /** It's public only to keep backwards compatibility of the FindSupport class. */
141
    public static final String FIND_HISTORY_CHANGED_PROP = "find-history-changed-prop"; //NOI18N
142
    public static final String FIND_HISTORY_CHANGED_PROP = "find-history-changed-prop"; //NOI18N
143
    public static final String REPLACE_HISTORY_CHANGED_PROP = "replace-history-changed-prop"; //NOI18N
142
    
144
    
143
    /**
145
    /**
144
     * Default message 'importance' for messages from find and replace actions.
146
     * Default message 'importance' for messages from find and replace actions.
Lines 162-167 Link Here
162
    
164
    
163
    private SPW lastSelected;
165
    private SPW lastSelected;
164
    private List<SPW> historyList = new ArrayList<SPW>();
166
    private List<SPW> historyList = new ArrayList<SPW>();
167
    private List<RP> replaceList = new ArrayList<RP>();
165
168
166
    private EditorFindSupport() {
169
    private EditorFindSupport() {
167
    }
170
    }
Lines 917-928 Link Here
917
//        firePropertyChange(FIND_HISTORY_CHANGED_PROP,null,null);
920
//        firePropertyChange(FIND_HISTORY_CHANGED_PROP,null,null);
918
    }
921
    }
919
    
922
    
923
    public void setReplaceHistory(List<RP> rpList){
924
        this.replaceList = new ArrayList<RP>(rpList);
925
    }
926
    
920
    public List<SPW> getHistory(){
927
    public List<SPW> getHistory(){
921
        if (historyList.isEmpty())
928
        if (historyList.isEmpty())
922
            firePropertyChange(FIND_HISTORY_CHANGED_PROP,null,null);
929
            firePropertyChange(FIND_HISTORY_CHANGED_PROP,null,null);
923
        return historyList;
930
        return historyList;
924
    }
931
    }
925
    
932
    
933
    public List<RP> getReplaceHistory(){
934
        if (replaceList.isEmpty()) {
935
            firePropertyChange(REPLACE_HISTORY_CHANGED_PROP,null,null);
936
        }
937
        return replaceList;
938
    }
939
    
926
    public void setLastSelected(SPW spw){
940
    public void setLastSelected(SPW spw){
927
        this.lastSelected = spw;
941
        this.lastSelected = spw;
928
        Map<String, Object> props = getFindProperties();
942
        Map<String, Object> props = getFindProperties();
Lines 942-947 Link Here
942
        firePropertyChange(FIND_HISTORY_PROP, null, spw);
956
        firePropertyChange(FIND_HISTORY_PROP, null, spw);
943
    }
957
    }
944
    
958
    
959
    public void addToReplaceHistory(RP rp) {
960
        if (rp == null) {
961
            return;
962
        }
963
        firePropertyChange(REPLACE_HISTORY_PROP, null, rp);
964
    }
965
    
945
    public final static class SPW{
966
    public final static class SPW{
946
        private String searchExpression;
967
        private String searchExpression;
947
        private boolean wholeWords;
968
        private boolean wholeWords;
Lines 1010-1013 Link Here
1010
            return  sb.toString();
1031
            return  sb.toString();
1011
        }
1032
        }
1012
    } // End of SPW class
1033
    } // End of SPW class
1034
1035
    public final static class RP {
1036
1037
        private String replaceExpression;
1038
        private boolean preserveCase;
1039
1040
        public RP(String replaceExpression, boolean preserveCase) {
1041
            this.replaceExpression = replaceExpression;
1042
            this.preserveCase = preserveCase;
1043
        }
1044
1045
        public String getReplaceExpression() {
1046
            return replaceExpression;
1047
        }
1048
1049
        public boolean isPreserveCase() {
1050
            return preserveCase;
1051
        }
1052
1053
        @Override
1054
        public boolean equals(Object obj) {
1055
            if (!(obj instanceof RP)) {
1056
                return false;
1057
            }
1058
            RP sp = (RP) obj;
1059
            return (this.replaceExpression.equals(sp.getReplaceExpression())
1060
                    && this.preserveCase == sp.isPreserveCase());
1061
        }
1062
1063
        @Override
1064
        public int hashCode() {
1065
            int result = 17;
1066
            result = 37 * result + (this.preserveCase ? 1 : 0);
1067
            result = 37 * result + this.replaceExpression.hashCode();
1068
            return result;
1069
        }
1070
    }
1013
}
1071
}
(-)a/editor.search/nbproject/project.properties (-1 / +1 lines)
Lines 1-3 Link Here
1
javac.source=1.6
1
javac.source=1.6
2
javac.compilerargs=-Xlint -Xlint:-serial
2
javac.compilerargs=-Xlint -Xlint:-serial
3
spec.version.base=1.9.0
3
spec.version.base=1.10.0
(-)a/editor.search/nbproject/project.xml (+8 lines)
Lines 6-11 Link Here
6
            <code-name-base>org.netbeans.modules.editor.search</code-name-base>
6
            <code-name-base>org.netbeans.modules.editor.search</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.netbeans.api.search</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <specification-version>1.7</specification-version>
14
                    </run-dependency>
15
                </dependency>
16
                <dependency>
9
                    <code-name-base>org.netbeans.modules.editor</code-name-base>
17
                    <code-name-base>org.netbeans.modules.editor</code-name-base>
10
                    <build-prerequisite/>
18
                    <build-prerequisite/>
11
                    <compile-dependency/>
19
                    <compile-dependency/>
(-)a/editor.search/src/org/netbeans/modules/editor/search/ReplaceBar.java (-1 / +11 lines)
Lines 276-281 Link Here
276
    }
276
    }
277
277
278
    void updateReplaceComboBoxHistory(String incrementalSearchText) {
278
    void updateReplaceComboBoxHistory(String incrementalSearchText) {
279
        EditorFindSupport.getInstance().addToReplaceHistory(new EditorFindSupport.RP(incrementalSearchText, preserveCaseCheckBox.isSelected()));
279
        // Add the text to the top of the list
280
        // Add the text to the top of the list
280
        for (int i = replaceComboBox.getItemCount() - 1; i >= 0; i--) {
281
        for (int i = replaceComboBox.getItemCount() - 1; i >= 0; i--) {
281
            String item = (String) replaceComboBox.getItemAt(i);
282
            String item = (String) replaceComboBox.getItemAt(i);
Lines 357-365 Link Here
357
    public void gainFocus() {
358
    public void gainFocus() {
358
        if (!isVisible()) {
359
        if (!isVisible()) {
359
            changeSearchBarToBePartOfReplaceBar();
360
            changeSearchBarToBePartOfReplaceBar();
360
            setVisible(true);
361
            SearchComboBoxEditor.changeToOneLineEditorPane((JEditorPane) replaceTextField);
361
            SearchComboBoxEditor.changeToOneLineEditorPane((JEditorPane) replaceTextField);
362
            addEnterKeystrokeReplaceTo(replaceTextField);
362
            addEnterKeystrokeReplaceTo(replaceTextField);
363
            String lastReplace = replaceTextField.getText();
364
            MutableComboBoxModel comboBoxModelIncSearch = ((MutableComboBoxModel) replaceComboBox.getModel());
365
            for (int i = comboBoxModelIncSearch.getSize() - 1; i >= 0; i--) {
366
                comboBoxModelIncSearch.removeElementAt(i);
367
            }
368
            for (EditorFindSupport.RP rp : EditorFindSupport.getInstance().getReplaceHistory()) {
369
                comboBoxModelIncSearch.addElement(rp.getReplaceExpression());
370
            }
371
            replaceTextField.setText(lastReplace);
372
            setVisible(true);
363
        }
373
        }
364
        searchBar.gainFocus();
374
        searchBar.gainFocus();
365
        searchBar.getIncSearchTextField().requestFocusInWindow();
375
        searchBar.getIncSearchTextField().requestFocusInWindow();
(-)a/editor.search/src/org/netbeans/modules/editor/search/SearchBar.java (+85 lines)
Lines 44-49 Link Here
44
import java.beans.PropertyChangeEvent;
44
import java.beans.PropertyChangeEvent;
45
import java.beans.PropertyChangeListener;
45
import java.beans.PropertyChangeListener;
46
import java.lang.ref.WeakReference;
46
import java.lang.ref.WeakReference;
47
import java.util.ArrayList;
47
import java.util.Arrays;
48
import java.util.Arrays;
48
import java.util.LinkedList;
49
import java.util.LinkedList;
49
import java.util.List;
50
import java.util.List;
Lines 64-69 Link Here
64
import org.netbeans.api.editor.mimelookup.MimeLookup;
65
import org.netbeans.api.editor.mimelookup.MimeLookup;
65
import org.netbeans.api.editor.mimelookup.MimePath;
66
import org.netbeans.api.editor.mimelookup.MimePath;
66
import org.netbeans.api.editor.settings.SimpleValueNames;
67
import org.netbeans.api.editor.settings.SimpleValueNames;
68
import org.netbeans.api.search.ReplacePattern;
69
import org.netbeans.api.search.SearchHistory;
70
import org.netbeans.api.search.SearchPattern;
67
import org.netbeans.editor.BaseDocument;
71
import org.netbeans.editor.BaseDocument;
68
import org.netbeans.editor.BaseKit;
72
import org.netbeans.editor.BaseKit;
69
import org.netbeans.editor.MultiKeymap;
73
import org.netbeans.editor.MultiKeymap;
Lines 140-145 Link Here
140
144
141
    @SuppressWarnings("unchecked")
145
    @SuppressWarnings("unchecked")
142
    private SearchBar() {
146
    private SearchBar() {
147
        loadSearchHistory();
143
        addEscapeKeystrokeFocusBackTo(this);
148
        addEscapeKeystrokeFocusBackTo(this);
144
        setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
149
        setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
145
        setFocusCycleRoot(true);
150
        setFocusCycleRoot(true);
Lines 236-241 Link Here
236
        setVisible(false);
241
        setVisible(false);
237
        usageLogging();
242
        usageLogging();
238
    }
243
    }
244
    
245
    private static class SearchHistoryUtility {
246
247
        public static List<EditorFindSupport.SPW> convertFromSearchHistoryToEditorFindSupport(List<SearchPattern> searchPatterns) {
248
            List<EditorFindSupport.SPW> history = new ArrayList<EditorFindSupport.SPW>();
249
            for (int i = 0; i < searchPatterns.size(); i++) {
250
                SearchPattern sptr = searchPatterns.get(i);
251
                EditorFindSupport.SPW spwrap = new EditorFindSupport.SPW(sptr.getSearchExpression(),
252
                        sptr.isWholeWords(), sptr.isMatchCase(), sptr.isRegExp());
253
                history.add(spwrap);
254
            }
255
            return history;
256
        }
257
        
258
        public static List<EditorFindSupport.RP> convertFromReplaceHistoryToEditorFindSupport(List<ReplacePattern> replacePatterns) {
259
            List<EditorFindSupport.RP> history = new ArrayList<EditorFindSupport.RP>();
260
            for (int i = 0; i < replacePatterns.size(); i++) {
261
                ReplacePattern rp = replacePatterns.get(i);
262
                EditorFindSupport.RP spwrap = new EditorFindSupport.RP(rp.getReplaceExpression(), rp.isPreserveCase());
263
                history.add(spwrap);
264
            }
265
            return history;
266
        }
267
    }
268
    private static PropertyChangeListener searchSelectedPatternListener;
269
    private static PropertyChangeListener editorHistoryChangeListener;
270
271
    private static void loadSearchHistory() {
272
        searchSelectedPatternListener = new PropertyChangeListener() {
273
            @Override
274
            public void propertyChange(PropertyChangeEvent evt) {
275
                if (evt == null) {
276
                    return;
277
                }
278
                if (SearchHistory.ADD_TO_HISTORY.equals(evt.getPropertyName())) {
279
                    EditorFindSupport.getInstance().setHistory(
280
                            SearchHistoryUtility.convertFromSearchHistoryToEditorFindSupport(SearchHistory.getDefault().getSearchPatterns()));
281
                }
282
                
283
                if (SearchHistory.ADD_TO_REPLACE.equals(evt.getPropertyName())) {
284
                    EditorFindSupport.getInstance().setReplaceHistory(
285
                            SearchHistoryUtility.convertFromReplaceHistoryToEditorFindSupport(SearchHistory.getDefault().getReplacePatterns()));
286
                }
287
            }
288
        };
289
290
        editorHistoryChangeListener = new PropertyChangeListener() {
291
            @Override
292
            public void propertyChange(PropertyChangeEvent evt) {
293
                if (evt == null) {
294
                    return;
295
                }
296
                if (EditorFindSupport.FIND_HISTORY_PROP.equals(evt.getPropertyName())) {
297
                    EditorFindSupport.SPW spw = (EditorFindSupport.SPW) evt.getNewValue();
298
                    if (spw == null || spw.getSearchExpression() == null || "".equals(spw.getSearchExpression())) { //NOI18N
299
                        return;
300
                    }
301
                    SearchPattern sp = SearchPattern.create(spw.getSearchExpression(),
302
                            spw.isWholeWords(), spw.isMatchCase(), spw.isRegExp());
303
                    SearchHistory.getDefault().add(sp);
304
                } else if (EditorFindSupport.FIND_HISTORY_CHANGED_PROP.equals(evt.getPropertyName())) {
305
                    EditorFindSupport.getInstance().setHistory(
306
                            SearchHistoryUtility.convertFromSearchHistoryToEditorFindSupport(SearchHistory.getDefault().getSearchPatterns()));
307
                } else if (EditorFindSupport.REPLACE_HISTORY_PROP.equals(evt.getPropertyName())) {
308
                    EditorFindSupport.RP rp = (EditorFindSupport.RP) evt.getNewValue();
309
                    if (rp == null || rp.getReplaceExpression() == null || "".equals(rp.getReplaceExpression())) { //NOI18N
310
                        return;
311
                    }
312
                    ReplacePattern replacePattern = ReplacePattern.create(rp.getReplaceExpression(), rp.isPreserveCase());
313
                    SearchHistory.getDefault().addReplace(replacePattern);
314
                } else if (EditorFindSupport.REPLACE_HISTORY_CHANGED_PROP.equals(evt.getPropertyName())) {
315
                    EditorFindSupport.getInstance().setReplaceHistory(
316
                            SearchHistoryUtility.convertFromReplaceHistoryToEditorFindSupport(SearchHistory.getDefault().getReplacePatterns()));
317
                }
318
            }
319
        };
320
321
        SearchHistory.getDefault().addPropertyChangeListener(searchSelectedPatternListener);
322
        EditorFindSupport.getInstance().addPropertyChangeListener(editorHistoryChangeListener);
323
    }
239
324
240
    private static void usageLogging() {
325
    private static void usageLogging() {
241
        Logger logger = Logger.getLogger("org.netbeans.ui.metrics.editor"); // NOI18N
326
        Logger logger = Logger.getLogger("org.netbeans.ui.metrics.editor"); // NOI18N
(-)a/editor.search/src/org/netbeans/modules/editor/search/completion/SearchCompletion.java (+8 lines)
Lines 48-53 Link Here
48
import javax.swing.text.JTextComponent;
48
import javax.swing.text.JTextComponent;
49
import org.netbeans.api.editor.mimelookup.MimeRegistration;
49
import org.netbeans.api.editor.mimelookup.MimeRegistration;
50
import org.netbeans.modules.editor.lib2.search.EditorFindSupport;
50
import org.netbeans.modules.editor.lib2.search.EditorFindSupport;
51
import org.netbeans.modules.editor.lib2.search.EditorFindSupport.RP;
51
import org.netbeans.modules.editor.lib2.search.EditorFindSupport.SPW;
52
import org.netbeans.modules.editor.lib2.search.EditorFindSupport.SPW;
52
import org.netbeans.modules.editor.search.SearchBar;
53
import org.netbeans.modules.editor.search.SearchBar;
53
import org.netbeans.modules.editor.search.SearchNbEditorKit;
54
import org.netbeans.modules.editor.search.SearchNbEditorKit;
Lines 109-114 Link Here
109
                        results.add(searchCompletionItem);
110
                        results.add(searchCompletionItem);
110
                    }
111
                    }
111
                }
112
                }
113
                for (RP rp : EditorFindSupport.getInstance().getReplaceHistory()) {
114
                    String s = rp.getReplaceExpression().trim();
115
                    if (s.toLowerCase().startsWith(queryText) && s.length() != queryText.length()) {
116
                        SearchCompletionItem searchCompletionItem = new SearchCompletionItem(s);
117
                        results.add(searchCompletionItem);
118
                    }
119
                }
112
            }
120
            }
113
            if (resultSet != null) { // resultSet can be null only in tests!
121
            if (resultSet != null) { // resultSet can be null only in tests!
114
                resultSet.addAllItems(results);
122
                resultSet.addAllItems(results);
(-)a/editor/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
javac.compilerargs=-Xlint:unchecked
43
javac.compilerargs=-Xlint:unchecked
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=1.69.0
45
spec.version.base=1.70.0
46
is.autoload=true
46
is.autoload=true
47
47
48
javadoc.arch=${basedir}/arch.xml
48
javadoc.arch=${basedir}/arch.xml
(-)a/editor/nbproject/project.xml (-8 lines)
Lines 59-72 Link Here
59
                    </run-dependency>
59
                    </run-dependency>
60
                </dependency>
60
                </dependency>
61
                <dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.api.search</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <specification-version>1.0</specification-version>
67
                    </run-dependency>
68
                </dependency>
69
                <dependency>
70
                    <code-name-base>org.netbeans.modules.editor.fold</code-name-base>
62
                    <code-name-base>org.netbeans.modules.editor.fold</code-name-base>
71
                    <build-prerequisite/>
63
                    <build-prerequisite/>
72
                    <compile-dependency/>
64
                    <compile-dependency/>
(-)a/editor/src/org/netbeans/modules/editor/EditorModule.java (-55 lines)
Lines 50-60 Link Here
50
import java.io.IOException;
50
import java.io.IOException;
51
import java.lang.reflect.Field;
51
import java.lang.reflect.Field;
52
import java.lang.reflect.Method;
52
import java.lang.reflect.Method;
53
import java.util.ArrayList;
54
import java.util.HashSet;
53
import java.util.HashSet;
55
import java.util.Hashtable;
54
import java.util.Hashtable;
56
import java.util.Iterator;
55
import java.util.Iterator;
57
import java.util.List;
58
import java.util.Map;
56
import java.util.Map;
59
import java.util.concurrent.atomic.AtomicBoolean;
57
import java.util.concurrent.atomic.AtomicBoolean;
60
import java.util.logging.Level;
58
import java.util.logging.Level;
Lines 69-76 Link Here
69
import javax.swing.text.rtf.RTFEditorKit;
67
import javax.swing.text.rtf.RTFEditorKit;
70
import org.netbeans.api.editor.mimelookup.MimeLookup;
68
import org.netbeans.api.editor.mimelookup.MimeLookup;
71
import org.netbeans.api.editor.mimelookup.MimePath;
69
import org.netbeans.api.editor.mimelookup.MimePath;
72
import org.netbeans.api.search.SearchHistory;
73
import org.netbeans.api.search.SearchPattern;
74
import org.netbeans.editor.AnnotationType;
70
import org.netbeans.editor.AnnotationType;
75
import org.netbeans.editor.AnnotationTypes;
71
import org.netbeans.editor.AnnotationTypes;
76
import org.netbeans.editor.BaseDocument;
72
import org.netbeans.editor.BaseDocument;
Lines 81-87 Link Here
81
import org.netbeans.modules.editor.lib.EditorPackageAccessor;
77
import org.netbeans.modules.editor.lib.EditorPackageAccessor;
82
import org.netbeans.modules.editor.lib2.actions.EditorRegistryWatcher;
78
import org.netbeans.modules.editor.lib2.actions.EditorRegistryWatcher;
83
import org.netbeans.modules.editor.lib2.document.ReadWriteUtils;
79
import org.netbeans.modules.editor.lib2.document.ReadWriteUtils;
84
import org.netbeans.modules.editor.lib2.search.EditorFindSupport;
85
import org.netbeans.modules.editor.options.AnnotationTypesFolder;
80
import org.netbeans.modules.editor.options.AnnotationTypesFolder;
86
import org.openide.cookies.EditorCookie;
81
import org.openide.cookies.EditorCookie;
87
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileObject;
Lines 113-132 Link Here
113
    
108
    
114
    private static final boolean debug = Boolean.getBoolean("netbeans.debug.editor.kits");
109
    private static final boolean debug = Boolean.getBoolean("netbeans.debug.editor.kits");
115
110
116
    private static class SearchHistoryUtility {
117
        public static List<EditorFindSupport.SPW> convertFromSearchHistoryToEditorFindSupport(List<SearchPattern> searchPatterns) {
118
            List<EditorFindSupport.SPW> history = new ArrayList<EditorFindSupport.SPW>();
119
            for (int i = 0; i < searchPatterns.size(); i++) {
120
                SearchPattern sptr = searchPatterns.get(i);
121
                EditorFindSupport.SPW spwrap = new EditorFindSupport.SPW(sptr.getSearchExpression(),
122
                        sptr.isWholeWords(), sptr.isMatchCase(), sptr.isRegExp());
123
                history.add(spwrap);
124
            }
125
            return history;
126
        }
127
    }
128
    private PropertyChangeListener searchSelectedPatternListener;
129
    private PropertyChangeListener editorHistoryChangeListener;
130
    private PropertyChangeListener topComponentRegistryListener;
111
    private PropertyChangeListener topComponentRegistryListener;
131
112
132
    /** Module installed again. */
113
    /** Module installed again. */
Lines 228-270 Link Here
228
209
229
        // ------------------------------------------------------------
210
        // ------------------------------------------------------------
230
        
211
        
231
         searchSelectedPatternListener = new PropertyChangeListener(){
232
             
233
            @Override
234
             public void propertyChange(PropertyChangeEvent evt){
235
                 if (evt == null)
236
                     return;             
237
                 if (SearchHistory.ADD_TO_HISTORY.equals(evt.getPropertyName())){
238
                     EditorFindSupport.getInstance().setHistory(
239
                             SearchHistoryUtility.convertFromSearchHistoryToEditorFindSupport(SearchHistory.getDefault().getSearchPatterns()));
240
                 }
241
             }
242
         };
243
212
244
        editorHistoryChangeListener = new PropertyChangeListener() {
245
246
            @Override
247
            public void propertyChange(PropertyChangeEvent evt) {
248
                if (evt == null) {
249
                    return;
250
                }
251
                if (EditorFindSupport.FIND_HISTORY_PROP.equals(evt.getPropertyName())) {
252
                    EditorFindSupport.SPW spw = (EditorFindSupport.SPW) evt.getNewValue();
253
                    if (spw == null || spw.getSearchExpression() == null || "".equals(spw.getSearchExpression())) { //NOI18N
254
                        return;
255
                    }
256
                    SearchPattern sp = SearchPattern.create(spw.getSearchExpression(),
257
                            spw.isWholeWords(), spw.isMatchCase(), spw.isRegExp());
258
                    SearchHistory.getDefault().add(sp);
259
                } else if (EditorFindSupport.FIND_HISTORY_CHANGED_PROP.equals(evt.getPropertyName())) {
260
                    EditorFindSupport.getInstance().setHistory(
261
                             SearchHistoryUtility.convertFromSearchHistoryToEditorFindSupport(SearchHistory.getDefault().getSearchPatterns()));
262
                }                       
263
            }
264
        };
265
266
        SearchHistory.getDefault().addPropertyChangeListener(searchSelectedPatternListener);
267
        EditorFindSupport.getInstance().addPropertyChangeListener(editorHistoryChangeListener);
268
        if (topComponentRegistryListener == null) {
213
        if (topComponentRegistryListener == null) {
269
            topComponentRegistryListener = new PropertyChangeListener() {
214
            topComponentRegistryListener = new PropertyChangeListener() {
270
                @Override
215
                @Override

Return to bug 221993