Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Widget disposed when using DeleteResourceAction(Trying to use an instance of DeleteResourceAction to utilise eclipse's standard project deletion)
Widget disposed when using DeleteResourceAction [message #1797116] Thu, 25 October 2018 14:12
Rob D is currently offline Rob DFriend
Messages: 1
Registered: October 2018
Junior Member
Hi all,

This is my first post here. I considered posting my question on stack overflow, but I thought I might find more specialist knowledge here.

My question is: How can I use an instance of DeleteResourceAction to utilise eclipse's standard project deletion?

I have an eclipse view, and in it, various items can be selected in a jface treeviewer. These items come from various sources - they could be a database entry, or backed by an eclipse `Resource`.

The user can remove items in the view. If the selection contains one or more projects, then when the user tries to remove the project(s), this code is used to remove them:

    List<TreeThing> projectsToDelete = myTreeViewer.getSelectedProjects(); //TreeThings are IAdaptable to IResource
    IShellProvider sp = new IShellProvider() {
        public Shell getShell() {
                return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    SelectionListenerAction deleteProjectsAction = new DeleteResourceAction( sp );
    deleteProjectsAction.selectionChanged( new StructuredSelection( projectsToDelete ) );;

This works as I expected under Windows - a dialog appears asking if the user wants to remove the project from disk, and pressing OK will perform the correct action. However, on Linux, a Widget Is Disposed Exception is thrown and the project remains on disk and in the workspace. Have I found a bug, or am I missing something I'm meant to be doing?

The widget which is disposed is, I believe, the activeShell, as retrieved fromthe ExecutionContext of an event. However, I can't see how my code can provide anything to avoid this - it provides a valid shellprovider which gives a valid shell, but this shellprovider is not used, and I have no control over the creation or handling of the event in which the activeshell is already disposed.

I will attach a stack trace, but must do so from another machine.

Many thanks in advance for any guidance.

Previous Topic:How do I create a JUnit5 Test Suite in Eclipse?
Next Topic:Changing locale in JVM?
Goto Forum:

Current Time: Sun Mar 03 10:24:50 GMT 2024

Powered by FUDForum. Page generated in 0.03748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top