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 102465

Summary: Select main project
Product: projects Reporter: Padraig Obriain <padraigob>
Component: Generic Projects UIAssignee: Jesse Glick <jglick>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: jrice
Priority: P3 Keywords: API
Version: 6.x   
Hardware: Sun   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Padraig Obriain 2007-04-25 11:21:26 UTC
In the Mercurial plugin when we clone a repository we set a project in the
cloned repository as the main project. 

We would like the new main project to be also selected.

We cannot find an API to do this.
Comment 1 Jan Lahoda 2007-04-25 11:26:00 UTC
org.netbeans.api.project.ui.OpenProjects.setMainProject? (in module
projects/projectuiapi)
Comment 2 Padraig Obriain 2007-04-25 11:38:42 UTC
We call setMainProject but that does not select the project.
Comment 3 Jan Lahoda 2007-04-25 11:44:16 UTC
Ok, I misunderstood the request, sorry.
Comment 4 John Rice 2007-04-25 13:28:13 UTC
Yep this is the API. What we want is on making the setMainProject call is to
have selection set to the project we have just set as our main project. An
option to expand it one or more levels would be nice as well, but the key for us
is to have the selection set to this project. Seems like reasonable default
behaviour, but could always add a setSelection flag if you didn't want this to
be the default.

org.netbeans.api.project.ui.OpenProjects:

Code snippet:
    public static void openProject(Project p, Object caller) {
        Project[] projects = new Project[] {p};
        OpenProjects.getDefault().open(projects, false);
        OpenProjects.getDefault().setMainProject(p);
 }
Comment 5 log111 2009-08-01 04:27:19 UTC
I think it's useless to have "set as Main project". I find that when you select none project as "Main one", then the "Run" icon in the tool bar just recognize the 
project you select as the option. It is enough to do so. 

Also, when you select a project as "Main project" using the right-click menu, you just cannot degrade it as "none Main project" by right-clicking. You must 
use "Run" in the menu bar. Even than, there is a small bug that when you select "NONE" in the "Set Main Project", the current Main one won't be degraded until 
you de-select all the items in the sub-menu "Set Main Project".
Comment 6 Jesse Glick 2010-05-04 23:04:23 UTC

*** This bug has been marked as a duplicate of bug 7551 ***