1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 17:25:38 +02:00

Removing redundant load methods.

This commit is contained in:
David Dykstal 2006-04-27 17:47:15 +00:00
parent ce1cce7d19
commit 7f5e7f3b3a

View file

@ -859,112 +859,6 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
// ----------------------------------------
/**
* Sets the resource bundle. Called by child class in their
* constructor, say, to load in their resource bundle. Handles
* rare case when not found by telling user, then dying.
* Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently.
* @param name of .properties file, without the '.properties' specified
* @return ResourceBundle if loaded successfully, null if not.
*/
public final ResourceBundle loadResourceBundle(String fileName)
{
ResourceBundle rb = null;
try {
IPath path = new Path("$nl$/"+fileName+".properties");
URL url = Platform.find(getBundle(), path);
if ( url != null )
{
InputStream in = url.openStream();
rb = new PropertyResourceBundle(in);
in.close();
}
else
logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",null);
} catch (IOException e) {
logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",e);
}
return rb;
}
/**
* Sets the default resource bundle (so that untranslated strings can be obtained). Called by child class in their
* constructor, say, to load in their resource bundle. Handles
* rare case when not found by telling user, then dying.
* Note: This is NOT to be used for plugin.properties since Eclipse handles that file differently.
* @param name of .properties file, without the '.properties' specified
* @return ResourceBundle if loaded successfully, null if not.
*/
public final ResourceBundle loadDefaultResourceBundle(String fileName)
{
ResourceBundle rb = null;
try {
IPath path = new Path(fileName+".properties");
URL url = Platform.find(getBundle(), path);
if ( url != null )
{
InputStream in = url.openStream();
rb = new PropertyResourceBundle(in);
in.close();
}
else
logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",null);
} catch (IOException e) {
logError("SystemBasePlugin - try for resource bundle " + fileName + " not successful!",e);
}
return rb;
}
/**
* Parse the given message file that is in the plugin into memory, into a SystemMessageFile object.
* @param fileName - unqualified name of the .xml message file, inluding the .xml extension.
* @return SystemMessageFile (null if unable to load the file)
*/
public final SystemMessageFile loadMessageFile(String fileName)
{
SystemMessageFile mf = null;
try
{
IPath path = new Path("$nl$/"+fileName);
URL url = Platform.find(getBundle(), path);
if (url != null) {
url = Platform.resolve(url);
mf = new SystemUIMessageFile(/*url.toString()*/url.getPath(), getBundle().getEntry("/").getPath());
}
} catch (Exception exc)
{
logError("Error loading message file " + fileName ,exc);
}
return mf;
}
/**
* Parse the given message file that is in the plugin into memory, into a SystemMessageFile object.
* @param fileName - unqualified name of the .xml message file, inluding the .xml extension.
* @return SystemMessageFile (null if unable to load the file)
*/
public final SystemMessageFile loadDefaultMessageFile(String fileName)
{
SystemMessageFile mf = null;
try
{
IPath path = new Path(fileName);
URL url = Platform.find(getBundle(), path);
if (url != null) {
url = Platform.resolve(url);
mf = new SystemUIMessageFile(/*url.toString()*/url.getPath(), getBundle().getEntry("/").getPath());
}
} catch (Exception exc)
{
logError("Error loading message file " + fileName ,exc);
}
return mf;
}
/**
* Put up an error message when a programming error is detected.
* Please note this should never happen in production so we don't translate!
*/