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.views.main;
|
|
20 |
|
|
21 |
import org.eclipse.jface.viewers.LabelProvider;
|
|
22 |
import org.eclipse.swt.graphics.Image;
|
|
23 |
|
|
24 |
import com.nokia.s60tools.appdep.core.data.ComponentParentNode;
|
|
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 |
|
|
29 |
/**
|
|
30 |
* Main view's component tree's label provider.
|
|
31 |
*/
|
|
32 |
class MainViewComponentTreeLabelProvider extends LabelProvider {
|
|
33 |
|
|
34 |
/* (non-Javadoc)
|
|
35 |
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
|
|
36 |
*/
|
|
37 |
public String getText(Object obj) {
|
|
38 |
|
|
39 |
String label = obj.toString();
|
|
40 |
|
|
41 |
if (obj instanceof ComponentParentNode){
|
|
42 |
ComponentParentNode pn = (ComponentParentNode) obj;
|
|
43 |
if(! pn.isRootComponent()){
|
|
44 |
if (pn.isMissing()){
|
|
45 |
label = label
|
|
46 |
+ " (" + Messages.getString("MainViewComponentTreeLabelProvider.ComponentDoesNotExist_StatusMsg") + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
47 |
}
|
|
48 |
else if(! pn.isDirectChildrensResolved()){
|
|
49 |
if(MainView.isDependencySearchOngoing()){
|
|
50 |
label = label
|
|
51 |
+ " (" + Messages.getString("MainViewComponentTreeLabelProvider.Searching_StatusMsg") + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
52 |
}
|
|
53 |
else{
|
|
54 |
label = label
|
|
55 |
+ " (" + Messages.getString("MainViewComponentTreeLabelProvider.Search_Aborted_StatusMsg") + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
56 |
}
|
|
57 |
}
|
|
58 |
else if( pn.wasGenericComponent()){
|
|
59 |
if(pn.getGenericComponentBindType() == ComponentParentNode.CompBindType.AUTO_BIND){
|
|
60 |
label = label
|
|
61 |
+ " (" + Messages.getString("MainViewComponentTreeLabelProvider.ComponentBindType_Auto") +" " +pn.getOriginalName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
|
62 |
}
|
|
63 |
else if(pn.getGenericComponentBindType() == ComponentParentNode.CompBindType.USER_BIND){
|
|
64 |
label = label
|
|
65 |
+ " (" + Messages.getString("MainViewComponentTreeLabelProvider.ComponentBindType_User") +" " +pn.getOriginalName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
|
66 |
}
|
|
67 |
}
|
|
68 |
}
|
|
69 |
}
|
|
70 |
return label;
|
|
71 |
}
|
|
72 |
|
|
73 |
/* (non-Javadoc)
|
|
74 |
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
|
|
75 |
*/
|
|
76 |
public Image getImage(Object obj) {
|
|
77 |
|
|
78 |
// Default image
|
|
79 |
/*******************************************************************************
|
|
80 |
* This method uses graphics that are taken/modified from a graphic that is made
|
|
81 |
* available under the terms of the Eclipse Public License v1.0.
|
|
82 |
*
|
|
83 |
* See 'com.nokia.s60tools.appdep.resources.ImageResourceManager'
|
|
84 |
* for detailed information about the original graphic.
|
|
85 |
*
|
|
86 |
*******************************************************************************/
|
|
87 |
String imageKey = ImageKeys.BIN_OBJ_LINK;
|
|
88 |
|
|
89 |
if (obj instanceof ComponentParentNode){
|
|
90 |
ComponentParentNode pn = (ComponentParentNode) obj;
|
|
91 |
if(pn.isRootComponent()){
|
|
92 |
if (pn.isMissing()){
|
|
93 |
imageKey = ImageKeys.ROOT_OBJ_ERROR;
|
|
94 |
}
|
|
95 |
else{
|
|
96 |
imageKey = ImageKeys.ROOT_OBJ;
|
|
97 |
}
|
|
98 |
}
|
|
99 |
else if (pn.isMissing()){
|
|
100 |
imageKey = ImageKeys.BIN_OBJ_ERROR;
|
|
101 |
}
|
|
102 |
else if (pn.wasGenericComponent()){
|
|
103 |
imageKey = ImageKeys.BIN_OBJ_BIND;
|
|
104 |
}
|
|
105 |
else if(! pn.isDirectChildrensResolved()){
|
|
106 |
if(MainView.isDependencySearchOngoing()){
|
|
107 |
imageKey = ImageKeys.BIN_OBJ_WARNING;
|
|
108 |
}
|
|
109 |
else{
|
|
110 |
imageKey = ImageKeys.BIN_OBJ_ERROR;
|
|
111 |
}
|
|
112 |
}
|
|
113 |
else{
|
|
114 |
imageKey = ImageKeys.BIN_OBJ;
|
|
115 |
}
|
|
116 |
}
|
|
117 |
|
|
118 |
return ImageResourceManager.getImage(imageKey);
|
|
119 |
}
|
|
120 |
}
|