author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 15 Jul 2010 10:08:51 -0700 | |
changeset 450 | ed815e0eef9a |
parent 432 | d2f02b279cdd |
child 454 | 38d6944cff88 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Copyright (c) 2009 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.wrttools; |
|
20 |
||
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
21 |
import java.io.PrintStream; |
310
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
22 |
import java.util.Collection; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
23 |
import java.util.Comparator; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
24 |
import java.util.TreeSet; |
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
25 |
|
310
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
26 |
import org.eclipse.core.resources.IProject; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
27 |
import org.eclipse.core.resources.ResourcesPlugin; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
28 |
import org.eclipse.core.runtime.IStatus; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
29 |
import org.eclipse.core.runtime.Status; |
260
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
30 |
import org.eclipse.jface.resource.ImageRegistry; |
0 | 31 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
432
d2f02b279cdd
Partial fix for Bug 3026 - Content Assist not working for phonegap APIs
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
310
diff
changeset
|
32 |
import org.eclipse.wst.jsdt.web.core.javascript.search.JsIndexManager; |
0 | 33 |
import org.osgi.framework.BundleContext; |
260
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
34 |
import org.symbian.tools.wrttools.core.WRTImages; |
309
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
35 |
import org.symbian.tools.wrttools.core.libraries.JSLibrary; |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
36 |
import org.symbian.tools.wrttools.core.libraries.LibraryManager; |
260
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
37 |
import org.symbian.tools.wrttools.sdt.utils.Logging; |
310
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
38 |
import org.symbian.tools.wrttools.util.ProjectUtils; |
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
39 |
|
260
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
40 |
import com.intel.bluetooth.BlueCoveImpl; |
0 | 41 |
|
42 |
/** |
|
43 |
* The activator class controls the plug-in life cycle |
|
44 |
*/ |
|
45 |
public class Activator extends AbstractUIPlugin { |
|
46 |
||
47 |
// The plug-in ID |
|
48 |
public static final String PLUGIN_ID = "org.symbian.tools.wrttools"; |
|
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
50
diff
changeset
|
49 |
|
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
50
diff
changeset
|
50 |
public static final String NAVIGATOR_ID = PLUGIN_ID + ".wrtnavigator"; |
0 | 51 |
|
52 |
// The shared instance |
|
53 |
private static Activator plugin; |
|
54 |
||
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
55 |
private static PrintStream savedSysOut; |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
56 |
|
309
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
57 |
private final LibraryManager manager = new LibraryManager(); |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
58 |
|
0 | 59 |
/** |
60 |
* The constructor |
|
61 |
*/ |
|
62 |
public Activator() { |
|
63 |
} |
|
64 |
||
65 |
/* |
|
66 |
* (non-Javadoc) |
|
67 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
68 |
*/ |
|
69 |
public void start(BundleContext context) throws Exception { |
|
70 |
super.start(context); |
|
71 |
plugin = this; |
|
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
72 |
|
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
73 |
// set parameters for BlueCove |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
74 |
String param = Integer.toString(65*1024); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
75 |
System.setProperty("bluecove.obex.mtu", param); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
76 |
BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", param); |
432
d2f02b279cdd
Partial fix for Bug 3026 - Content Assist not working for phonegap APIs
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
310
diff
changeset
|
77 |
JsIndexManager.getInstance(); |
0 | 78 |
} |
79 |
||
80 |
/* |
|
81 |
* (non-Javadoc) |
|
82 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
83 |
*/ |
|
84 |
public void stop(BundleContext context) throws Exception { |
|
85 |
plugin = null; |
|
86 |
super.stop(context); |
|
87 |
} |
|
260
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
88 |
|
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
89 |
@Override |
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
90 |
protected void initializeImageRegistry(ImageRegistry reg) { |
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
91 |
WRTImages.init(reg); |
38f012067872
Bug 2207 fix, wizard banners
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
182
diff
changeset
|
92 |
} |
145
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
93 |
|
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
94 |
/** Toggle BlueCove logging |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
95 |
*/ |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
96 |
public static void enableBlueCoveDiagnostics(boolean enable) { |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
97 |
System.setProperty("bluecove.debug", Boolean.valueOf(enable).toString()); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
98 |
BlueCoveImpl.instance().enableNativeDebug(enable); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
99 |
if (enable) { |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
100 |
System.setOut(new PrintStream(ConsoleFactory.createStream())); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
101 |
} else { |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
102 |
System.setOut(savedSysOut); |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
103 |
} |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
104 |
} |
19985c154f5c
Merged. Added deployment. Fixed developer experience. Added about.ini, about.properties.
tasneems@symbian.org
parents:
139
diff
changeset
|
105 |
|
0 | 106 |
|
107 |
/** |
|
108 |
* Returns the shared instance |
|
109 |
* |
|
110 |
* @return the shared instance |
|
111 |
*/ |
|
112 |
public static Activator getDefault() { |
|
113 |
return plugin; |
|
114 |
} |
|
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
115 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
116 |
public static void log(Exception e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
117 |
log(e.getLocalizedMessage(), e); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
118 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
119 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
120 |
public static void log(String message, Exception e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
121 |
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e)); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
0
diff
changeset
|
122 |
} |
50
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
3
diff
changeset
|
123 |
|
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
3
diff
changeset
|
124 |
public static void log(int severity, String message, Throwable x) { |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
3
diff
changeset
|
125 |
IStatus status = new Status(severity, PLUGIN_ID, 0, message, x); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
3
diff
changeset
|
126 |
Logging.log(getDefault(), status); |
0560e98b9bf6
Added widget project nature and WRT validators
tasneems@symbian.org
parents:
3
diff
changeset
|
127 |
} |
0 | 128 |
|
309
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
129 |
public static JSLibrary[] getJSLibraries() { |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
130 |
return getDefault().manager.getLibraries(); |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
131 |
} |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
260
diff
changeset
|
132 |
|
310
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
133 |
public static IProject[] getWrtProjects() { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
134 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
135 |
Collection<IProject> prjs = new TreeSet<IProject>(new Comparator<IProject>() { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
136 |
public int compare(IProject o1, IProject o2) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
137 |
if (o1 == o2) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
138 |
return 0; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
139 |
} else if (o1 == null) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
140 |
return -1; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
141 |
} else if (o2 == null) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
142 |
return 1; |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
143 |
} else { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
144 |
return o1.getName().compareTo(o2.getName()); |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
145 |
} |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
146 |
} |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
147 |
}); |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
148 |
for (IProject project : projects) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
149 |
if (ProjectUtils.hasWrtNature(project)) { |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
150 |
prjs.add(project); |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
151 |
} |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
152 |
} |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
153 |
return prjs.toArray(new IProject[prjs.size()]); |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
154 |
} |
e9484be98cfe
UI to add libraries was introduced
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
155 |
|
0 | 156 |
} |