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

Bug 364792

Summary: Importing resources should inform about selection changes
Product: [Eclipse Project] Platform Reporter: Wojciech Trocki <wtrocki>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, remy.suen
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
java source
none
Proposed patch none

Description Wojciech Trocki CLA 2011-11-25 03:54:58 EST
Build Identifier: 

When importing external folder to project, import wizard does not inform page views about new selection. So package explorer dont show new container or resource. 

Reproducible: Always
Comment 1 Wojciech Trocki CLA 2011-11-25 03:58:46 EST
Created attachment 207519 [details]
java source

Proposed path
Comment 2 Wojciech Trocki CLA 2011-11-25 08:37:04 EST
I check that workbench window should be instantiated in constructor. Now is instantiated in selection method. Here activeWorkbench returns null. 
Sorry for that.
Comment 3 Remy Suen CLA 2011-11-25 14:46:43 EST
(In reply to comment #1)
> Created attachment 207519 [details]
> java source
> 
> Proposed path

Could you attach the file as a diff?
http://wiki.eclipse.org/Platform_UI/How_to_Contribute
Comment 4 Paul Webster CLA 2011-11-25 15:04:10 EST
In new wizards, org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard calls org.eclipse.ui.wizards.newresource.BasicNewResourceWizard.selectAndReveal(IResource) as part of its performFinish() operation.

That seems to imply you want a similar pattern implemented on org.eclipse.ui.wizards.datatransfer.FileSystemImportWizard, not in the operations.

As Remy mentioned, you should follow http://wiki.eclipse.org/Platform_UI/How_to_Contribute and provide your changes as a patch.

PW
Comment 5 Wojciech Trocki CLA 2011-11-26 15:11:52 EST
Created attachment 207572 [details]
Proposed patch

In attachment is a proposed patch.
Thanks for introduction :) I'm very happy for this opportunity. 

In case of this bug we have two options:
Select root container or first imported resource (folder or file)
I'm implemented both solutions (second is commented)
Source code quality is not so good. I hope that patch can be useful.

There is no option to select whole structure. Operation returns only boolean, so we must find first element using root visitor.

(In reply to comment #4)
> That seems to imply you want a similar pattern implemented on
> org.eclipse.ui.wizards.datatransfer.FileSystemImportWizard, not in the
> operations.
>

Operations should deal with resources. This pattern should be invokend in 
operationPerformed hook or in performFinish. I use second solution.
Comment 6 Dani Megert CLA 2011-11-28 05:36:40 EST
This is done on purpose, see bug 2336.
Comment 7 Paul Webster CLA 2011-11-28 09:13:08 EST
(In reply to comment #6)
> This is done on purpose, see bug 2336.

Dani, I thought this was about selecting in the package explorer (and others) after the import was done, similar to the call in org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard.performFinish()

PW
Comment 8 Dani Megert CLA 2011-11-28 09:26:54 EST
(In reply to comment #7)
> (In reply to comment #6)
> > This is done on purpose, see bug 2336.
> 
> Dani, I thought this was about selecting in the package explorer (and others)
> after the import was done, similar to the call in
> org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard.performFinish()

Yes, but in the case of the new wizard there is just one new resource. In case of import you might end up with many many selections, hence this was not implemented on purpose when importing.
Comment 9 Paul Webster CLA 2011-11-28 09:54:34 EST
(In reply to comment #8)
> 
> Yes, but in the case of the new wizard there is just one new resource. In case
> of import you might end up with many many selections, hence this was not
> implemented on purpose when importing.

Is it acceptable to either 1) pick the first resource during the import or 2) select the containier?  I have no preference but if it's useful to the users, I'm OK with it.

PW
Comment 10 Dani Megert CLA 2011-11-28 09:59:24 EST
(In reply to comment #9)
> (In reply to comment #8)
> > 
> > Yes, but in the case of the new wizard there is just one new resource. In case
> > of import you might end up with many many selections, hence this was not
> > implemented on purpose when importing.
> 
> Is it acceptable to either 1) pick the first resource during the import or 2)
> select the containier?  I have no preference but if it's useful to the users,
> I'm OK with it.
> 
> PW

I think this would be random. I'd prefer not to touch the selection. Somewhat import is similar to copy/paste, where we also don't change the view selection.
Comment 11 Dani Megert CLA 2011-11-29 02:06:55 EST
> Somewhat import is similar to copy/paste, where we also don't change the view 
> selection.
And same applies when using Drag&Drop.
Comment 12 Lars Vogel CLA 2019-11-14 03:53:41 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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.