Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] get artifact name and getProjet return null

Hi, I am new to this list and new to CDT plug-in development and have some questions and hope I can get some answers or hints where to find answers.

Question 1
I want to get the artifact name and the arguments for the active project.
I have found that this information is stored in .metadata/.plugins/org.eclipse.debug.core/.launches/{project_name}.launch
(org.eclipse.cdt.launch.PROGRAM_ARGUMENTS and org.eclipse.cdt.launch.PROGRAM_NAME) but I can not see how to get this information from the API.

Question 2
Using the following function to get the active project will always return null, is this a bug or do I use it incorrect?

IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject();

For now I use this method, but it is far from perfect since I need to close all the other projects.

IProject[] myproject = ResourcesPlugin.getWorkspace().getRoot().getProjects();
  IProject project = null;
  for(int i = 0; i < myproject.length; i++) {
    if( myproject[i].isOpen()) {
      project = myproject[i];
      continue;
    }
}

/Mikael

Back to the top