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.
API change is needed because of the fix of issue #54028 It is necessary to fire further PropertyChangeEvent to fix it. (Details in the issue #54028)It is event ADD_TO_HISTORY, that will be fired after adding new SearchPattern to history. Old value of event would be null, new value would be added pattern. Also pattern checking before adding to history is a subject of the API change. If pattern is null, its search expression is null or empty, or there is already the same pattern item in the top of the history list, the pattern will not be added (event will not be fired) I will create some test(s) and attach it together with API change diffs.
Created attachment 20171 [details] API change diffs
1. diff -u is much easier to read 2. should not you increase the version number in manifest.mf to 3.6? 3. in tests it is useful to check that some things do not happen. Like: > public void testAddToSearchHistoryListener() throws Exception{ > final boolean fired[] = new boolean[2]; > PropertyChangeListener pcl = new PropertyChangeListener(){ > public void propertyChange(PropertyChangeEvent evt){ > if (evt!=null && SearchHistory.ADD_TO_HISTORY.equals(evt.getPropertyName())){ > fired[0] = true; > } else { > fired[1] = true; > } > }; > SearchHistory.getDefault().addPropertyChangeListener(pcl); > SearchHistory.getDefault().add(SearchPattern.create("searchtext",true,true,false)); > SearchHistory.getDefault().removePropertyChangeListener(pcl); > assertTrue(fired[0]); > assertFalse("Only the expected change is fired", fired[1]); > } Otherwise, this change seems to have all I was asking for.
Thanks for the review and test tip. Ad 1: I am attaching diff -u with recommended test changes. ad 2: Should a version be increased if the API change is compatible?
Created attachment 20174 [details] updated diff
Yes version is always increased. And you did it already in apichanges.xml.
OK, I have increased a version to 3.6 in manifest.mf
I am about to commit the changes within 24 hours
fixed in [maintrunk] /cvs/openidex/manifest.mf,v <-- manifest.mf new revision: 1.34; previous revision: 1.33 /cvs/openidex/api/apichanges.xml,v <-- apichanges.xml new revision: 1.4; previous revision: 1.3 /cvs/openidex/src/org/openidex/search/SearchHistory.java,v <-- SearchHistory.java new revision: 1.4; previous revision: 1.3 /cvs/openidex/test/unit/src/org/openidex/search/SearchHistoryTest.java,v <-- SearchHistoryTest.java new revision: 1.2; previous revision: 1.1