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_";
// 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());
@Override
public void stop() {
SingletonFocusManager.releaseSingleton();
-
+
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
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
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
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