audit log added to list of server logs; unfinished log viewer in Java console; minor...
authorVictor Kirhenshtein <victor@netxms.org>
Sun, 18 Oct 2009 19:54:40 +0000 (19:54 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Sun, 18 Oct 2009 19:54:40 +0000 (19:54 +0000)
51 files changed:
.gitattributes
include/nxclapi.h
src/java/netxms-client/src/main/java/org/netxms/client/log/Log.java
src/java/netxms-client/src/main/java/org/netxms/client/log/LogColumn.java
src/java/netxms-client/src/main/java/org/netxms/client/log/LogFilter.java
src/java/netxms-client/src/main/java/org/netxms/client/maps/NetworkMapObjectData.java
src/java/netxms-client/src/main/java/org/netxms/client/maps/NetworkMapObjectLink.java
src/java/netxms-client/src/main/java/org/netxms/client/maps/NetworkMapPage.java
src/java/netxms-eclipse/AlarmViewer/plugin.xml
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/Activator.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmComparator.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmListLabelProvider.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/AcknowledgeAlarm.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/OpenAlarmBrowser.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/TerminateAlarm.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/views/AlarmBrowser.java [moved from src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmBrowser.java with 51% similarity]
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/widgets/AlarmList.java [moved from src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmView.java with 70% similarity]
src/java/netxms-eclipse/LogViewer/.classpath [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/.project [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/META-INF/MANIFEST.MF [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/build.properties [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/icons/AuditLog.png [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/icons/EventLog.png [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/icons/TrapLog.png [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/icons/do_query.png [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/icons/log_viewer_job.png [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/plugin.xml [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/Activator.java [copied from src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/Activator.java with 62% similarity]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/Messages.java [copied from src/java/netxms-eclipse/core/src/org/netxms/ui/eclipse/console/Messages.java with 57% similarity]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/actions/OpenAuditLog.java [copied from src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/actions/OpenServerConfig.java with 74% similarity]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/ColumnSelectionDialog.java [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/QueryBuilder.java [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeContentProvider.java [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeElement.java [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeLabelProvider.java [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/messages.properties [new file with mode: 0644]
src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/views/LogViewer.java [new file with mode: 0644]
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/LastValuesView.java
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/views/LastValues.java
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/actions/OpenServerConfig.java
src/java/netxms-eclipse/UserManager/src/org/netxms/ui/eclipse/usermanager/dialogs/SelectUserDialog.java
src/java/netxms-eclipse/core/src/org/netxms/ui/eclipse/console/Activator.java
src/java/netxms-eclipse/core/src/org/netxms/ui/eclipse/console/Messages.java
src/java/netxms-eclipse/core/src/org/netxms/ui/eclipse/console/NXMCActionBarAdvisor.java
src/java/netxms-eclipse/library/META-INF/MANIFEST.MF
src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/jobs/ConsoleJob.java [new file with mode: 0644]
src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/shared/IActionConstants.java
src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/tools/SortableTableViewer.java
src/server/core/logs.cpp
src/server/include/nxcore_logs.h

index e5452bf..29103f2 100644 (file)
@@ -280,14 +280,14 @@ src/java/netxms-eclipse/AlarmViewer/icons/outstanding.png -text
 src/java/netxms-eclipse/AlarmViewer/icons/terminated.png -text
 src/java/netxms-eclipse/AlarmViewer/plugin.xml -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/Activator.java -text
-src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmBrowser.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmComparator.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmListFilter.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmListLabelProvider.java -text
-src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmView.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/AcknowledgeAlarm.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/OpenAlarmBrowser.java -text
 src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/actions/TerminateAlarm.java -text
+src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/views/AlarmBrowser.java -text
+src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/widgets/AlarmList.java -text
 src/java/netxms-eclipse/Charts/.settings/org.eclipse.jdt.core.prefs -text
 src/java/netxms-eclipse/Charts/META-INF/MANIFEST.MF -text
 src/java/netxms-eclipse/Charts/build.properties -text
@@ -363,6 +363,25 @@ src/java/netxms-eclipse/LanguagePacks/ru/objectbrowser/META-INF/MANIFEST.MF -tex
 src/java/netxms-eclipse/LanguagePacks/ru/objectbrowser/build.properties -text
 src/java/netxms-eclipse/LanguagePacks/ru/objectbrowser/src/org/netxms/ui/eclipse/objectbrowser/messages_ru.properties -text
 src/java/netxms-eclipse/LanguagePacks/ru/objectbrowser/src/org/netxms/ui/eclipse/objectbrowser/views/messages_ru.properties -text
+src/java/netxms-eclipse/LogViewer/.settings/org.eclipse.jdt.core.prefs -text
+src/java/netxms-eclipse/LogViewer/META-INF/MANIFEST.MF -text
+src/java/netxms-eclipse/LogViewer/build.properties -text
+src/java/netxms-eclipse/LogViewer/icons/AuditLog.png -text
+src/java/netxms-eclipse/LogViewer/icons/EventLog.png -text
+src/java/netxms-eclipse/LogViewer/icons/TrapLog.png -text
+src/java/netxms-eclipse/LogViewer/icons/do_query.png -text
+src/java/netxms-eclipse/LogViewer/icons/log_viewer_job.png -text
+src/java/netxms-eclipse/LogViewer/plugin.xml -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/Activator.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/Messages.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/actions/OpenAuditLog.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/ColumnSelectionDialog.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/QueryBuilder.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeContentProvider.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeElement.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeLabelProvider.java -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/messages.properties -text
+src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/views/LogViewer.java -text
 src/java/netxms-eclipse/NetworkMaps/META-INF/MANIFEST.MF -text
 src/java/netxms-eclipse/NetworkMaps/build.properties -text
 src/java/netxms-eclipse/NetworkMaps/icons/node.png -text
@@ -577,6 +596,7 @@ src/java/netxms-eclipse/library/jar/jfreechart-1.0.13-experimental.jar -text
 src/java/netxms-eclipse/library/jar/jfreechart-1.0.13-swt.jar -text
 src/java/netxms-eclipse/library/jar/jfreechart-1.0.13.jar -text
 src/java/netxms-eclipse/library/jar/swtgraphics2d.jar -text
+src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/jobs/ConsoleJob.java -text
 src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/library/Activator.java -text
 src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/shared/IActionConstants.java -text
 src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/shared/IUIConstants.java -text
index 2d44c9f..4fa7365 100644 (file)
@@ -495,7 +495,7 @@ enum
 #define SYSTEM_ACCESS_MANAGE_TOOLS        0x00000800
 #define SYSTEM_ACCESS_MANAGE_SCRIPTS      0x00001000
 #define SYSTEM_ACCESS_VIEW_TRAP_LOG       0x00002000
-// OBSOLETE: #define SYSTEM_ACCESS_MANAGE_MODULES      0x00004000
+#define SYSTEM_ACCESS_VIEW_AUDIT_LOG      0x00004000
 #define SYSTEM_ACCESS_MANAGE_AGENT_CFG    0x00008000
 #define SYSTEM_ACCESS_MANAGE_SITUATIONS   0x00010000
 #define SYSTEM_ACCESS_SEND_SMS            0x00020000
index 63c54e3..c195e43 100644 (file)
@@ -1,11 +1,26 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.client.log;\r
 \r
 import java.io.IOException;\r
 import java.util.Collection;\r
-import java.util.HashMap;\r
+import java.util.LinkedHashMap;\r
 \r
 import org.netxms.base.NXCPCodes;\r
 import org.netxms.base.NXCPMessage;\r
@@ -24,7 +39,7 @@ public class Log
        private NXCSession session;\r
        private int handle;\r
        private String name;\r
-       private HashMap<String, LogColumn> columns;\r
+       private LinkedHashMap<String, LogColumn> columns;\r
        private long numRecords;        // Number of records ready after successful query() \r
        \r
        /**\r
@@ -39,7 +54,7 @@ public class Log
                handle = msg.getVariableAsInteger(NXCPCodes.VID_LOG_HANDLE);\r
                \r
                int count = msg.getVariableAsInteger(NXCPCodes.VID_NUM_COLUMNS);\r
-               columns = new HashMap<String, LogColumn>(count);\r
+               columns = new LinkedHashMap<String, LogColumn>(count);\r
                long baseId = NXCPCodes.VID_COLUMN_INFO_BASE;\r
                for(int i = 0; i < count; i++, baseId += 10)\r
                {\r
@@ -72,15 +87,26 @@ public class Log
         * Get description for given column name.\r
         * \r
         * @param columnName Column name\r
-        * @return Column description\r
+        * @return Column description or null if column with given name does not exist\r
         */\r
-       public String getColumnDescription(String columnName)\r
+       public String getColumnDescription(final String columnName)\r
        {\r
                LogColumn col = columns.get(columnName);\r
                return (col != null) ? col.getDescription() : null;\r
        }\r
        \r
        /**\r
+        * Get column object by column name.\r
+        * \r
+        * @param columnName Column name\r
+        * @return Column object or null if column with given name does not exist\r
+        */\r
+       public LogColumn getColumn(final String columnName)\r
+       {\r
+               return columns.get(columnName);\r
+       }\r
+       \r
+       /**\r
         * Send query to server\r
         * \r
         * @param filter Log filter\r
index 326ae11..aad4498 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.client.log;\r
 \r
@@ -11,6 +26,15 @@ import org.netxms.base.NXCPMessage;
  */\r
 public class LogColumn\r
 {\r
+       // Column types\r
+       public static final int LC_TEXT          = 0;\r
+       public static final int LC_SEVERITY      = 1;\r
+       public static final int LC_OBJECT_ID     = 2;\r
+       public static final int LC_USER_ID       = 3;\r
+       public static final int LC_EVENT_CODE    = 4;\r
+       public static final int LC_TIMESTAMP     = 5;\r
+       public static final int LC_INTEGER       = 6;\r
+\r
        private String name;\r
        private String description;\r
        private int type;\r
index e45bb90..d8f29d6 100644 (file)
@@ -19,6 +19,7 @@
 package org.netxms.client.log;\r
 \r
 import java.util.HashMap;\r
+import java.util.Set;\r
 import java.util.Map.Entry;\r
 \r
 import org.netxms.base.NXCPCodes;\r
@@ -73,6 +74,16 @@ public class LogFilter
        }\r
        \r
        /**\r
+        * Get all column filters.\r
+        * \r
+        * @return all configured column filters\r
+        */\r
+       public Set<Entry<String, ColumnFilter>> getColumnFilters()\r
+       {\r
+               return columnFilters.entrySet();\r
+       }\r
+       \r
+       /**\r
         * Fill NXCP message with filter's data.\r
         * \r
         * @param msg NXCP message\r
index c9b2e59..275e2e4 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.client.maps;\r
 \r
index 8fca2ba..fd50b12 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.client.maps;\r
 \r
index 86a4522..ccbd523 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.client.maps;\r
 \r
index 05f8410..0b7aa1c 100644 (file)
@@ -7,7 +7,7 @@
             name="Alarm Browser"\r
             allowMultiple="false"\r
             icon="icons/alarm_browser.png"\r
-            class="org.netxms.ui.eclipse.alarmviewer.AlarmBrowser"\r
+            class="org.netxms.ui.eclipse.alarmviewer.views.AlarmBrowser"\r
             id="org.netxms.ui.eclipse.alarmviewer.view.alarm_browser">\r
       </view>\r
    </extension>\r
index 4aca33c..40f6f97 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.ui.eclipse.alarmviewer;\r
 \r
@@ -7,6 +22,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.PlatformUI;\r
 import org.eclipse.ui.plugin.AbstractUIPlugin;\r
 import org.eclipse.ui.progress.IProgressService;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.osgi.framework.BundleContext;\r
 \r
 /**\r
@@ -38,7 +54,7 @@ public class Activator extends AbstractUIPlugin
                \r
                // Register icon for our jobs\r
                IProgressService service = PlatformUI.getWorkbench().getProgressService();\r
-          service.registerIconForFamily(getImageDescriptor("icons/alarm_browser.png"), AlarmView.JOB_FAMILY);\r
+          service.registerIconForFamily(getImageDescriptor("icons/alarm_browser.png"), AlarmList.JOB_FAMILY);\r
        }\r
 \r
        \r
index a2ce25a..08c574f 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.TableColumn;\r
 import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCObject;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 \r
 /**\r
@@ -48,29 +49,29 @@ public class AlarmComparator extends ViewerComparator
                int rc;\r
                switch((Integer)sortColumn.getData("ID"))\r
                {\r
-                       case AlarmView.COLUMN_SEVERITY:\r
+                       case AlarmList.COLUMN_SEVERITY:\r
                                rc = compareNumbers(((NXCAlarm)e1).getCurrentSeverity(), ((NXCAlarm)e2).getCurrentSeverity());\r
                                break;\r
-                       case AlarmView.COLUMN_STATE:\r
+                       case AlarmList.COLUMN_STATE:\r
                                rc = compareNumbers(((NXCAlarm)e1).getState(), ((NXCAlarm)e2).getState());\r
                                break;\r
-                       case AlarmView.COLUMN_SOURCE:\r
+                       case AlarmList.COLUMN_SOURCE:\r
                                NXCObject obj1 = NXMCSharedData.getInstance().getSession().findObjectById(((NXCAlarm)e1).getSourceObjectId());\r
                                NXCObject obj2 = NXMCSharedData.getInstance().getSession().findObjectById(((NXCAlarm)e2).getSourceObjectId());\r
                                String name1 = (obj1 != null) ? obj1.getObjectName() : "<unknown>";\r
                                String name2 = (obj2 != null) ? obj2.getObjectName() : "<unknown>";\r
                                rc = name1.compareToIgnoreCase(name2);\r
                                break;\r
-                       case AlarmView.COLUMN_MESSAGE:\r
+                       case AlarmList.COLUMN_MESSAGE:\r
                                rc = ((NXCAlarm)e1).getMessage().compareToIgnoreCase(((NXCAlarm)e2).getMessage());\r
                                break;\r
-                       case AlarmView.COLUMN_COUNT:\r
+                       case AlarmList.COLUMN_COUNT:\r
                                rc = compareNumbers(((NXCAlarm)e1).getRepeatCount(), ((NXCAlarm)e2).getRepeatCount());\r
                                break;\r
-                       case AlarmView.COLUMN_CREATED:\r
+                       case AlarmList.COLUMN_CREATED:\r
                                rc = ((NXCAlarm)e1).getCreationTime().compareTo(((NXCAlarm)e2).getCreationTime());\r
                                break;\r
-                       case AlarmView.COLUMN_LASTCHANGE:\r
+                       case AlarmList.COLUMN_LASTCHANGE:\r
                                rc = ((NXCAlarm)e1).getLastChangeTime().compareTo(((NXCAlarm)e2).getLastChangeTime());\r
                                break;\r
                        default:\r
index 1fb21a4..4cc41cf 100644 (file)
@@ -11,6 +11,7 @@ import org.eclipse.swt.graphics.Image;
 import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCObject;\r
 import org.netxms.client.constants.Severity;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 import org.netxms.ui.eclipse.shared.StatusDisplayInfo;\r
 \r
@@ -54,9 +55,9 @@ public class AlarmListLabelProvider implements ITableLabelProvider
        {\r
                switch(columnIndex)\r
                {\r
-                       case AlarmView.COLUMN_SEVERITY:\r
+                       case AlarmList.COLUMN_SEVERITY:\r
                                return severityImages[((NXCAlarm)element).getCurrentSeverity()];\r
-                       case AlarmView.COLUMN_STATE:\r
+                       case AlarmList.COLUMN_STATE:\r
                                return stateImages[((NXCAlarm)element).getState()];\r
                }\r
                return null;\r
@@ -70,20 +71,20 @@ public class AlarmListLabelProvider implements ITableLabelProvider
        {\r
                switch(columnIndex)\r
                {\r
-                       case AlarmView.COLUMN_SEVERITY:\r
+                       case AlarmList.COLUMN_SEVERITY:\r
                                return StatusDisplayInfo.getStatusText(((NXCAlarm)element).getCurrentSeverity());\r
-                       case AlarmView.COLUMN_STATE:\r
+                       case AlarmList.COLUMN_STATE:\r
                                return stateText[((NXCAlarm)element).getState()];\r
-                       case AlarmView.COLUMN_SOURCE:\r
+                       case AlarmList.COLUMN_SOURCE:\r
                                NXCObject object = NXMCSharedData.getInstance().getSession().findObjectById(((NXCAlarm)element).getSourceObjectId());\r
                                return (object != null) ? object.getObjectName() : null;\r
-                       case AlarmView.COLUMN_MESSAGE:\r
+                       case AlarmList.COLUMN_MESSAGE:\r
                                return ((NXCAlarm)element).getMessage();\r
-                       case AlarmView.COLUMN_COUNT:\r
+                       case AlarmList.COLUMN_COUNT:\r
                                return Integer.toString(((NXCAlarm)element).getRepeatCount());\r
-                       case AlarmView.COLUMN_CREATED:\r
+                       case AlarmList.COLUMN_CREATED:\r
                                return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((NXCAlarm)element).getCreationTime());\r
-                       case AlarmView.COLUMN_LASTCHANGE:\r
+                       case AlarmList.COLUMN_LASTCHANGE:\r
                                return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((NXCAlarm)element).getLastChangeTime());\r
                }\r
                return null;\r
index f4bed25..0a0c90c 100644 (file)
@@ -16,7 +16,7 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
 import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCException;\r
 import org.netxms.ui.eclipse.alarmviewer.Activator;\r
-import org.netxms.ui.eclipse.alarmviewer.AlarmView;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 \r
 \r
@@ -68,7 +68,7 @@ public class AcknowledgeAlarm implements IObjectActionDelegate
                @Override\r
                public boolean belongsTo(Object family)\r
                {\r
-                       return family == AlarmView.JOB_FAMILY;\r
+                       return family == AlarmList.JOB_FAMILY;\r
                }\r
        }\r
        \r
index c0bd22b..af954d1 100644 (file)
@@ -6,7 +6,7 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.ui.IWorkbenchWindow;\r
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;\r
 import org.eclipse.ui.PartInitException;\r
-import org.netxms.ui.eclipse.alarmviewer.AlarmBrowser;\r
+import org.netxms.ui.eclipse.alarmviewer.views.AlarmBrowser;\r
 \r
 public class OpenAlarmBrowser implements IWorkbenchWindowActionDelegate\r
 {\r
index 4ea0da2..e765a0b 100644 (file)
@@ -16,7 +16,7 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
 import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCException;\r
 import org.netxms.ui.eclipse.alarmviewer.Activator;\r
-import org.netxms.ui.eclipse.alarmviewer.AlarmView;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 \r
 \r
@@ -68,7 +68,7 @@ public class TerminateAlarm implements IObjectActionDelegate
                @Override\r
                public boolean belongsTo(Object family)\r
                {\r
-                       return family == AlarmView.JOB_FAMILY;\r
+                       return family == AlarmList.JOB_FAMILY;\r
                }\r
        }\r
        \r
@@ -1,7 +1,22 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
-package org.netxms.ui.eclipse.alarmviewer;\r
+package org.netxms.ui.eclipse.alarmviewer.views;\r
 \r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.layout.FormAttachment;\r
@@ -9,6 +24,7 @@ import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.ui.part.ViewPart;\r
+import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 \r
 /**\r
  * @author Victor\r
@@ -18,7 +34,7 @@ public class AlarmBrowser extends ViewPart
 {\r
        public static final String ID = "org.netxms.ui.eclipse.alarmviewer.view.alarm_browser";\r
        \r
-       private AlarmView alarmView;\r
+       private AlarmList alarmView;\r
 \r
        /**\r
         * \r
@@ -37,7 +53,7 @@ public class AlarmBrowser extends ViewPart
       FormLayout formLayout = new FormLayout();\r
                parent.setLayout(formLayout);\r
                \r
-               alarmView = new AlarmView(this, parent, SWT.NONE);\r
+               alarmView = new AlarmList(this, parent, SWT.NONE);\r
                FormData fd = new FormData();\r
                fd.left = new FormAttachment(0, 0);\r
                fd.top = new FormAttachment(0, 0);\r
@@ -1,14 +1,28 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
-package org.netxms.ui.eclipse.alarmviewer;\r
+package org.netxms.ui.eclipse.alarmviewer.widgets;\r
 \r
 import java.util.HashMap;\r
 \r
 import org.eclipse.core.runtime.IProgressMonitor;\r
 import org.eclipse.core.runtime.IStatus;\r
 import org.eclipse.core.runtime.Status;\r
-import org.eclipse.core.runtime.jobs.Job;\r
 import org.eclipse.jface.action.GroupMarker;\r
 import org.eclipse.jface.action.IMenuListener;\r
 import org.eclipse.jface.action.IMenuManager;\r
@@ -22,13 +36,16 @@ import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Menu;\r
 import org.eclipse.ui.IWorkbenchActionConstants;\r
 import org.eclipse.ui.part.ViewPart;\r
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;\r
 import org.eclipse.ui.progress.UIJob;\r
 import org.netxms.client.NXCAlarm;\r
-import org.netxms.client.NXCException;\r
 import org.netxms.client.NXCListener;\r
 import org.netxms.client.NXCNotification;\r
 import org.netxms.client.NXCSession;\r
+import org.netxms.ui.eclipse.alarmviewer.Activator;\r
+import org.netxms.ui.eclipse.alarmviewer.AlarmComparator;\r
+import org.netxms.ui.eclipse.alarmviewer.AlarmListFilter;\r
+import org.netxms.ui.eclipse.alarmviewer.AlarmListLabelProvider;\r
+import org.netxms.ui.eclipse.jobs.ConsoleJob;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 import org.netxms.ui.eclipse.tools.SortableTableViewer;\r
 \r
@@ -36,7 +53,7 @@ import org.netxms.ui.eclipse.tools.SortableTableViewer;
  * @author victor\r
  *\r
  */\r
-public class AlarmView extends Composite\r
+public class AlarmList extends Composite\r
 {\r
        public static final String JOB_FAMILY = "AlarmViewJob";\r
        \r
@@ -56,7 +73,7 @@ public class AlarmView extends Composite
        private AlarmListFilter alarmFilter;\r
        private HashMap<Long, NXCAlarm> alarmList;\r
        \r
-       public AlarmView(ViewPart viewPart, Composite parent, int style)\r
+       public AlarmList(ViewPart viewPart, Composite parent, int style)\r
        {\r
                super(parent, style);\r
                session = NXMCSharedData.getInstance().getSession();\r
@@ -78,56 +95,37 @@ public class AlarmView extends Composite
                addListener(SWT.Resize, new Listener() {\r
                        public void handleEvent(Event e)\r
                        {\r
-                               alarmViewer.getControl().setBounds(AlarmView.this.getClientArea());\r
+                               alarmViewer.getControl().setBounds(AlarmList.this.getClientArea());\r
                        }\r
                });\r
 \r
                // Request alarm list from server\r
-               Job job = new Job("Synchronize alarm list")\r
+               new ConsoleJob("Synchronize alarm list", viewPart, Activator.PLUGIN_ID, JOB_FAMILY)\r
                {\r
                        @Override\r
-                       protected IStatus run(IProgressMonitor monitor)\r
+                       protected void runInternal(IProgressMonitor monitor) throws Exception\r
                        {\r
-                               IStatus status;\r
-                               \r
-                               try\r
-                               {\r
-                                       alarmList = session.getAlarms(false);\r
-                                       status = Status.OK_STATUS;\r
+                               alarmList = session.getAlarms(false);\r
 \r
-                                       new UIJob("Initialize alarm viewer") {\r
-                                               @Override\r
-                                               public IStatus runInUIThread(IProgressMonitor monitor)\r
+                               new UIJob("Initialize alarm viewer") {\r
+                                       @Override\r
+                                       public IStatus runInUIThread(IProgressMonitor monitor)\r
+                                       {\r
+                                               synchronized(alarmList)\r
                                                {\r
-                                                       synchronized(alarmList)\r
-                                                       {\r
-                                                               alarmViewer.setInput(alarmList.values());\r
-                                                       }\r
-                                                       return Status.OK_STATUS;\r
+                                                       alarmViewer.setInput(alarmList.values());\r
                                                }\r
-                                       }.schedule();\r
-                               }\r
-                               catch(Exception e)\r
-                               {\r
-                                       status = new Status(Status.ERROR, Activator.PLUGIN_ID, \r
-                           (e instanceof NXCException) ? ((NXCException)e).getErrorCode() : 0,\r
-                           "Cannot synchronize alarm list: " + e.getMessage(), e);\r
-                               }\r
-                               return status;\r
+                                               return Status.OK_STATUS;\r
+                                       }\r
+                               }.schedule();\r
                        }\r
 \r
-                       /* (non-Javadoc)\r
-                        * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)\r
-                        */\r
                        @Override\r
-                       public boolean belongsTo(Object family)\r
+                       protected String getErrorMessage()\r
                        {\r
-                               return family == AlarmView.JOB_FAMILY;\r
+                               return "Cannot synchronize alarm list";\r
                        }\r
-               };\r
-               IWorkbenchSiteProgressService siteService =\r
-             (IWorkbenchSiteProgressService)viewPart.getSite().getAdapter(IWorkbenchSiteProgressService.class);\r
-               siteService.schedule(job, 0, true);\r
+               }.start();\r
                \r
                // Add client library listener\r
                clientListener = new NXCListener() {\r
diff --git a/src/java/netxms-eclipse/LogViewer/.classpath b/src/java/netxms-eclipse/LogViewer/.classpath
new file mode 100644 (file)
index 0000000..ad32c83
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/src/java/netxms-eclipse/LogViewer/.project b/src/java/netxms-eclipse/LogViewer/.project
new file mode 100644 (file)
index 0000000..4863d3e
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>nxmc-logviewer</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/src/java/netxms-eclipse/LogViewer/.settings/org.eclipse.jdt.core.prefs b/src/java/netxms-eclipse/LogViewer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..ba46ed3
--- /dev/null
@@ -0,0 +1,8 @@
+#Fri Oct 16 14:20:21 EEST 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/src/java/netxms-eclipse/LogViewer/META-INF/MANIFEST.MF b/src/java/netxms-eclipse/LogViewer/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..9dbbd69
--- /dev/null
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: NetXMS Log Viewer
+Bundle-SymbolicName: org.netxms.ui.eclipse.logviewer;singleton:=true
+Bundle-Version: 1.1.0.20091016
+Bundle-Activator: org.netxms.ui.eclipse.logviewer.Activator
+Bundle-Vendor: netxms.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.netxms.ui.eclipse.library;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/src/java/netxms-eclipse/LogViewer/build.properties b/src/java/netxms-eclipse/LogViewer/build.properties
new file mode 100644 (file)
index 0000000..67eacaf
--- /dev/null
@@ -0,0 +1,7 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .,\\r
+               plugin.xml,\\r
+               icons/\r
+bin.excludes = icons/.svn/\r
diff --git a/src/java/netxms-eclipse/LogViewer/icons/AuditLog.png b/src/java/netxms-eclipse/LogViewer/icons/AuditLog.png
new file mode 100644 (file)
index 0000000..49bb24d
Binary files /dev/null and b/src/java/netxms-eclipse/LogViewer/icons/AuditLog.png differ
diff --git a/src/java/netxms-eclipse/LogViewer/icons/EventLog.png b/src/java/netxms-eclipse/LogViewer/icons/EventLog.png
new file mode 100644 (file)
index 0000000..0491954
Binary files /dev/null and b/src/java/netxms-eclipse/LogViewer/icons/EventLog.png differ
diff --git a/src/java/netxms-eclipse/LogViewer/icons/TrapLog.png b/src/java/netxms-eclipse/LogViewer/icons/TrapLog.png
new file mode 100644 (file)
index 0000000..b3fa18c
Binary files /dev/null and b/src/java/netxms-eclipse/LogViewer/icons/TrapLog.png differ
diff --git a/src/java/netxms-eclipse/LogViewer/icons/do_query.png b/src/java/netxms-eclipse/LogViewer/icons/do_query.png
new file mode 100644 (file)
index 0000000..7c0ab2b
Binary files /dev/null and b/src/java/netxms-eclipse/LogViewer/icons/do_query.png differ
diff --git a/src/java/netxms-eclipse/LogViewer/icons/log_viewer_job.png b/src/java/netxms-eclipse/LogViewer/icons/log_viewer_job.png
new file mode 100644 (file)
index 0000000..56fcf84
Binary files /dev/null and b/src/java/netxms-eclipse/LogViewer/icons/log_viewer_job.png differ
diff --git a/src/java/netxms-eclipse/LogViewer/plugin.xml b/src/java/netxms-eclipse/LogViewer/plugin.xml
new file mode 100644 (file)
index 0000000..f6c9141
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?eclipse version="3.4"?>\r
+<plugin>\r
+\r
+   <extension\r
+         point="org.eclipse.ui.views">\r
+      <view\r
+            name="Log Viewer"\r
+            allowMultiple="true"\r
+            class="org.netxms.ui.eclipse.logviewer.views.LogViewer"\r
+            id="org.netxms.ui.eclipse.logviewer.view.log_viewer">\r
+      </view>\r
+   </extension>\r
+\r
+   <extension\r
+         point="org.eclipse.ui.commands">\r
+      <command\r
+            name="Audit Log"\r
+            description="Open Audit Log"\r
+            categoryId="org.netxms.ui.eclipse.console.category.views"\r
+            id="org.netxms.ui.eclipse.logviewer.commands.openAuditLog">\r
+      </command>\r
+   </extension>\r
+   \r
+   <extension point = "org.eclipse.ui.actionSets">\r
+          <actionSet id="org.netxms.ui.eclipse.logviewer.action_set"\r
+                  label="Log Viewer"\r
+                  visible="true">\r
+                  <action id="org.netxms.ui.eclipse.logviewer.actions.openAuditLog"\r
+                          menubarPath="view/logs"\r
+                          toolbarPath="logs/additions"\r
+                          label="Audit Log"\r
+                          tooltip="Open Audit Log"\r
+                          icon="icons/AuditLog.png"\r
+                          class="org.netxms.ui.eclipse.logviewer.actions.OpenAuditLog"\r
+                          definitionId="org.netxms.ui.eclipse.logviewer.commands.openAuditLog">\r
+                  </action>\r
+          </actionSet>\r
+   </extension>\r
+\r
+   <extension\r
+         point="org.eclipse.ui.bindings">\r
+      <key\r
+            commandId="org.netxms.ui.eclipse.logviewer.commands.openAuditLog"\r
+            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"\r
+            sequence="Ctrl+Alt+F11">\r
+      </key>\r
+   </extension>\r
+\r
+</plugin>\r
@@ -1,12 +1,10 @@
-/**\r
- * \r
- */\r
-package org.netxms.ui.eclipse.alarmviewer;\r
+package org.netxms.ui.eclipse.logviewer;\r
 \r
 import org.eclipse.jface.resource.ImageDescriptor;\r
 import org.eclipse.ui.PlatformUI;\r
 import org.eclipse.ui.plugin.AbstractUIPlugin;\r
 import org.eclipse.ui.progress.IProgressService;\r
+import org.netxms.ui.eclipse.logviewer.views.LogViewer;\r
 import org.osgi.framework.BundleContext;\r
 \r
 /**\r
@@ -14,12 +12,13 @@ import org.osgi.framework.BundleContext;
  */\r
 public class Activator extends AbstractUIPlugin\r
 {\r
+\r
        // The plug-in ID\r
-       public static final String PLUGIN_ID = "org.netxms.ui.eclipse.alarmviewer";\r
+       public static final String PLUGIN_ID = "org.netxms.ui.eclipse.logviewer";\r
 \r
        // The shared instance\r
        private static Activator plugin;\r
-       \r
+\r
        /**\r
         * The constructor\r
         */\r
@@ -29,7 +28,10 @@ public class Activator extends AbstractUIPlugin
 \r
        /*\r
         * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)\r
+        * \r
+        * @see\r
+        * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext\r
+        * )\r
         */\r
        public void start(BundleContext context) throws Exception\r
        {\r
@@ -38,13 +40,15 @@ public class Activator extends AbstractUIPlugin
                \r
                // Register icon for our jobs\r
                IProgressService service = PlatformUI.getWorkbench().getProgressService();\r
-          service.registerIconForFamily(getImageDescriptor("icons/alarm_browser.png"), AlarmView.JOB_FAMILY);\r
+          service.registerIconForFamily(getImageDescriptor("icons/log_viewer_job.png"), LogViewer.JOB_FAMILY);\r
        }\r
 \r
-       \r
        /*\r
         * (non-Javadoc)\r
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)\r
+        * \r
+        * @see\r
+        * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext\r
+        * )\r
         */\r
        public void stop(BundleContext context) throws Exception\r
        {\r
@@ -54,7 +58,7 @@ public class Activator extends AbstractUIPlugin
 \r
        /**\r
         * Returns the shared instance\r
-        *\r
+        * \r
         * @return the shared instance\r
         */\r
        public static Activator getDefault()\r
@@ -63,10 +67,11 @@ public class Activator extends AbstractUIPlugin
        }\r
 \r
        /**\r
-        * Returns an image descriptor for the image file at the given\r
-        * plug-in relative path\r
-        *\r
-        * @param path the path\r
+        * Returns an image descriptor for the image file at the given plug-in\r
+        * relative path\r
+        * \r
+        * @param path\r
+        *           the path\r
         * @return the image descriptor\r
         */\r
        public static ImageDescriptor getImageDescriptor(String path)\r
@@ -1,13 +1,20 @@
-package org.netxms.ui.eclipse.console;\r
+package org.netxms.ui.eclipse.logviewer;\r
 \r
 import java.util.MissingResourceException;\r
 import java.util.ResourceBundle;\r
 \r
-public class Messages\r
-{\r
-       private static final String BUNDLE_NAME = "org.netxms.ui.eclipse.console.messages"; //$NON-NLS-1$\r
+import org.eclipse.osgi.util.NLS;\r
 \r
+public class Messages extends NLS\r
+{\r
+       private static final String BUNDLE_NAME = "org.netxms.ui.eclipse.logviewer.messages"; //$NON-NLS-1$\r
        private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\r
+       public static String LogViewer_AuditLog;\r
+       static\r
+       {\r
+               // initialize resource bundle\r
+               NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
+       }\r
 \r
        private Messages()\r
        {\r
@@ -1,25 +1,31 @@
-package org.netxms.ui.eclipse.serverconfig.actions;\r
+/**\r
+ * \r
+ */\r
+package org.netxms.ui.eclipse.logviewer.actions;\r
 \r
 import org.eclipse.jface.action.IAction;\r
 import org.eclipse.jface.dialogs.MessageDialog;\r
 import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.ui.IWorkbenchPage;\r
 import org.eclipse.ui.IWorkbenchWindow;\r
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;\r
 import org.eclipse.ui.PartInitException;\r
-import org.netxms.ui.eclipse.serverconfig.views.ServerConfigurationEditor;\r
+import org.netxms.ui.eclipse.logviewer.views.LogViewer;\r
 \r
-public class OpenServerConfig implements IWorkbenchWindowActionDelegate\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class OpenAuditLog implements IWorkbenchWindowActionDelegate\r
 {\r
        private IWorkbenchWindow window;\r
-       \r
+\r
        /* (non-Javadoc)\r
         * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()\r
         */\r
        @Override\r
        public void dispose()\r
        {\r
-               // TODO Auto-generated method stub\r
-               \r
        }\r
 \r
        /* (non-Javadoc)\r
@@ -41,7 +47,7 @@ public class OpenServerConfig implements IWorkbenchWindowActionDelegate
                {       \r
                        try \r
                        {\r
-                               window.getActivePage().showView(ServerConfigurationEditor.ID);\r
+                               window.getActivePage().showView(LogViewer.ID, "AuditLog", IWorkbenchPage.VIEW_ACTIVATE);\r
                        } \r
                        catch (PartInitException e) \r
                        {\r
@@ -56,7 +62,5 @@ public class OpenServerConfig implements IWorkbenchWindowActionDelegate
        @Override\r
        public void selectionChanged(IAction action, ISelection selection)\r
        {\r
-               // TODO Auto-generated method stub\r
-               \r
        }\r
 }\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/ColumnSelectionDialog.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/ColumnSelectionDialog.java
new file mode 100644 (file)
index 0000000..e347301
--- /dev/null
@@ -0,0 +1,108 @@
+/**\r
+ * \r
+ */\r
+package org.netxms.ui.eclipse.logviewer.dialogs;\r
+\r
+import java.util.Collection;\r
+\r
+import org.eclipse.jface.dialogs.Dialog;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Combo;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.netxms.client.log.Log;\r
+import org.netxms.client.log.LogColumn;\r
+import org.netxms.ui.eclipse.tools.WidgetHelper;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class ColumnSelectionDialog extends Dialog\r
+{\r
+       private Log logHandle;\r
+       private Combo columnList;\r
+       private LogColumn[] columns;\r
+       private LogColumn selectedColumn;\r
+       \r
+       /**\r
+        * @param parentShell\r
+        */\r
+       public ColumnSelectionDialog(Shell parentShell, Log logHandle)\r
+       {\r
+               super(parentShell);\r
+               this.logHandle = logHandle;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       protected Control createDialogArea(Composite parent)\r
+       {\r
+               Composite dialogArea = (Composite)super.createDialogArea(parent);\r
+               GridLayout layout = new GridLayout();\r
+               layout.verticalSpacing = WidgetHelper.INNER_SPACING;\r
+               dialogArea.setLayout(layout);\r
+               \r
+               Label label = new Label(dialogArea, SWT.NONE);\r
+               label.setText("Log columns");\r
+               \r
+               columnList = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);\r
+               GridData gd = new GridData();\r
+               gd.grabExcessHorizontalSpace = true;\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.widthHint = 250;\r
+               columnList.setLayoutData(gd);\r
+               \r
+               Collection<LogColumn> c = logHandle.getColumns();\r
+               columns = c.toArray(new LogColumn[c.size()]);\r
+               for(int i = 0; i < columns.length; i++)\r
+                       columnList.add(columns[i].getDescription());\r
+               \r
+               columnList.setFocus();\r
+               \r
+               return dialogArea;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.dialogs.Dialog#okPressed()\r
+        */\r
+       @Override\r
+       protected void okPressed()\r
+       {\r
+               int index = columnList.getSelectionIndex();\r
+               if (index >= 0)\r
+               {\r
+                       selectedColumn = columns[index];\r
+                       super.okPressed();\r
+               }\r
+               else\r
+               {\r
+                       MessageDialog.openWarning(getShell(), "Warning", "You should select column first!");\r
+               }\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)\r
+        */\r
+       @Override\r
+       protected void configureShell(Shell newShell)\r
+       {\r
+               super.configureShell(newShell);\r
+               newShell.setText("Select Column");\r
+       }\r
+\r
+       /**\r
+        * @return the selectedColumn\r
+        */\r
+       public LogColumn getSelectedColumn()\r
+       {\r
+               return selectedColumn;\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/QueryBuilder.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/QueryBuilder.java
new file mode 100644 (file)
index 0000000..936eb39
--- /dev/null
@@ -0,0 +1,285 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.logviewer.dialogs;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Set;\r
+import java.util.Map.Entry;\r
+\r
+import org.eclipse.jface.dialogs.Dialog;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.jface.viewers.StructuredSelection;\r
+import org.eclipse.jface.viewers.TreeViewer;\r
+import org.eclipse.jface.window.Window;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.events.SelectionListener;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.layout.RowLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.netxms.client.log.ColumnFilter;\r
+import org.netxms.client.log.Log;\r
+import org.netxms.client.log.LogColumn;\r
+import org.netxms.client.log.LogFilter;\r
+import org.netxms.ui.eclipse.logviewer.dialogs.helpers.FilterTreeContentProvider;\r
+import org.netxms.ui.eclipse.logviewer.dialogs.helpers.FilterTreeElement;\r
+import org.netxms.ui.eclipse.logviewer.dialogs.helpers.FilterTreeLabelProvider;\r
+import org.netxms.ui.eclipse.tools.WidgetHelper;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class QueryBuilder extends Dialog\r
+{\r
+       private Log logHandle;\r
+       private LogFilter filter;\r
+       private TreeViewer filterTree;\r
+       private ArrayList<FilterTreeElement> elements;\r
+       private FilterTreeElement rootElement;\r
+       private Button buttonAddColumn;\r
+       private Button buttonAddSet;\r
+       private Button buttonAddOperation;\r
+       private Button buttonRemove;\r
+       \r
+       /**\r
+        * @param parentShell\r
+        */\r
+       public QueryBuilder(Shell parentShell, Log logHandle, LogFilter filter)\r
+       {\r
+               super(parentShell);\r
+               this.logHandle = logHandle;\r
+               this.filter = filter;\r
+               createInternalTree(filter);\r
+       }\r
+       \r
+       /**\r
+        * Create internal tree-like representation of log filter\r
+        * \r
+        * @param filter Initial log filter\r
+        */\r
+       private void createInternalTree(final LogFilter filter)\r
+       {\r
+               elements = new ArrayList<FilterTreeElement>();\r
+               \r
+               rootElement = new FilterTreeElement(FilterTreeElement.ROOT, null, null);\r
+               elements.add(rootElement);\r
+               \r
+               final Set<Entry<String, ColumnFilter>> columnFilters = filter.getColumnFilters();\r
+               for(final Entry<String, ColumnFilter> cf : columnFilters)\r
+               {\r
+                       final LogColumn lc = logHandle.getColumn(cf.getKey());\r
+                       if (lc != null)\r
+                       {\r
+                               final FilterTreeElement column = new FilterTreeElement(FilterTreeElement.COLUMN, lc, rootElement);\r
+                               addColumnFilter(column, cf.getValue());\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Add column filter to given tree element\r
+        * \r
+        * @param parent Tree element\r
+        * @param filter Filter to add\r
+        */\r
+       private void addColumnFilter(final FilterTreeElement parent, final ColumnFilter filter)\r
+       {\r
+               FilterTreeElement entry = new FilterTreeElement(FilterTreeElement.FILTER, filter, parent);\r
+               if (filter.getType() == ColumnFilter.SET)\r
+               {\r
+                       for(final ColumnFilter f : filter.getSubFilters())\r
+                       {\r
+                               addColumnFilter(entry, f);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       protected Control createDialogArea(Composite parent)\r
+       {\r
+               Composite dialogArea = (Composite)super.createDialogArea(parent);\r
+               \r
+               GridLayout layout = new GridLayout();\r
+               layout.numColumns = 2;\r
+               dialogArea.setLayout(layout);\r
+               \r
+               /* filter tree */\r
+               filterTree = new TreeViewer(dialogArea, SWT.SINGLE | SWT.BORDER);\r
+               filterTree.setContentProvider(new FilterTreeContentProvider());\r
+               filterTree.setLabelProvider(new FilterTreeLabelProvider());\r
+               // We cannot simply pass rootElement to setInput(). Note from IStructuredContentProvider.getElements(): \r
+               // For instances where the viewer is displaying a tree containing a single 'root' element \r
+               // it is still necessary that the 'input' does not return itself from this method. This leads to \r
+               // recursion issues (see bug 9262). \r
+               ArrayList<FilterTreeElement> input = new ArrayList<FilterTreeElement>(1);\r
+               input.add(rootElement);\r
+               filterTree.setInput(input);\r
+               \r
+               GridData gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.grabExcessHorizontalSpace = true;\r
+               gd.widthHint = 400;\r
+               gd.heightHint = 300;\r
+               filterTree.getControl().setLayoutData(gd);\r
+               \r
+               /* buttons */\r
+               Composite buttons = new Composite(dialogArea, SWT.NONE);\r
+               RowLayout buttonLayout = new RowLayout();\r
+               buttonLayout.type = SWT.VERTICAL;\r
+               buttonLayout.fill = true;\r
+               buttonLayout.pack = false;\r
+               buttonLayout.marginTop = 0;\r
+               buttonLayout.spacing = WidgetHelper.OUTER_SPACING;\r
+               buttons.setLayout(buttonLayout);\r
+               gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.verticalAlignment = SWT.TOP;\r
+               buttons.setLayoutData(gd);\r
+               \r
+               buttonAddColumn = new Button(buttons, SWT.PUSH);\r
+               buttonAddColumn.setText("Add &column filter");\r
+               buttonAddColumn.addSelectionListener(new SelectionListener() {\r
+                       @Override\r
+                       public void widgetDefaultSelected(SelectionEvent e)\r
+                       {\r
+                               widgetSelected(e);\r
+                       }\r
+\r
+                       @Override\r
+                       public void widgetSelected(SelectionEvent e)\r
+                       {\r
+                               addColumn();\r
+                       }\r
+               });\r
+\r
+               buttonAddSet = new Button(buttons, SWT.PUSH);\r
+               buttonAddSet.setText("Add filter &set");\r
+               buttonAddSet.addSelectionListener(new SelectionListener() {\r
+                       @Override\r
+                       public void widgetDefaultSelected(SelectionEvent e)\r
+                       {\r
+                               widgetSelected(e);\r
+                       }\r
+\r
+                       @Override\r
+                       public void widgetSelected(SelectionEvent e)\r
+                       {\r
+                               addFilterSet();\r
+                       }\r
+               });\r
+               \r
+               buttonAddOperation = new Button(buttons, SWT.PUSH);\r
+               buttonAddOperation.setText("Add &condition");\r
+               buttonAddOperation.addSelectionListener(new SelectionListener() {\r
+                       @Override\r
+                       public void widgetDefaultSelected(SelectionEvent e)\r
+                       {\r
+                               widgetSelected(e);\r
+                       }\r
+\r
+                       @Override\r
+                       public void widgetSelected(SelectionEvent e)\r
+                       {\r
+                       }\r
+               });\r
+               \r
+               buttonRemove = new Button(buttons, SWT.PUSH);\r
+               buttonRemove.setText("&Remove");\r
+               \r
+               return dialogArea;\r
+       }\r
+       \r
+       /**\r
+        * Add column to filter\r
+        */\r
+       private void addColumn()\r
+       {\r
+               ColumnSelectionDialog dlg = new ColumnSelectionDialog(getShell(), logHandle);\r
+               if (dlg.open() == Window.OK)\r
+               {\r
+                       // Check if selected column already has filters\r
+                       for(FilterTreeElement e : elements)\r
+                       {\r
+                               if ((e.getType() == FilterTreeElement.COLUMN) &&\r
+                                   (((LogColumn)e.getObject()).getName().equals(dlg.getSelectedColumn().getName())))\r
+                               {\r
+                                       filterTree.setSelection(new StructuredSelection(e), true);\r
+                                       return; // Column already added\r
+                               }\r
+                       }\r
+                       \r
+                       // Add column\r
+                       FilterTreeElement column = new FilterTreeElement(FilterTreeElement.COLUMN, dlg.getSelectedColumn(), rootElement);\r
+                       elements.add(column);\r
+                       filterTree.refresh();\r
+                       filterTree.setSelection(new StructuredSelection(column), true);\r
+               }\r
+       }\r
+       \r
+       /**\r
+        * Add filter set\r
+        */\r
+       private void addFilterSet()\r
+       {\r
+               IStructuredSelection selection = (IStructuredSelection)filterTree.getSelection();\r
+               if (selection.isEmpty())\r
+               {\r
+                       MessageDialog.openWarning(getShell(), "Warning", "Please select column or filter set");\r
+                       return;\r
+               }\r
+               \r
+               FilterTreeElement element = (FilterTreeElement)selection.getFirstElement();\r
+               if (element.getType() == FilterTreeElement.ROOT)\r
+               {\r
+                       MessageDialog.openWarning(getShell(), "Warning", "Please select column or filter set");\r
+                       return;\r
+               }\r
+               \r
+               \r
+       }\r
+\r
+       /**\r
+        * Get filter created by builder\r
+        * \r
+        * @return the filter\r
+        */\r
+       public LogFilter getFilter()\r
+       {\r
+               return filter;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)\r
+        */\r
+       @Override\r
+       protected void configureShell(Shell newShell)\r
+       {\r
+               super.configureShell(newShell);\r
+               newShell.setText("Log Query Builder");\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeContentProvider.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeContentProvider.java
new file mode 100644 (file)
index 0000000..ee8a87b
--- /dev/null
@@ -0,0 +1,84 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.logviewer.dialogs.helpers;\r
+\r
+import java.util.List;\r
+\r
+import org.eclipse.jface.viewers.ITreeContentProvider;\r
+import org.eclipse.jface.viewers.Viewer;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class FilterTreeContentProvider implements ITreeContentProvider\r
+{\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Object[] getChildren(Object parentElement)\r
+       {\r
+               return ((FilterTreeElement)parentElement).getChilds();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Object getParent(Object element)\r
+       {\r
+               return ((FilterTreeElement)element).getParent();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)\r
+        */\r
+       @Override\r
+       public boolean hasChildren(Object element)\r
+       {\r
+               return ((FilterTreeElement)element).hasChilds();\r
+       }\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)\r
+        */\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Object[] getElements(Object inputElement)\r
+       {\r
+               return ((List<FilterTreeElement>)inputElement).toArray();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IContentProvider#dispose()\r
+        */\r
+       @Override\r
+       public void dispose()\r
+       {\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)\r
+        */\r
+       @Override\r
+       public void inputChanged(Viewer viewer, Object oldInput, Object newInput)\r
+       {\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeElement.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeElement.java
new file mode 100644 (file)
index 0000000..17d7d57
--- /dev/null
@@ -0,0 +1,99 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.logviewer.dialogs.helpers;\r
+\r
+import java.util.ArrayList;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class FilterTreeElement\r
+{\r
+       public static final int ROOT = 0;\r
+       public static final int COLUMN = 1;\r
+       public static final int FILTER = 2;\r
+       \r
+       private int type;\r
+       private Object object;\r
+       private FilterTreeElement parent;\r
+       private ArrayList<FilterTreeElement> childs;\r
+       \r
+       public FilterTreeElement(int type, Object object, FilterTreeElement parent)\r
+       {\r
+               this.type = type;\r
+               this.object = object;\r
+               this.parent = parent;\r
+               childs = new ArrayList<FilterTreeElement>();\r
+               if (parent != null)\r
+                       parent.addChild(this);\r
+       }\r
+\r
+       /**\r
+        * @return the type\r
+        */\r
+       public int getType()\r
+       {\r
+               return type;\r
+       }\r
+\r
+       /**\r
+        * @return the object\r
+        */\r
+       public Object getObject()\r
+       {\r
+               return object;\r
+       }\r
+\r
+       /**\r
+        * @return the parent\r
+        */\r
+       public FilterTreeElement getParent()\r
+       {\r
+               return parent;\r
+       }\r
+\r
+       /**\r
+        * @return the childs\r
+        */\r
+       public FilterTreeElement[] getChilds()\r
+       {\r
+               return childs.toArray(new FilterTreeElement[childs.size()]);\r
+       }\r
+       \r
+       /**\r
+        * Returns true if element has childs\r
+        * \r
+        * @return true if element has childs\r
+        */\r
+       public boolean hasChilds()\r
+       {\r
+               return childs.size() > 0;\r
+       }\r
+       \r
+       /**\r
+        * Add child element\r
+        * \r
+        * @param element Element to add\r
+        */\r
+       public void addChild(final FilterTreeElement element)\r
+       {\r
+               childs.add(element);\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeLabelProvider.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/dialogs/helpers/FilterTreeLabelProvider.java
new file mode 100644 (file)
index 0000000..65d6ae0
--- /dev/null
@@ -0,0 +1,115 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.logviewer.dialogs.helpers;\r
+\r
+import org.eclipse.jface.viewers.ILabelProvider;\r
+import org.eclipse.jface.viewers.ILabelProviderListener;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.netxms.client.log.ColumnFilter;\r
+import org.netxms.client.log.LogColumn;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class FilterTreeLabelProvider implements ILabelProvider\r
+{\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Image getImage(Object element)\r
+       {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)\r
+        */\r
+       @Override\r
+       public String getText(Object element)\r
+       {\r
+               FilterTreeElement fte = (FilterTreeElement)element;\r
+               switch(fte.getType())\r
+               {\r
+                       case FilterTreeElement.ROOT:\r
+                               return "[FILTER]";\r
+                       case FilterTreeElement.COLUMN:\r
+                               return ((LogColumn)fte.getObject()).getDescription();\r
+                       case FilterTreeElement.FILTER:\r
+                               final ColumnFilter cf = (ColumnFilter)fte.getObject();\r
+                               switch(cf.getType())\r
+                               {\r
+                                       case ColumnFilter.EQUALS:\r
+                                               return "= " + cf.getEqualsTo();\r
+                                       case ColumnFilter.LIKE:\r
+                                               return "LIKE " + cf.getLike();\r
+                                       case ColumnFilter.RANGE:\r
+                                               return "IN RANGE " + cf.getRangeFrom() + " .. " + cf.getRangeTo();\r
+                                       case ColumnFilter.SET:\r
+                                               return (cf.getOperation() == ColumnFilter.AND) ? "AND" : "OR";\r
+                                       default:\r
+                                               return "";\r
+                               }\r
+                       default:\r
+                               return "";\r
+               }\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)\r
+        */\r
+       @Override\r
+       public void addListener(ILabelProviderListener listener)\r
+       {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()\r
+        */\r
+       @Override\r
+       public void dispose()\r
+       {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)\r
+        */\r
+       @Override\r
+       public boolean isLabelProperty(Object element, String property)\r
+       {\r
+               // TODO Auto-generated method stub\r
+               return false;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)\r
+        */\r
+       @Override\r
+       public void removeListener(ILabelProviderListener listener)\r
+       {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/messages.properties b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/messages.properties
new file mode 100644 (file)
index 0000000..85726c2
--- /dev/null
@@ -0,0 +1 @@
+LogViewer_AuditLog=Audit Log\r
diff --git a/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/views/LogViewer.java b/src/java/netxms-eclipse/LogViewer/src/org/netxms/ui/eclipse/logviewer/views/LogViewer.java
new file mode 100644 (file)
index 0000000..5911d52
--- /dev/null
@@ -0,0 +1,267 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.logviewer.views;\r
+\r
+import java.util.Collection;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Status;\r
+import org.eclipse.jface.action.Action;\r
+import org.eclipse.jface.action.IMenuManager;\r
+import org.eclipse.jface.action.IToolBarManager;\r
+import org.eclipse.jface.action.Separator;\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.jface.viewers.TableViewer;\r
+import org.eclipse.jface.window.Window;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.layout.FillLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.TableColumn;\r
+import org.eclipse.ui.IActionBars;\r
+import org.eclipse.ui.IViewSite;\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.part.ViewPart;\r
+import org.eclipse.ui.progress.UIJob;\r
+import org.netxms.client.NXCSession;\r
+import org.netxms.client.log.Log;\r
+import org.netxms.client.log.LogColumn;\r
+import org.netxms.client.log.LogFilter;\r
+import org.netxms.ui.eclipse.jobs.ConsoleJob;\r
+import org.netxms.ui.eclipse.logviewer.Activator;\r
+import org.netxms.ui.eclipse.logviewer.Messages;\r
+import org.netxms.ui.eclipse.logviewer.dialogs.QueryBuilder;\r
+import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
+import org.netxms.ui.eclipse.tools.RefreshAction;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public class LogViewer extends ViewPart\r
+{\r
+       public static final String ID = "org.netxms.ui.eclipse.logviewer.view.log_viewer";\r
+       public static final String JOB_FAMILY = "LogViewerJob";\r
+               \r
+       private NXCSession session;\r
+       private TableViewer viewer;\r
+       private String logName;\r
+       private Log logHandle;\r
+       private LogFilter filter;\r
+       private Image titleImage = null;\r
+       private RefreshAction actionRefresh;\r
+       private Action actionDoQuery;\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite)\r
+        */\r
+       @Override\r
+       public void init(IViewSite site) throws PartInitException\r
+       {\r
+               super.init(site);\r
+               \r
+               session = NXMCSharedData.getInstance().getSession();\r
+               logName = site.getSecondaryId();\r
+               setPartName(Messages.getString("LogViewer_" + logName));\r
+               final ImageDescriptor img = Activator.getImageDescriptor("icons/" + logName + ".png");\r
+               if (img != null)\r
+               {\r
+                       titleImage = img.createImage();\r
+                       this.setTitleImage(titleImage);\r
+               }\r
+               filter = new LogFilter();\r
+       }\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       public void createPartControl(Composite parent)\r
+       {\r
+               parent.setLayout(new FillLayout());\r
+\r
+               viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION);\r
+               org.eclipse.swt.widgets.Table table = viewer.getTable();\r
+               table.setLinesVisible(true);\r
+               table.setHeaderVisible(true);\r
+\r
+               makeActions();\r
+               contributeToActionBars();\r
+               \r
+               new ConsoleJob("Open log \"" + logName + "\"", this, Activator.PLUGIN_ID, JOB_FAMILY) {\r
+                       @Override\r
+                       protected String getErrorMessage()\r
+                       {\r
+                               return "Cannot open server log file \"" + logName + "\"";\r
+                       }\r
+\r
+                       @Override\r
+                       protected void runInternal(IProgressMonitor monitor) throws Exception\r
+                       {\r
+                               logHandle = session.openServerLog(logName);\r
+                               new UIJob("Setup log viewer for \"" + logName + "\" log")\r
+                               {\r
+                                       @Override\r
+                                       public IStatus runInUIThread(IProgressMonitor monitor)\r
+                                       {\r
+                                               setupLogViewer();\r
+                                               return Status.OK_STATUS;\r
+                                       }               \r
+                               }.schedule();\r
+                       }\r
+               }.start();\r
+       }\r
+       \r
+       /**\r
+        * Estimate required column width\r
+        */\r
+       private int estimateColumnWidth(final LogColumn lc)\r
+       {\r
+               switch(lc.getType())\r
+               {\r
+                       case LogColumn.LC_INTEGER:\r
+                               return 80;\r
+                       case LogColumn.LC_TIMESTAMP:\r
+                               return 120;\r
+                       case LogColumn.LC_SEVERITY:\r
+                               return 100;\r
+                       case LogColumn.LC_OBJECT_ID:\r
+                               return 150;\r
+                       case LogColumn.LC_TEXT:\r
+                               return 250;\r
+                       default:\r
+                               return 100;\r
+               }\r
+       }\r
+       \r
+       /**\r
+        * Setup log viewer after successful log open\r
+        */\r
+       private void setupLogViewer()\r
+       {\r
+               org.eclipse.swt.widgets.Table table = viewer.getTable();\r
+               Collection<LogColumn> columns = logHandle.getColumns();\r
+               for(final LogColumn lc : columns)\r
+               {\r
+                       TableColumn column = new TableColumn(table, SWT.LEFT);\r
+                       column.setText(lc.getDescription());\r
+                       column.setWidth(estimateColumnWidth(lc));\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Contribute actions to action bar\r
+        */\r
+       private void contributeToActionBars()\r
+       {\r
+               IActionBars bars = getViewSite().getActionBars();\r
+               fillLocalPullDown(bars.getMenuManager());\r
+               fillLocalToolBar(bars.getToolBarManager());\r
+       }\r
+\r
+       /**\r
+        * Fill local pull-down menu\r
+        * \r
+        * @param manager\r
+        *           Menu manager for pull-down menu\r
+        */\r
+       private void fillLocalPullDown(IMenuManager manager)\r
+       {\r
+               manager.add(actionDoQuery);\r
+               manager.add(new Separator());\r
+               manager.add(actionRefresh);\r
+       }\r
+\r
+       /**\r
+        * Fill local tool bar\r
+        * \r
+        * @param manager\r
+        *           Menu manager for local toolbar\r
+        */\r
+       private void fillLocalToolBar(IToolBarManager manager)\r
+       {\r
+               manager.add(actionDoQuery);\r
+               manager.add(new Separator());\r
+               manager.add(actionRefresh);\r
+       }\r
+\r
+       /**\r
+        * Create actions\r
+        */\r
+       private void makeActions()\r
+       {\r
+               actionRefresh = new RefreshAction()\r
+               {\r
+                       /* (non-Javadoc)\r
+                        * @see org.eclipse.jface.action.Action#run()\r
+                        */\r
+                       @Override\r
+                       public void run()\r
+                       {\r
+                       }\r
+               };\r
+\r
+               actionDoQuery = new Action()\r
+               {\r
+                       /* (non-Javadoc)\r
+                        * @see org.eclipse.jface.action.Action#run()\r
+                        */\r
+                       @Override\r
+                       public void run()\r
+                       {\r
+                               doQuery();\r
+                       }\r
+               };\r
+               actionDoQuery.setText("New &query");\r
+               actionDoQuery.setImageDescriptor(Activator.getImageDescriptor("icons/do_query.png"));\r
+       }\r
+       \r
+       /**\r
+        * Prepare filter and execute query on server\r
+        */\r
+       private void doQuery()\r
+       {\r
+               QueryBuilder dlg = new QueryBuilder(getSite().getShell(), logHandle, filter);\r
+               if (dlg.open() == Window.OK)\r
+               {\r
+                       \r
+               }\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()\r
+        */\r
+       @Override\r
+       public void setFocus()\r
+       {\r
+               viewer.getControl().setFocus();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#dispose()\r
+        */\r
+       @Override\r
+       public void dispose()\r
+       {\r
+               if (titleImage != null)\r
+                       titleImage.dispose();\r
+               super.dispose();\r
+       }\r
+}\r
index 89bbff2..04655cf 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.ui.eclipse.objectview;\r
 \r
@@ -99,7 +114,7 @@ public class LastValuesView extends Composite
                                {\r
                                        status = new Status(Status.ERROR, Activator.PLUGIN_ID, \r
                            (e instanceof NXCException) ? ((NXCException)e).getErrorCode() : 0,\r
-                           "Cannot get DCI values for node " + node.getObjectName() + ": " + e.getMessage(), e);\r
+                           "Cannot get DCI values for node " + node.getObjectName() + ": " + e.getMessage(), null);\r
                                }\r
                                return status;\r
                        }\r
index 2abf966..30f4868 100644 (file)
@@ -29,14 +29,6 @@ public class LastValues extends ViewPart
        private NXCNode node;\r
        private LastValuesView dataView;\r
        \r
-       /**\r
-        * \r
-        */\r
-       public LastValues()\r
-       {\r
-               // TODO Auto-generated constructor stub\r
-       }\r
-\r
        /* (non-Javadoc)\r
         * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite)\r
         */\r
index 49c94cf..67bc84a 100644 (file)
@@ -18,8 +18,6 @@ public class OpenServerConfig implements IWorkbenchWindowActionDelegate
        @Override\r
        public void dispose()\r
        {\r
-               // TODO Auto-generated method stub\r
-               \r
        }\r
 \r
        /* (non-Javadoc)\r
@@ -56,7 +54,5 @@ public class OpenServerConfig implements IWorkbenchWindowActionDelegate
        @Override\r
        public void selectionChanged(IAction action, ISelection selection)\r
        {\r
-               // TODO Auto-generated method stub\r
-               \r
        }\r
 }\r
index 267370e..dcb0446 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.ui.eclipse.usermanager.dialogs;\r
 \r
index d8c4d06..05b51ab 100644 (file)
@@ -1,3 +1,21 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
 package org.netxms.ui.eclipse.console;\r
 \r
 import org.eclipse.jface.action.StatusLineContributionItem;\r
index 71477d8..f26c663 100644 (file)
@@ -6,7 +6,6 @@ import java.util.ResourceBundle;
 public class Messages\r
 {\r
        private static final String BUNDLE_NAME = "org.netxms.ui.eclipse.console.messages"; //$NON-NLS-1$\r
-\r
        private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\r
 \r
        private Messages()\r
index bc75ae5..b59d82c 100644 (file)
@@ -149,6 +149,8 @@ public class NXMCActionBarAdvisor extends ActionBarAdvisor
                viewMenu.add(new Separator());
                viewMenu.add(new GroupMarker(IActionConstants.M_PRIMARY_VIEW));
                viewMenu.add(new Separator());
+               viewMenu.add(new GroupMarker(IActionConstants.M_LOGS_VIEW));
+               viewMenu.add(new Separator());
                viewMenu.add(openConsoleAction);
                viewMenu.add(openProgressViewAction);
                viewMenu.add(new GroupMarker(IActionConstants.M_TOOL_VIEW));
@@ -178,6 +180,10 @@ public class NXMCActionBarAdvisor extends ActionBarAdvisor
 
                toolbar = new ToolBarManager(SWT.FLAT | SWT.TRAIL);
                toolbar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+               coolBar.add(new ToolBarContributionItem(toolbar, "logs")); //$NON-NLS-1$
+
+               toolbar = new ToolBarManager(SWT.FLAT | SWT.TRAIL);
+               toolbar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
                coolBar.add(new ToolBarContributionItem(toolbar, "tools")); //$NON-NLS-1$
 
                toolbar = new ToolBarManager(SWT.FLAT | SWT.TRAIL);
index b2ce657..275266a 100644 (file)
@@ -32,6 +32,7 @@ Export-Package: com.keypoint,
  org.netxms.client.events,
  org.netxms.client.log,
  org.netxms.client.maps,
+ org.netxms.ui.eclipse.jobs,
  org.netxms.ui.eclipse.shared,
  org.netxms.ui.eclipse.tools,
  org.netxms.ui.eclipse.widgets
diff --git a/src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/jobs/ConsoleJob.java b/src/java/netxms-eclipse/library/src/org/netxms/ui/eclipse/jobs/ConsoleJob.java
new file mode 100644 (file)
index 0000000..0184351
--- /dev/null
@@ -0,0 +1,114 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.jobs;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Status;\r
+import org.eclipse.core.runtime.jobs.Job;\r
+import org.eclipse.ui.part.ViewPart;\r
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;\r
+import org.netxms.client.NXCException;\r
+import org.netxms.ui.eclipse.library.Activator;\r
+\r
+/**\r
+ * @author Victor\r
+ *\r
+ */\r
+public abstract class ConsoleJob extends Job\r
+{\r
+       private IWorkbenchSiteProgressService siteService;\r
+       private String pluginId;\r
+       private Object jobFamily;\r
+       \r
+       /**\r
+        * Constructor for console job object\r
+        * \r
+        * @param name Job's name\r
+        * @param viewPart Related view part or null\r
+        * @param pluginId Related plugin ID\r
+        * @param jobFamily Job's family or null\r
+        */\r
+       public ConsoleJob(String name, ViewPart viewPart, String pluginId, Object jobFamily)\r
+       {\r
+               super(name);\r
+               this.pluginId = (pluginId != null) ? pluginId : Activator.PLUGIN_ID;\r
+               this.jobFamily = jobFamily;\r
+               siteService = (viewPart != null) ? \r
+                                       (IWorkbenchSiteProgressService)viewPart.getSite().getAdapter(IWorkbenchSiteProgressService.class) : null;\r
+               setUser(true);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)\r
+        */\r
+       @Override\r
+       protected IStatus run(IProgressMonitor monitor)\r
+       {\r
+               IStatus status;\r
+               try\r
+               {\r
+                       runInternal(monitor);\r
+                       status = Status.OK_STATUS;\r
+               }\r
+               catch(Exception e)\r
+               {\r
+                       status = new Status(Status.ERROR, pluginId, \r
+                  (e instanceof NXCException) ? ((NXCException)e).getErrorCode() : 0,\r
+                  getErrorMessage() + ": " + e.getMessage(), null);\r
+               }\r
+               return status;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)\r
+        */\r
+       @Override\r
+       public boolean belongsTo(Object family)\r
+       {\r
+               return family == jobFamily;\r
+       }\r
+       \r
+       /**\r
+        * Start job.\r
+        */\r
+       public void start()\r
+       {\r
+               if (siteService != null)\r
+                       siteService.schedule(this, 0, true);\r
+               else\r
+                       schedule();\r
+       }\r
+\r
+       /**\r
+        * Executes job. Called from within Job.run(). If job fails, this method should throw appropriate exception.\r
+        * \r
+        * @param monitor the monitor to be used for reporting progress and responding to cancellation. The monitor is never null.\r
+        * @throws Exception in case of any failure.\r
+        */\r
+       protected abstract void runInternal(IProgressMonitor monitor) throws Exception;\r
+       \r
+       /**\r
+        * Should return error message which will be shown in case of job failure.\r
+        * Result of exception's getMessage() will be appended to this message.\r
+        * \r
+        * @return Error message\r
+        */\r
+       protected abstract String getErrorMessage();\r
+}\r
index 51938ad..c5ba34f 100644 (file)
@@ -16,6 +16,7 @@ public interface IActionConstants
        public static final String M_PRODUCT_VIEW = "product";\r
        public static final String M_PRIMARY_VIEW = "primary";\r
        public static final String M_TOOL_VIEW = "tools";\r
+       public static final String M_LOGS_VIEW = "logs";\r
 \r
        public static final String MB_OBJECT_CREATION = "objectcreation";\r
        public static final String MB_OBJECT_MANAGEMENT = "objectmgmt";\r
index ced290a..ef8d9ba 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2009 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
  */\r
 package org.netxms.ui.eclipse.tools;\r
 \r
index b9d4cc4..515b708 100644 (file)
 
 static NXCORE_LOG s_logs[] =
 {
+       { _T("AuditLog"), _T("audit_log"), SYSTEM_ACCESS_VIEW_AUDIT_LOG,
+               {
+                       { "record_id", "Record ID", LC_INTEGER },
+                       { "timestamp", "Timestamp", LC_TIMESTAMP },
+                       { "subsystem", "Subsystem", LC_TEXT },
+                       { "user_id", "User", LC_USER_ID },
+                       { "workstation", "Workstation", LC_TEXT },
+                       { "message", "Message", LC_TEXT },
+                       { NULL, NULL, 0 }
+               }
+       },
        { _T("EventLog"), _T("event_log"), SYSTEM_ACCESS_VIEW_EVENT_LOG,
                {
                        { "event_timestamp", "Time", LC_TIMESTAMP },
index b6cd21d..d54acb2 100644 (file)
@@ -34,6 +34,7 @@
 #define LC_USER_ID         3
 #define LC_EVENT_CODE      4
 #define LC_TIMESTAMP       5
+#define LC_INTEGER         6
 
 
 //