org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/projects/TMWPropertyTester.java
changeset 461 7a8f9fa8d278
child 463 aea4c83725d8
equal deleted inserted replaced
460:c0bff5ed874c 461:7a8f9fa8d278
       
     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.tmw.core.internal.projects;
       
    20 
       
    21 import org.eclipse.core.expressions.PropertyTester;
       
    22 import org.eclipse.core.resources.IResource;
       
    23 import org.symbian.tools.tmw.core.TMWCore;
       
    24 
       
    25 public class TMWPropertyTester extends PropertyTester {
       
    26     public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
       
    27         if ("istmwproject".equals(property)) {
       
    28             return isTMWProject(receiver);
       
    29         }
       
    30         return false;
       
    31     }
       
    32 
       
    33     private boolean isTMWProject(Object receiver) {
       
    34         if (receiver instanceof IResource) {
       
    35             return TMWCore.getDefault().create(((IResource) receiver).getProject()) != null;
       
    36         }
       
    37         return false;
       
    38     }
       
    39 
       
    40 }