|
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.runtimes; |
|
20 |
|
21 import java.net.URI; |
|
22 |
|
23 import org.eclipse.core.runtime.CoreException; |
|
24 import org.eclipse.core.runtime.IPath; |
|
25 import org.eclipse.wst.jsdt.core.IIncludePathEntry; |
|
26 import org.eclipse.wst.jsdt.core.IJavaScriptProject; |
|
27 import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer; |
|
28 import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainerInitializer; |
|
29 import org.eclipse.wst.jsdt.core.JavaScriptCore; |
|
30 import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer; |
|
31 import org.eclipse.wst.jsdt.core.compiler.libraries.LibraryLocation; |
|
32 import org.symbian.tools.tmw.core.TMWCore; |
|
33 |
|
34 public class MobileRuntimeLibraryContainerInitializer extends JsGlobalScopeContainerInitializer implements |
|
35 IJsGlobalScopeContainerInitializer { |
|
36 |
|
37 public boolean allowAttachJsDoc() { |
|
38 return false; |
|
39 } |
|
40 |
|
41 public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project) { |
|
42 return true; |
|
43 } |
|
44 |
|
45 public String[] containerSuperTypes() { |
|
46 return new String[0]; |
|
47 } |
|
48 |
|
49 public Object getComparisonID(IPath containerPath, IJavaScriptProject project) { |
|
50 return containerPath.append(project.getElementName()); |
|
51 } |
|
52 |
|
53 @Override |
|
54 public String getDescription() { |
|
55 return "Project library with mobile web runtime APIs"; |
|
56 } |
|
57 |
|
58 public String getDescription(IPath containerPath, IJavaScriptProject project) { |
|
59 return getDescription(); |
|
60 } |
|
61 |
|
62 public IJsGlobalScopeContainer getFailureContainer(final IPath containerPath, IJavaScriptProject project) { |
|
63 return new IJsGlobalScopeContainer() { |
|
64 |
|
65 public String getDescription() { |
|
66 final String description = MobileRuntimeLibraryContainerInitializer.this.getDescription(); |
|
67 return description; |
|
68 } |
|
69 |
|
70 public IIncludePathEntry[] getIncludepathEntries() { |
|
71 return new IIncludePathEntry[0]; |
|
72 } |
|
73 |
|
74 public int getKind() { |
|
75 return K_APPLICATION; |
|
76 } |
|
77 |
|
78 public IPath getPath() { |
|
79 return containerPath; |
|
80 } |
|
81 |
|
82 public String[] resolvedLibraryImport(String a) { |
|
83 return new String[0]; |
|
84 } |
|
85 }; |
|
86 } |
|
87 |
|
88 public URI getHostPath(IPath path, IJavaScriptProject project) { |
|
89 return null; |
|
90 } |
|
91 |
|
92 public String getInferenceID() { |
|
93 return null; |
|
94 } |
|
95 |
|
96 public LibraryLocation getLibraryLocation() { |
|
97 return null; |
|
98 } |
|
99 |
|
100 public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { |
|
101 if (!project.isOpen() || TMWCore.create(project.getProject()) != null) { |
|
102 JavaScriptCore.setJsGlobalScopeContainer(containerPath, new IJavaScriptProject[] { project }, |
|
103 new IJsGlobalScopeContainer[] { new MobileRuntimeLibraryContainer(project, containerPath) }, null); |
|
104 } |
|
105 } |
|
106 |
|
107 public void removeFromProject(IJavaScriptProject project) { |
|
108 // Do nothing |
|
109 } |
|
110 |
|
111 public void requestJsGlobalScopeContainerUpdate(IPath containerPath, IJavaScriptProject project, |
|
112 IJsGlobalScopeContainer containerSuggestion) throws CoreException { |
|
113 // TODO |
|
114 System.out.println("abc"); |
|
115 } |
|
116 } |