当前位置: 首页>>代码示例>>Java>>正文


Java ProgressMonitor.beginTask方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.ProgressMonitor.beginTask方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor.beginTask方法的具体用法?Java ProgressMonitor.beginTask怎么用?Java ProgressMonitor.beginTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.ProgressMonitor的用法示例。


在下文中一共展示了ProgressMonitor.beginTask方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: indexAll

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
public Result indexAll(ChangeIndex index) {
  ProgressMonitor pm = new TextProgressMonitor();
  pm.beginTask("Collecting projects", ProgressMonitor.UNKNOWN);
  SortedSet<ProjectHolder> projects = new TreeSet<>();
  int changeCount = 0;
  Stopwatch sw = Stopwatch.createStarted();
  for (Project.NameKey name : projectCache.all()) {
    try (Repository repo = repoManager.openRepository(name)) {
      long size = estimateSize(repo);
      changeCount += size;
      projects.add(new ProjectHolder(name, size));
    } catch (IOException e) {
      log.error("Error collecting projects", e);
      return new Result(sw, false, 0, 0);
    }
    pm.update(1);
  }
  pm.endTask();
  setTotalWork(changeCount);

  return indexAll(index, projects);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:AllChangesIndexer.java

示例2: migrateData

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException {
  try {
    try (Repository repo = repoManager.openRepository(allUsersName)) {
      ProgressMonitor pm = new TextProgressMonitor();
      pm.beginTask("Collecting accounts", ProgressMonitor.UNKNOWN);
      Set<Account> accounts = scanAccounts(db, pm);
      pm.endTask();
      pm.beginTask("Migrating accounts to NoteDb", accounts.size());
      for (Account account : accounts) {
        updateAccountInNoteDb(repo, account);
        pm.update(1);
      }
      pm.endTask();
    }
  } catch (IOException | ConfigInvalidException e) {
    throw new OrmException("Migrating accounts to NoteDb failed", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:Schema_154.java

示例3: migrateData

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try {
    try (Repository repo = repoManager.openRepository(allUsersName)) {
      ProgressMonitor pm = new TextProgressMonitor();
      pm.beginTask("Removing \"My Drafts\" menu items", ProgressMonitor.UNKNOWN);
      for (Account.Id id : (Iterable<Account.Id>) Accounts.readUserRefs(repo)::iterator) {
        if (removeMyDrafts(repo, id)) {
          pm.update(1);
        }
      }
      pm.endTask();
    }
  } catch (IOException | ConfigInvalidException e) {
    throw new OrmException("Removing \"My Drafts\" menu items failed", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:Schema_160.java

示例4: doImport

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
public void doImport(ProgressMonitor progress) throws Exception {
  MetaDataUpdate md = null;
  try {
    md = metaDataUpdateFactory.create(getProjectNameKey());
    projectConfig = ProjectConfig.read(md);
    progress.beginTask("Configure Gerrit project", 2);
    setProjectSettings();
    progress.update(1);
    setProjectPermissions();
    progress.update(1);
    md.setMessage("Imported from " + getSourceUri());
    projectConfig.commit(md);
    projectCache.onCreateProject(getProjectNameKey());
  } finally {
    if (md != null) {
      md.close();
    }
    progress.endTask();
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:22,代码来源:CreateProjectStep.java

示例5: run

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
public int run() throws Exception {
  mustHaveValidSite();

  Injector dbInjector = createDbInjector(SINGLE_USER);
  manager.add(dbInjector);
  manager.start();
  RuntimeShutdown.add(manager::stop);
  dbInjector.injectMembers(this);

  ProgressMonitor progress = new TextProgressMonitor();
  progress.beginTask("Importing entities", ProgressMonitor.UNKNOWN);
  try (ReviewDb db = schemaFactory.open()) {
    for (RelationModel model : new JavaSchemaModel(ReviewDb.class).getRelations()) {
      relations.put(model.getRelationID(), Relation.create(model, db));
    }

    Parser<UnknownFieldSet> parser = UnknownFieldSet.getDefaultInstance().getParserForType();
    try (InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) {
      UnknownFieldSet msg;
      while ((msg = parser.parseDelimitedFrom(in)) != null) {
        Map.Entry<Integer, UnknownFieldSet.Field> e =
            Iterables.getOnlyElement(msg.asMap().entrySet());
        Relation rel =
            checkNotNull(
                relations.get(e.getKey()),
                "unknown relation ID %s in message: %s",
                e.getKey(),
                msg);
        List<ByteString> values = e.getValue().getLengthDelimitedList();
        checkState(values.size() == 1, "expected one string field in message: %s", msg);
        upsert(rel, values.get(0));
        progress.update(1);
      }
    }
    progress.endTask();
  }

  return 0;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:41,代码来源:ProtobufImport.java

示例6: collectProjects

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
private List<Project.NameKey> collectProjects(ProgressMonitor progress) {
  progress.beginTask("Collecting projects", ProgressMonitor.UNKNOWN);
  List<Project.NameKey> names = new ArrayList<>();
  for (Project.NameKey nameKey : projectCache.all()) {
    names.add(nameKey);
  }
  progress.endTask();
  return names;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:AllProjectsIndexer.java

示例7: collectGroups

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
private List<AccountGroup.UUID> collectGroups(ProgressMonitor progress) throws OrmException {
  progress.beginTask("Collecting groups", ProgressMonitor.UNKNOWN);
  try (ReviewDb db = schemaFactory.open()) {
    return groups.getAllUuids(db).collect(toImmutableList());
  } finally {
    progress.endTask();
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:AllGroupsIndexer.java

示例8: collectAccounts

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
private List<Account.Id> collectAccounts(ProgressMonitor progress) throws IOException {
  progress.beginTask("Collecting accounts", ProgressMonitor.UNKNOWN);
  List<Account.Id> ids = new ArrayList<>();
  for (Account.Id accountId : accounts.allIds()) {
    ids.add(accountId);
    progress.update(1);
  }
  progress.endTask();
  return ids;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:AllAccountsIndexer.java

示例9: doImport

import org.eclipse.jgit.lib.ProgressMonitor; //导入方法依赖的package包/类
@Override
public void doImport(ProgressMonitor progress) throws Exception {
  progress.beginTask("Setting up Gerrit replication", 2);

  String repositoryName = getOrganisation() + "/" + getRepositoryName();
  progress.update(1);
  replicationConfig.addSecureCredentials(authUsername, authToken);
  progress.update(1);
  replicationConfig.addReplicationRemote(
      authUsername, gitHubUrl + "/${name}.git", repositoryName);
  progress.endTask();
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:13,代码来源:ReplicateProjectStep.java


注:本文中的org.eclipse.jgit.lib.ProgressMonitor.beginTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。