diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorMessages.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorMessages.java
index a2ff97029..9c7a073b0 100644
--- a/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorMessages.java
+++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorMessages.java
@@ -14,30 +14,42 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
- * Processing Editor Messages object handles localization stuff
- * using the ProcessingEditorMessages.preferences file. This class
- * is never instantiated, and all of its variables and methods are
+ * Handles localization stuff using the ProcessingEditorMessages.preferences
+ * file. This is never instantiated, and all of its variables and methods are
* static.
*
* @author lonnen
*/
public class ProcessingEditorMessages {
+ /** location of the resource bundle */
private static final String RESOURCE_BUNDLE= "org.processing.editor.ProcessingEditorMessages";//$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ /** the resource bundle object itself*/
+ static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
private ProcessingEditorMessages() {
}
+ /**
+ * Gets a string for the given key from this resource bundle or one of its parents.
+ * Calling this method is equivalent to calling (String) getObject(key)
+ *
+ * @param key the key for the desired string
+ * @return the string for the given key
+ */
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ return "!" + key + "!";
}
}
+ /**
+ * Exposes the resource bundle for direct access
+ * @return this resource bundle
+ */
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
}
diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorPlugin.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorPlugin.java
index 5c623cdef..619392a25 100644
--- a/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorPlugin.java
+++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingEditorPlugin.java
@@ -33,7 +33,7 @@ import org.osgi.framework.BundleContext;
public class ProcessingEditorPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.processing.ProcessingEditor";
- public static final String PROCESSING_PARTITIONING= "__processing_partitioning"; //$NON-NLS-1$
+ public static final String PROCESSING_PARTITIONING= "__processing_partitioning";
// The shared instance
private static ProcessingEditorPlugin fgInstance;
@@ -143,18 +143,18 @@ public class ProcessingEditorPlugin extends AbstractUIPlugin {
* @param filename the file to be loaded
* @return BufferedInputStream to read the file with
*/
- public BufferedInputStream getFileInputStream(String filename) {
- Bundle bundle = getDefault().getBundle();
- URL fileLocation;
- try {
- fileLocation = FileLocator.toFileURL(bundle.getEntry(filename));
- BufferedInputStream file = new BufferedInputStream(fileLocation.openStream());
- return file;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null; // this should be more explicit than a null pointer from a caught exception, right? [lonnen] June 15, 2010
- }
+ public BufferedInputStream getFileInputStream(String filename) {
+ //TODO consider replacing this with find (IPath path) and openStream (IPath file)
+ Bundle bundle = getDefault().getBundle(); // the plugin's root directory, regardless of install directory
+ try {
+ URL fileLocation = FileLocator.toFileURL(bundle.getEntry(filename));
+ BufferedInputStream file = new BufferedInputStream(fileLocation.openStream());
+ return file;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null; // this should be more explicit than a null pointer from a caught exception, right? [lonnen] June 15, 2010
+ }
}
diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingEditorMessages.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingEditorMessages.java
index 79f7f86b4..8afec0667 100644
--- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingEditorMessages.java
+++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingEditorMessages.java
@@ -13,20 +13,37 @@ package org.processing.editor.language;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+/**
+ * Handles localization stuff using the ProcessingEditorMessages.preferences
+ * file. This is never instantiated, and all of its variables and methods are
+ * static.
+ *
+ * @author lonnen
+ */
public class ProcessingEditorMessages {
+ /** location of the resource bundle */
private static final String RESOURCE_BUNDLE= "org.processing.editor.ProcessingEditorMessages";//$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ /** the resource bundle object itself*/
+ static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
private ProcessingEditorMessages() {
}
+ /**
+ * Gets a string for the given key from this resource bundle or one of its parents.
+ * Calling this method is equivalent to calling (String) getObject(key)
+ *
+ * @param key the key for the desired string
+ * @return the string for the given key
+ */
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ return "!" + key + "!";
}
}
+
}