geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1172496 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui: plugin.xml src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
Date Mon, 19 Sep 2011 07:28:47 GMT
Author: hanhongfang
Date: Mon Sep 19 07:28:46 2011
New Revision: 1172496

URL: http://svn.apache.org/viewvc?rev=1172496&view=rev
Log:
Only enable popup menu when server is started. GERONIMODEVTOOLS-764 Control the OSGI bundle's
start level in GEP. Thanks Yi Xiao for the patch.

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml?rev=1172496&r1=1172495&r2=1172496&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml
Mon Sep 19 07:28:46 2011
@@ -414,6 +414,13 @@
           type="org.eclipse.wst.server.ui.IServerModule"
           class="org.apache.geronimo.st.v30.ui.propertyTesters.OSGiBundlePropertyTester">
        </propertyTester>
+       <propertyTester
+          id="org.apache.geronimo.st.v30.ui.propertyTester"
+          namespace="org.apache.geronimo.st.v30.ui"
+          properties="serverState"
+          type="org.eclipse.wst.server.ui.IServerModule"
+          class="org.apache.geronimo.st.v30.ui.propertyTesters.OSGiBundlePropertyTester">
+       </propertyTester>
     </extension>
    
     <!--
@@ -429,8 +436,13 @@
           enablesFor="1"
           class="org.apache.geronimo.st.v30.ui.actions.ChangeBundleStartLevelAction">
         </action>
-        <enablement>
-            <test property="org.apache.geronimo.st.v30.ui.isOSGiBundle" value="true"/>
+        <enablement>            
+            <and>
+                <test property="org.apache.geronimo.st.v30.ui.isOSGiBundle" value="true"/>
+                <!-- the args is one of the values in {STATE_UNKNOWN(0), STATE_STARTING(1),
STATE_STARTED(2), STATE_STOPPING(3), STATE_STOPPED(4),
+                NOTICE: only support value = "true" -->
+                <test property="org.apache.geronimo.st.v30.ui.serverState" args="2" value="true"/>
+            </and>
         </enablement>
       </objectContribution>	  
     </extension>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java?rev=1172496&r1=1172495&r2=1172496&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
Mon Sep 19 07:28:46 2011
@@ -53,7 +53,19 @@ public class OSGiBundlePropertyTester ex
                     }
                 }
             }
-        } 
+        } else if(target != null && "serverState".equals(properties)) {
+            if(args.length > 1 || args.length == 0 || !(target instanceof IServerModule))
return false;
+            try {
+                int state = (Integer) args[0];
+                if(state < 0 || state > 4) return false;
+                IServerModule ms = (IServerModule) target;
+                int realState = ms.getServer().getServerState();
+                
+                return realState == state; 
+            } catch(ClassCastException e) {
+                return false;
+            }
+        }
         return false;
     }
 }



Mime
View raw message