Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7793eb47ec9628e9b1b31846c83e87bfcb9e5acd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.ats.util.widgets.dialog;

import java.util.logging.Level;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osee.ats.artifact.VersionArtifact;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
import org.eclipse.swt.graphics.Image;

/**
 * @author Donald G. Dunne
 */
public class VersionArtifactLabelProvider extends LabelProvider {

   @Override
   public String getText(Object element) {
      if (element instanceof VersionArtifact) {
         VersionArtifact verArt = (VersionArtifact) element;
         String str = verArt.getName();
         try {
            if (verArt.getEstimatedReleaseDate() != null) {
               str += " - Estimated Release: " + XDate.getDateStr(verArt.getEstimatedReleaseDate(), XDate.MMDDYY);
            }
         } catch (Exception ex) {
            OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
         }
         return str;
      }
      return "Unknown element type";
   }

   @Override
   public Image getImage(Object element) {
      if (element instanceof VersionArtifact) {
         return ArtifactImageManager.getImage((VersionArtifact) element);
      }
      return null;
   }
}

Back to the top