示例#1
0
 public String getText(Object element) {
   String label = getSimpleLabel(element);
   if (label == null) {
     return element.toString();
   }
   ITestElement testElement = (ITestElement) element;
   if (fLayoutMode == TestRunnerViewPart.LAYOUT_HIERARCHICAL) {
     if (testElement.getParentContainer() instanceof ITestRunSession) {
       String testKindDisplayName = fTestRunnerPart.getTestKindDisplayName();
       if (testKindDisplayName != null) {
         label =
             Messages.format(
                 JUnitMessages.TestSessionLabelProvider_testName_JUnitVersion,
                 new Object[] {label, testKindDisplayName});
       }
     }
   } else {
     if (element instanceof ITestCaseElement) {
       String className =
           BasicElementLabels.getJavaElementName(((ITestCaseElement) element).getTestClassName());
       label =
           Messages.format(
               JUnitMessages.TestSessionLabelProvider_testMethodName_className,
               new Object[] {label, className});
     }
   }
   return addElapsedTime(label, testElement.getElapsedTimeInSeconds());
 }
示例#2
0
 private static IStatus addOutOfSync(IStatus status, IResource resource) {
   IStatus entry =
       new Status(
           IStatus.ERROR,
           ResourcesPlugin.PI_RESOURCES,
           IResourceStatus.OUT_OF_SYNC_LOCAL,
           Messages.format(
               JUnitMessages.Resources_outOfSync,
               BasicElementLabels.getPathLabel(resource.getFullPath(), false)),
           null);
   if (status == null) {
     return entry;
   } else if (status.isMultiStatus()) {
     ((MultiStatus) status).add(entry);
     return status;
   } else {
     MultiStatus result =
         new MultiStatus(
             ResourcesPlugin.PI_RESOURCES,
             IResourceStatus.OUT_OF_SYNC_LOCAL,
             JUnitMessages.Resources_outOfSyncResources,
             null);
     result.add(status);
     result.add(entry);
     return result;
   }
 }
示例#3
0
 private String addElapsedTime(String string, double time) {
   if (!fShowTime || Double.isNaN(time)) {
     return string;
   }
   String formattedTime = timeFormat.format(time);
   return Messages.format(
       JUnitMessages.TestSessionLabelProvider_testName_elapsedTimeInSeconds,
       new String[] {string, formattedTime});
 }
示例#4
0
 private static IStatus addModified(IStatus status, IFile file) {
   IStatus entry =
       JUnitStatus.createError(
           Messages.format(
               JUnitMessages.Resources_fileModified,
               BasicElementLabels.getPathLabel(file.getFullPath(), false)));
   if (status == null) {
     return entry;
   } else if (status.isMultiStatus()) {
     ((MultiStatus) status).add(entry);
     return status;
   } else {
     MultiStatus result =
         new MultiStatus(
             JUnitPlugin.getPluginId(),
             IJUnitStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
             JUnitMessages.Resources_modifiedResources,
             null);
     result.add(status);
     result.add(entry);
     return result;
   }
 }