Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 300368 - Resource Working Set shows inexistent project that cannot be deleted in Package Explorer
Summary: Resource Working Set shows inexistent project that cannot be deleted in Packa...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 311168 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-21 08:57 EST by Martin Oberhuber CLA
Modified: 2013-04-24 09:46 EDT (History)
10 users (show)

See Also:


Attachments
Screenshot showing the error dialog (9.64 KB, image/gif)
2010-01-21 08:57 EST, Martin Oberhuber CLA
no flags Details
Fix (1.49 KB, patch)
2011-01-07 09:54 EST, Markus Keller CLA
no flags Details | Diff
Team Project Set to reproduce the problem (832 bytes, application/xml)
2011-01-07 09:59 EST, Markus Keller CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2010-01-21 08:57:18 EST
Created attachment 156787 [details]
Screenshot showing the error dialog

Build ID: I20091210-1301 (Eclipse 3.6m4) on WinXP

In my Workspace, I have two closed projects which I cannot delete any more: When I try to delete the project, no matter whether I choose to delete the underlying filestore, I get a dialog (see also attached):

Delete Resources
A fatal error occurred while performing the refactoring
Found problems:
No input element provided
No context information available
[back] [cancel]

As an end user, I am confused by this dialog because it talks about a refactoring (which I did not initiate, I wanted to delete a project!). It also gives me no indication how to resolve the problem.

I investigated the issue a little, and found that in the case of these two closed projects, the underlying location is displayed as 
   <resource does not exist>
in the project properties. I tried deliberately reproducing this case but could not; this state might have been initiated through my team provider (ClearCase Remote Client v7.1 Eclipse plugin), but I am not sure. The workspace was carried over from several older Eclipse versions. I can provide more data if needed.

Expected behavior: 
------------------
Deleting a project without the "Delete file system resources" switched on only unregisters the project from my workspace. This should always succeed regardless of whether the unerlying location exists or not. Furthermore, in case "delete file system" was chosen and the operation fails, the error dialog should be improved to not talk about a "refactoring" which is confusing for end users.

I'm marking the issue as "major" since there is no workaround for getting rid of the stale project.
Comment 1 Szymon Brandys CLA 2010-01-21 10:08:27 EST
Martin, I've just tried to reproduce it on my I20100115-1100. The steps were:
1. Create a project
2. Close the project
3. Delete the project directory in the file system
4. Then I tried to delete the project and it worked

You could add a test to our automated tests suite. This would help if the problem is intermittent.
Comment 2 John Arthorne CLA 2010-01-21 10:17:20 EST
Martin, what view are you using to delete the project? I'm guessing Package Explorer due to the refactoring message. Do you get the same problem in the Navigator or Project Explorer?
Comment 3 Martin Oberhuber CLA 2010-01-21 11:19:15 EST
Yes, this is in the package explorer.

In project explorer or navigator, I do not even see those strange projects, so the problem does not occur in those views.
Comment 4 John Arthorne CLA 2010-01-21 11:36:42 EST
(In reply to comment #3)

> In project explorer or navigator, I do not even see those strange projects, so
> the problem does not occur in those views.

Hm, that is very strange. This suggests to me the projects don't actually exist in the resource tree but somehow the Java model or the view itself may be in a weird state. AFAIK the Navigator view will show all projects in the workspace. Do the weird projects still exist after a shutdown and restart?
Comment 5 Martin Oberhuber CLA 2010-01-21 17:32:33 EST
Yes, they survived tons of restarts so far...
Comment 6 Martin Oberhuber CLA 2010-01-21 17:43:32 EST
I happened to have the Coretools installed, and in the Metadata spy for my workspace, the projects do not show up either. I guess they are in fact no resources but in the JDT model only.

Reassigning to JDT and reducing severity since this seems to be a really unusual case...
Comment 7 Szymon Brandys CLA 2010-01-21 17:49:08 EST
Now I remember that I and Tomasz experienced problems with closed projects in Package Explorer. One of them is bug 296786. 

Another issue I could see is that when a project was closed, it appeared in Package Explorer twice. I could delete one entry, however couldn't delete or open another one.

Since it happened once or twice and I didn't have steps, I didn't raise a bug for it. Tomasz did it, however it is marked WORKSFORME now.

I could not see those problems in Project Explorer.
Comment 8 Olivier Thomann CLA 2010-01-22 11:37:19 EST
I could not reproduce.
Comment 9 Martin Oberhuber CLA 2010-01-22 18:31:01 EST
Perhaps this traceback, which I just found twice in my error log, is related to the problem:

org.eclipse.core.runtime.CoreException: No property tester contributes a property org.eclipse.core.resources.projectNature to type class org.eclipse.jdt.internal.core.JavaProject
	at org.eclipse.core.internal.expressions.TypeExtensionManager.getProperty(TypeExtensionManager.java:123)
	at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:96)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
	at org.eclipse.ui.internal.dialogs.RegistryPageContributor.failsEnablement(RegistryPageContributor.java:260)
	at org.eclipse.ui.internal.dialogs.RegistryPageContributor.isApplicableTo(RegistryPageContributor.java:209)
	at org.eclipse.ui.internal.dialogs.PropertyPageContributorManager.getApplicableContributors(PropertyPageContributorManager.java:199)
	at org.eclipse.ui.dialogs.PropertyDialogAction.hasPropertyPagesFor(PropertyDialogAction.java:104)
	at org.eclipse.ui.dialogs.PropertyDialogAction.isApplicableForSelection(PropertyDialogAction.java:146)
	at org.eclipse.ui.dialogs.PropertyDialogAction.isApplicableForSelection(PropertyDialogAction.java:126)
	at org.eclipse.jdt.ui.actions.OpenViewActionGroup.fillContextMenu(OpenViewActionGroup.java:276)
	at org.eclipse.jdt.ui.actions.NavigateActionGroup.fillContextMenu(NavigateActionGroup.java:105)
	at org.eclipse.jdt.internal.ui.actions.CompositeActionGroup.fillContextMenu(CompositeActionGroup.java:72)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.fillContextMenu(PackageExplorerActionGroup.java:287)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.menuAboutToShow(PackageExplorerPart.java:780)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:338)
	at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:469)
	at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:465)
	at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:491)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:235)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1074)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1055)
	at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:4277)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3980)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:348)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1594)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2032)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4678)
	at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method)
	at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:254)
	at org.eclipse.swt.widgets.Display.runPopups(Display.java:3972)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3518)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2407)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2371)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at com.windriver.ide.application.CopyOfIDEApplication.start(Unknown Source)
	at com.windriver.ide.application.UnifiedSWTSwingApplication.access$4(Unknown Source)
	at com.windriver.ide.application.UnifiedSWTSwingApplication.start(Unknown Source)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1339)
Comment 10 Martin Oberhuber CLA 2010-01-25 15:38:55 EST
I'm not surprised that you cannot reproduce this -- I also do not know how my workspace got into this strange state.

But the point I'm trying to make is: Once the workspace is in this strange state (there are items which are a JavaProject without an underlying IProject), Eclipse should allow me to get rid of these items. 

> Expected behavior: 
> ------------------
> Deleting a project without the "Delete file system resources" switched on only
> unregisters the project from my workspace. This should always succeed
> regardless of whether the unerlying location exists or not.
Comment 11 Olivier Thomann CLA 2010-01-26 17:22:12 EST
(In reply to comment #10)
> But the point I'm trying to make is: Once the workspace is in this strange
> state (there are items which are a JavaProject without an underlying IProject),
> Eclipse should allow me to get rid of these items. 
I understand what you are trying to do. As long as we cannot reproduce this weird state, it is difficult to propose a solution.

> > Expected behavior: 
> > ------------------
> > Deleting a project without the "Delete file system resources" switched on only
> > unregisters the project from my workspace. This should always succeed
> > regardless of whether the underlying location exists or not.
I doubt this is the only reason why this failed. I tried to remove close projects for which I had removed the underlying location and it worked.
Comment 12 Martin Oberhuber CLA 2011-01-05 07:03:04 EST
I think that this is actually a duplicate of bug 333437, which has exact steps to reproduce the problem. The "closed project" is not really a project, but it's a broken reference from a working set in "top level: working sets" mode.

*** This bug has been marked as a duplicate of bug 333437 ***
Comment 13 Markus Keller CLA 2011-01-07 09:53:33 EST
The issue here is that the project does not actually exist, but it's shown in the Package Explorer, because it is in a Resource Working Set. The refactoring has no way to remove this project from the working set, since it only gets a reference to the inexistent project. The right fix is to make sure such invalid references are removed from the working set.
Comment 14 Markus Keller CLA 2011-01-07 09:54:13 EST
Reopening to fix in the ResourceWorkingSetUpdater.
Comment 15 Markus Keller CLA 2011-01-07 09:54:35 EST
Created attachment 186276 [details]
Fix
Comment 16 Markus Keller CLA 2011-01-07 09:57:38 EST
Fixed in HEAD. The bad projects will not be shown in the working set any more.

To manually resolve the problem in older builds, either
- edit the working set (e.g. Package Explorer context menu > Properties) and remove the bad project), or
- drag the project into the "Other Project" working set (that will remove it)
Comment 17 Markus Keller CLA 2011-01-07 09:59:06 EST
Created attachment 186277 [details]
Team Project Set to reproduce the problem
Comment 18 Martin Oberhuber CLA 2011-01-10 06:53:00 EST
(In reply to comment #16)

The first workaround doesn't work, since the bad project ref doesn't appear in the working set Properties.

> - drag the project into the "Other Project" working set (that will remove it)

This works fine.
Comment 19 Markus Keller CLA 2011-01-10 07:06:53 EST
(In reply to comment #18)
> The first workaround doesn't work, since the bad project ref doesn't appear in
> the working set Properties.

Yeah, sorry. But you can check/uncheck another project to cause a dummy change and then click OK.

Probably the easiest solution: Open context menu on bad project(s), choose Assign Working Sets..., click Deselect All, OK.
Comment 20 Markus Keller CLA 2011-01-24 16:56:51 EST
*** Bug 311168 has been marked as a duplicate of this bug. ***
Comment 21 Raksha Vasisht CLA 2011-01-25 06:55:45 EST
Verified for 3.7 M5 with  I20110124-1800.
Comment 22 Jörg Thönnes CLA 2013-04-24 09:32:37 EDT
I happen to have exactly this issue with M2E Maven project and the same workaround. Shall I file a new issue?
Comment 23 Markus Keller CLA 2013-04-24 09:46:20 EDT
> Shall I file a new issue?
Yes. In general, don't reopen bugs that have been closed in a past milestone.

> I happen to have exactly this issue with M2E Maven project and the same
> workaround.
Sounds like it's not exactly this issue, since this issue has been fixed.
In the new bug, please add a screenshot and tell which working set type you use (right-click > Properties).