Example usage for org.eclipse.jdt.internal.core UserLibraryManager getUserLibrary

List of usage examples for org.eclipse.jdt.internal.core UserLibraryManager getUserLibrary

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core UserLibraryManager getUserLibrary.

Prototype

public synchronized UserLibrary getUserLibrary(String libName) 

Source Link

Usage

From source file:net.rim.ejde.internal.util.WorkspaceDependencyUtils.java

License:Open Source License

/**
 * Generates a valid name of the BlackBerry user library for the given <code>workspaceName</code>.
 *
 * @param workspaceName//from   w  w w .ja va  2  s .c  o  m
 * @return
 */
static public String generateBBLibName(String workspaceName) {
    UserLibraryManager userLibMgr = JavaModelManager.getUserLibraryManager();
    UserLibrary rimLibs;
    String libName = BLACIBERRY_LIB_PREFIX + workspaceName;
    for (int i = 1; i < 100; i++) {
        rimLibs = userLibMgr.getUserLibrary(libName);
        if (rimLibs != null) {
            libName = BLACIBERRY_LIB_PREFIX + workspaceName + "_" + i;
        } else {
            return libName;
        }
    }

    return IConstants.EMPTY_STRING;
}

From source file:net.rim.ejde.internal.util.WorkspaceDependencyUtils.java

License:Open Source License

/**
 *
 * @param classPathEntries/*from   w  w w  .  java 2s.co m*/
 * @param userLibrary
 * @throws CoreException
 *
 */
static public void storeDependenciesAsUserLibrary(IClasspathEntry[] classPathEntries, String userLibrary)
        throws CoreException {
    if (classPathEntries == null || classPathEntries.length == 0) {
        return;
    }
    UserLibraryManager userLibMgr = JavaModelManager.getUserLibraryManager();
    UserLibrary rimLibs = userLibMgr.getUserLibrary(userLibrary);

    boolean isSysLib = false;

    if (rimLibs != null) {
        // this should not happen
        throw new CoreException(StatusFactory.createErrorStatus("BlackBerry user library already exist."));
    }

    String classpathEntriesSequence = "";

    for (IClasspathEntry classpathEntry : classPathEntries) {
        classpathEntriesSequence = "<" + classpathEntry.toString() + ">";
    }

    _log.debug("Storing User-Library [" + userLibrary + "] as [" + classpathEntriesSequence + "]");

    userLibMgr.setUserLibrary(userLibrary, classPathEntries, isSysLib);
}

From source file:net.rim.ejde.internal.util.WorkspaceDependencyUtils.java

License:Open Source License

/**
*
*///from w w w.  j  a  va 2  s  .co  m
static public IClasspathEntry[] getClasspathEntriesForUserLibrary(String userLibrary) {
    IClasspathEntry[] result = null;

    UserLibraryManager userLibMgr = JavaModelManager.getUserLibraryManager();
    UserLibrary rimLibs = userLibMgr.getUserLibrary(userLibrary);

    if (null == rimLibs)
        return new IClasspathEntry[] {};

    result = rimLibs.getEntries();

    if (0 < result.length)
        return result;

    return new IClasspathEntry[] {};
}

From source file:org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig.java

License:Open Source License

/**
 * Resolve the referenced user libraries into a collection of classpath entries that reference
 * physical libraries. //  w  ww. jav a2s  .co  m
 * 
 * @return the classpath entries contributed by the referenced user libraries
 */

public synchronized Collection<IClasspathEntry> resolve() {
    final List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
    final UserLibraryManager userLibraryManager = JavaModelManager.getUserLibraryManager();

    for (String libraryName : this.libraryNames) {
        final UserLibrary userLibrary = userLibraryManager.getUserLibrary(libraryName);

        if (userLibrary != null) {
            for (IClasspathEntry cpe : userLibrary.getEntries()) {
                entries.add(cpe);
            }
        }
    }

    return Collections.unmodifiableCollection(entries);
}

From source file:org.eclipse.jst.common.project.facet.ui.libprov.user.internal.DownloadLibraryWizardMainPage.java

License:Open Source License

private static boolean isUserLibraryDefined(final String name) {
    final UserLibraryManager userLibraryManager = JavaModelManager.getUserLibraryManager();
    return (userLibraryManager.getUserLibrary(name) != null);
}