summary tables with empty menu path not shown in context menu (issue #1191)
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 15 Jun 2016 19:09:23 +0000 (22:09 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 15 Jun 2016 19:09:23 +0000 (22:09 +0300)
ChangeLog
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/SourceProvider.java
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/SummaryTablesDynamicMenu.java
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/api/SummaryTablesCache.java
webui/webapp/DataCollection/src/org/netxms/ui/eclipse/datacollection/SourceProvider.java
webui/webapp/DataCollection/src/org/netxms/ui/eclipse/datacollection/SummaryTablesDynamicMenu.java
webui/webapp/DataCollection/src/org/netxms/ui/eclipse/datacollection/api/SummaryTablesCache.java

index 99e7052..d785a8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,8 @@
 - Added option to set type of each varbind in nxsnmpset
 - Management console
        - New editors for Agent Config Policy and Log Parser Policy. 
-- Fixed issues: #906, #1039, #1096, #1187, #1230, #1237, #1239
+       - DCI summary tables with empty menu path not shown in object context menu
+- Fixed issues: #906, #1039, #1096, #1187, #1191, #1230, #1237, #1239
 
 
 *
index cf23b47..6281863 100644 (file)
@@ -92,7 +92,7 @@ public class SourceProvider extends AbstractSourceProvider
          @Override
          public void run()
          {
-            stateMap.put(SUMMARY_TABLES_EXIST, !SummaryTablesCache.isEmpty());
+            stateMap.put(SUMMARY_TABLES_EXIST, !SummaryTablesCache.isEmpty(true));
             fireSourceChanged(ISources.WORKBENCH, getCurrentState());
          }
       });
index e1bc527..7397089 100644 (file)
@@ -122,6 +122,9 @@ public class SummaryTablesDynamicMenu extends ContributionItem implements IWorkb
                int added = 0;
                for(int i = 0; i < tables.length; i++)
                {
+                  if (tables[i].getMenuPath().isEmpty())
+                     continue;
+                  
                        String[] path = tables[i].getMenuPath().split("\\-\\>"); //$NON-NLS-1$
                
                        Menu rootMenu = tablesMenu;
index 4f2dd4e..a5cff88 100644 (file)
@@ -134,10 +134,17 @@ public class SummaryTablesCache
        /**
         * @return
         */
-       public static boolean isEmpty()
+       public static boolean isEmpty(boolean menuOnly)
        {
       synchronized(tables)
       {
+         if (menuOnly)
+         {
+            for(DciSummaryTableDescriptor d : tables.values())
+               if (!d.getMenuPath().isEmpty())
+                  return false;
+            return true;
+         }
          return tables.isEmpty();
       }
        }
index 56d8f12..2f3d03c 100644 (file)
@@ -92,7 +92,7 @@ public class SourceProvider extends AbstractSourceProvider
          @Override
          public void run()
          {
-            stateMap.put(SUMMARY_TABLES_EXIST, !SummaryTablesCache.getInstance().isEmpty());
+            stateMap.put(SUMMARY_TABLES_EXIST, !SummaryTablesCache.getInstance().isEmpty(true));
             fireSourceChanged(ISources.WORKBENCH, getCurrentState());
          }
       });
index df3f10b..2125829 100644 (file)
@@ -122,6 +122,9 @@ public class SummaryTablesDynamicMenu extends ContributionItem implements IWorkb
                int added = 0;
                for(int i = 0; i < tables.length; i++)
                {
+                  if (tables[i].getMenuPath().isEmpty())
+                     continue;
+                  
                        String[] path = tables[i].getMenuPath().split("\\-\\>"); //$NON-NLS-1$
                
                        Menu rootMenu = tablesMenu;
index 002ae5a..c1ce1a4 100644 (file)
@@ -163,10 +163,17 @@ public class SummaryTablesCache
        /**
         * @return
         */
-       public boolean isEmpty()
+       public boolean isEmpty(boolean menuOnly)
        {
       synchronized(tables)
       {
+         if (menuOnly)
+         {
+            for(DciSummaryTableDescriptor d : tables.values())
+               if (!d.getMenuPath().isEmpty())
+                  return false;
+            return true;
+         }
          return tables.isEmpty();
       }
        }