author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 09 Aug 2010 15:18:34 -0700 | |
changeset 461 | 7a8f9fa8d278 |
child 468 | a05c6e5cc7d9 |
permissions | -rw-r--r-- |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/** |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
* |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
* Contributors: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
* Description: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
* Overview: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
* Details: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
* Failures and causes: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
*/ |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
package org.symbian.tools.tmw.core.internal.projects; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
import java.util.Map; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
import java.util.WeakHashMap; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
23 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
import org.eclipse.core.resources.IProject; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
import org.eclipse.core.runtime.CoreException; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
import org.symbian.tools.tmw.core.ITMWConstants; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
import org.symbian.tools.tmw.core.TMWCore; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
import org.symbian.tools.tmw.core.projects.IMTWProject; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
import org.symbian.tools.tmw.core.projects.IMTWProjectProvider; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
public class MTWFacetedProjectProvider implements IMTWProjectProvider { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
private final Map<IProject, IMTWProject> projects = new WeakHashMap<IProject, IMTWProject>(); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
public IMTWProject create(IProject project) { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
if (!projects.containsKey(project)) { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
projects.put(project, new TMWFacetedProject(project)); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
return projects.get(project); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
public boolean isSupportedProject(IProject project) { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
try { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
return FacetedProjectFramework.hasProjectFacet(project, ITMWConstants.CORE_FACET); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
} catch (CoreException e) { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
TMWCore.log(null, e); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
return false; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
} |