[Title] modify path validation routine (warning dialog)
authorgreatim <jaewon81.lim@samsung.com>
Fri, 11 Apr 2014 12:14:05 +0000 (21:14 +0900)
committergreatim <jaewon81.lim@samsung.com>
Fri, 11 Apr 2014 12:14:05 +0000 (21:14 +0900)
[Desc.]
[Issue]

org.tizen.dynamicanalyzer.workbench/META-INF/MANIFEST.MF
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/nl/WorkbenchLabels.java
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/nl/WorkbenchLabels.properties
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/Application.java
org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPlugin.java

index 8238a52..b4411d0 100644 (file)
@@ -7,7 +7,8 @@ Bundle-Version: 2.1.0.qualifier
 Bundle-Vendor: %providerName
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.ui,
- org.tizen.dynamicanalyzer.common;bundle-version="1.0.0"
+ org.tizen.dynamicanalyzer.common;bundle-version="1.0.0",
+ org.tizen.dynamicanalyzer.appearance;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.tizen.dynamicanalyzer.common.path,
  org.tizen.dynamicanalyzer.util,
index 7aa654a..69d31ca 100644 (file)
@@ -5,6 +5,9 @@ import org.eclipse.osgi.util.NLS;
 public class WorkbenchLabels extends NLS {
 
        private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.WorkbenchLabels"; //$NON-NLS-1$
+       
+       public static String TIZEN_SDK_PATH_ERROR_TITLE;
+       public static String TIZEN_SDK_PATH_ERROR;
 
        static {
                NLS.initializeMessages(BUNDLE_NAME, WorkbenchLabels.class);
index e69de29..7b9701c 100644 (file)
@@ -0,0 +1,2 @@
+TIZEN_SDK_PATH_ERROR_TITLE=SDK Installation Error
+TIZEN_SDK_PATH_ERROR=Tizen SDK installation path was not found.\nPlease make sure that Tizen SDK is installed correctly.
\ No newline at end of file
index 257a2eb..66b6647 100755 (executable)
@@ -42,12 +42,17 @@ import org.eclipse.core.runtime.Platform;
 import org.eclipse.equinox.app.IApplication;
 import org.eclipse.equinox.app.IApplicationContext;
 import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.PlatformUI;
 import org.tizen.dynamicanalyzer.common.path.PathConstants;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.nl.WorkbenchLabels;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.util.FileUtil;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 
 public class Application implements IApplication {
        private static final String LOG_PREFIX = "da_log_";
@@ -59,60 +64,64 @@ public class Application implements IApplication {
 
                // check for tizen sdk installation
                boolean pathValidness = PathManager.checkTizenPathValidation();
-               
-               if (pathValidness) {
-
-                       // set workspace directory for dynamic analyzer
-                       // why?
-                       Location instanceLoc = Platform.getInstanceLocation();
-                       String path = PathManager.DA_INSTALL_PATH + File.separator;
-                       try {
-                               instanceLoc.set(new URL("file", null, path), false);
-                       } catch (MalformedURLException e) {
-                               e.printStackTrace();
-                       }
+               if (pathValidness == false) {
+                       DADialog dialog = new DADialog(new Shell(display), SWT.NONE);
+                       dialog.setTitleText(WorkbenchLabels.TIZEN_SDK_PATH_ERROR_TITLE);
+                       dialog.setMessage(WorkbenchLabels.TIZEN_SDK_PATH_ERROR);
+                       dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                       dialog.open();
+                       System.exit(-1);
+               }
 
-                       // set log postfix
-                       SimpleDateFormat format = new SimpleDateFormat(
-                                       "yyyy_MM_dd_HH-mm-ss", Locale.KOREA); //$NON-NLS-1$
-                       Date date = new Date();
-                       String logPostFix = format.format(date);
-                       PathManager.setLogPostFix(logPostFix);
-
-                       // check for log to file
-                       String logtofile = PathManager.DA_DATA_PATH + File.separator
-                                       + PathConstants.DA_STDOUT_TO_FILE;
-                       File ltofile = new File(logtofile);
-                       if (ltofile != null && ltofile.exists()) {
-                               String logPath = PathManager.DA_LOG_PATH;
-                               File logs = new File(logPath);
-                               if (!logs.exists() && !logs.mkdirs()) {
-                                       System.out
-                                                       .println("Log directory create failed.. log file create failed...");
-                               } else {
-                                       String logFileName = LOG_PREFIX + logPostFix;//$NON-NLS-1$
-                                       logPath += File.separator + logFileName;
-
-                                       File logfile = new File(logPath);
-                                       FileOutputStream fos = new FileOutputStream(logfile);
-                                       PrintStream ps = new PrintStream(fos);
-                                       System.setOut(ps);
-                                       System.setErr(ps);
-
-                                       checkLogs(logs.getPath());
-                               }
-                       }
+               // set workspace directory for dynamic analyzer
+               // why?
+               Location instanceLoc = Platform.getInstanceLocation();
+               String path = PathManager.DA_INSTALL_PATH + File.separator;
+               try {
+                       instanceLoc.set(new URL("file", null, path), false);
+               } catch (MalformedURLException e) {
+                       e.printStackTrace();
+               }
 
-                       // check for multiple instance of dynamic analyzer
-                       if (SingletonFocusManager.acquireSingleton()) {
-                               System.out.println("The First DA Running");
+               // set log postfix
+               SimpleDateFormat format = new SimpleDateFormat(
+                               "yyyy_MM_dd_HH-mm-ss", Locale.KOREA); //$NON-NLS-1$
+               Date date = new Date();
+               String logPostFix = format.format(date);
+               PathManager.setLogPostFix(logPostFix);
+
+               // check for log to file
+               String logtofile = PathManager.DA_DATA_PATH + File.separator
+                               + PathConstants.DA_STDOUT_TO_FILE;
+               File ltofile = new File(logtofile);
+               if (ltofile != null && ltofile.exists()) {
+                       String logPath = PathManager.DA_LOG_PATH;
+                       File logs = new File(logPath);
+                       if (!logs.exists() && !logs.mkdirs()) {
+                               System.out
+                                               .println("Log directory create failed.. log file create failed...");
                        } else {
-                               System.out.println("Already DA Running");
-                               SingletonFocusManager.setFocusToDA();
-                               System.exit(-1);
+                               String logFileName = LOG_PREFIX + logPostFix;//$NON-NLS-1$
+                               logPath += File.separator + logFileName;
+
+                               File logfile = new File(logPath);
+                               FileOutputStream fos = new FileOutputStream(logfile);
+                               PrintStream ps = new PrintStream(fos);
+                               System.setOut(ps);
+                               System.setErr(ps);
+
+                               checkLogs(logs.getPath());
                        }
+               }
 
-               } // end of if (pathValidness)
+               // check for multiple instance of dynamic analyzer
+               if (SingletonFocusManager.acquireSingleton()) {
+                       System.out.println("The First DA Running");
+               } else {
+                       System.out.println("Already DA Running");
+                       SingletonFocusManager.setFocusToDA();
+                       System.exit(-1);
+               }
 
                int returnCode = PlatformUI.createAndRunWorkbench(display,
                                new ApplicationWorkbenchAdvisor());
@@ -127,7 +136,7 @@ public class Application implements IApplication {
        @Override
        public void stop() {
                SingletonFocusManager.releaseSingleton();
-               
+
                if (!PlatformUI.isWorkbenchRunning()) {
                        return;
                }
index e634048..e04c294 100644 (file)
@@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.tizen.dynamicanalyzer.common;bundle-version="1.0.0",
  org.tizen.dynamicanalyzer.widgets;bundle-version="1.0.0",
- org.tizen.dynamicanalyzer.workbench;bundle-version="2.1.0",
- org.tizen.dynamicanalyzer.appearance;bundle-version="1.0.0"
+ org.tizen.dynamicanalyzer.appearance;bundle-version="1.0.0",
+ org.tizen.dynamicanalyzer.workbench;bundle-version="2.1.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Activator: org.tizen.dynamicanalyzer.common.AnalyzerPlugin
 Bundle-ActivationPolicy: lazy
index d3fb2e5..f1c0def 100644 (file)
@@ -30,8 +30,6 @@ import java.io.File;
 import java.util.List;\r
 \r
 \r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Shell;\r
 import org.eclipse.ui.IPartService;\r
 import org.eclipse.ui.IWorkbench;\r
 import org.eclipse.ui.IWorkbenchListener;\r
@@ -42,12 +40,8 @@ import org.osgi.framework.BundleContext;
 import org.tizen.dynamicanalyzer.common.path.PathManager;\r
 import org.tizen.dynamicanalyzer.listeners.AnalyzerPartListener;\r
 import org.tizen.dynamicanalyzer.listeners.AnalyzerPerspectiveListener;\r
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
-import org.tizen.dynamicanalyzer.resources.ImageResources;\r
 import org.tizen.dynamicanalyzer.sql.SqlManager;\r
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;\r
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
-import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;\r
 \r
 public class AnalyzerPlugin extends AbstractUIPlugin {\r
 \r
@@ -62,18 +56,6 @@ public class AnalyzerPlugin extends AbstractUIPlugin {
                super.start(context);\r
                plugin = this;\r
                \r
-               // check for path validness\r
-               if (!PathManager.checkTizenPathValidation()) {\r
-                       final Shell shell = WorkbenchUtil.getWorkbenchWindow()\r
-                                       .getShell();\r
-                       DADialog dialog = new DADialog(shell, SWT.NONE); // FIXME\r
-                       dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);\r
-                       dialog.setMessage(AnalyzerLabels.PATH_WARNING);\r
-                       if (dialog.open() == true) {\r
-                               System.exit(-1);\r
-                       }\r
-               }\r
-\r
                // Adds workbench listener.\r
                IWorkbench workbench = PlatformUI.getWorkbench();\r
                workbench.getActiveWorkbenchWindow().getPages();\r