From db9dd3dffb28d959205ccfd7a0828f2728221426 Mon Sep 17 00:00:00 2001 From: "yoonki.park" Date: Wed, 27 Jul 2011 19:59:17 +0900 Subject: [PATCH] [Title] remove system.exit code from sdk path check routine. --- .../ide/common/properties/InstallPathConfig.java | 29 ++++++++-------------- .../samsung/ide/common/util/ConsoleManager.java | 24 +++++++++++------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/properties/InstallPathConfig.java b/com.samsung.ide.common/src/com/samsung/ide/common/properties/InstallPathConfig.java index 14252a2..e81781a 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/properties/InstallPathConfig.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/properties/InstallPathConfig.java @@ -8,10 +8,7 @@ package com.samsung.ide.common.properties; import java.io.File; import java.util.prefs.Preferences; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - +import com.samsung.ide.common.util.ConsoleManager; import com.samsung.ide.common.util.HostUtil; import com.samsung.ide.common.util.OSChecker; @@ -21,11 +18,9 @@ final public class InstallPathConfig { private static String sdkInstallPath; private final static String SLP_REGKEY = "slpsdk-installpath"; private final static String EMULATOR_PATH = "Emulator"; - private final static String BUILDSYSTEM_PATH = "SDK" + File.separatorChar +"build-system"; - static { + public InstallPathConfig() { String sdkPath; - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if ( OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) { sdkPath= System.getProperty("user.home") + "/.slpsdk"; @@ -33,33 +28,31 @@ final public class InstallPathConfig { if (HostUtil.exists(fileContent[1])) { sdkInstallPath = fileContent[1]; } else { - MessageDialog.openInformation(window.getShell(),"SLP SDK", "SLP SDK is not installed propertly. \nSLP IDE will be terminated."); - System.exit(-1); + ConsoleManager cm = new ConsoleManager("SLP SDK",true); + cm.getMessageConsoleStream(true).println("SLP SDK is not installed propertly."); } } else if (OSChecker.isWindows()) { sdkPath = Preferences.userRoot().get(SLP_REGKEY, ""); if (HostUtil.exists(sdkPath)) { sdkInstallPath = sdkPath; } else { - MessageDialog.openInformation(window.getShell(),"SLP SDK", "SLP SDK is not installed propertly. \nSLP IDE will be terminated."); - System.exit(-1); + ConsoleManager cm = new ConsoleManager("SLP SDK",true); + cm.getMessageConsoleStream(true).println("SLP SDK is not installed propertly."); } } else { - MessageDialog.openInformation(window.getShell(),"SLP SDK", System.getProperty("os.name") + " is not supported. \nSLP IDE will be terminated."); - System.exit(-1); + ConsoleManager cm = new ConsoleManager("SLP SDK",true); + cm.getMessageConsoleStream(true).println(System.getProperty("os.name") + " is not supported currently."); } } public static String getEmulatorPath(){ return sdkInstallPath + File.separatorChar + EMULATOR_PATH; } - public static String getIDEPath() { // can't help but putting the code due to the wac ide path - return System.getProperty("user.dir"); + public static String getIDEPath() { + // FIXME : can't help but putting the code due to the wac ide path , It has to be removed soon. + return System.getProperty("user.dir"); } public static String getSDKPath() { return sdkInstallPath; } - public static String getSBIPath() { - return sdkInstallPath + File.separatorChar + BUILDSYSTEM_PATH; - } } diff --git a/com.samsung.ide.common/src/com/samsung/ide/common/util/ConsoleManager.java b/com.samsung.ide.common/src/com/samsung/ide/common/util/ConsoleManager.java index b78581c..214b244 100644 --- a/com.samsung.ide.common/src/com/samsung/ide/common/util/ConsoleManager.java +++ b/com.samsung.ide.common/src/com/samsung/ide/common/util/ConsoleManager.java @@ -115,15 +115,21 @@ public class ConsoleManager public MessageConsoleStream getMessageConsoleStream() { return getConsole().newMessageStream(); } - public void print(String line) { - final MessageConsoleStream output = getConsole().newMessageStream(); - output.print(line); - try { - output.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - ConsolePlugin.log(e); - } + public void print(final String line) { + Runnable runnable = new Runnable() { + public void run() { + final MessageConsoleStream output = getConsole().newMessageStream(); + output.print(line); + try { + output.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + ConsolePlugin.log(e); + } + } + }; + Display.getDefault().syncExec(runnable); + } public void println(String line) { final MessageConsoleStream output = getConsole().newMessageStream(); -- 2.7.4