eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
81 stars 188 forks source link

Always remove deleted projects from working sets #2250

Open HannesWell opened 2 months ago

HannesWell commented 2 months ago

Suggestion

If I delete a project from the disk via the package explorer it often happens it remains as closed project in the working set it was assigned too. This is especially annoying because I then cannot delete the project from the working set because the dialog then says that the project does not exist anymore and therefore cannot be deleted. A workaround seems to be to explicitly remove the project from the working sets (e.g. in its properties).

Ideally the latter would always happen automatically when a project is deleted.

Community

jukzi commented 2 months ago

duplicate of https://github.com/eclipse-platform/eclipse.platform/issues/1074 ?

iloveeclipse commented 2 months ago

Interestingly, I always (since years) work with working sets and never needed to delete any project from working set after project deletion.

I guess it's not about working sets, but about projects remaining "known" by the workspace after they were deleted outside of Eclipse and so shown in all "explorers"?

HannesWell commented 1 month ago

duplicate of eclipse-platform/eclipse.platform#1074 ?

Not exactly, but it happens in the same scenario. While it is probably makes sense to work on both at the same time, this is only about projects removed from the file-system staying in working sets.

I guess it's not about working sets, but about projects remaining "known" by the workspace after they were deleted outside of Eclipse and so shown in all "explorers"?

As far as I can tell from my experiments the projects are not displayed when e.g. the Package-Explorer is configured to have project's as top level elements. But they remain present if working sets are selected as top level elements and I still can remove them from the configuration of the working set in its settings.

jim-zy commented 1 month ago

I'm working on this

HannesWell commented 1 month ago

I'm working on this

Great. You are one of the students from CodeDays, aren't you?

Much success on this task and don't hesitate to ask for help if you need any.

A-Lauper commented 2 weeks ago

Hi, I am part of Jim’s student team with CodeDay. Thank you for your words of encouragement. I am having difficulty reproducing the issue as I understand it.

What I have tried:

Attempt 1 Set the Package Explorer top level elements to “working sets”. Delete from disk a project assigned to a working set through the Package Explorer in Eclipse. The project appears to have been removed from the working set. Video: https://www.youtube.com/watch?v=uq35eJurQW8

Attempt 2 Delete a project from the system file explorer outside of Eclipse. The project remains in the working set. If I refresh the Package Explorer, it detects that the project has been deleted and prompts to delete the project from the workspace. Video: https://www.youtube.com/watch?v=FeAUICRkyxY

I have attempted with both Java and Resource working sets and have had the same results.

To clarify, is the issue that projects are not automatically removed from the workspace when deleted outside of Eclipse, or is the issue directly related to when projects are deleted through the Package Explorer in Eclipse?

Build Id Information: Eclipse Platform Version: 2024-12 (4.34) Build id: I20241016-2000 OS: Windows 11, v.10.0, x86_64 / win32 Java vendor: Oracle Corporation Java runtime version: 17.0.11+7-LTS-207 Java version: 17.0.11

Thank you!

jim-zy commented 2 weeks ago

I'm working on this

Great. You are one of the students from CodeDays, aren't you?

Much success on this task and don't hesitate to ask for help if you need any.

Hi, we found the same issue when deleting plug-in projects from a plug-in working set, the project remains in the working set after deleted in the package explorer, did you encounter the issue with plug-in project? @HannesWell

HannesWell commented 1 week ago

Sorry for the delayed reply.

I'm working on this

Great. You are one of the students from CodeDays, aren't you? Much success on this task and don't hesitate to ask for help if you need any.

Hi, we found the same issue when deleting plug-in projects from a plug-in working set, the project remains in the working set after deleted in the package explorer, did you encounter the issue with plug-in project? @HannesWell

Great! Yes I encountered this problem with a Plug-in project (i.e. with a project that has PDE's nature org.eclipse.pde.PluginNature specified in the .project file. I haven't tested it with projects that don't have that nature. Can you check if the nature makes a difference? If yes that could already be a strong hint for the underlying cause.

jim-zy commented 1 week ago

Sorry for the delayed reply.

I'm working on this

Great. You are one of the students from CodeDays, aren't you? Much success on this task and don't hesitate to ask for help if you need any.

Hi, we found the same issue when deleting plug-in projects from a plug-in working set, the project remains in the working set after deleted in the package explorer, did you encounter the issue with plug-in project? @HannesWell

Great! Yes I encountered this problem with a Plug-in project (i.e. with a project that has PDE's nature org.eclipse.pde.PluginNature specified in the .project file. I haven't tested it with projects that don't have that nature. Can you check if the nature makes a difference? If yes that could already be a strong hint for the underlying cause.

Yes, the nature matters and a Java project could be deleted automatically from the working set. Also, I found that the PDE related problem you mentioned could be solved if you press F5 as the refresh button in the project explorer, then the project that was deleted from the package explorer will disappear. So this could be a UI problem.

HannesWell commented 1 week ago

I also did some experiments and for me the nature of the project didn't made a difference.

In general the modification of working-sets seems not to work well, even additions didn't always work in my workspace with many working sets and many projects and not the creation of the working sets themself was displayed in the Package Explorer immediately.

But since I couldn't create the working-set or project a second time, then the error was that it already exists, I agree that it's probably a UI problem.

One cause could maybe also be that the org.eclipse.ui.navigator.resources.ProjectExplorer provided by eclipse.platform.ui and the org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart provided by eclipse.jdt.ui interfere somehow.

Maybe you can check those two classes if they might interfere or if they are maybe not correctly updated if the underlying resource model changes?

freyajiang commented 1 week ago

just discovered that deleting projects from the Package Explorer triggers the removeWorkingSet(IWorkingSet workingSet) function in the codebase. This might be a useful starting point for addressing the issue at hand