diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java | 267 |
1 files changed, 127 insertions, 140 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java b/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java index 8cff533693..a90c3a4034 100644 --- a/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java +++ b/plugins/org.eclipse.emf.cdo.releng.setup.ide/src/org/eclipse/emf/cdo/releng/setup/ide/SetupIDE.java @@ -10,149 +10,136 @@ */ package org.eclipse.emf.cdo.releng.setup.ide; -import org.eclipse.emf.cdo.releng.setup.helper.OS; -import org.eclipse.emf.cdo.releng.setup.helper.ProgressLog; -import org.eclipse.emf.cdo.releng.setup.helper.ProgressLogRunnable; -import org.eclipse.emf.cdo.releng.setup.ui.ProgressLogDialog; - -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -import java.io.File; -import java.util.Collections; -import java.util.List; - /** * @author Eike Stepper */ +@Deprecated public final class SetupIDE { - private static final SetupContext CONTEXT = Activator.getDefault(); - - private static final IWorkbench WORKBENCH = PlatformUI.getWorkbench(); - - private static final int INITIAL = 0; - - private static final int DONE = 100; - - private static int state; - - public static void run() throws Exception - { - state = readState(); - if (state == DONE) - { - return; - } - - IWorkbenchWindow window = WORKBENCH.getWorkbenchWindows()[0]; - run(window); - } - - private static void run(IWorkbenchWindow window) - { - final Shell shell = window.getShell(); - shell.getDisplay().asyncExec(new Runnable() - { - public void run() - { - ProgressLogDialog.run(shell, CONTEXT.getLogFile(), "Setting up IDE", new ProgressLogRunnable() - { - public boolean run(ProgressLog log) throws Exception - { - boolean autoBuilding = Buckminster.disableAutoBuilding(); - - try - { - return SetupIDE.run(log); - } - finally - { - Buckminster.restoreAutoBuilding(autoBuilding); - } - } - }); - } - }); - } - - private static boolean run(ProgressLog log) throws Exception - { - boolean restart = false; - if (state < 1) - { - P2.registerUpdateLocations(); - saveState(1); - } - - if (state < 2) - { - Prefs.initEarly(); - saveState(2); - } - - if (state < 3) - { - GitClones.init(); - saveState(3); - } - - if (state < 4) - { - Buckminster.importBaseline(); - saveState(4); - } - - if (state < 5) - { - Buckminster.importTarget(); - saveState(5); - } - - if (state < 6) - { - Buckminster.importMSpec(); - saveState(6); - restart = true; - } - - if (state < 7) - { - WorkingSets.init(); - saveState(7); - } - - if (state < DONE) - { - Prefs.initLate(); - saveState(DONE); - } - - Buckminster.restoreAutoBuilding(true); - return restart; - } - - private static void saveState(int state) - { - File stateFile = new File(Activator.getDefault().getStateLocation().toOSString(), "state.txt"); - OS.INSTANCE.writeText(stateFile, Collections.singletonList(Integer.toString(state))); - } - - private static int readState() - { - File stateFile = new File(Activator.getDefault().getStateLocation().toOSString(), "state.txt"); - if (stateFile.exists()) - { - List<String> lines = OS.INSTANCE.readText(stateFile); - if (!lines.isEmpty()) - { - String line = lines.get(0); - return Integer.parseInt(line); - } - } - - return INITIAL; - } + // private static final SetupContext CONTEXT = Activator.getDefault(); + // + // private static final IWorkbench WORKBENCH = PlatformUI.getWorkbench(); + // + // private static final int INITIAL = 0; + // + // private static final int DONE = 100; + // + // private static int state; + // + // public static void run() throws Exception + // { + // state = readState(); + // if (state == DONE) + // { + // return; + // } + // + // IWorkbenchWindow window = WORKBENCH.getWorkbenchWindows()[0]; + // run(window); + // } + // + // private static void run(IWorkbenchWindow window) + // { + // final Shell shell = window.getShell(); + // shell.getDisplay().asyncExec(new Runnable() + // { + // public void run() + // { + // ProgressLogDialog.run(shell, CONTEXT.getLogFile(), "Setting up IDE", new ProgressLogRunnable() + // { + // public boolean run(ProgressLog log) throws Exception + // { + // boolean autoBuilding = Buckminster.disableAutoBuilding(); + // + // try + // { + // return SetupIDE.run(log); + // } + // finally + // { + // Buckminster.restoreAutoBuilding(autoBuilding); + // } + // } + // }); + // } + // }); + // } + // + // private static boolean run(ProgressLog log) throws Exception + // { + // boolean restart = false; + // if (state < 1) + // { + // P2.registerUpdateLocations(); + // saveState(1); + // } + // + // if (state < 2) + // { + // Prefs.initEarly(); + // saveState(2); + // } + // + // if (state < 3) + // { + // GitClones.init(); + // saveState(3); + // } + // + // if (state < 4) + // { + // Buckminster.importBaseline(); + // saveState(4); + // } + // + // if (state < 5) + // { + // Buckminster.importTarget(); + // saveState(5); + // } + // + // if (state < 6) + // { + // Buckminster.importMSpec(); + // saveState(6); + // restart = true; + // } + // + // if (state < 7) + // { + // WorkingSets.init(); + // saveState(7); + // } + // + // if (state < DONE) + // { + // Prefs.initLate(); + // saveState(DONE); + // } + // + // Buckminster.restoreAutoBuilding(true); + // return restart; + // } + // + // private static void saveState(int state) + // { + // File stateFile = new File(Activator.getDefault().getStateLocation().toOSString(), "state.txt"); + // OS.INSTANCE.writeText(stateFile, Collections.singletonList(Integer.toString(state))); + // } + // + // private static int readState() + // { + // File stateFile = new File(Activator.getDefault().getStateLocation().toOSString(), "state.txt"); + // if (stateFile.exists()) + // { + // List<String> lines = OS.INSTANCE.readText(stateFile); + // if (!lines.isEmpty()) + // { + // String line = lines.get(0); + // return Integer.parseInt(line); + // } + // } + // + // return INITIAL; + // } } |