diff --git a/.gitignore b/.gitignore
index 8facea3..9faf990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Database
/DB/
+/Databases/
# Database logs
*.log
@@ -11,4 +12,10 @@ target/
.idea
# UI Images
-*.png
\ No newline at end of file
+*.png
+
+# intelliJ files
+*.iml
+
+# screenshots folder
+/Screenshots/
diff --git a/CSV_Before_Run_call_trace.txt b/CSV_Before_Run_call_trace.txt
deleted file mode 100644
index 1d6443b..0000000
--- a/CSV_Before_Run_call_trace.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-1500994917851|13532|1|Enter|1|[[Ljava.lang.String;@5fcfe4b2]
-1500994917940|13532|12|Enter|2|[javafx.stage.Stage@1dd8ca16]
-1500994917944|13532|12|Enter|3|[com.application.Main@275a96b5]
-1500994917944|13532|12|Exit
-1500994917945|13532|12|Enter|4|[]
-1500994918049|13532|12|Enter|5|[MenuItem@12b748e0[styleClass=[menu-item]]]
-1500994918049|13532|12|Exit
-1500994918049|13532|12|Enter|5|[MenuItem@7334ee37[styleClass=[menu-item]]]
-1500994918049|13532|12|Exit
-1500994918049|13532|12|Enter|5|[MenuItem@7d1e983a[styleClass=[menu-item]]]
-1500994918049|13532|12|Exit
-1500994918049|13532|12|Enter|5|[MenuItem@2c5ebf5f[styleClass=[menu-item]]]
-1500994918049|13532|12|Exit
-1500994918050|13532|12|Enter|5|[MenuItem@406127c[styleClass=[menu-item]]]
-1500994918050|13532|12|Exit
-1500994918050|13532|12|Enter|5|[MenuItem@5017019d[styleClass=[menu-item]]]
-1500994918050|13532|12|Exit
-1500994918050|13532|12|Enter|5|[MenuItem@59419ced[styleClass=[menu-item]]]
-1500994918050|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@341d1344[styleClass=label glyph-font]'']
-1500994918051|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@5ceef7b3[styleClass=label glyph-font]'']
-1500994918051|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@99dae37[styleClass=label glyph-font]'']
-1500994918051|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@6a64a955[styleClass=label glyph-font]'']
-1500994918051|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@36bf006e[styleClass=label glyph-font]'']
-1500994918051|13532|12|Exit
-1500994918051|13532|12|Enter|6|[Glyph@1dc72a65[styleClass=label glyph-font]'']
-1500994918052|13532|12|Exit
-1500994918052|13532|12|Enter|6|[Glyph@794fc3fc[styleClass=label glyph-font]'']
-1500994918052|13532|12|Exit
-1500994918052|13532|12|Enter|6|[Glyph@36aef381[styleClass=label glyph-font]'']
-1500994918052|13532|12|Exit
-1500994918052|13532|12|Enter|7|[]
-1500994918060|13532|12|Exit
-1500994918060|13532|12|Enter|8|[]
-1500994918064|13532|12|Exit
-1500994918064|13532|12|Exit
-1500994918334|13532|12|Exit
-1500994920827|13532|12|Enter|9|[javafx.event.ActionEvent[source=MenuItem@12b748e0[styleClass=[menu-item]]]]
-1500994920827|13532|12|Enter|10|[MethodDefinition]
-1500994932180|13532|12|Exit
-1500994932182|13532|12|Enter|11|[/home/omer/ThreadExampleThree_method_definitions.txt]
-1500994932182|13532|12|Exit
-1500994932184|13532|12|Enter|12|[methodDefnFileSet,true]
-1500994932184|13532|12|Exit
-1500994932184|13532|12|Exit
-1500994934923|13532|12|Enter|13|[javafx.event.ActionEvent[source=MenuItem@7334ee37[styleClass=[menu-item]]]]
-1500994934923|13532|12|Enter|10|[CallTrace]
-1500994942691|13532|12|Exit
-1500994942692|13532|12|Enter|14|[/home/omer/ThreadExampleThree_call_trace.txt]
-1500994942692|13532|12|Exit
-1500994942692|13532|12|Enter|12|[callTraceFileSet,true]
-1500994942692|13532|12|Exit
-1500994942692|13532|12|Exit
-1500994953782|13532|1|Exit
diff --git a/CSV_Before_Run_method_definitions.txt b/CSV_Before_Run_method_definitions.txt
deleted file mode 100644
index a2ee4d5..0000000
--- a/CSV_Before_Run_method_definitions.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-1|com.application.Main|main|([Ljava/lang/String;)V
-2|com.application.Main|start|(Ljavafx/stage/Stage;)V
-3|com.application.fxgraph.graph.EventHandlers|saveRef|(Lcom/application/Main;)V
-4|com.application.Main|setUpMenu|()V
-5|com.application.Main|lambda$setUpMenu$0|(Ljavafx/scene/control/MenuItem;)V
-6|com.application.Main|lambda$setUpMenu$1|(Lorg/controlsfx/glyphfont/Glyph;)V
-7|com.application.Main|populateInstructions|()V
-8|com.application.Main|setMenuActions|()V
-9|com.application.Main|lambda$setMenuActions$2|(Ljavafx/event/ActionEvent;)V
-10|com.application.Main|chooseLogFile|(Ljava/lang/String;)Ljava/io/File;
-11|com.application.logs.fileHandler.MethodDefinitionLogFile|setFile|(Ljava/io/File;)V
-12|com.application.Main|changeBool|(Ljava/lang/String;Z)V
-13|com.application.Main|lambda$setMenuActions$3|(Ljavafx/event/ActionEvent;)V
-14|com.application.logs.fileHandler.CallTraceLogFile|setFile|(Ljava/io/File;)V
diff --git a/CallStackVisualization.iml b/CallStackVisualization.iml
deleted file mode 100644
index 9a6c139..0000000
--- a/CallStackVisualization.iml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 030675b..1a695ff 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,37 @@
-# CSVFull
+# Java Call Stack Graph Tool
+#### A tool to generate a graphical representation of the Java call stack.
+This tool generate a tree graph for the call stack using the information in log files for you code. A specific format of log files are required for the tool to parse and process the logs. Please see _**How to generate Log files for you code**_ section below to generate log files for your own code.
+
+### Instruction to run tool using Maven.
+1. Download or clone the repository.
+`git clone https://github.com/OmerKhureshi/JavaCallStackGraphTool.git`
+
+2. Since this is a Maven project, use the command below to run the tool from root folder of the repo.
+`mvn exec:java -Dexec.mainClass=com.csgt.Main`
### Instruction to run tool using intelliJ.
1. Download or clone the repository.
-2. In IntelliJ, create a new project and choose `Create Project from Existing Sources...`. Choose the cloned repository to improt all the file.
-3. Ensure that this project is recognized as a Maven project inside IntelliJ.
-6. Run the Main java class in `/src/main/java/com/application/Main.java`.
+2. In IntelliJ, create a new project and choose `Create Project from Existing Sources...`. Choose the cloned repository to import all the files.
+ Or.
+
+ Right click `pom.xml` file and click open with then choose IntelliJ.
+3. Ensure that this project is recognized as a Maven project inside IntelliJ and all the dependencies are downloaded.
+6. Run the Main java class at `/src/main/java/com/csgt/Main.java`.
### How to use the tool?
-1. Click File -> Select Method Definition log file.
-2. Click File -> Select Call Trace file.
-3. Click Run -> Run.
-4. If you want to start over, click Run -> Reset and redo steps 1 through 3 above.
+#### For first time use:
+For the first time, the tool requires the log files that should be used to generate the graph.
+1. Click `File -> Select Method Definition log file` (⎇ + m).
+2. Click `File -> Select Call Trace file` (⎇ + c).
+3. Click `Render -> Run` (⎇ + r).
+4. To start over, click `Render -> Reset` (⎇ + ⇧ + r) and redo steps 1 to 3 above.
+
+#### For consecutive uses:
+The tool uses an embedded database to store the parsed information from the log files. Therefore for consecutive uses of the same log files, you can point to the previously generated database to generate the graph without processing the log files. The database file can be found at `/Databases`. The file is suffixed with the time stamp.
+1. Click `File -> Load existing database` (⎇ + d).
+2. Click `Render -> Run` (⎇ + r)
+3. To start over, click `Render -> Reset` (⎇ + ⇧ + r).
-### Generate Log files.
-Call Trace and Method Definition log files can be generated by using the shell script [here](https://github.com/omersalar/LogWeaver)
+### How to generate Log files for your code?
+Call Trace and Method Definition log files can be generated by following the instructions [here](https://github.com/omerkhureshi/LogWeaver).
diff --git a/pom.xml b/pom.xml
index bfece00..00fbe35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.omer.csc895
- CallStackVisualization
+ com.csgt
+ CallStackGraphTool
1.0-SNAPSHOT
@@ -34,7 +34,13 @@
derby
10.13.1.1
+
+
+ commons-lang
+ commons-lang
+ 2.6
+
-
\ No newline at end of file
+
diff --git a/src/main/java/com/application/Controller.java b/src/main/java/com/application/Controller.java
deleted file mode 100644
index 362c156..0000000
--- a/src/main/java/com/application/Controller.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.application;
-
-public class Controller {
-}
diff --git a/src/main/java/com/application/Main.java b/src/main/java/com/application/Main.java
deleted file mode 100644
index 4effb44..0000000
--- a/src/main/java/com/application/Main.java
+++ /dev/null
@@ -1,1541 +0,0 @@
-package com.application;
-
-import com.application.db.DAOImplementation.*;
-import com.application.db.DatabaseUtil;
-import com.application.db.TableNames;
-import com.application.fxgraph.ElementHelpers.ConvertDBtoElementTree;
-import com.application.fxgraph.ElementHelpers.Element;
-import com.application.fxgraph.cells.CircleCell;
-import com.application.fxgraph.graph.*;
-import com.application.logs.fileHandler.CallTraceLogFile;
-import com.application.logs.fileHandler.MethodDefinitionLogFile;
-import com.application.logs.fileIntegrity.CheckFileIntegrity;
-import com.application.logs.parsers.ParseCallTrace;
-import javafx.animation.KeyFrame;
-import javafx.animation.Timeline;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import javafx.concurrent.Task;
-import javafx.embed.swing.SwingFXUtils;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.geometry.*;
-import javafx.scene.Group;
-import javafx.scene.Node;
-import javafx.scene.Scene;
-import javafx.scene.SnapshotParameters;
-import javafx.scene.control.*;
-import javafx.scene.image.WritableImage;
-import javafx.scene.layout.*;
-import javafx.scene.paint.Color;
-import javafx.scene.text.Font;
-import javafx.scene.text.FontWeight;
-import javafx.stage.FileChooser;
-import javafx.stage.Modality;
-import javafx.stage.Stage;
-import javafx.util.Duration;
-import org.controlsfx.glyphfont.FontAwesome;
-import org.controlsfx.glyphfont.Glyph;
-
-import javax.imageio.ImageIO;
-import java.io.File;
-import java.io.IOException;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class Main extends Application {
-
-
- // Main UI screen
- private Graph graph;
- Model model;
- private BorderPane root;
- private ConvertDBtoElementTree convertDBtoElementTree;
- private Stage primaryStage;
-
- // Information panel.
- private boolean methodDefnFileSet;
- private boolean callTraceFileSet;
-
- private Glyph methodDefnInfoGlyph;
- private String methodDefnInfoString = "Select Method Definition log file.";
- private Label methodDefnInfoLabel;
-
- private Glyph callTraceInfoGlyph;
- private String callTraceInfoString = "Select Call Trace log file.";
- private Label callTraceInfoLabel;
-
- private Glyph runInfoGlyph;
-
- private FlowPane instructionsNode;
-
- // Menu bar
- private MenuBar menuBar;
-
- private Menu fileMenu; // File menu button
- private MenuItem chooseMethodDefnMenuItem;
- private MenuItem chooseCallTraceMenuItem;
- private Glyph methodDefnGlyph;
- private Glyph callTraceGlyph;
-
- private Menu runMenu; // Run menu button
- private MenuItem runAnalysisMenuItem;
- private Glyph runAnalysisGlyph;
- private MenuItem resetMenuItem;
- private Glyph resetGlyph;
-
- private Menu saveImgMenu; // Save Image menu button
- private MenuItem saveImgMenuItem;
- private Glyph saveImgGlyph;
-
- private Menu goToMenu;
- private Menu recentMenu;
- private Glyph recentsGlyph;
- private MenuItem clearHistoryMenuItem;
- private Glyph clearHistoryGlyph;
-
- private Menu highlight;
- private MenuItem highlightMenuItem;
- private Glyph highlightItemsGlyph;
-
- // Status bar
- private Group statusBar;
- private Label statusBarLabel = new Label();
-
- // Thread list panel on left.
- static ListView threadListView;
- ObservableList threadsObsList;
-
- // Progress bar
- Stage pStage;
- Scene pScene;
- ProgressBar progressBar;
- VBox pVBox;
- Label title;
- Label progressText;
- private static final int PROGRESS_BAR_WIDTH = 676;
-
- // Background tasks
- Task task;
-
- private boolean firstTimeLoad = true;
-
-
- @Override
- public void start(Stage primaryStage) {
- this.primaryStage = primaryStage;
- root = new BorderPane();
- EventHandlers.saveRef(this);
-
- Scene scene = new Scene(root, 1000, 300);
-
- // URL url = getClass().getClassLoader().getResource("css/application.css");
- // String css = url.toExternalForm();
- // scene.getStylesheets().add(css);
- // scene.getStylesheets().add(getClass().getResource("css/application.css").toExternalForm());
-
- primaryStage.setScene(scene);
- primaryStage.setTitle("Call Stack Visualization");
- primaryStage.show();
-
-
- // *****************
- // Display user confirmation window to reset or reload the application.
- // *****************
- Task userConfirmation = new Task() {
- @Override
- protected Void call() throws Exception {
- firstTimeLoad = isFirstLoad();
- System.out.println("Is first time load? : " + firstTimeLoad);
- return null;
- }
-
- @Override
- protected void succeeded() {
- super.succeeded();
- chooseReloadOrReset(firstTimeLoad);
- }
-
- @Override
- protected void failed() {
- super.failed();
-
- System.out.println("*******************************");
- System.out.println("FAILED BACKGROUND DB CHECK.");
- System.out.println("*******************************");
- }
- };
-
- new Thread(userConfirmation).start();
-
-
- }
-
- private boolean isFirstLoad() {
- try {
- DatabaseMetaData dbm = DatabaseUtil.getConnection().getMetaData();
- ResultSet tables = dbm.getTables(null, null, TableNames.ELEMENT_TABLE, null);
- if (tables.next()) {
- methodDefnFileSet = callTraceFileSet = true;
- return false;
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
-
- return true;
- }
-
- private void chooseReloadOrReset(boolean firstTimeLoad) {
- if (firstTimeLoad) {
- setUpInfoPanel();
- setUpMenu();
- setUpMenuActions();
- return;
- }
-
- Alert userChoiceAlert = new Alert(Alert.AlertType.CONFIRMATION);
- userChoiceAlert.setTitle("Start up options");
- userChoiceAlert.setHeaderText("Start new or reload previous log files?");
- userChoiceAlert.setContentText("You can either start fresh and load new log files or you may choose to reload previously loaded log files. If the log files are large, you can avoid long load times after the first load by clicking Reload previous in the successive use of this application.");
-
- ButtonType startFreshButtonType = new ButtonType("Start new");
- ButtonType reloadButtonType = new ButtonType("Reload previous");
- userChoiceAlert.getButtonTypes().setAll(startFreshButtonType, reloadButtonType);
- userChoiceAlert.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
- userChoiceAlert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
-
- Optional res = userChoiceAlert.showAndWait();
-
- if (res.isPresent() && res.get() == startFreshButtonType) {
- // Start fresh. Load new configuration.
- this.firstTimeLoad = true;
- setUpInfoPanel();
- setUpMenu();
- setUpMenuActions();
- } else if (res.isPresent() && res.get() == reloadButtonType) {
- // Reload previous configuration.
- setUpMenuForReloads();
- setUpMenuActions();
- reload();
- }
- }
-
- private void setUpMenu() {
- List glyphs = new ArrayList<>();
- List