org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/navigator/PackagingInformationDecorator.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Wed, 21 Jul 2010 11:26:43 -0700
changeset 454 38d6944cff88
child 455 5da55957c779
permissions -rw-r--r--
Bug 3352 - Replace our Navigator View with the JSDT one
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
454
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/**
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.mtw.ui.navigator;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
import org.eclipse.core.resources.IResource;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import org.eclipse.core.runtime.IAdaptable;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
import org.eclipse.jface.viewers.IDecoration;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
import org.eclipse.jface.viewers.ILabelProviderListener;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.symbian.tools.wrttools.core.WRTImages;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.symbian.tools.wrttools.util.ProjectUtils;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
public class PackagingInformationDecorator implements ILightweightLabelDecorator {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
    public void decorate(Object element, IDecoration decoration) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
        IResource resource = null;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
        if (element instanceof IResource) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
            resource = (IResource) element;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
        } else if (element instanceof IAdaptable) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
            resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
        }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
        if (resource != null && resource.isAccessible() && ProjectUtils.isExcluded(resource)) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
            decoration.addOverlay(WRTImages.getExcludedImageDescriptor(), IDecoration.TOP_RIGHT);
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
        }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
    }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
    public void addListener(ILabelProviderListener listener) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
        // Do nothing
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
    }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
    public void dispose() {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
        // Do nothing
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
    }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
    public boolean isLabelProperty(Object element, String property) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
        // Do nothing
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
        return false;
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
    }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
    public void removeListener(ILabelProviderListener listener) {
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
        // Do nohing
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
    }
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
38d6944cff88 Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
}