use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class EclipseLaunchConsoleConfigurationPreferences method getProperties.
public Properties getProperties() {
File propFile = getPropertyFile();
if (propFile == null)
return getProjectOverrides();
Properties fileProp = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(propFile);
fileProp.load(fis);
} catch (IOException io) {
throw new HibernateConsoleRuntimeException(NLS.bind(HibernateConsoleMessages.EclipseLaunchConsoleConfigurationPreferences_could_not_load_property_file, propFile), io);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
}
// which properties are main?
Properties p = getProjectOverrides();
if (p != null) {
p.putAll(fileProp);
return p;
}
return fileProp;
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class HibernateConsolePlugin method readStateFrom.
void readStateFrom(File f) {
try {
EclipseConsoleConfigurationPreferences[] preferences = EclipseConsoleConfigurationPreferences.readStateFrom(f);
for (int i = 0; i < preferences.length; i++) {
ConsoleConfigurationPreferences prefs = preferences[i];
// TODO: do we need to broadcast every time when reading state ?
KnownConfigurations.getInstance().addConfiguration(new EclipseConsoleConfiguration(prefs), false);
}
} catch (HibernateConsoleRuntimeException hcr) {
logErrorMessage(HibernateConsoleMessages.HibernateConsolePlugin_error_while_reading_console_config, hcr);
}
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ReloadConfigurationAction method doRun.
protected void doRun() {
for (Iterator<?> i = getSelectedNonResources().iterator(); i.hasNext(); ) {
try {
Object node = i.next();
if (node instanceof ConsoleConfiguration) {
ConsoleConfiguration config = (ConsoleConfiguration) node;
config.reset();
updateState(config);
viewer.refresh(node);
}
} catch (HibernateConsoleRuntimeException he) {
HibernateConsolePlugin.getDefault().showError(viewer.getControl().getShell(), HibernateConsoleMessages.ReloadConfigurationAction_exception_while_start_hibernate, he);
} catch (UnsupportedClassVersionError ucve) {
HibernateConsolePlugin.getDefault().showError(viewer.getControl().getShell(), HibernateConsoleMessages.ReloadConfigurationAction_starting_hibernate_resulted_exception, ucve);
}
}
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ClassLoaderHelper method getRawLocationFile.
private static File getRawLocationFile(IPath simplePath) {
IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(simplePath);
File file = null;
if (member != null) {
IPath rawLocation = member.getRawLocation();
if (rawLocation == null) {
rawLocation = member.getLocation();
if (rawLocation == null) {
throw new HibernateConsoleRuntimeException(HibernateConsoleMessages.ClassLoaderHelper_could_not_determine_physical_location_for + simplePath);
}
}
file = rawLocation.toFile();
} else {
file = simplePath.toFile();
}
return file;
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class StandAloneConsoleConfigurationPreferences method readStateFrom.
public static StandAloneConsoleConfigurationPreferences[] readStateFrom(File f) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser;
try {
parser = factory.newDocumentBuilder();
Document doc = parser.parse(f);
Element root = doc.getDocumentElement();
NodeList elementsByTagName = root.getElementsByTagName(CONFIGURATION_TAG);
StandAloneConsoleConfigurationPreferences[] result = new StandAloneConsoleConfigurationPreferences[elementsByTagName.getLength()];
for (int i = 0; i < elementsByTagName.getLength(); i++) {
result[i] = new StandAloneConsoleConfigurationPreferences();
result[i].readStateFrom((Element) elementsByTagName.item(i));
}
return result;
} catch (SAXException sa) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.StandAloneConsoleConfigurationPreferences_errors_while_parsing + f, sa);
} catch (ParserConfigurationException e) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.StandAloneConsoleConfigurationPreferences_errors_while_parsing + f, e);
} catch (IOException e) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.StandAloneConsoleConfigurationPreferences_errors_while_parsing + f, e);
}
}
Aggregations