class NXCAlarm renamed to Alarm and movef to events subpackage
authorVictor Kirhenshtein <victor@netxms.org>
Sun, 1 Nov 2009 11:32:42 +0000 (11:32 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Sun, 1 Nov 2009 11:32:42 +0000 (11:32 +0000)
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmComparator.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/AlarmListFilter.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/TerminateAlarm.java
src/java/netxms-eclipse/AlarmViewer/src/org/netxms/ui/eclipse/alarmviewer/widgets/AlarmList.java

index 08c574f..5479102 100644 (file)
@@ -8,8 +8,8 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerComparator;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.widgets.TableColumn;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCObject;\r
+import org.netxms.client.events.Alarm;\r
 import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 \r
@@ -50,29 +50,29 @@ public class AlarmComparator extends ViewerComparator
                switch((Integer)sortColumn.getData("ID"))\r
                {\r
                        case AlarmList.COLUMN_SEVERITY:\r
-                               rc = compareNumbers(((NXCAlarm)e1).getCurrentSeverity(), ((NXCAlarm)e2).getCurrentSeverity());\r
+                               rc = compareNumbers(((Alarm)e1).getCurrentSeverity(), ((Alarm)e2).getCurrentSeverity());\r
                                break;\r
                        case AlarmList.COLUMN_STATE:\r
-                               rc = compareNumbers(((NXCAlarm)e1).getState(), ((NXCAlarm)e2).getState());\r
+                               rc = compareNumbers(((Alarm)e1).getState(), ((Alarm)e2).getState());\r
                                break;\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
+                               NXCObject obj1 = NXMCSharedData.getInstance().getSession().findObjectById(((Alarm)e1).getSourceObjectId());\r
+                               NXCObject obj2 = NXMCSharedData.getInstance().getSession().findObjectById(((Alarm)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 AlarmList.COLUMN_MESSAGE:\r
-                               rc = ((NXCAlarm)e1).getMessage().compareToIgnoreCase(((NXCAlarm)e2).getMessage());\r
+                               rc = ((Alarm)e1).getMessage().compareToIgnoreCase(((Alarm)e2).getMessage());\r
                                break;\r
                        case AlarmList.COLUMN_COUNT:\r
-                               rc = compareNumbers(((NXCAlarm)e1).getRepeatCount(), ((NXCAlarm)e2).getRepeatCount());\r
+                               rc = compareNumbers(((Alarm)e1).getRepeatCount(), ((Alarm)e2).getRepeatCount());\r
                                break;\r
                        case AlarmList.COLUMN_CREATED:\r
-                               rc = ((NXCAlarm)e1).getCreationTime().compareTo(((NXCAlarm)e2).getCreationTime());\r
+                               rc = ((Alarm)e1).getCreationTime().compareTo(((Alarm)e2).getCreationTime());\r
                                break;\r
                        case AlarmList.COLUMN_LASTCHANGE:\r
-                               rc = ((NXCAlarm)e1).getLastChangeTime().compareTo(((NXCAlarm)e2).getLastChangeTime());\r
+                               rc = ((Alarm)e1).getLastChangeTime().compareTo(((Alarm)e2).getLastChangeTime());\r
                                break;\r
                        default:\r
                                rc = 0;\r
index 0d73bb9..b78435c 100644 (file)
@@ -5,8 +5,8 @@ package org.netxms.ui.eclipse.alarmviewer;
 \r
 import org.eclipse.jface.viewers.Viewer;\r
 import org.eclipse.jface.viewers.ViewerFilter;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCObject;\r
+import org.netxms.client.events.Alarm;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
 \r
 /**\r
@@ -32,10 +32,10 @@ public class AlarmListFilter extends ViewerFilter
        @Override\r
        public boolean select(Viewer viewer, Object parentElement, Object element)\r
        {\r
-               if ((rootObject == 0) || (rootObject == ((NXCAlarm)element).getSourceObjectId()))\r
+               if ((rootObject == 0) || (rootObject == ((Alarm)element).getSourceObjectId()))\r
                        return true;    // No filtering by object ID or root object is a source\r
                \r
-               NXCObject object = NXMCSharedData.getInstance().getSession().findObjectById(((NXCAlarm)element).getSourceObjectId());\r
+               NXCObject object = NXMCSharedData.getInstance().getSession().findObjectById(((Alarm)element).getSourceObjectId());\r
                if (object != null)\r
                        return object.isChildOf(rootObject);\r
                return false;\r
index 4cc41cf..a73e3d5 100644 (file)
@@ -8,9 +8,9 @@ import java.text.DateFormat;
 import org.eclipse.jface.viewers.ILabelProviderListener;\r
 import org.eclipse.jface.viewers.ITableLabelProvider;\r
 import org.eclipse.swt.graphics.Image;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCObject;\r
 import org.netxms.client.constants.Severity;\r
+import org.netxms.client.events.Alarm;\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
@@ -56,9 +56,9 @@ public class AlarmListLabelProvider implements ITableLabelProvider
                switch(columnIndex)\r
                {\r
                        case AlarmList.COLUMN_SEVERITY:\r
-                               return severityImages[((NXCAlarm)element).getCurrentSeverity()];\r
+                               return severityImages[((Alarm)element).getCurrentSeverity()];\r
                        case AlarmList.COLUMN_STATE:\r
-                               return stateImages[((NXCAlarm)element).getState()];\r
+                               return stateImages[((Alarm)element).getState()];\r
                }\r
                return null;\r
        }\r
@@ -72,20 +72,20 @@ public class AlarmListLabelProvider implements ITableLabelProvider
                switch(columnIndex)\r
                {\r
                        case AlarmList.COLUMN_SEVERITY:\r
-                               return StatusDisplayInfo.getStatusText(((NXCAlarm)element).getCurrentSeverity());\r
+                               return StatusDisplayInfo.getStatusText(((Alarm)element).getCurrentSeverity());\r
                        case AlarmList.COLUMN_STATE:\r
-                               return stateText[((NXCAlarm)element).getState()];\r
+                               return stateText[((Alarm)element).getState()];\r
                        case AlarmList.COLUMN_SOURCE:\r
-                               NXCObject object = NXMCSharedData.getInstance().getSession().findObjectById(((NXCAlarm)element).getSourceObjectId());\r
+                               NXCObject object = NXMCSharedData.getInstance().getSession().findObjectById(((Alarm)element).getSourceObjectId());\r
                                return (object != null) ? object.getObjectName() : null;\r
                        case AlarmList.COLUMN_MESSAGE:\r
-                               return ((NXCAlarm)element).getMessage();\r
+                               return ((Alarm)element).getMessage();\r
                        case AlarmList.COLUMN_COUNT:\r
-                               return Integer.toString(((NXCAlarm)element).getRepeatCount());\r
+                               return Integer.toString(((Alarm)element).getRepeatCount());\r
                        case AlarmList.COLUMN_CREATED:\r
-                               return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((NXCAlarm)element).getCreationTime());\r
+                               return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((Alarm)element).getCreationTime());\r
                        case AlarmList.COLUMN_LASTCHANGE:\r
-                               return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((NXCAlarm)element).getLastChangeTime());\r
+                               return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(((Alarm)element).getLastChangeTime());\r
                }\r
                return null;\r
        }\r
index 0a0c90c..06978d1 100644 (file)
@@ -13,8 +13,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IObjectActionDelegate;\r
 import org.eclipse.ui.IWorkbenchPart;\r
 import org.eclipse.ui.progress.IWorkbenchSiteProgressService;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCException;\r
+import org.netxms.client.events.Alarm;\r
 import org.netxms.ui.eclipse.alarmviewer.Activator;\r
 import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
@@ -49,8 +49,8 @@ public class AcknowledgeAlarm implements IObjectActionDelegate
                        try\r
                        {\r
                                for(int i = 0; i < selection.length; i++)\r
-                                       if (selection[i] instanceof NXCAlarm)\r
-                                               NXMCSharedData.getInstance().getSession().acknowledgeAlarm(((NXCAlarm)selection[i]).getId());\r
+                                       if (selection[i] instanceof Alarm)\r
+                                               NXMCSharedData.getInstance().getSession().acknowledgeAlarm(((Alarm)selection[i]).getId());\r
                                status = Status.OK_STATUS;\r
                        }\r
                        catch(Exception e)\r
index e765a0b..eaa0400 100644 (file)
@@ -13,8 +13,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IObjectActionDelegate;\r
 import org.eclipse.ui.IWorkbenchPart;\r
 import org.eclipse.ui.progress.IWorkbenchSiteProgressService;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCException;\r
+import org.netxms.client.events.Alarm;\r
 import org.netxms.ui.eclipse.alarmviewer.Activator;\r
 import org.netxms.ui.eclipse.alarmviewer.widgets.AlarmList;\r
 import org.netxms.ui.eclipse.shared.NXMCSharedData;\r
@@ -49,8 +49,8 @@ public class TerminateAlarm implements IObjectActionDelegate
                        try\r
                        {\r
                                for(int i = 0; i < selection.length; i++)\r
-                                       if (selection[i] instanceof NXCAlarm)\r
-                                               NXMCSharedData.getInstance().getSession().terminateAlarm(((NXCAlarm)selection[i]).getId());\r
+                                       if (selection[i] instanceof Alarm)\r
+                                               NXMCSharedData.getInstance().getSession().terminateAlarm(((Alarm)selection[i]).getId());\r
                                status = Status.OK_STATUS;\r
                        }\r
                        catch(Exception e)\r
index d3d7d75..f22892f 100644 (file)
@@ -37,10 +37,10 @@ import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.IWorkbenchActionConstants;\r
 import org.eclipse.ui.part.ViewPart;\r
 import org.eclipse.ui.progress.UIJob;\r
-import org.netxms.client.NXCAlarm;\r
 import org.netxms.client.NXCListener;\r
 import org.netxms.client.NXCNotification;\r
 import org.netxms.client.NXCSession;\r
+import org.netxms.client.events.Alarm;\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
@@ -71,7 +71,7 @@ public class AlarmList extends Composite
        private NXCListener clientListener = null;\r
        private TableViewer alarmViewer;\r
        private AlarmListFilter alarmFilter;\r
-       private HashMap<Long, NXCAlarm> alarmList;\r
+       private HashMap<Long, Alarm> alarmList;\r
        \r
        public AlarmList(ViewPart viewPart, Composite parent, int style)\r
        {\r
@@ -138,7 +138,7 @@ public class AlarmList extends Composite
                                        case NXCNotification.ALARM_CHANGED:\r
                                                synchronized(alarmList)\r
                                                {\r
-                                                       alarmList.put(((NXCAlarm)n.getObject()).getId(), (NXCAlarm)n.getObject());\r
+                                                       alarmList.put(((Alarm)n.getObject()).getId(), (Alarm)n.getObject());\r
                                                }\r
                                                scheduleAlarmViewerUpdate();\r
                                                break;\r
@@ -146,7 +146,7 @@ public class AlarmList extends Composite
                                        case NXCNotification.ALARM_DELETED:\r
                                                synchronized(alarmList)\r
                                                {\r
-                                                       alarmList.remove(((NXCAlarm)n.getObject()).getId());\r
+                                                       alarmList.remove(((Alarm)n.getObject()).getId());\r
                                                }\r
                                                scheduleAlarmViewerUpdate();\r
                                                break;\r