Bug 213119 - Search dialog doesn't remember last mode and settings
Summary: Search dialog doesn't remember last mode and settings
Status: RESOLVED WORKSFORME
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday, helpwanted, polish
: 299235 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-16 16:39 EST by Randy Hudson CLA
Modified: 2019-09-02 15:01 EDT (History)
8 users (show)

See Also:


Attachments
mylyn/context/zip (880 bytes, application/octet-stream)
2009-01-08 15:59 EST, Benjamin Cabé CLA
no flags Details
My changes to PluginSearchPage.java (5.90 KB, patch)
2012-09-26 14:39 EDT, Tristan Hume CLA
no flags Details | Diff
mylyn/context/zip (705.38 KB, application/octet-stream)
2012-09-26 14:39 EDT, Tristan Hume CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2007-12-16 16:39:26 EST
1) Open search dialog
2) Choose plug-in search tab
3) Limit to "All"
4) External Scope to "All"
5) search for something
6) Re-open search dialog

bug: Search dialog displays file search.
bug: selecting plug-in tab resets changes made in steps 3&4
Comment 1 Martin Aeschlimann CLA 2008-04-25 16:03:45 EDT
That's PDE search, sorry for the delay.
Comment 2 Martin Probst CLA 2008-12-23 12:55:16 EST
I don't think this is related to PDE. This happens to me all the time with the regular search dialog, without even having PDE installed.

The dialog also forgets the search type, and much worse, the search scope (selected resources/workspace/all projects), when you're just using Java/Text file searches.

I think this setting/default dialog preference should also survive Eclipse restarts. Or we need a completely different GUI for file searches - I think it's very common to try out searching for something, and then change that search string, and the current process is very annoying.
Comment 3 Benjamin Cabé CLA 2009-01-08 15:57:30 EST
(In reply to comment #0)
> bug: Search dialog displays file search.

You should file a bug against Platform/Search.

> bug: selecting plug-in tab resets changes made in steps 3&4

Actually, not exactly. If you expand the search combo, you'll find the previously executed queries, and as soon as you'll have selected an old 'pattern', the whole query will be displayed in UI again. But, unfortunately, the list is not persisted on disk and thus lost when you restart Eclipse.

That would be fair enough to:
1. Select the first item (if there is any) of the combo when the search page is activated
2. Persist the 'QueryData' array using IDialogSettings
Comment 4 Benjamin Cabé CLA 2009-01-08 15:59:16 EST
Attaching a Mylyn context. Implementing the persistency mechanism is pretty straightforward.
Comment 5 Benjamin Cabé CLA 2009-01-08 15:59:24 EST
Created attachment 122010 [details]
mylyn/context/zip
Comment 6 Benjamin Cabé CLA 2009-01-08 16:04:49 EST
(In reply to comment #3)
> (In reply to comment #0)
> > bug: Search dialog displays file search.
> 
> You should file a bug against Platform/Search.

Well, you should *not* ;-) See 33710.
Comment 7 Benjamin Cabé CLA 2010-01-11 10:39:18 EST
*** Bug 299235 has been marked as a duplicate of this bug. ***
Comment 8 Tristan Hume CLA 2012-09-25 15:30:42 EDT
I have looked into fixing this and came up with a few options.
The main constraint is that the key-value IDialogSettings only supports strings and arrays of strings as values.

Here are some ways I have thought of saving the array of QueryData objects:
1) For each QueryData property, have an array of string values. The value at each index for that array represents the value of that property of the QueryData object at that index in the previousQueries array. I.E keys such as previousQueries-text, previousQueries-limit which would each contain an array of string values.

2) Mix the position data into the key. For each item in the previousQueries array there would be one key for each attribute. For example, the key previousQueries-text-2 would contain the text attribute for the second element of the previousQueries array.

This allows the usage of the built in retrieval methods for integers and other primitive types. It is less clean but it is easier to implement.

3) Implement methods on the QueryData class to serialize it to and from a string. Then only one key would be needed that would contain an array of QueryData strings.

This appears to be the cleanest method but has some pitfalls such as escaping text from the search terms so that odd queries don't mess up the serialization. Java serialization can not be used because it does not work on nested classes.


Any thoughts on which method I should implement? Are there any other methods of saving the data that you can think of?
Comment 9 Tristan Hume CLA 2012-09-26 13:49:07 EDT
I thought of a solution to the string escaping problem with my option #3 in my previous comment. The search queries can't contain newlines so I store the string as a series of values separated by newlines.

I have implemented code that saves the state of the previousQueries array and restores it on startup. The only problem at the moment is that the array of IWorkingSets needs to be serialized into the string. IWorkingSet inherits IPersistableElement but I am not sure how the persistence works and how I can properly restore the selected working sets.
Comment 10 Tristan Hume CLA 2012-09-26 14:39:14 EDT
Created attachment 221526 [details]
My changes to PluginSearchPage.java

I added code to store the names of the selected working sets and restore them.

This patch implements full, working persistence for the PDE search page.
Comment 11 Tristan Hume CLA 2012-09-26 14:39:29 EDT
Created attachment 221527 [details]
mylyn/context/zip
Comment 12 Curtis Windatt CLA 2012-09-26 15:53:28 EDT
PDE committer time is very limited, but I will try to review your patch for 4.3.
Comment 13 Curtis Windatt CLA 2013-01-09 16:59:25 EST
A superior solution would be what JDT does for their search page.  They store the various settings as independant properties in a dialog settings.  Then for each previous search pattern a new settings section is created.  That way you can take advantage of the error checking built into the dialog/preferences API.
Comment 14 Eclipse Genie CLA 2018-11-19 14:08:45 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 15 Lars Vogel CLA 2019-09-02 15:00:33 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.
Comment 16 Lars Vogel CLA 2019-09-02 15:01:00 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.