]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - argeo/cms/e4/monitoring/StateLabelProvider.java
1 package org
.argeo
.cms
.e4
.monitoring
;
3 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
4 import org
.eclipse
.swt
.graphics
.Image
;
5 import org
.osgi
.framework
.Bundle
;
6 import org
.osgi
.framework
.Constants
;
8 /** Label provider showing the sate of bundles */
9 class StateLabelProvider
extends ColumnLabelProvider
{
10 private static final long serialVersionUID
= -7885583135316000733L;
13 public Image
getImage(Object element
) {
15 if (element
instanceof Bundle
)
16 state
= ((Bundle
) element
).getState();
17 else if (element
instanceof BundleNode
)
18 state
= ((BundleNode
) element
).getBundle().getState();
19 else if (element
instanceof ServiceReferenceNode
)
20 if (((ServiceReferenceNode
) element
).isPublished())
21 return OsgiExplorerImages
.SERVICE_PUBLISHED
;
23 return OsgiExplorerImages
.SERVICE_REFERENCED
;
28 case Bundle
.UNINSTALLED
:
29 return OsgiExplorerImages
.INSTALLED
;
30 case Bundle
.INSTALLED
:
31 return OsgiExplorerImages
.INSTALLED
;
33 return OsgiExplorerImages
.RESOLVED
;
35 return OsgiExplorerImages
.STARTING
;
37 return OsgiExplorerImages
.STARTING
;
39 return OsgiExplorerImages
.ACTIVE
;
46 public String
getText(Object element
) {
51 public String
getToolTipText(Object element
) {
52 Bundle bundle
= (Bundle
) element
;
53 Integer state
= bundle
.getState();
55 case Bundle
.UNINSTALLED
:
57 case Bundle
.INSTALLED
:
62 String activationPolicy
= bundle
.getHeaders()
63 .get(Constants
.BUNDLE_ACTIVATIONPOLICY
).toString();
65 // .get("Bundle-ActivationPolicy").toString();
66 // FIXME constant triggers the compilation failure
67 if (activationPolicy
!= null
68 && activationPolicy
.equals(Constants
.ACTIVATION_LAZY
))
69 // && activationPolicy.equals("lazy"))
70 // FIXME constant triggers the compilation failure
71 // && activationPolicy.equals(Constants.ACTIVATION_LAZY))