This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253371 - Optionally disable CloseProject action for RCP applications
Summary: Optionally disable CloseProject action for RCP applications
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P4 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-08 18:49 UTC by heithecker
Modified: 2015-07-08 18:52 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description heithecker 2015-07-08 18:49:25 UTC
Contrary to all other project sensitive actions, by default org.netbeans.modules.project.ui.actions.CloseProject is always enabled, i.e. it does not check for the project action command "close" to be present. 

In a netbeans RCP application not related to programming we use the project api to group files and nodes thematically. Some projects are "build-in" projects, which are ensured to be open after start up and should never be closed. For simplicity the correspondig project folders reside inside the config file system. If the user, however, inadvertently closes a project, he or she either has to restart the application or navigate with the open project action to the config file system, which is not desirable because difficult to communicate. 

This approach could be appropriate for other netbeans RCP applications too, so I propose to make closing of projects conditional, i.e. optionally require an explicit close command. In fact, this would only mean changing a few lines of code in class org.netbeans.modules.project.ui.actions.CloseProject (as far as I understand):

static boolean requireCloseCommand = Boolean.valueOf(System.getProperty("require.project.close.action", "false"));
....
    @Override
    protected void actionPerformed( final Lookup context ) {
.......
String cmd = requireCloseCommand ? "close" : null;
        Project[] projects = ActionsUtil.getProjectsFromLookup( context, cmd );        
.....
    }
    
    @Override
    public void refresh(Lookup context, boolean immediate) {
        
        super.refresh(context, immediate);

        String cmd = requireCloseCommand ? "close" : null;
        Project[] projects = ActionsUtil.getProjectsFromLookup( context, cmd );
 .....      
    }

For now, we override CloseProject and also its registry (ProjectActions) but this means that we need an implementation dependency, which is not preferrable.

Boris