Bug 440275 - Automatic wildcard support for adding plug-ins to plug-in based products
Summary: Automatic wildcard support for adding plug-ins to plug-in based products
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: 4.5 M3   Edit
Assignee: Simon Scholz CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on:
Blocks:
 
Reported: 2014-07-23 17:09 EDT by Lars Vogel CLA
Modified: 2014-11-04 06:57 EST (History)
10 users (show)

See Also:


Attachments
Without wildcard (12.79 KB, image/png)
2014-07-23 17:10 EDT, Lars Vogel CLA
no flags Details
With wildcard (38.95 KB, image/png)
2014-07-23 17:11 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2014-07-23 17:09:40 EDT
At the moment the has to enter * in the product editor to perform a regular expression matching at the beginning. This is different compared to the MANIFEST.MF dependencies and the feature based products. 

We should fix that.
Comment 1 Lars Vogel CLA 2014-07-23 17:10:56 EDT
Created attachment 245311 [details]
Without wildcard
Comment 2 Lars Vogel CLA 2014-07-23 17:11:17 EDT
Created attachment 245312 [details]
With wildcard
Comment 3 Curtis Windatt CLA 2014-07-24 10:09:07 EDT
YEs, the inconsistent wildcard support in the dialogs is frustrating.  As the dialogs are used in many editors it would be great to have this improved.
Comment 4 Simon Scholz CLA 2014-08-12 16:47:16 EDT
I just added a first proposal for this bug here: https://git.eclipse.org/r/#/c/31468/

But I during my research I spottet also other places, where the PluginSelectionDialog should be used instead of the ElementListSelectionDialog for selecting Plug-ins.
For instance in the PluginConfigurationSection and the SplashLocationSection. I´ll have a look at those issues tomorrow.
Comment 5 Lars Vogel CLA 2014-08-12 16:56:37 EDT
(In reply to Simon Scholz from comment #4)
> I just added a first proposal for this bug here:
> https://git.eclipse.org/r/#/c/31468/

Works fine for me and the change looks also great. Thanks Simon.
Comment 6 Vikas Chandra CLA 2014-08-13 05:08:05 EDT
+1 to https://git.eclipse.org/r/#/c/31468/

Will be good to fix the same issue in Splash and Config tab of product editor ( as mentioned in comment #4 )
Comment 7 Simon Scholz CLA 2014-08-14 18:47:17 EDT
As you can see here https://git.eclipse.org/r/#/c/31468/ I also added the PluginSelectionDialog to the PluginConfigurationSection and to the SplashLocationSection.

In addition to that I also saw that the TargetDefinitionContentPage also uses the ElementListSelectionDialog instead of the PluginSelectionDialog.
Therefore I also removed the ElementListSelectionDialog and implemented a solution with the PluginSelectionDialog.

Because of my changes the org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionContentPage.getValidBundles() method is not used any more, but as it is declared as protected other derived classes may use this method. Or can I expect that other derived classes do not exist as the package is "internal"?
Comment 8 Lars Vogel CLA 2014-08-15 04:02:08 EDT
WORKSFORME is a status used to describe that the problem cannot be reproduced by the developer. Once Curtis or Vikas apply you patch, the put this bug to FIXED.
Comment 9 Curtis Windatt CLA 2014-08-18 11:40:03 EDT
(In reply to Simon Scholz from comment #7)
> As you can see here https://git.eclipse.org/r/#/c/31468/ I also added the
> PluginSelectionDialog to the PluginConfigurationSection and to the
> SplashLocationSection.
> 
> In addition to that I also saw that the TargetDefinitionContentPage also
> uses the ElementListSelectionDialog instead of the PluginSelectionDialog.
> Therefore I also removed the ElementListSelectionDialog and implemented a
> solution with the PluginSelectionDialog.

I gave this a quick test, saw that it only affects the implicit dependencies page. The wildcard support is better.  The label provider is a little odd.  Even though the list is restricted to what is in your target platform (and implicit dependencies only is an id, not version), the PluginSelectionDialog displays icons indicating workspace vs external as well as the version number.  Also, the initial list is blank, which can be disconcerting, especially if your target has very few plug-ins.

I am still ok with the change.

> 
> Because of my changes the
> org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionContentPage.
> getValidBundles() method is not used any more, but as it is declared as
> protected other derived classes may use this method. Or can I expect that
> other derived classes do not exist as the package is "internal"?

This is a good things to check.  In this case getValidBundles() can be removed.
Comment 10 Vikas Chandra CLA 2014-08-20 12:08:59 EDT
Initial list being blank makes it consistent with manifest editor. If we are to have an initial list, we can probably track it using another work item - which can probably solve it for all cases.

However, the presence of version number now instead of no version number is a change that can affect the product editor.

Would a user want 

 <plugins>
      <plugin id="com.google.guava" version="15.0.0.v201403281430"/>
   </plugins>

instead of 

   <plugins>
      <plugin id="com.google.guava"/>
   </plugins>

What if an user created a product configuration file, added dependency and then changed the plugin version by updating or something? Is that a realistic scenario?
Comment 11 Lars Vogel CLA 2014-08-20 12:20:30 EDT
(In reply to Vikas Chandra from comment #10) 
> However, the presence of version number now instead of no version number is
> a change that can affect the product editor.

I like that the version is added, that is consistent with the feature handling in the product editor (and the MANIFEST.MF dependency handling). If you add feature in the product, a version number is also added.
Comment 12 Curtis Windatt CLA 2014-09-04 13:48:08 EDT
(In reply to Vikas Chandra from comment #10)
> What if an user created a product configuration file, added dependency and
> then changed the plugin version by updating or something? Is that a
> realistic scenario?

There are times a user will want a specific version of a plug-in, but often it is easier to not have a version and simply use the highest available.  It depends on how detailed the user wants their dependencies to be.

While it won't block users (you can edit the version in the properties), I do recommend we avoid changing the behaviour. The dialog should not save the version information.

It would be nice if we provided some better tooling to help users add a version number should they want one (an option to always include version info when adding, or a button to set versions to the what is available in the target, or a suggestion based on available plug-ins in the properties dialog).  This is outside the scope of this bug though.
Comment 13 Vikas Chandra CLA 2014-09-15 09:06:28 EDT
>>often it is easier to not have a version and simply use the highest available

Can we have this behavior along with "Automatic wildcard support". ?
Comment 14 Vikas Chandra CLA 2014-09-15 09:07:50 EDT
Moving to 4.5 M3 as we don't want to change the behavior of giving version numbers to the plugin added ( although we do want wildcard support for product editors etc). This will involve changing the patch attached.
Comment 15 Curtis Windatt CLA 2014-09-15 11:21:23 EDT
(In reply to Vikas Chandra from comment #13)
> >>often it is easier to not have a version and simply use the highest available
> 
> Can we have this behavior along with "Automatic wildcard support". ?

When taking the result from the dialog, simply strip the version information before storing it in the product model.  We were storing the plug-in information before without version.
Comment 16 Vikas Chandra CLA 2014-09-18 09:52:29 EDT
Simon, any plan to update the patch?
Comment 17 Simon Scholz CLA 2014-09-18 16:07:50 EDT
Sorry for the delay Vikas,
I just updated the PluginSection class, so that 0.0.0 is used as version in order to match with the former behavior.

Are you ok with Patch 10?
Comment 18 Vikas Chandra CLA 2014-09-19 02:38:34 EDT
Thanks Simon

I will review it and put it in early 4.5M3
Comment 19 Vikas Chandra CLA 2014-09-23 04:25:55 EDT
+1 to patch 10 of https://git.eclipse.org/r/#/c/31468/

Couple of things are slightly odd but they happen "outside" the scope of this bug.

1) In a new dialog, the new dialog is empty ( same behavior in MANIFEST editor) . Putting * doesn't work. It doesn't work for MANIFEST editor as well - add dependency as well.

2) There are 9-10 instance of "0.0.0" in pde.ui plugin
Comment 20 Simon Scholz CLA 2014-09-23 05:36:43 EDT
I just opened a bug for the second issue Vikas.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=444808

Unfortunately I  am not able to assign this Bug to me.
Comment 22 Vikas Chandra CLA 2014-10-04 07:50:09 EDT
Verified in 

Version: Mars (4.5)
Build id: N20141003-2000
Comment 23 Lars Vogel CLA 2014-10-24 19:26:30 EDT
I think that should be added to the PDE N&N, lots of our users have complained about that in the past.
Comment 24 Simon Scholz CLA 2014-10-30 19:01:15 EDT
I added the WildcardItemsFilter protected inner class in order to support wildcards filtering for selection dialogs.
I have done this in order to also support wildcards in the FilteredPluginArtifactsSelectionDialog, which also uses an ItemFilter.

See this patch: https://git.eclipse.org/r/#/c/35698/
Comment 25 Lars Vogel CLA 2014-11-03 01:55:39 EST
(In reply to Simon Scholz from comment #24)
> I added the WildcardItemsFilter protected inner class in order to support
> wildcards filtering for selection dialogs.
> I have done this in order to also support wildcards in the
> FilteredPluginArtifactsSelectionDialog, which also uses an ItemFilter.
> 
> See this patch: https://git.eclipse.org/r/#/c/35698/

Thanks, merged with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d04a5dfd9d252e9202b435f22b5f69d805358150
Comment 26 Simon Scholz CLA 2014-11-03 06:13:16 EST
I also added wildcard support for the FilteredPluginArtifactsSelectionDialog.

See: https://git.eclipse.org/r/#/c/35799/

Thanks to Markus Keller for spotting this dialog, where the wildcard support was still missing.
Comment 27 Markus Keller CLA 2014-11-04 06:07:27 EST
(In reply to Lars Vogel from comment #25)
> Thanks, merged with
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=d04a5dfd9d252e9202b435f22b5f69d805358150

This is wrong for too many reasons. Reverted in master.

The name WildcardItemsFilter doesn't convey that this is about implicit prefix matching.

Each and every call to "matches(..)" checks the pattern again. That's is inefficient and unnecessary.

Why using & instead of && ?

WildcardItemsFilter is API, but the documentation doesn't match the implementation. Why are there checks for "?" and "."?

The change to AbstractContentProvider is wrong.

I'm also not convinced this is of enough general interest to be API at all.

A project lead should be informed if you add new API. And the commit should link to a bug in the affected bundle's component. Definitely not something to add to a PDE bug that has already been closed in the last milestone.


(In reply to Simon Scholz from comment #26)
> I also added wildcard support for the FilteredPluginArtifactsSelectionDialog.
That belongs to bug 449348.
Comment 28 Simon Scholz CLA 2014-11-04 06:47:10 EST
The reason only why I added the WildcardItemsFilter was that I do not want to have duplicate code for the PluginSelectionDialog and the FilteredPluginArtifactsSelectionDialog. Therefore I copied the implementation of the matches method in the PluginSelectionDialog into an abstract class.

Sorry that I did not yet checked the inefficiency of the implementation, which is currently used in the PluginSelectionDialog.
I think this inefficiency should be fixed within an other Bug.
Comment 29 Simon Scholz CLA 2014-11-04 06:57:30 EST
> (In reply to Simon Scholz from comment #26)
> > I also added wildcard support for the FilteredPluginArtifactsSelectionDialog.
> That belongs to bug 449348.

I now changed the commit message of my patch: https://git.eclipse.org/r/#/c/35799/