1 /** |
|
2 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Symbian Foundation - initial contribution. |
|
11 * Contributors: |
|
12 * Description: |
|
13 * Overview: |
|
14 * Details: |
|
15 * Platforms/Drives/Compatibility: |
|
16 * Assumptions/Requirement/Pre-requisites: |
|
17 * Failures and causes: |
|
18 */ |
|
19 package org.symbian.tools.mtw.ui.navigator; |
|
20 |
|
21 import org.eclipse.core.resources.IResource; |
|
22 import org.eclipse.core.runtime.IAdaptable; |
|
23 import org.eclipse.jface.viewers.IDecoration; |
|
24 import org.eclipse.jface.viewers.ILabelProviderListener; |
|
25 import org.eclipse.jface.viewers.ILightweightLabelDecorator; |
|
26 import org.symbian.tools.mtw.core.MTWCore; |
|
27 import org.symbian.tools.mtw.core.projects.IMTWProject; |
|
28 import org.symbian.tools.mtw.core.runtimes.IPackager; |
|
29 import org.symbian.tools.mtw.ui.MTWCoreUI; |
|
30 |
|
31 public class PackagingInformationDecorator implements ILightweightLabelDecorator { |
|
32 |
|
33 public void decorate(Object element, IDecoration decoration) { |
|
34 IResource resource = null; |
|
35 if (element instanceof IResource) { |
|
36 resource = (IResource) element; |
|
37 } else if (element instanceof IAdaptable) { |
|
38 resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class); |
|
39 } |
|
40 if (resource != null && resource.isAccessible()) { |
|
41 IMTWProject project = MTWCore.getDefault().create(resource.getProject()); |
|
42 if (project != null) { |
|
43 IPackager packager = MTWCore.getDefault().getRuntimesManager().getPackager(project); |
|
44 if (packager.getPathInPackage(resource) != null) { |
|
45 decoration.addOverlay(MTWCoreUI.getImages().getExcludedIconDescriptor(), IDecoration.TOP_RIGHT); |
|
46 } |
|
47 } |
|
48 } |
|
49 } |
|
50 |
|
51 public void addListener(ILabelProviderListener listener) { |
|
52 // Do nothing |
|
53 |
|
54 } |
|
55 |
|
56 public void dispose() { |
|
57 // Do nothing |
|
58 |
|
59 } |
|
60 |
|
61 public boolean isLabelProperty(Object element, String property) { |
|
62 // Do nothing |
|
63 return false; |
|
64 } |
|
65 |
|
66 public void removeListener(ILabelProviderListener listener) { |
|
67 // Do nohing |
|
68 |
|
69 } |
|
70 |
|
71 } |
|