changeset 138:9cd4715a15aa

Bug 2828: Warn if chosen snapshot do not have reference tree data Reviewed-by: yasuenag GitHub: https://github.com/HeapStats/heapstats/pull/6
author KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
date Mon, 01 Feb 2016 11:49:46 +0900
parents ef19ed367737
children 7ead933556b3
files ChangeLog analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/RefTreeController.java analyzer/fx/src/main/resources/snapshotResources_en.properties analyzer/fx/src/main/resources/snapshotResources_ja.properties
diffstat 4 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 29 00:21:54 2016 +0900
+++ b/ChangeLog	Mon Feb 01 11:49:46 2016 +0900
@@ -1,3 +1,7 @@
+2016-02-01  KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
+
+	* Bug 2828: Warn if chosen snapshot do not have reference tree data
+
 2016-01-29  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 2817: Incorrect thread name in deadlock alert SNMP trap.
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/RefTreeController.java	Fri Jan 29 00:21:54 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/RefTreeController.java	Mon Feb 01 11:49:46 2016 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2015 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -44,6 +44,9 @@
 import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.fxml.Initializable;
+import javafx.scene.control.Alert;
+import javafx.scene.control.Alert.AlertType;
+import javafx.scene.control.ButtonType;
 import javafx.scene.control.CheckBox;
 import javafx.scene.control.Label;
 import javafx.scene.control.RadioButton;
@@ -93,7 +96,7 @@
     private ObjectProperty<SnapShotHeader> currentSnapShotHeader;
 
     private LongProperty currentObjectTag;
-    
+
     private ResourceBundle resource;
 
     private void buildTab() {
@@ -293,13 +296,17 @@
      */
     @FXML
     private void onOkClick(ActionEvent event) {
-        
+
         if ((currentSnapShotHeader.get() == null)
-                || !currentSnapShotHeader.get().hasReferenceData()
                 || (currentObjectTag.get() == -1)){
             return;
+        } else if (!currentSnapShotHeader.get().hasReferenceData()) {
+            // Version 1.0.x or "collect_reftree=false" do not have reftree data
+            Alert dialog = new Alert(AlertType.ERROR, resource.getString("reftree.nodata"), ButtonType.OK);
+            dialog.show();
+            return;
         }
-        
+
         mxCell cell = (mxCell) graph.getDefaultParent();
         List<Object> removeCells = new ArrayList<>();
 
--- a/analyzer/fx/src/main/resources/snapshotResources_en.properties	Fri Jan 29 00:21:54 2016 +0900
+++ b/analyzer/fx/src/main/resources/snapshotResources_en.properties	Mon Feb 01 11:49:46 2016 +0900
@@ -77,3 +77,4 @@
 reftree.size=RefSize
 reftree.ranking=Ranking
 reftree.message.notselect=Please select Object which you want to see the reference at [Histogram] or [SnapShot Data] Tab.
+reftree.nodata=Chosen snapshot does not have Reference Tree data.
--- a/analyzer/fx/src/main/resources/snapshotResources_ja.properties	Fri Jan 29 00:21:54 2016 +0900
+++ b/analyzer/fx/src/main/resources/snapshotResources_ja.properties	Mon Feb 01 11:49:46 2016 +0900
@@ -77,3 +77,4 @@
 reftree.size=\u53c2\u7167\u91cf 
 reftree.ranking=\u30e9\u30f3\u30ad\u30f3\u30b0
 reftree.message.notselect=[\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0]\u304b[\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u60c5\u5831]\u30bf\u30d6\u304b\u3089\u53c2\u7167\u30c4\u30ea\u30fc\u3092\u78ba\u8a8d\u3057\u305f\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044
+reftree.nodata=\u9078\u629e\u3057\u305f\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u306b\u306f\u53c2\u7167\u30c4\u30ea\u30fc\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093