Java 检索完整的类路径

Java 检索完整的类路径,java,eclipse,tfs,filepath,eclipse-luna,Java,Eclipse,Tfs,Filepath,Eclipse Luna,我试图从已编辑的类中检索完整的文件路径。我可以检索注释、版本号、作者和日期,但当项目中包含多个类时,似乎无法获取已编辑的完整文件路径 我使用这些来检索评论和作者: String comments = pc.getPendingChanges().getComment(); System.out.println("Comments: " + comments); String author = pc.getPendingChanges().getAllPendingChanges()[0].g

我试图从已编辑的类中检索完整的文件路径。我可以检索注释、版本号、作者和日期,但当项目中包含多个类时,似乎无法获取已编辑的完整文件路径

我使用这些来检索评论和作者:

String comments = pc.getPendingChanges().getComment();
System.out.println("Comments: " + comments);

String author =  pc.getPendingChanges().getAllPendingChanges()[0].getPendingSetOwnerDisplay();
System.out.println("Author: " + author);
我使用它来检索路径:

String fileName =  pc.getPendingChanges().getAllPendingChanges()[0].getLocalItem();
System.out.println("FileName: " + fileName);
但我只得到这个输出:

文件名:C:\VS2013\Plugin\pluginest\HelloWorld.classpath

我需要显示带有类名的完整路径

文件名:C:\VS2013\Plugin\pluginest\HelloWorld.Test.java

完整方法如下所示:

@Override
public PolicyFailure[] evaluate(PolicyContext context)
            throws PolicyEvaluationCancelledException {

    final PendingCheckin pc =  getPendingCheckin();
    final List<PolicyFailure> failures = new ArrayList<PolicyFailure>();

    final WorkItemCheckinInfo[] AssociatedWorkItems = pc.getWorkItems().getCheckedWorkItems();


    WorkItem AssociatedCodeReview = null;
    String failureReason = "";
    for (int i=0; i<AssociatedWorkItems.length; i++) {
        AssociatedCodeReview = AssociatedWorkItems[i].getWorkItem();
        if (AssociatedCodeReview.getType().getName() == "Code Review") {
            break;
        }
    }
    if (AssociatedCodeReview != null) {
        if (AssociatedCodeReview.getFields().getField("System.State").getValue()
            .toString().equals("Not Approved")) {

            failureReason = "Code Review Work Item associated but that is not approved by expert";
            failures.add(new PolicyFailure(failureReason, this));
        }
    } else {
        String fileName =  pc.getPendingChanges().getAllPendingChanges()[0].getLocalItem();
        System.out.println("FileName: " + fileName);

        String fileName2 =  pc.getPendingChanges().getAllPendingChanges()[0].getServerItem();
        System.out.println("FileName2: " + fileName2);

        String[] fileName3 =  pc.getPendingChanges().getAffectedTeamProjectPaths();
        System.out.println("FileName3: " + fileName3[0]);

        //System.out.println("Found " + pc.getPendingChanges().getAffectedTeamProjectPaths()[0] + " work items.");

        String comments = pc.getPendingChanges().getComment();
        System.out.println("Comments: " + comments);

        String author =  pc.getPendingChanges().getAllPendingChanges()[0].getPendingSetOwnerDisplay();
        System.out.println("Author: " + author);

        String version =  String.valueOf(pc.getPendingChanges().getAllPendingChanges()[0].getVersion());
        System.out.println("Version: " + version);

        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        System.out.println("Date Time: " + dateFormat.format(date));
    }
    return failures.toArray(new PolicyFailure[failures.size()]);
}

它确实可以工作,这是我的Eclipse安装中的一个错误

String fileName =  pc.getPendingChanges().getAllPendingChanges()[x].getLocalItem();

什么是个人电脑?开始时应该是什么?什么是test.java?pc是最终PendingCheckin pc=getPendingCheckin;test只是一个简单的java类,用于测试,其中只有一个打印输出语句PendingCheckin是什么框架的一部分?import com.microsoft.tfs.core.PendingCheckin.PendingCheckin;