Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How do I remove a classpath entry from a classpath container initialized by another plugin?
How do I remove a classpath entry from a classpath container initialized by another plugin? [message #902773] Mon, 20 August 2012 11:52
Ricardo Gladwell is currently offline Ricardo GladwellFriend
Messages: 12
Registered: July 2009
Location: London, UK
Junior Member

I'd like to modify a classpath container initialised by another plug-in. Specifically, I'd like to filter/remove certain classpath entries in the "Android Dependencies" classpath container initialized by the Eclipse Android Development Tools plug-in (ADT).

Currently I'm "modifying" the contents by creating a new classpath container, copying the entries I'm interested from the original Android classpath container and then deleting the original:

    final IPath path = new Path(AdtConstants.CONTAINER_LIBRARIES);
    IClasspathContainer container = findClasspathContainer(classpath, path, project);
    MavenLibrariesClasspathContainer newContainer = new MavenLibrariesClasspathContainer("Android Dependencies", path);

     for(IClasspathEntry entry : container.getClasspathEntries()) {
        if(!entry.getPath().toOSString().contains(File.separator + "libs" + File.separator)) {
            newContainer.addClasspathEntry(entry);
        }
    }

    classpath.removeEntry(path);

    JavaCore.setClasspathContainer(
                new Path("me.gladwell.eclipse.m2e.android.LIBRARIES"),
                new IJavaProject[] { project },
                new IClasspathContainer[] { newContainer },
                new NullProgressMonitor()
    );


However, this is buggy and causes the Eclipse workspace to be (temporarily) broken and looks ugly when Eclipse is restarted.

Is there a more seamless way I can remove classpath entries from a classpath container perhaps without having to delete the whole classpath container and replace it?
Previous Topic:Entry point does not exist error in tomcat
Next Topic:Merge gives the possibility to merge again
Goto Forum:
  


Current Time: Fri Apr 19 23:07:56 GMT 2024

Powered by FUDForum. Page generated in 0.02639 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top