use of org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData in project erlide_eclipse by erlang.
the class RuntimePreferencePage method performOk.
@Override
public boolean performOk() {
if (defaultRuntime == null || defaultRuntime == RuntimeInfo.NO_RUNTIME_INFO) {
defaultRuntime = (RuntimeInfo) fRuntimeList.getElementAt(0);
}
if (erlideRuntime == null) {
erlideRuntime = defaultRuntime;
}
boolean restart = false;
final RuntimeInfo oldDefault = catalog.getDefaultRuntime();
if (oldDefault != RuntimeInfo.NO_RUNTIME_INFO && !defaultRuntime.equals(oldDefault)) {
restart = RestartDialog.openQuestion(getShell());
}
catalog.setRuntimes(runtimes, defaultRuntime.getName(), erlideRuntime.getName());
final RuntimeInfoPreferencesSerializer serializer = new RuntimeInfoPreferencesSerializer();
serializer.store(new RuntimeInfoCatalogData(runtimes, defaultRuntime.getName(), erlideRuntime.getName()));
// save column widths
final IDialogSettings settings = ErlideUIPlugin.getDefault().getDialogSettings();
saveColumnSettings(settings, RuntimePreferencePage.RUNTIMES_PREFERENCE_PAGE);
if (restart) {
new UIJob("restart") {
@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
PlatformUI.getWorkbench().restart();
return Status.OK_STATUS;
}
}.schedule(100);
}
return super.performOk();
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData in project erlide_eclipse by erlang.
the class RuntimeCore method getRuntimeInfoCatalog.
public static final synchronized IRuntimeInfoCatalog getRuntimeInfoCatalog(final IRuntimeInfoSerializer serializer) {
if (RuntimeCore.runtimeInfoCatalog == null) {
final RuntimeInfoCatalogData data = serializer.load();
RuntimeCore.runtimeInfoCatalog = new RuntimeInfoCatalog();
RuntimeCore.runtimeInfoCatalog.setRuntimes(data.runtimes, data.defaultRuntimeName, data.erlideRuntimeName);
final RuntimeInfo runtime = RuntimeCore.runtimeInfoCatalog.getErlideRuntime();
if (!HostnameChecker.getInstance().detectHostNames(runtime.getOtpHome())) {
// XXX show troubleshooting page and re-detect
ErlLogger.error("no matching hostnames found!! Edit ~/.erlide.hosts");
}
}
return RuntimeCore.runtimeInfoCatalog;
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData in project erlide_eclipse by erlang.
the class RuntimeInfoPreferencesSerializer method load.
@Override
public synchronized RuntimeInfoCatalogData load() {
RuntimeInfoCatalogData data = new RuntimeInfoCatalogData();
data = loadPrefs(data, RuntimeInfoPreferencesSerializer.getDefaultOldRootNode());
data = loadPrefs(data, defaultRootNode);
data = loadPrefs(data, RuntimeInfoPreferencesSerializer.getInstanceOldRootNode());
data = loadPrefs(data, instanceRootNode);
String dflt = null;
String ide = null;
if (!data.runtimes.isEmpty()) {
dflt = data.defaultRuntimeName != null ? data.defaultRuntimeName : data.runtimes.iterator().next().getName();
ide = data.erlideRuntimeName != null ? data.erlideRuntimeName : dflt;
}
return new RuntimeInfoCatalogData(data.runtimes, dflt, ide);
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData in project erlide_eclipse by erlang.
the class RuntimeInfoPreferencesSerializer method loadPrefs.
private RuntimeInfoCatalogData loadPrefs(final RuntimeInfoCatalogData data, final IEclipsePreferences root) {
String[] children;
final Collection<RuntimeInfo> runtimes = new ArrayList<>(data.runtimes);
try {
children = root.childrenNames();
for (final String name : children) {
final RuntimeInfo rt = RuntimeInfoLoader.load(root.node(name));
runtimes.add(rt);
}
} catch (final BackingStoreException e) {
ErlLogger.warn(e);
}
final String defaultRuntimeName = root.get(RuntimeInfoPreferencesSerializer.DEFAULT_KEY, data.defaultRuntimeName);
final String ideRuntimeName = root.get(RuntimeInfoPreferencesSerializer.ERLIDE_KEY, data.erlideRuntimeName);
return new RuntimeInfoCatalogData(runtimes, defaultRuntimeName, ideRuntimeName);
}
Aggregations