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

Bug 333506

Summary: Delete key deleting wrong project in Package Explorer
Product: [Eclipse Project] e4 Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: daniel_megert, Mike_Wilson, pwebster, remy.suen, tom.schindl
Version: unspecified   
Target Milestone: 4.1 RC4   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Screen shot
none
Execute in context v01
none
Execute in context v02
none
Execute in context v03
none
Execute in context v04 none

Description John Arthorne CLA 2011-01-04 14:36:14 EST
I20101202-2256

I selected a project in the Package Explorer, and hit the Delete button. The confirmation prompt showed that it was trying to delete the wrong project. This can obviously cause catastrophic data loss...
Comment 1 John Arthorne CLA 2011-01-04 14:36:35 EST
Created attachment 186041 [details]
Screen shot
Comment 2 Remy Suen CLA 2011-01-04 14:51:33 EST
Did you have that project selected in another view? When you select something else again, does the problem fix itself? This might be the same issue as bug 333390.
Comment 3 John Arthorne CLA 2011-01-04 14:59:11 EST
No, I had no other views open containing projects. Only Package Explorer, Outline, Debug, JUnit, and Variables views open.

Messing around with the selection didn't seem to have any effect. The selection seemed to be "stuck" on that single project no matter what I did. I eventually restarted to get things working again.
Comment 4 Remy Suen CLA 2011-01-04 16:27:42 EST
John got into this state again just now. The deletion action is fine in the 'Project Explorer' and interestingly enough, F2 works in the 'Package Explorer' also so it would imply that only the delete action for that particular view is dead.
Comment 5 Paul Webster CLA 2011-01-28 15:10:15 EST
I was in this state, although closing and re-opening the PkgExp fixed it.

It uses org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction as the action for the delete key (and delete menu item, which I found to have the exact same problem)

PW
Comment 6 John Arthorne CLA 2011-01-28 15:59:13 EST
To give an update, I get into this state almost every day (as recently as I20110123). I tried using the Project Explorer instead of the Package Explorer but I get the problem in both views.
Comment 7 John Arthorne CLA 2011-01-28 16:24:48 EST
I believe I just hit another manifestation of this bug. I selected a couple of files in the Project Explorer, and did Export > As Archive. I clicked finish, only to discover later that the zip file contained a *different* plugin. Somehow the selection from the Project Explorer didn't carry over to the wizard. I repeated the same steps and got the same error, indicating that the selection of the Project Explorer was permanently stuck at some old value.
Comment 8 Eric Moffatt CLA 2011-05-18 15:39:43 EDT
John says that he hasn't seen this in quite some time...I'll mark it as FIXED and we'll test this in the RC candidate...it's not just a matter of firing it up and trying the scenario, it was some sort of state that you could get into after a period of use...

John please re-open (and ping me) if this ever shows up again for you.
Comment 9 Paul Webster CLA 2011-05-19 12:59:32 EDT
I saw this problem yesterday in our latest builds.

PW
Comment 10 Mike Wilson CLA 2011-05-20 13:22:51 EDT
Obviously, this is serious. Increasing Importance.
Comment 11 John Arthorne CLA 2011-05-20 13:29:08 EDT
I just hit this again in I20110516-2200. In case there is a pattern that emerges, this time the selection was stuck permanently on a build.properties file.
Comment 12 Remy Suen CLA 2011-05-20 13:55:46 EDT
(In reply to comment #11)
> I just hit this again in I20110516-2200. In case there is a pattern that
> emerges, this time the selection was stuck permanently on a build.properties
> file.

Was it 'Delete' or 'Export' or a completely different action?
Comment 13 Paul Webster CLA 2011-05-20 13:57:56 EDT
I've seen it most recently, so I'm running 4.1 as a debug server.  If I hit the problem again, I can connect from another 4.1 instance and hopefully debug.

PW
Comment 14 John Arthorne CLA 2011-05-20 15:04:17 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > I just hit this again in I20110516-2200. In case there is a pattern that
> > emerges, this time the selection was stuck permanently on a build.properties
> > file.
> 
> Was it 'Delete' or 'Export' or a completely different action?

Delete. I've only ever seen the problem once during export. This is possibly because I delete far more often than export.
Comment 15 Thomas Schindl CLA 2011-05-24 08:45:06 EDT
I just had this very problem - thank god i already committed the project to my local git-repo because I didn't read the dialog box appropriately and so wiped the project from my disk
Comment 16 Paul Webster CLA 2011-05-25 15:53:47 EDT
Created attachment 196604 [details]
Execute in context v01

Execute the package explorer delete in the correct context.
PW
Comment 17 Paul Webster CLA 2011-05-25 16:50:01 EDT
Created attachment 196609 [details]
Execute in context v02

Same again, but using a utility method to add the item interfaces to the static context.

PW
Comment 18 Paul Webster CLA 2011-05-25 17:32:57 EDT
(In reply to comment #17)
> Created attachment 196609 [details]
> Execute in context v02

I've released this, as the framework was not honouring the "executeInContext(*)" request.

PW
Comment 19 Remy Suen CLA 2011-05-26 09:47:46 EDT
A new test failure appeared in the I20110526-0630 build as a result of changes from this bug.

java.lang.NullPointerException
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.addParms(HandlerServiceImpl.java:72)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:127)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:371)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:352)
at org.eclipse.jdt.ui.tests.leaks.JavaLeakTest.testJavaEditorActionDelegate(JavaLeakTest.java:462)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
at junit.extensions.TestSetup.run(TestSetup.java:27)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:416)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:249)
at org.eclipse.test.UITestApplication$2.run(UITestApplication.java:197)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3561)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3210)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:944)
Comment 20 Paul Webster CLA 2011-05-26 09:55:11 EDT
(In reply to comment #19)
> A new test failure appeared in the I20110526-0630 build as a result of changes
> from this bug.
> 
> java.lang.NullPointerException
> at

I've released a fix for this, and we'll probably spin a new build today.
PW
Comment 21 Remy Suen CLA 2011-05-26 13:31:55 EDT
Created attachment 196687 [details]
Execute in context v03

Paul, I suggest disposing the static contexts when we're done with them. Right now there are too many of them lying around and it fills the 'Contexts' view up.

We should also always be passing a "throw away" context to the EHS as the EHS will manipulate the contents of this context directly.
Comment 22 Paul Webster CLA 2011-05-26 14:00:07 EDT
Created attachment 196692 [details]
Execute in context v04

Catch some additional areas where we create a throw-away context.

PW
Comment 23 Paul Webster CLA 2011-05-27 15:30:23 EDT
We're going to have to keep our eyes out for this in our testing in RC4
PW
Comment 24 Paul Webster CLA 2011-06-21 12:27:29 EDT
I haven't been able to reproduce this since the change.

We'll re-open if it re-occurs.

PW