Eclipse plugin: checking selected project closed or open

I've created a plugin that asks for the selected project name and path. Here is the code:

IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection();
Object firstElement = selection.getFirstElement();
if (firstElement != null) {
    if (firstElement instanceof IAdaptable) {
        IProject project = (IProject) ((IAdaptable) firstElement).getAdapter(IProject.class);
        IPath path = project.getFullPath();
        IPath location = project.getLocation();
    }
}

      

But how can I check if the selected project is closed or open?

+3


source to share


1 answer


IProject

has a method isOpen()

. This will show you if the project is open.



+2


source







All Articles