Object tools - Columns tab present when it should not be fixes ##723
authorEriks Jenkevics <eriks@netxms.org>
Mon, 5 Sep 2016 07:43:48 +0000 (10:43 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Mon, 5 Sep 2016 07:43:48 +0000 (10:43 +0300)
src/java/netxms-eclipse/ObjectTools/plugin.xml
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java [new file with mode: 0644]
webui/webapp/ObjectTools/plugin.xml
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java [new file with mode: 0644]

index 48bb601..576ff6d 100644 (file)
             id="org.netxms.ui.eclipse.objecttools.propertypages.Columns#4"
             name="%page.name.Columns">
          <enabledWhen>
-            <instanceof
-                  value="org.netxms.client.objecttools.ObjectTool">
-            </instanceof>
+            <test
+                  forcePluginActivation="true"
+                  property="org.netxms.ui.eclipse.objecttools.hasType">
+            </test>
          </enabledWhen>
       </page>
       <page
             id="wakeup">
       </handler>
    </extension>
+   <extension
+         point="org.eclipse.core.expressions.propertyTesters">
+      <propertyTester
+            class="org.netxms.ui.eclipse.objecttools.ObjectToolsPopertyTester"
+            id="org.netxms.ui.eclipse.objecttools.ObjectToolsPropertyTester"
+            namespace="org.netxms.ui.eclipse.objecttools"
+            properties="hasType"
+            type="org.netxms.client.objecttools.ObjectTool">
+      </propertyTester>
+   </extension>
 
 </plugin>
diff --git a/src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java b/src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java
new file mode 100644 (file)
index 0000000..8f50f97
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2016 RadenSolutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.objecttools;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.netxms.client.objecttools.ObjectTool;
+
+/**
+ * Property tester for ObjectTool
+ * 
+ */
+public class ObjectToolsPopertyTester extends PropertyTester
+{
+   @Override
+   public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
+   {
+      if (!(receiver instanceof ObjectTool))
+         return false;
+
+      ObjectTool objectTool = (ObjectTool)receiver;
+      switch(objectTool.getType())
+      {
+         case ObjectTool.TYPE_TABLE_AGENT:
+         case ObjectTool.TYPE_TABLE_SNMP:
+            return true;
+         default:
+            return false;
+      }
+   }
+
+}
index e797c36..249e387 100644 (file)
             id="org.netxms.ui.eclipse.objecttools.propertypages.Columns#4"
             name="%page.name.Columns">
          <enabledWhen>
-            <instanceof
-                  value="org.netxms.client.objecttools.ObjectTool">
-            </instanceof>
+            <test
+                  forcePluginActivation="true"
+                  property="org.netxms.ui.eclipse.objecttools.hasType">
+            </test>
          </enabledWhen>
       </page>
       <page
             id="wakeup">
       </handler>
    </extension>
+   <extension
+         point="org.eclipse.core.expressions.propertyTesters">
+      <propertyTester
+            class="org.netxms.ui.eclipse.objecttools.ObjectToolsPopertyTester"
+            id="org.netxms.ui.eclipse.objecttools.ObjectToolsPropertyTester"
+            namespace="org.netxms.ui.eclipse.objecttools"
+            properties="hasType"
+            type="org.netxms.client.objecttools.ObjectTool">
+      </propertyTester>
+   </extension>
 
 </plugin>
diff --git a/webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java b/webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsPopertyTester.java
new file mode 100644 (file)
index 0000000..8f50f97
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2016 RadenSolutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.objecttools;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.netxms.client.objecttools.ObjectTool;
+
+/**
+ * Property tester for ObjectTool
+ * 
+ */
+public class ObjectToolsPopertyTester extends PropertyTester
+{
+   @Override
+   public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
+   {
+      if (!(receiver instanceof ObjectTool))
+         return false;
+
+      ObjectTool objectTool = (ObjectTool)receiver;
+      switch(objectTool.getType())
+      {
+         case ObjectTool.TYPE_TABLE_AGENT:
+         case ObjectTool.TYPE_TABLE_SNMP:
+            return true;
+         default:
+            return false;
+      }
+   }
+
+}