Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Re: createCDTProject Complains About Path Overlap

Hi Karol,

>/home/kka34/runtime-EclipseApplication/TestProject overlaps the
location of another project: 'TestProject'.
> Any ideas on what could be wrong?

The resource APIs are a bit tricky here.  When you create a new project,
you should specify the project location as null if you want it to go in
the default location -- i.e., <workspace root> / <project name>.  

Only use IProjectDescription#setLocation[URI]() to set a non-null
location if it *won't* live in that default location, otherwise you'll
get the "overlapping location" error.

-- Ed

-----Original Message-----
From: Karol Krizka [mailto:kkrizka@xxxxxxxxx] 
Sent: Tuesday, July 08, 2008 3:50 PM
To: CDT General developers list.
Subject: [cdt-dev] Re: createCDTProject Complains About Path Overlap

My appologies, but GMail sent this email before I was finished. Below is
the entire email.

Hi,

I am trying to programitically create an new managed make project and
after poking around the CDT New Project Wizards I came up with the code
at the end of the post. The problem is that the
createCDTProject() function complains about a location overlap with an
existing project:
/home/kka34/runtime-EclipseApplication/TestProject overlaps the location
of another project: 'TestProject'.
I am not sure why I am getting this error, because I have not even
touched the repoLocation variables before using it in this function.
Any ideas on what could be wrong?

Cheers,
Karol Krizka

//Get the location for the project
FileSystemConfiguration
fsconfig=FileSystemSupportRegistry.getInstance().getDefaultConfiguration
();
IPath wsPath=Platform.getLocation();
URI
location=fsconfig.getContributor().getURI(wsPath.toOSString()+"/"+repoLo
cation);

//Create CDT project...
IProject newProject=null;
IProjectType
pt=ManagedBuildManager.getExtensionProjectType("cmtplugin.projectType");

IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot
root = workspace.getRoot();

final IProject newProjectHandle = root.getProject(repoLocation);

if (!newProjectHandle.exists()) {
IProjectDescription description =
workspace.newProjectDescription(newProjectHandle.getName());
                       if(location != null)
                               description.setLocationURI(location);

                       try
                       {
                               newProject =
CCorePlugin.getDefault().createCDTProject(description,
newProjectHandle, new NullProgressMonitor());
                       }
                       catch(CoreException e)
                       {
                               e.printStackTrace();
                               return null;
                       }
               }



Back to the top