Search in sources :

Example 1 with Reference

use of org.eclipse.egit.github.core.Reference in project Bitocle by mthli.

the class RepoContentTask method doInBackground.

@Override
protected Boolean doInBackground(Void... params) {
    if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
        String master = "heads/master";
        RepositoryId id = RepositoryId.create(owner, name);
        Reference ref;
        String sha;
        if (!fragment.isToggle()) {
            try {
                ref = dataService.getReference(id, master);
            } catch (IOException i) {
                return false;
            }
            sha = ref.getObject().getSha();
            if (isCancelled()) {
                return false;
            }
        } else {
            sha = fragment.getBookmarkItem().getSha();
        }
        try {
            root = dataService.getTree(id, sha, true);
        } catch (IOException i) {
            return false;
        }
    }
    if (isCancelled()) {
        return false;
    }
    return true;
}
Also used : Reference(org.eclipse.egit.github.core.Reference) IOException(java.io.IOException) RepositoryId(org.eclipse.egit.github.core.RepositoryId)

Example 2 with Reference

use of org.eclipse.egit.github.core.Reference in project Bitocle by mthli.

the class StarContentTask method doInBackground.

@Override
protected Boolean doInBackground(Void... params) {
    if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
        String master = "heads/master";
        RepositoryId id = RepositoryId.create(owner, name);
        Reference ref;
        String sha;
        if (!fragment.isToggle()) {
            try {
                ref = dataService.getReference(id, master);
            } catch (IOException i) {
                return false;
            }
            sha = ref.getObject().getSha();
            if (isCancelled()) {
                return false;
            }
        } else {
            sha = fragment.getBookmarkItem().getSha();
        }
        try {
            root = dataService.getTree(id, sha, true);
        } catch (IOException i) {
            return false;
        }
    }
    if (isCancelled()) {
        return false;
    }
    return true;
}
Also used : Reference(org.eclipse.egit.github.core.Reference) IOException(java.io.IOException) RepositoryId(org.eclipse.egit.github.core.RepositoryId)

Aggregations

IOException (java.io.IOException)2 Reference (org.eclipse.egit.github.core.Reference)2 RepositoryId (org.eclipse.egit.github.core.RepositoryId)2