本文整理汇总了Java中org.eclipse.egit.github.core.service.LabelService类的典型用法代码示例。如果您正苦于以下问题:Java LabelService类的具体用法?Java LabelService怎么用?Java LabelService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LabelService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了LabelService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
public boolean connect(String username, String password){
this.username=username;
client = new GitHubClient();
client.setCredentials(username, password);
repoService = new MyRepositoriesService(client);
userService = new UserService(client);
issueService = new IssueService(client);
milestoneService = new MilestoneService(client);
labelService = new LabelService(client);
commitService = new CommitService(client);
markdownService = new MarkdownService(client);
colaboratorService = new CollaboratorService(client);
contentsService = new ContentsService(client);
try {
loadInformations();
return true;
} catch (IOException e) {
mainApp.writeNotification(e.getMessage());
return false;
}
}
示例2: makeOrGetReviewRequestLabel
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
private Label makeOrGetReviewRequestLabel(GitHubClient client, Repo repo) {
Label reviewRequestLabel = new Label().setColor("009800").setName("Review Request");
LabelService labelService = new LabelService(client);
try {
reviewRequestLabel = labelService.getLabel(repo.repoOwner, repo.repoName, "Review Request");
} catch(IOException e) {
System.out.println("Review Request Label not found. Going to create it");
try {
reviewRequestLabel = labelService.createLabel(repo.repoOwner, repo.repoName, reviewRequestLabel);
} catch (IOException e1) {
e1.printStackTrace(); //this is a bigger problem
}
}
return reviewRequestLabel;
}
示例3: createCustomLabels
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
private List<Label> createCustomLabels(GitHubClient client) {
List<Label> labels = new ArrayList<>();
LabelService labelService = new LabelService(client);
for (String customLabel : customLabelStrings) {
Label newLabel = new Label().setColor(randomColor()).setName(customLabel);
try {
Label alreadyExistingLabel = labelService.getLabel(repo.repoOwner, repo.repoName, customLabel);
labels.add(alreadyExistingLabel);
} catch(IOException e) {
System.out.println("new label " +customLabel + " not found. Going to create it");
try {
newLabel = labelService.createLabel(repo.repoOwner, repo.repoName, newLabel);
} catch (IOException e1) {
e1.printStackTrace(); //this is a bigger problem
}
labels.add(newLabel);
}
}
return labels;
}
示例4: getLabelStartsWith
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
private static Label getLabelStartsWith(GitHubClient client, RepositoryId repositoryId,
String startsWith) throws IOException {
LabelService lservice = new LabelService(client);
for (Label label : lservice.getLabels(repositoryId)) {
if (label.getName().startsWith(startsWith)) {
return label;
}
}
return null;
}
示例5: changeLabelName
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
public static void changeLabelName(GitHubClient client, RepositoryId repositoryId,
String labelName, String changedName) throws IOException {
LabelService lservice = new LabelService(client);
IssueService iservice = new IssueService(client);
Label label = lservice.getLabel(repositoryId, labelName.replace(" ", "%20"));
System.out.println(label.getName());
// Create the label with the changed name
Label changedLabel = new Label();
changedLabel.setName(changedName);
changedLabel.setColor(label.getColor());
changedLabel = lservice.createLabel(repositoryId, changedLabel);
// find issues with the existing label
Map<String, String> filterData = new HashMap<String, String>();
filterData.put(IssueService.FILTER_LABELS, label.getName());
List<Issue> issues = iservice.getIssues(repositoryId, filterData);
// label each issue with the changed label
for (Issue issue : issues) {
System.out.println(issue.getTitle());
List<Label> labels = issue.getLabels();
// delete the existing label
for (Iterator<Label> iter = labels.listIterator(); iter.hasNext();) {
Label l = iter.next();
if (l.getName().equals(labelName))
iter.remove();
}
// add the new changed label
labels.add(changedLabel);
issue.setLabels(labels);
iservice.editIssue(repositoryId, issue);
System.out.println(labels.toString());
}
// delete the existing label
lservice.deleteLabel(repositoryId, labelName.replace(" ", "%20"));
}
示例6: LabelsDialog
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
/**
* Create dialog helper to display labels
*
* @param activity
* @param requestCode
* @param repository
* @param service
*/
public LabelsDialog(final DialogFragmentActivity activity,
final int requestCode, final IRepositoryIdProvider repository,
final LabelService service) {
this.activity = activity;
this.requestCode = requestCode;
this.repository = repository;
this.service = service;
}
示例7: getLabelByName
import org.eclipse.egit.github.core.service.LabelService; //导入依赖的package包/类
private static Label getLabelByName(GitHubClient client, RepositoryId repositoryId,
String labelName) throws IOException {
LabelService lservice = new LabelService(client);
return lservice.getLabel(repositoryId, labelName.replace(" ", "%20"));
}