[jbosstools-commits] JBoss Tools SVN: r43720 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb: META-INF and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 14 18:43:09 EDT 2012


Author: dgolovin
Date: 2012-09-14 18:43:09 -0400 (Fri, 14 Sep 2012)
New Revision: 43720

Added:
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/JavaProjectPropertyTester.java
Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
Log:
https://issues.jboss.org/browse/JBIDE-12625 Knowledge-base content assist proposals list is shown even when there is no knowledge-base feature enabled for the project

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF	2012-09-14 20:50:49 UTC (rev 43719)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF	2012-09-14 22:43:09 UTC (rev 43720)
@@ -28,7 +28,8 @@
  org.jboss.tools.common.ui,
  org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
  org.eclipse.jst.j2ee;bundle-version="1.1.500",
- org.jboss.tools.common.validation
+ org.jboss.tools.common.validation,
+ org.eclipse.core.expressions;bundle-version="3.4.400"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Vendor: %providerName

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml	2012-09-14 20:50:49 UTC (rev 43719)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml	2012-09-14 22:43:09 UTC (rev 43720)
@@ -220,7 +220,16 @@
    <extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
    		id="kb_el_proposals"
 			name="KB EL Proposals">
-	   	<proposalCategory icon="$nl$/icons/ca/el.png"/>
+	   	<proposalCategory
+           icon="$nl$/icons/ca/el.png">
+        <enablement>
+           <test
+                 forcePluginActivation="false"
+                 property="org.eclipse.core.resources.projectNature"
+                 value="org.jboss.tools.jst.web.kb.kbnature">
+           </test>
+        </enablement>
+     </proposalCategory>
  	</extension>
 
 	<extension point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
@@ -333,5 +342,15 @@
            nature="org.eclipse.jdt.core.javanature">
      </queryParticipant>
   </extension>
+ <extension
+       point="org.eclipse.core.expressions.propertyTesters">
+    <propertyTester
+          class="org.jboss.tools.jst.web.kb.JavaProjectPropertyTester"
+          id="org.jboss.tools.jst.web.kb.propertyTester2"
+          namespace="org.eclipse.core.resources"
+          properties="projectNature"
+          type="org.eclipse.jdt.core.IJavaProject">
+    </propertyTester>
+ </extension>
  
 </plugin>

Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/JavaProjectPropertyTester.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/JavaProjectPropertyTester.java	                        (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/JavaProjectPropertyTester.java	2012-09-14 22:43:09 UTC (rev 43720)
@@ -0,0 +1,38 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+
+public class JavaProjectPropertyTester extends PropertyTester {
+
+	public JavaProjectPropertyTester() {
+	}
+
+	@Override
+	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+		IJavaProject prj = (IJavaProject)receiver;
+		boolean result = false;
+		IProject eclproj = prj.getProject();
+		try {
+			if(eclproj.isAccessible()) {
+				result = eclproj.hasNature(expectedValue.toString());
+			}
+		} catch (CoreException e) {
+			WebKbPlugin.getDefault().logError(e);
+		}
+		return result;
+	}
+
+}


Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/JavaProjectPropertyTester.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list