[MODULE]Get main project and get its git information

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[MODULE]Get main project and get its git information

Gabriele
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault().getMainProject();
 projects = project == null ? OpenProjects.getDefault().getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p);
   System.out.println(info.getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that.
Can anyone set me in the right direction?




Reply | Threaded
Open this post in threaded view
|

Re: [MODULE]Get main project and get its git information

Benno Markiewicz
What do you think is the main project? The main can be set via Run->Set Main Project 

I guess this info not what you to read. So what is the use case behind your question? 

Den 2 feb. 2017 14:00 skrev "Gabriele" <[hidden email]>:
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault().getMainProject();
 projects = project == null ? OpenProjects.getDefault().getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p);
   System.out.println(info.getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that.
Can anyone set me in the right direction?




Reply | Threaded
Open this post in threaded view
|

Re: [MODULE]Get main project and get its git information

Benno Markiewicz
I read your mail again. Have a look at my old Plugin https://github.com/markiewb/nb-git-branch-in-statusbar



Den 2 feb. 2017 19:28 skrev "Benno Markiewicz" <[hidden email]>:
What do you think is the main project? The main can be set via Run->Set Main Project 

I guess this info not what you to read. So what is the use case behind your question? 

Den 2 feb. 2017 14:00 skrev "Gabriele" <[hidden email]>:
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault().getMainProject();
 projects = project == null ? OpenProjects.getDefault().getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p);
   System.out.println(info.getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that.
Can anyone set me in the right direction?




Reply | Threaded
Open this post in threaded view
|

Re: [MODULE]Get main project and get its git information

Brett Ryan
In reply to this post by Benno Markiewicz
I think the assumption would be that it would return itself if there is no main project set?

Is this true for maven projects though? You can not set the main so should it return the parent or should a main be set?

On 3 Feb 2017, at 05:28, Benno Markiewicz <[hidden email]> wrote:

What do you think is the main project? The main can be set via Run->Set Main Project 

I guess this info not what you to read. So what is the use case behind your question? 

Den 2 feb. 2017 14:00 skrev "Gabriele" <[hidden email]>:
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault().getMainProject();
 projects = project == null ? OpenProjects.getDefault().getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p);
   System.out.println(info.getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that.
Can anyone set me in the right direction?




Reply | Threaded
Open this post in threaded view
|

Re: [MODULE]Get main project and get its git information

S M-5
please forward all future [nbdev] comments to [hidden email]. Please remove [hidden email] from your correspondence. Regards. Steve Metz



From: Brett Ryan <[hidden email]>
To: [hidden email]
Sent: Thursday, February 2, 2017 11:41 AM
Subject: [nbdev] Re: [MODULE]Get main project and get its git information

I think the assumption would be that it would return itself if there is no main project set?

Is this true for maven projects though? You can not set the main so should it return the parent or should a main be set?

On 3 Feb 2017, at 05:28, Benno Markiewicz <[hidden email]> wrote:

What do you think is the main project? The main can be set via Run->Set Main Project 

I guess this info not what you to read. So what is the use case behind your question? 

Den 2 feb. 2017 14:00 skrev "Gabriele" <[hidden email]>:
I'm using this code to get the selected project, but getMainProject always returns null so it falls back to getting all projects.

Code:
 Project[] projects;
 Project project = OpenProjects.getDefault(). getMainProject();
 projects = project == null ? OpenProjects.getDefault(). getOpenProjects() : new Project[]{project};
 for (Project p : projects) {
   ProjectInformation info = ProjectUtils.getInformation(p) ;
   System.out.println(info. getName());
 }



After that, I want to extract the project's credentials and info to connect to the repository. I couldn't find any example or hint on how to do that.
Can anyone set me in the right direction?