Copy DCI name (not description) from last value view issue #1159
authorEriks Jenkevics <eriks@netxms.org>
Wed, 17 Aug 2016 13:00:06 +0000 (16:00 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Wed, 17 Aug 2016 13:00:06 +0000 (16:00 +0300)
ChangeLog
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/widgets/LastValuesWidget.java

index df7f77d..fe5ae4a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@
 - Management console
        - New editors for Agent Config Policy and Log Parser Policy. 
        - DCI summary tables with empty menu path not shown in object context menu
-- Fixed issues: #92, #906, #959, #1051, #1096, #1187, #1191, #1230, #1237, #1254, #1263
+- Fixed issues: #92, #906, #959, #1051, #1096, #1159, #1187, #1191, #1230, #1237, #1254, #1263
 
 
 *
index 0c6b480..19c0ee6 100644 (file)
@@ -103,6 +103,7 @@ public class LastValuesWidget extends Composite
        private Action actionShowUnsupported;
        private Action actionExportToCsv;
        private Action actionCopyToClipboard;
+       private Action actionCopyDciName;
        private List<OpenHandlerData> openHandlers = new ArrayList<OpenHandlerData>(0);
        
        /**
@@ -310,6 +311,14 @@ public class LastValuesWidget extends Composite
             copySelection();
          }
       };
+      
+      actionCopyDciName = new Action("Copy DCI Name", SharedIcons.COPY) {
+         @Override
+         public void run()
+         {
+            copySelectionDciName();
+         }
+      };
        }
        
        /**
@@ -345,6 +354,7 @@ public class LastValuesWidget extends Composite
                manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
       manager.add(new Separator());
                manager.add(actionCopyToClipboard);
+               manager.add(actionCopyDciName);
                manager.add(actionExportToCsv);
                manager.add(new Separator());
                manager.add(new GroupMarker(GroupMarkers.MB_SECONDARY));
@@ -691,4 +701,24 @@ public class LastValuesWidget extends Composite
              sb.append(nl);
           WidgetHelper.copyToClipboard(sb.toString());
        }
+       
+       /**
+        * Copy DCI name of selection
+        */
+       private void copySelectionDciName()
+       {
+          IStructuredSelection selection = (IStructuredSelection)dataViewer.getSelection();
+      if (selection.isEmpty())
+         return;
+      
+      StringBuilder dciName = new StringBuilder();
+      for(Object o : selection.toList())
+      {
+         if (dciName.length() > 0)
+            dciName.append(' ');
+         DciValue v = (DciValue)o;
+         dciName.append(v.getName());
+      }
+      WidgetHelper.copyToClipboard(dciName.toString());
+       }
 }