0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
package com.nokia.s60tools.appdep.ui.wizards;
|
|
20 |
|
|
21 |
import org.eclipse.jface.viewers.ITableLabelProvider;
|
|
22 |
import org.eclipse.jface.viewers.LabelProvider;
|
|
23 |
import org.eclipse.swt.graphics.Image;
|
|
24 |
|
|
25 |
import com.nokia.s60tools.appdep.resources.ImageKeys;
|
|
26 |
import com.nokia.s60tools.appdep.resources.ImageResourceManager;
|
|
27 |
import com.nokia.s60tools.appdep.resources.Messages;
|
|
28 |
import com.nokia.s60tools.appdep.ui.views.data.ComponentListNode;
|
|
29 |
import com.nokia.s60tools.appdep.util.AppDepConsole;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Select component wizard page label provider.
|
|
33 |
*/
|
|
34 |
class SelectComponentWizardPageLabelProvider extends LabelProvider implements ITableLabelProvider {
|
|
35 |
|
|
36 |
/* (non-Javadoc)
|
|
37 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
|
38 |
*/
|
|
39 |
public Image getColumnImage(Object element, int columnIndex) {
|
|
40 |
|
|
41 |
// Only using image for name columns
|
|
42 |
if(columnIndex == ComponentListNode.NAME_COLUMN_INDEX){
|
|
43 |
return getNameColumnImage();
|
|
44 |
}
|
|
45 |
|
|
46 |
// Otherwise no images are used
|
|
47 |
return null;
|
|
48 |
}
|
|
49 |
|
|
50 |
/* (non-Javadoc)
|
|
51 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
|
52 |
*/
|
|
53 |
public String getColumnText(Object element, int columnIndex) {
|
|
54 |
String label = element.toString();
|
|
55 |
|
|
56 |
ComponentListNode entryData = (ComponentListNode) element;
|
|
57 |
|
|
58 |
switch (columnIndex) {
|
|
59 |
|
|
60 |
case ComponentListNode.NAME_COLUMN_INDEX:
|
|
61 |
label = entryData.getComponentName();
|
|
62 |
break;
|
|
63 |
|
|
64 |
case ComponentListNode.TARGET_TYPE_COLUMN_INDEX:
|
|
65 |
label = entryData.getBuildTargetTypeAsString();
|
|
66 |
break;
|
|
67 |
|
|
68 |
case ComponentListNode.DATE_CACHED_COLUMN_INDEX:
|
|
69 |
label = entryData.getCachedComponentModificationTimestampAsString();
|
|
70 |
break;
|
|
71 |
|
|
72 |
default:
|
|
73 |
AppDepConsole.getInstance().println(Messages.getString("GeneralMessages.Unexpected_Column_Index_ErrMsg") + ": " + columnIndex, AppDepConsole.MSG_ERROR); //$NON-NLS-1$ //$NON-NLS-2$
|
|
74 |
break;
|
|
75 |
}
|
|
76 |
|
|
77 |
return label;
|
|
78 |
}
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Gets image for name columns.
|
|
82 |
* @return image for name columns.
|
|
83 |
*/
|
|
84 |
public Image getNameColumnImage() {
|
|
85 |
/*******************************************************************************
|
|
86 |
* This piece of the graphic is taken/modified from a graphic that is made
|
|
87 |
* available under the terms of the Eclipse Public License v1.0.
|
|
88 |
*
|
|
89 |
* See 'com.nokia.s60tools.appdep.resources.ImageResourceManager'
|
|
90 |
* for detailed information about the original graphic.
|
|
91 |
*
|
|
92 |
*******************************************************************************/
|
|
93 |
String imageKey = ImageKeys.BIN_OBJ;
|
|
94 |
return ImageResourceManager.getImage(imageKey);
|
|
95 |
}
|
|
96 |
}
|