Lines 39-66
Link Here
|
39 |
*/ |
39 |
*/ |
40 |
public class JSFUICommonPlugin extends AbstractUIPlugin { |
40 |
public class JSFUICommonPlugin extends AbstractUIPlugin { |
41 |
// Properties contains general properties and defaults to preferences. |
41 |
// Properties contains general properties and defaults to preferences. |
42 |
private static final String PROPERTIES = "default.properties"; |
42 |
private static final String PROPERTIES = "default.properties"; //$NON-NLS-1$ |
43 |
// preferences will |
43 |
// preferences will |
44 |
// contain this string |
44 |
// contain this string |
45 |
// in the key. |
45 |
// in the key. |
46 |
|
46 |
|
47 |
private static final String P_CONSOLE_LOGGING = "console.logging.on"; |
47 |
private static final String P_CONSOLE_LOGGING = "console.logging.on"; //$NON-NLS-1$ |
48 |
|
48 |
|
49 |
private static final String P_CONSOLE_LOG_LEVEL = "console.logging.max.level"; |
49 |
private static final String P_CONSOLE_LOG_LEVEL = "console.logging.max.level"; //$NON-NLS-1$ |
50 |
|
50 |
|
51 |
private static final String P_ECLIPSE_LOGGING = "eclipse.logging.on"; |
51 |
private static final String P_ECLIPSE_LOGGING = "eclipse.logging.on"; //$NON-NLS-1$ |
52 |
|
52 |
|
53 |
private static final String P_ECLIPSE_LOG_LEVEL = "eclipse.logging.max.level"; |
53 |
private static final String P_ECLIPSE_LOG_LEVEL = "eclipse.logging.max.level"; //$NON-NLS-1$ |
54 |
|
54 |
|
55 |
private static final String P_FILE_LOGGING = "file.logging.on"; |
55 |
private static final String P_FILE_LOGGING = "file.logging.on"; //$NON-NLS-1$ |
56 |
|
56 |
|
57 |
private static final String P_FILE_LOG_LEVEL = "file.logging.max.level"; |
57 |
private static final String P_FILE_LOG_LEVEL = "file.logging.max.level"; //$NON-NLS-1$ |
58 |
|
58 |
|
59 |
private static final String P_FILE_PATH = "file.logging.path"; |
59 |
private static final String P_FILE_PATH = "file.logging.path"; //$NON-NLS-1$ |
60 |
|
60 |
|
61 |
private static final String P_FILE_CLEAR = "file.logging.startup.clear"; |
61 |
private static final String P_FILE_CLEAR = "file.logging.startup.clear"; //$NON-NLS-1$ |
62 |
|
62 |
|
63 |
private static final String P_FILE_ROLLOVER_FREQUENCY = "file.logging.rollover.frequency"; |
63 |
private static final String P_FILE_ROLLOVER_FREQUENCY = "file.logging.rollover.frequency"; //$NON-NLS-1$ |
64 |
|
64 |
|
65 |
private static final int DEBUG_LEVEL = 0; |
65 |
private static final int DEBUG_LEVEL = 0; |
66 |
|
66 |
|
Lines 122-140
Link Here
|
122 |
if (isThreeDot() == false) { |
122 |
if (isThreeDot() == false) { |
123 |
throw new CoreException(new Status(IStatus.ERROR, getBundle() |
123 |
throw new CoreException(new Status(IStatus.ERROR, getBundle() |
124 |
.getSymbolicName(), IStatus.OK, |
124 |
.getSymbolicName(), IStatus.OK, |
125 |
"Requires eclipse version 3.x", null)); |
125 |
"Requires eclipse version 3.x", null)); //$NON-NLS-1$ |
126 |
} |
126 |
} |
127 |
|
127 |
|
128 |
try { |
128 |
try { |
129 |
// get resource bundle. |
129 |
// get resource bundle. |
130 |
_resourceBundle = ResourceBundle |
130 |
_resourceBundle = ResourceBundle |
131 |
.getBundle("org.eclipse.jst.jsf.common.ui.CommonResources"); |
131 |
.getBundle("org.eclipse.jst.jsf.common.ui.CommonResources"); //$NON-NLS-1$ |
132 |
_alerts = new Alerts(this, _resourceBundle); |
132 |
_alerts = new Alerts(this, _resourceBundle); |
133 |
|
133 |
|
134 |
// get properties. |
134 |
// get properties. |
135 |
_properties = new Properties(); |
135 |
_properties = new Properties(); |
136 |
InputStream input = null; |
136 |
InputStream input = null; |
137 |
_pluginBase = getBundle().getEntry("/"); |
137 |
_pluginBase = getBundle().getEntry("/"); //$NON-NLS-1$ |
138 |
try { |
138 |
try { |
139 |
input = (new URL(_pluginBase, PROPERTIES)).openStream(); |
139 |
input = (new URL(_pluginBase, PROPERTIES)).openStream(); |
140 |
_properties.load(input); |
140 |
_properties.load(input); |
Lines 162-169
Link Here
|
162 |
if (_log != null) { |
162 |
if (_log != null) { |
163 |
_log |
163 |
_log |
164 |
.error( |
164 |
.error( |
165 |
"log.msg", |
165 |
"log.msg", //$NON-NLS-1$ |
166 |
"Problems starting plug-in Web Application Development Common.", |
166 |
"Problems starting plug-in Web Application Development Common.", //$NON-NLS-1$ |
167 |
ee); |
167 |
ee); |
168 |
} |
168 |
} |
169 |
|
169 |
|
Lines 172-178
Link Here
|
172 |
IStatus.ERROR, |
172 |
IStatus.ERROR, |
173 |
getBundle().getSymbolicName(), |
173 |
getBundle().getSymbolicName(), |
174 |
IStatus.OK, |
174 |
IStatus.OK, |
175 |
"Problems starting plug-in Web Application Development Common", |
175 |
"Problems starting plug-in Web Application Development Common", //$NON-NLS-1$ |
176 |
ee)); |
176 |
ee)); |
177 |
} |
177 |
} |
178 |
} |
178 |
} |
Lines 284-296
Link Here
|
284 |
if (image == null) { |
284 |
if (image == null) { |
285 |
try { |
285 |
try { |
286 |
ImageDescriptor id = ImageDescriptor.createFromURL(new URL( |
286 |
ImageDescriptor id = ImageDescriptor.createFromURL(new URL( |
287 |
_pluginBase, "icons/" + name)); |
287 |
_pluginBase, "icons/" + name)); //$NON-NLS-1$ |
288 |
images.put(name, id); |
288 |
images.put(name, id); |
289 |
|
289 |
|
290 |
image = images.get(name); |
290 |
image = images.get(name); |
291 |
} catch (MalformedURLException ee) { |
291 |
} catch (MalformedURLException ee) { |
292 |
// log.CommonPlugin.image.error=Image {0} not found. |
292 |
// log.CommonPlugin.image.error=Image {0} not found. |
293 |
_log.error("log.msg", "log.CommonPlugin.image.error", name, ee); |
293 |
_log.error("log.msg", "log.CommonPlugin.image.error", name, ee); //$NON-NLS-1$ //$NON-NLS-2$ |
294 |
} |
294 |
} |
295 |
} |
295 |
} |
296 |
return image; |
296 |
return image; |
Lines 318-328
Link Here
|
318 |
if (id == null) { |
318 |
if (id == null) { |
319 |
try { |
319 |
try { |
320 |
id = ImageDescriptor.createFromURL(new URL(_pluginBase, |
320 |
id = ImageDescriptor.createFromURL(new URL(_pluginBase, |
321 |
"icons/" + name)); |
321 |
"icons/" + name)); //$NON-NLS-1$ |
322 |
images.put(name, id); |
322 |
images.put(name, id); |
323 |
} catch (MalformedURLException ee) { |
323 |
} catch (MalformedURLException ee) { |
324 |
// log.CommonPlugin.image.error=Image {0} not found. |
324 |
// log.CommonPlugin.image.error=Image {0} not found. |
325 |
_log.error("log.msg", "log.CommonPlugin.image.error", name, ee); |
325 |
_log.error("log.msg", "log.CommonPlugin.image.error", name, ee); //$NON-NLS-1$ //$NON-NLS-2$ |
326 |
} |
326 |
} |
327 |
} |
327 |
} |
328 |
return id; |
328 |
return id; |
Lines 370-391
Link Here
|
370 |
store.setDefault(P_CONSOLE_LOGGING, _properties.getProperty( |
370 |
store.setDefault(P_CONSOLE_LOGGING, _properties.getProperty( |
371 |
P_CONSOLE_LOGGING, Boolean.TRUE.toString())); |
371 |
P_CONSOLE_LOGGING, Boolean.TRUE.toString())); |
372 |
store.setDefault(P_CONSOLE_LOG_LEVEL, strToIntLogLevel(_properties |
372 |
store.setDefault(P_CONSOLE_LOG_LEVEL, strToIntLogLevel(_properties |
373 |
.getProperty(P_CONSOLE_LOG_LEVEL, "ERROR"))); |
373 |
.getProperty(P_CONSOLE_LOG_LEVEL, "ERROR"))); //$NON-NLS-1$ |
374 |
|
374 |
|
375 |
store.setDefault(P_ECLIPSE_LOGGING, _properties.getProperty( |
375 |
store.setDefault(P_ECLIPSE_LOGGING, _properties.getProperty( |
376 |
P_ECLIPSE_LOGGING, Boolean.TRUE.toString())); |
376 |
P_ECLIPSE_LOGGING, Boolean.TRUE.toString())); |
377 |
store.setDefault(P_ECLIPSE_LOG_LEVEL, strToIntLogLevel(_properties |
377 |
store.setDefault(P_ECLIPSE_LOG_LEVEL, strToIntLogLevel(_properties |
378 |
.getProperty(P_ECLIPSE_LOG_LEVEL, "ERROR"))); |
378 |
.getProperty(P_ECLIPSE_LOG_LEVEL, "ERROR"))); //$NON-NLS-1$ |
379 |
|
379 |
|
380 |
store.setDefault(P_FILE_LOGGING, _properties.getProperty( |
380 |
store.setDefault(P_FILE_LOGGING, _properties.getProperty( |
381 |
P_FILE_LOGGING, Boolean.FALSE.toString())); |
381 |
P_FILE_LOGGING, Boolean.FALSE.toString())); |
382 |
store.setDefault(P_FILE_LOG_LEVEL, strToIntLogLevel(_properties |
382 |
store.setDefault(P_FILE_LOG_LEVEL, strToIntLogLevel(_properties |
383 |
.getProperty(P_FILE_LOG_LEVEL, "ERROR"))); |
383 |
.getProperty(P_FILE_LOG_LEVEL, "ERROR"))); //$NON-NLS-1$ |
384 |
store.setDefault(P_FILE_PATH, _properties.getProperty(P_FILE_PATH, "")); |
384 |
store.setDefault(P_FILE_PATH, _properties.getProperty(P_FILE_PATH, "")); //$NON-NLS-1$ |
385 |
store.setDefault(P_FILE_CLEAR, _properties.getProperty(P_FILE_CLEAR, |
385 |
store.setDefault(P_FILE_CLEAR, _properties.getProperty(P_FILE_CLEAR, |
386 |
Boolean.TRUE.toString())); |
386 |
Boolean.TRUE.toString())); |
387 |
store.setDefault(P_FILE_ROLLOVER_FREQUENCY, _properties.getProperty( |
387 |
store.setDefault(P_FILE_ROLLOVER_FREQUENCY, _properties.getProperty( |
388 |
P_FILE_ROLLOVER_FREQUENCY, "DAILY")); |
388 |
P_FILE_ROLLOVER_FREQUENCY, "DAILY")); //$NON-NLS-1$ |
389 |
} |
389 |
} |
390 |
|
390 |
|
391 |
/** |
391 |
/** |
Lines 400-415
Link Here
|
400 |
if (str == null) { |
400 |
if (str == null) { |
401 |
return ERROR_LEVEL; |
401 |
return ERROR_LEVEL; |
402 |
} |
402 |
} |
403 |
if (str.equalsIgnoreCase("DEBUG")) { |
403 |
if (str.equalsIgnoreCase("DEBUG")) { //$NON-NLS-1$ |
404 |
return DEBUG_LEVEL; |
404 |
return DEBUG_LEVEL; |
405 |
} |
405 |
} |
406 |
if (str.equalsIgnoreCase("INFO")) { |
406 |
if (str.equalsIgnoreCase("INFO")) { //$NON-NLS-1$ |
407 |
return INFO_LEVEL; |
407 |
return INFO_LEVEL; |
408 |
} |
408 |
} |
409 |
if (str.equalsIgnoreCase("WARN")) { |
409 |
if (str.equalsIgnoreCase("WARN")) { //$NON-NLS-1$ |
410 |
return WARN_LEVEL; |
410 |
return WARN_LEVEL; |
411 |
} |
411 |
} |
412 |
if (str.equalsIgnoreCase("FATAL")) { |
412 |
if (str.equalsIgnoreCase("FATAL")) { //$NON-NLS-1$ |
413 |
return FATAL_LEVEL; |
413 |
return FATAL_LEVEL; |
414 |
} |
414 |
} |
415 |
return ERROR_LEVEL; |
415 |
return ERROR_LEVEL; |