geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1161984 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui: ./ META-INF/ src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/
Date Fri, 26 Aug 2011 03:57:29 GMT
Author: hanhongfang
Date: Fri Aug 26 03:57:29 2011
New Revision: 1161984

URL: http://svn.apache.org/viewvc?rev=1161984&view=rev
Log:
show popup menu only on standalone OSGi bundle. GERONIMODEVTOOLS-764 Control the OSGI bundle's
start level in GEP

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/plugin.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/META-INF/MANIFEST.MF?rev=1161984&r1=1161983&r2=1161984&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/META-INF/MANIFEST.MF
Fri Aug 26 03:57:29 2011
@@ -35,6 +35,7 @@ Require-Bundle: 
  org.eclipse.wst.sse.ui,
  org.eclipse.wst.xml.ui,
  org.eclipse.core.variables,
- org.eclipse.pde.core
+ org.eclipse.pde.core,
+ org.eclipse.core.expressions
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: Apache Software Foundation

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=1161984&r1=1161983&r2=1161984&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
Fri Aug 26 03:57:29 2011
@@ -405,20 +405,34 @@
     <extension point="org.eclipse.ui.startup">
         <startup class="org.apache.geronimo.st.v30.ui.Startup"/>
     </extension>
+    
+    <extension point="org.eclipse.core.expressions.propertyTesters">
+       <propertyTester
+          id="org.apache.geronimo.st.v30.ui.propertyTester"
+          namespace="org.apache.geronimo.st.v30.ui"
+          properties="isOSGiBundle"
+          type="org.eclipse.wst.server.ui.IServerModule"
+          class="org.apache.geronimo.st.v30.ui.propertyTesters.OSGiBundlePropertyTester">
+       </propertyTester>
+    </extension>
+   
     <!--
         The pop up menu of changing the bundle's startup level
     -->
-	<extension point="org.eclipse.ui.popupMenus">
-	  <objectContribution
-	    id="org.apache.geronimo.st.v30.ui.change.osgi.bundle.startlevel"
-	    objectClass="org.eclipse.wst.server.ui.IServerModule">
-	    <action
-	      id="org.apache.geronimo.st.v30.ui.change.osgi.bundle.startlevel.action"
-	      label="%changeBundleStartLevel"
-	      enablesFor="1"
-	      class="org.apache.geronimo.st.v30.ui.actions.ChangeBundleStartLevelAction">
-	    </action>
-	  </objectContribution>
-	</extension>
-	    
+    <extension point="org.eclipse.ui.popupMenus">
+      <objectContribution
+        id="org.apache.geronimo.st.v30.ui.change.osgi.bundle.startlevel"
+        objectClass="org.eclipse.wst.server.ui.IServerModule">
+        <action
+          id="org.apache.geronimo.st.v30.ui.change.osgi.bundle.startlevel.action"
+          label="%changeBundleStartLevel"
+          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>
+      </objectContribution>	  
+    </extension>
+        
 </plugin>

Added: 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=1161984&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
Fri Aug 26 03:57:29 2011
@@ -0,0 +1,59 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @version $Rev$ $Date$
+ */
+package org.apache.geronimo.st.v30.ui.propertyTesters;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.ui.IServerModule;
+
+public class OSGiBundlePropertyTester extends PropertyTester{
+    
+    public OSGiBundlePropertyTester() {
+    }
+
+    @Override
+    public boolean test(Object target, String properties, Object[] args, Object value) {
       
+      
+        if (target != null && "isOSGiBundle".equals(properties)) {
+            if (target instanceof IServerModule) {
+                IServerModule ms = (IServerModule) target;
+                IModule[] modules =ms.getModule();
+                if (modules == null || modules.length == 0) {
+                    return false;
+                }
+                
+                if (modules.length == 1) {
+                    IModule m = modules[0];
+                    boolean isOSGiBundle = "osgi.bundle".equals(m.getModuleType().getId());
+                    if (value == null) {
+                        value = Boolean.TRUE;
+                    }
+                    if ((Boolean)value) {
+                        return isOSGiBundle;
+                    } else {
+                        return !isOSGiBundle;
+                    }
+                }
+            }
+        } 
+        return false;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/propertyTesters/OSGiBundlePropertyTester.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message