コード例 #1
0
  @Override
  public String getToolTipText(Object element) {
    String toolTipText;

    if (element instanceof SampleCategory) {
      return ((SampleCategory) element).getName();
    }
    if (element instanceof SamplesReference) {
      SamplesReference samplesRef = (SamplesReference) element;
      toolTipText = samplesRef.getDescriptionText();
      if (toolTipText == null) {
        toolTipText = samplesRef.getName();
      }
      if (toolTipText == null) {
        toolTipText = samplesRef.getPath();
      }
      return toolTipText;
    }
    if (element instanceof SampleEntry) {
      toolTipText = ((SampleEntry) element).getDescription();
      if (toolTipText != null) {
        return toolTipText;
      }
      File file = ((SampleEntry) element).getFile();
      if (file != null) {
        return file.getName();
      }
    }
    return super.getText(element);
  }
コード例 #2
0
 @Override
 public String getText(Object element) {
   if (element instanceof SampleCategory) {
     return ((SampleCategory) element).getName();
   }
   if (element instanceof SamplesReference) {
     SamplesReference samplesRef = (SamplesReference) element;
     String name = samplesRef.getName();
     return name == null ? samplesRef.getPath() : name;
   }
   if (element instanceof SampleEntry) {
     File file = ((SampleEntry) element).getFile();
     if (file != null) {
       return file.getName();
     }
   }
   return super.getText(element);
 }