Search in sources :

Example 1 with FileListingService

use of com.android.ddmlib.FileListingService in project android by JetBrains.

the class AndroidDataSourcePropertiesDialog method loadDatabases.

private void loadDatabases(@NotNull IDevice device) {
    myDatabaseMap.clear();
    final FileListingService service = device.getFileListingService();
    if (service == null)
        return;
    final Set<String> packages = new HashSet<String>();
    for (AndroidFacet facet : ProjectFacetManager.getInstance(myProject).getFacets(AndroidFacet.ID)) {
        final Manifest manifest = facet.getManifest();
        if (manifest != null) {
            final String aPackage = manifest.getPackage().getStringValue();
            if (aPackage != null && aPackage.length() > 0) {
                packages.add(aPackage);
            }
        }
    }
    if (packages.isEmpty())
        return;
    final long startTime = System.currentTimeMillis();
    boolean tooLong = false;
    for (String aPackage : packages) {
        myDatabaseMap.put(aPackage, tooLong ? Collections.<String>emptyList() : loadDatabases(device, aPackage));
        if (System.currentTimeMillis() - startTime > 4000) {
            tooLong = true;
        }
    }
}
Also used : FileListingService(com.android.ddmlib.FileListingService) Manifest(org.jetbrains.android.dom.manifest.Manifest) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) HashSet(com.intellij.util.containers.HashSet)

Aggregations

FileListingService (com.android.ddmlib.FileListingService)1 HashSet (com.intellij.util.containers.HashSet)1 Manifest (org.jetbrains.android.dom.manifest.Manifest)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1