Search in sources :

Example 1 with RuntimeInfoPreferencesSerializer

use of org.erlide.backend.runtimeinfo.RuntimeInfoPreferencesSerializer 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();
}
Also used : RuntimeInfoPreferencesSerializer(org.erlide.backend.runtimeinfo.RuntimeInfoPreferencesSerializer) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) RuntimeInfoCatalogData(org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData) UIJob(org.eclipse.ui.progress.UIJob)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 UIJob (org.eclipse.ui.progress.UIJob)1 RuntimeInfoPreferencesSerializer (org.erlide.backend.runtimeinfo.RuntimeInfoPreferencesSerializer)1 RuntimeInfo (org.erlide.runtime.runtimeinfo.RuntimeInfo)1 RuntimeInfoCatalogData (org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData)1