org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/projects/ProjectProvider.java
changeset 461 7a8f9fa8d278
parent 460 c0bff5ed874c
child 462 cdc4995b1677
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/mtw/core/internal/projects/ProjectProvider.java	Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.mtw.core.internal.projects;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-import org.symbian.tools.mtw.core.projects.IMTWProjectProvider;
-
-public class ProjectProvider implements IMTWProjectProvider {
-    private final IConfigurationElement element;
-    private final Expression expression;
-    private IMTWProjectProvider provider;
-
-    public ProjectProvider(IConfigurationElement element) throws CoreException {
-        this.element = element;
-        IConfigurationElement[] children = element.getChildren("enablement");
-        if (children.length == 1) {
-            expression = ExpressionConverter.getDefault().perform(children[0]);
-        } else {
-            expression = null;
-            if (children.length > 1) {
-                MTWCore.log(
-                        "Project extension in plugin %s has several <enablement> elements. All expressions will be ignored.",
-                        element.getNamespaceIdentifier());
-            }
-        }
-    }
-
-    public IMTWProject create(IProject project) {
-        return getProvider().create(project);
-    }
-
-    private IMTWProjectProvider getProvider() {
-        if (provider == null) {
-            try {
-                provider = (IMTWProjectProvider) element.createExecutableExtension("class");
-            } catch (CoreException e) {
-                throw new RuntimeException(e);
-            }
-        }
-        return provider;
-    }
-
-    public boolean isSupportedProject(final IProject project) {
-        try {
-            final EvaluationResult result = expression.evaluate(new EvaluationContext(null, project));
-            if (EvaluationResult.TRUE.equals(result)) {
-                return getProvider().isSupportedProject(project);
-            }
-        } catch (CoreException e) {
-            MTWCore.log(null, e);
-        }
-        return false;
-    }
-}