I develop plugin to netbeans IDE and i would like to determinate user to select a open projects in netbeans IDE in some action: How it is possible to call this window and get some reason from user action on it?:
I develop plugin to netbeans IDE and i would like to determinate user to select a open projects in netbeans IDE in some action: How it is possible to call this window and get some reason from user action on it?:
I am not really sure what you want to achieve, but you may take a look on the following code:
Lookup gLookup = Utilities.actionsGlobalContext();
Project currentlySelectedProject = gLookup.lookup(Project.class);
// do something with the project, e.g., print out its name
System.out.println(ProjectUtils.getInformation(currentlySelectedProject).getDisplayName());
This code gives you currently selected project in the projects window of NetBeans IDE (therefore the project has to be already open to get it). If you need to follow changes to it, you can add a listener for it:
Lookup.Result<Project> globalResultOBJ = gLookup.lookup(new Lookup.Template(Project.class));
LookupListener globalListenerOBJ = new LookupListener() {
@Override
public void resultChanged(LookupEvent le) {
currentlySelectedProject = genlokup.lookup(Project.class);
// again you can do something with newly selected project
System.out.println(ProjectUtils.getInformation(currentlySelectedProject).getDisplayName());
}
};
globalResultOBJ.addLookupListener(globalListenerOBJ);
This codes will give you access to currently selected project. Is that what you need or dou you want explicitly ask the user to open a new project? Meaning, that you want to programmatically open the run the Open project action?