use of org.eclipse.ui.WorkbenchException in project jbosstools-hibernate by jbosstools.
the class OrmDiagram method loadFromFile.
public void loadFromFile(IPath path, boolean format) {
fileLoadSuccessfull = false;
FileInputStream fis = null;
try {
File file = new File(path.toOSString());
if (file.exists()) {
fis = new FileInputStream(file);
if (format) {
BufferedReader reader = new BufferedReader(// $NON-NLS-1$
new InputStreamReader(fis, "utf-8"));
try {
IMemento memento = XMLMemento.createReadRoot(reader);
loadState(memento);
fileLoadSuccessfull = true;
} catch (WorkbenchException e) {
// $NON-NLS-1$
HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of mapping.", e);
}
} else {
Properties properties = new Properties();
properties.load(fis);
loadFromProperties(properties);
fileLoadSuccessfull = true;
}
}
} catch (IOException ex) {
// $NON-NLS-1$
HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of mapping.", ex);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
}
}
use of org.eclipse.ui.WorkbenchException in project erlide_eclipse by erlang.
the class FilteredModulesSelectionDialog method restoreDialog.
@Override
protected void restoreDialog(final IDialogSettings settings) {
super.restoreDialog(settings);
final String setting = settings.get(FilteredModulesSelectionDialog.WORKINGS_SET_SETTINGS);
if (setting != null) {
try {
final IMemento memento = XMLMemento.createReadRoot(new StringReader(setting));
workingSetFilterActionGroup.restoreState(memento);
} catch (final WorkbenchException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, ErlideUIPlugin.PLUGIN_ID, IStatus.ERROR, "", // $NON-NLS-1$
e));
// don't do anything. Simply don't restore the settings
}
}
addListFilter(workingSetFilter);
applyFilter();
}
Aggregations