Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313392

Summary: Support Import operations on 'Plug-in Dependencies' entries in Project and Package Explorer
Product: [Eclipse Project] PDE Reporter: Darin Wright <darin.eclipse>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: ankur_sharma, curtis.windatt.public, daniel_megert, markus.kell.r, Michael_Rennie
Version: 3.6Keywords: noteworthy
Target Milestone: 3.8 M2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix
none
Adds import action to project/package explorer none

Description Darin Wright CLA 2010-05-18 12:38:11 EDT
Follow up from bug 310437.

"If possible, we should also offer the 'Import As' context menu on elements
inside the 'Plug-in Dependencies' container (in the Package Explorer). This
would allow an easy conversion from binary to source."
Comment 1 Curtis Windatt CLA 2011-04-18 14:19:37 EDT
This has been dropped from the 3.7 plan due to a lack of resources.
Comment 2 Dani Megert CLA 2011-04-19 02:29:48 EDT
We should try to do this during 3.8.
Comment 3 Curtis Windatt CLA 2011-08-19 16:49:06 EDT
Created attachment 201838 [details]
Fix

Adds the import sub-menu to the context menu of the plug-in dependencies view and target platform state view.  Sub menu only shows on items which we have a model for and do not exist in the workspace.  We do not know at menu creation time whether the Import from Repository option is viable, so a dialog informs the user if they try to import from repo when it is not supported (this is not new behaviour).
Comment 4 Curtis Windatt CLA 2011-08-22 13:03:54 EDT
Committed to master branch.
Comment 5 Dani Megert CLA 2011-08-25 03:02:42 EDT
Does not work for me using I20110823-0925 or N20110824-2000.
Comment 6 Curtis Windatt CLA 2011-08-25 14:45:14 EDT
(In reply to comment #5)
> Does not work for me using I20110823-0925 or N20110824-2000.

I can confirm that the fix is in and works in I20110823-0925.  I may have been over eager in closing this as fixed as I added the option to the two views, not to the PDE classpath container contents.  I'll try to add to those menus for M2.
Comment 7 Dani Megert CLA 2011-08-26 02:42:53 EDT
> I can confirm that the fix is in and works in I20110823-0925.
Maybe you refer to comment 3? While it's nice if you add it to many other views, this bug is about the 'Project Explorer' and the 'Package Explorer' and I just tried again in I20110823-0925 or N20110825-2000. to get the 'Import As' for those views without any luck (I also looked in the 'PDE Tools' sub-menu). Did I miss something?
Comment 8 Curtis Windatt CLA 2011-08-26 17:27:50 EDT
Created attachment 202255 [details]
Adds import action to project/package explorer

This adds a "Import from repository" action to IPackageFragmentRoots. I haven't pushed this to the master branch yet as I have a couple of concerns.

1) Performance.  All the package fragment root has is a path to the jar/folder.  PDE has no mapping of install locations to models.  Therefore to check if the action should be enabled, we must search all known external (target) models, ask them for their install location and compare. I found this to not be a problem on my machine with 455 plug-ins, but it could be an issue for 1000+ plug-in targets.

2) Not filtered to just plug-in projects or the plug-in dependencies classpath container. Currently the menu item is visible (not enabled) for all other package fragment roots, even in non-PDE projects. I was trying to use the visbility settings on the extension, but couldn't get the object to adapt to IProject.  If we can create our own property tester we can improve this.


3) Poor location in the menu. I originally had it beside the import/export actions, but that menu group is not available in the project explorer. For now I have not specified a menu path.
Comment 9 Curtis Windatt CLA 2011-08-26 17:31:57 EDT
(In reply to comment #7)
> > I can confirm that the fix is in and works in I20110823-0925.
> Maybe you refer to comment 3? While it's nice if you add it to many other
> views, this bug is about the 'Project Explorer' and the 'Package Explorer' and
> I just tried again in I20110823-0925 or N20110825-2000. to get the 'Import As'
> for those views without any luck (I also looked in the 'PDE Tools' sub-menu).
> Did I miss something?

In the target platform state view, you need to select an external plug-in.  If you select something from your workspace, the menu will not be visible. Same goes for the dependencies view, you need to focus on a plug-in and select an external plug-in for the menu to be visible.  We also need to have a PDE model for the selection.  Hopefully this helps.
Comment 10 Dani Megert CLA 2011-08-29 03:40:00 EDT
(In reply to comment #8)
> Created attachment 202255 [details] [diff]
> Adds import action to project/package explorer
> 
> This adds a "Import from repository" action to IPackageFragmentRoots. I haven't
> pushed this to the master branch yet as I have a couple of concerns.
> 
> 1) Performance.  All the package fragment root has is a path to the jar/folder.
>  PDE has no mapping of install locations to models.  Therefore to check if the
> action should be enabled,
You could enable it if the JAR is inside a PDE container. Also note that the action should also be available on imported binary PDE projects.


> 2) Not filtered to just plug-in projects or the plug-in dependencies classpath
> container. Currently the menu item is visible (not enabled) for all other
> package fragment roots, even in non-PDE projects. I was trying to use the
> visbility settings on the extension, but couldn't get the object to adapt to
> IProject.  If we can create our own property tester we can improve this.
This is a must for committing the feature.
Comment 11 Curtis Windatt CLA 2011-09-09 17:31:25 EDT
I went through a few iterations to find what worked the best.  The fix uses the newer command/menus framework and a property tester for IPackageFragmentRoot.

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=f8569bc8cfebc6fc5e89fcf9a3c340baec8ba672
Comment 12 Dani Megert CLA 2011-09-13 04:25:25 EDT
Looks good except for the menu label:
- doesn't use title style
- no mnemonic
==> filed bug 357452 to track this.