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


Java Label.setName方法代码示例

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


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

示例1: changeLabelName

import org.eclipse.egit.github.core.Label; //导入方法依赖的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"));
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:39,代码来源:IssueManagement.java

示例2: labelRepoId

import org.eclipse.egit.github.core.Label; //导入方法依赖的package包/类
@Test
public void labelRepoId() {
    Label label = new Label();
    label.setName("test label");
    label.setColor("ffffff");
    TurboLabel turboLabel = new TurboLabel("dummy/dummy", label);
    assertEquals("dummy/dummy", turboLabel.getRepoId());

}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:10,代码来源:TurboLabelTest.java

示例3: createIssue

import org.eclipse.egit.github.core.Label; //导入方法依赖的package包/类
private void createIssue(Repo repo, PdfComment comment, IssueService issueService, List<Label> customLabels) throws IOException {
    Issue issue = new Issue();
    issue.setTitle(comment.getTitle());
    
    String body = comment.getComment();
    try {
        String imageURL = ImageUtils.uploadPhoto(comment.getImage());
        body = String.format("![snippet](%s)%n%n%s", imageURL, body);
    } catch (IOException e) {
        e.printStackTrace();
        // could not upload image, but carry on anyway
    }
    
    issue.setBody(body); 
    List<Label> newLabels = new ArrayList<>(customLabels);
    //add tags to labels
    for(Tag tag : comment.getTags()) {
    	Label label = new Label();
    	label.setName(tag.name());     // these tags are, by default, the normal grey color.  
    	newLabels.add(label);             // User can change these to the severity whey want
    }
    
    issue.setLabels(newLabels);
    //creates an issue remotely
    issue = issueService.createIssue(repo.repoOwner, repo.repoName, issue);
    comment.setIssueNumber(issue.getNumber());
}
 
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:28,代码来源:ReviewSubmitServlet.java

示例4: updateIssue

import org.eclipse.egit.github.core.Label; //导入方法依赖的package包/类
private void updateIssue(Repo repo, PdfComment comment, IssueService issueService)
        throws IOException {
    System.out.println("Looking for "+repo.repoOwner+'/'+repo.repoName);
    Issue issue = issueService.getIssue(repo.repoOwner, repo.repoName, comment.getIssueNumber());
    String issueText = comment.getComment();
    if(!issue.getBody().equals(issueText)) {
        // makes a comment if the text has changed
    	issueService.createComment(repo.repoOwner, repo.repoName, comment.getIssueNumber(), issueText);
    }
    
    List<Label> existingLabels = issue.getLabels();
    List<Label> labels = new ArrayList<>();
    for(Tag tag : comment.getTags()) {
    	Label l = new Label();
    	l.setName(tag.name());
    	labels.add(l);
    }
    
    boolean shouldUpdateLabels = labels.size() != existingLabels.size();
    if(!shouldUpdateLabels) {
    	for(Label l1 : labels) {
    		shouldUpdateLabels = true;
    		for(Label l2 : existingLabels) {
    			if(l1.getName().equals(l2.getName())) {
    				shouldUpdateLabels = false;
    				break;
    			}
    		}
    		if(shouldUpdateLabels)
    			break;
    	}
    }
    
    if(shouldUpdateLabels) {
    	issue.setLabels(labels);
    	issueService.editIssue(repo.repoOwner, repo.repoName, issue);
    }
}
 
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:39,代码来源:ReviewSubmitServlet.java

示例5: prepareGithubIssue

import org.eclipse.egit.github.core.Label; //导入方法依赖的package包/类
/**
 * Creates an transferable GithubIssue
 * 
 * @param mantisIssue
 * @return an Issue
 * @throws IOException
 */
public Issue prepareGithubIssue( final MantisBtIssue mantisIssue )
        throws IOException {

    Issue issue = new Issue();
    issue.setBody( mantisIssue.getBody() );

    List<Label> labels = new ArrayList<Label>();

    // priority
    PriorityMapping priority = mantisIssue.getPriority();
    if ( priority.getLabel() != null ) {
        Label labelPriority = new Label();
        labelPriority.setName( priority.getLabel() );
        labels.add( labelPriority );
    }

    // severity
    Label labelSeverity = new Label();
    SeverityMapping severity = mantisIssue.getSeverity();
    labelSeverity.setName( severity.getLabel() );
    labels.add( labelSeverity );

    issue.setLabels( labels );

    // milestones
    Milestone milestone = this.milestoneMap.get( mantisIssue.getMilestone() );
    if ( milestone == null && mantisIssue.getMilestone() != null && mantisIssue.getMilestone().length() > 0 ) {
        Milestone newMilestone = new Milestone();
        newMilestone.setTitle( mantisIssue.getMilestone() );
        Milestone createdMilestone = this.milestoneService.createMilestone( this.userParam, this.repositoryParam,
                newMilestone );
        this.milestoneMap.put( mantisIssue.getMilestone(), createdMilestone );
        milestone = createdMilestone;
    }

    issue.setMilestone( milestone );
    issue.setState( IssueService.STATE_OPEN );
    issue.setTitle( mantisIssue.getSummary() );
    issue.setAssignee( this.repository.getOwner() );
    return issue;
}
 
开发者ID:tpummer,项目名称:issue2github,代码行数:49,代码来源:GithubIssueBuilder.java


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