Author: scabanovich
Date: 2011-08-02 20:11:53 -0400 (Tue, 02 Aug 2011)
New Revision: 33476
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilderMarker.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/UsedJavaProjectCheck.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/EnableKBOnProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/KBProblemMarkerResolutionGenerator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBSettingsPreferencePage.java
Log:
JBIDE-9120
https://issues.jboss.org/browse/JBIDE-9120
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-08-02 23:41:16 UTC (rev
33475)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-08-03 00:11:53 UTC (rev
33476)
@@ -241,6 +241,9 @@
</super>
<persistent value="true">
</persistent>
+ <attribute
+ name="kind">
+ </attribute>
</extension>
<extension
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -34,6 +34,11 @@
public static String KBPROBLEM;
public static String KBPROBLEM_LOCATION;
public static String ENABLE_KB;
+ public static String KBPROBLEM_DEPENDS_ON_JAVA_SINGLE;
+ public static String KBPROBLEM_DEPENDS_ON_JAVA_MANY;
+ public static String ENABLE_KB_ON_SINGLE;
+ public static String ENABLE_KB_ON_MANY;
+
public static String ILLEGAL_CONTENTTYPE;
public static String EXCEPTION_DURING_CREATING_MARKER;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties 2011-08-03
00:11:53 UTC (rev 33476)
@@ -12,6 +12,11 @@
KBPROBLEM_LOCATION=Project: {0}
ENABLE_KB=Enable JSF CA and validation on this project
+KBPROBLEM_DEPENDS_ON_JAVA_SINGLE= JBoss Tools Knowledge Base problem: Nature is not
installed on required Java project {0}. Use Quick Fix to include artifacts declared in
that project into Content Assistant and Validation.
+KBPROBLEM_DEPENDS_ON_JAVA_MANY= JBoss Tools Knowledge Base problem: Nature is not
installed on required Java projects {0}. Use Quick Fix to include artifacts declared in
these projects into Content Assistant and Validation.
+ENABLE_KB_ON_SINGLE=Enable Knowledge Base capabilities on project {0}
+ENABLE_KB_ON_MANY=Enable Knowledge Base capabilities on projects {0}
+
ILLEGAL_CONTENTTYPE=Unknown contentType argument value: {0}
EXCEPTION_DURING_CREATING_MARKER=Exception occurred during creating marker for validation
error on ''{0}''
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/EnableKBOnProject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/EnableKBOnProject.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/EnableKBOnProject.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -10,16 +10,17 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.action;
+import java.util.List;
+
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ui.IMarkerResolution;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.kb.IKbProject;
-import org.jboss.tools.jst.web.kb.KbMessages;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.jboss.tools.jst.web.kb.internal.KbBuilderMarker;
+import org.jboss.tools.jst.web.kb.internal.scanner.UsedJavaProjectCheck;
/**
* The Marker Resolution that enables the KB Nature on the project
@@ -27,12 +28,17 @@
* @author Victor Rubezhny
*
*/
-public class EnableKBOnProject implements IMarkerResolution{
+public class EnableKBOnProject implements IMarkerResolution {
+ String label;
public String getLabel() {
- return KbMessages.ENABLE_KB;
+ return label;
}
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
public void run(IMarker marker) {
IResource resource = marker.getResource();
IProject project = resource instanceof IProject ? (IProject)resource :
@@ -42,9 +48,15 @@
return;
try {
- EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
+ WebKbPlugin.enableKB(project, new NullProgressMonitor());
+
+ List<IProject> ps = new UsedJavaProjectCheck().getNonKbJavaProjects(project);
+ for (IProject p: ps) {
+ WebKbPlugin.enableKB(p, new NullProgressMonitor());
+ p.deleteMarkers(KbBuilderMarker.KB_BUILDER_PROBLEM_MARKER_TYPE, true,
IResource.DEPTH_ONE);
+ }
// Find existing KBNATURE problem marker and kill it if exists
- project.deleteMarkers(KbProject.KB_BUILDER_PROBLEM_MARKER_TYPE, true,
IResource.DEPTH_ONE);
+ project.deleteMarkers(KbBuilderMarker.KB_BUILDER_PROBLEM_MARKER_TYPE, true,
IResource.DEPTH_ONE);
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/KBProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/KBProblemMarkerResolutionGenerator.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/action/KBProblemMarkerResolutionGenerator.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -10,9 +10,18 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.action;
+import java.util.List;
+
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.jboss.tools.jst.web.kb.KbMessages;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.internal.KbBuilderMarker;
+import org.jboss.tools.jst.web.kb.internal.scanner.UsedJavaProjectCheck;
/**
* Shows the Marker Resolutions for KB Problem Marker
@@ -22,8 +31,30 @@
*/
public class KBProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
public IMarkerResolution[] getResolutions(IMarker marker) {
+ try {
+ if(!KbBuilderMarker.KB_BUILDER_PROBLEM_MARKER_TYPE.equals(marker.getType())) {
+ return new IMarkerResolution[0];
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ EnableKBOnProject resolution = new EnableKBOnProject();
+ if(marker.getAttribute(KbBuilderMarker.ATTR_KIND, 1) ==
KbBuilderMarker.KIND_DEPENDS_ON_NON_KB_POJECTS) {
+ try {
+ UsedJavaProjectCheck check = new UsedJavaProjectCheck();
+ List<IProject> list =
check.getNonKbJavaProjects(marker.getResource().getProject());
+ String messageId = list.size() == 1 ? KbMessages.ENABLE_KB_ON_SINGLE :
KbMessages.ENABLE_KB_ON_MANY;
+ String projectList = check.asText(list);
+ String label = NLS.bind(messageId, projectList);
+ resolution.setLabel(label);
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ } else {
+ resolution.setLabel(KbMessages.ENABLE_KB);
+ }
return new IMarkerResolution[] {
- new EnableKBOnProject()
+ resolution
};
}
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilder.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -29,6 +29,7 @@
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.internal.scanner.IFileScanner;
import org.jboss.tools.jst.web.kb.internal.scanner.LibraryScanner;
+import org.jboss.tools.jst.web.kb.internal.scanner.UsedJavaProjectCheck;
import org.jboss.tools.jst.web.kb.internal.scanner.XMLScanner;
import org.osgi.framework.Bundle;
@@ -101,6 +102,7 @@
} else if(sp.getClassPath().hasToUpdateProjectDependencies()) {
sp.getClassPath().validateProjectDependencies();
}
+ new UsedJavaProjectCheck().check(sp);
TypeInfoCollector.cleanCache();
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilderMarker.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilderMarker.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilderMarker.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -0,0 +1,66 @@
+package org.jboss.tools.jst.web.kb.internal;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.jst.web.kb.KbMessages;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+
+public class KbBuilderMarker {
+
+ public static final String KB_BUILDER_PROBLEM_MARKER_TYPE =
"org.jboss.tools.jst.web.kb.kbBuilderProblemMarker"; //$NON-NLS-1$
+
+ //Default for backward compatibility.
+ public static final int KIND_KB_NATURE_OR_BUILDER_MISSING = 1;
+
+ public static final int KIND_DEPENDS_ON_NON_KB_POJECTS = 2;
+
+ public static final String ATTR_KIND = "kind"; //$NON-NLS-1$
+
+ public static IMarker[] getOwnedMarkers(IResource r, int kind) {
+ ArrayList<IMarker> l = null;
+ try {
+ if(r != null && r.isAccessible()) {
+ IMarker[] ms = r.findMarkers(null, false, 1);
+ for (IMarker m: ms) {
+ if(KB_BUILDER_PROBLEM_MARKER_TYPE.equals(m.getType())
+ && m.isSubtypeOf(IMarker.PROBLEM)
+ && (kind == m.getAttribute(ATTR_KIND, 1))) {
+ if(l == null) {
+ l = new ArrayList<IMarker>();
+ }
+ l.add(m);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return (l == null) ? null : l.toArray(new IMarker[0]);
+ }
+
+ public static IMarker createOrUpdateKbProblemMarker(IMarker m, IResource r, String
message, int kind) throws CoreException {
+ String location = MessageFormat.format(KbMessages.KBPROBLEM_LOCATION, new Object[]
{r.getProject().getName()});
+
+ if (m == null) {
+ m = r.createMarker(KB_BUILDER_PROBLEM_MARKER_TYPE);
+ m.setAttribute(KbBuilderMarker.ATTR_KIND,
KbBuilderMarker.KIND_KB_NATURE_OR_BUILDER_MISSING);
+ if(kind == KIND_KB_NATURE_OR_BUILDER_MISSING) {
+ r.setPersistentProperty(KbProjectFactory.NATURE_MOCK, "true");
//$NON-NLS-1$
+ KbProjectFactory.getKbProject(r.getProject(), true);
+ }
+ }
+
+ m.setAttribute(ATTR_KIND, kind);
+ m.setAttribute(IMarker.LOCATION, location);
+ m.setAttribute(IMarker.MESSAGE, message);
+ m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
+ m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
+ return m;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbBuilderMarker.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -128,6 +128,9 @@
*/
public void configure() throws CoreException {
addToBuildSpec(KbBuilder.BUILDER_ID);
+ if(project.getPersistentProperty(KbProjectFactory.NATURE_MOCK) != null) {
+ project.setPersistentProperty(KbProjectFactory.NATURE_MOCK, null);
+ }
}
/*
@@ -973,11 +976,12 @@
if (kbNatureFound && kbBuilderFound) {
// Find existing KBNATURE problem marker and kill it if exists
- IMarker[] markers = getOwnedMarkers(project);
+ IMarker[] markers = KbBuilderMarker.getOwnedMarkers(project,
KbBuilderMarker.KIND_KB_NATURE_OR_BUILDER_MISSING);
if (markers != null && markers.length > 0) {
try {
- project.deleteMarkers(KB_BUILDER_PROBLEM_MARKER_TYPE, true, IResource.DEPTH_ONE);
- project.setPersistentProperty(KbProjectFactory.NATURE_MOCK, null);
+ for (IMarker m: markers) {
+ m.delete();
+ }
} catch (CoreException ex) {
WebKbPlugin.getDefault().logError(ex);
}
@@ -986,7 +990,7 @@
}
// Find existing KBNATURE problem marker and install it if doesn't exist
- IMarker[] markers = getOwnedMarkers(project);
+ IMarker[] markers = KbBuilderMarker.getOwnedMarkers(project,
KbBuilderMarker.KIND_KB_NATURE_OR_BUILDER_MISSING);
if (markers == null || markers.length == 0) {
try {
@@ -1006,35 +1010,6 @@
return false;
}
- public static final String KB_BUILDER_PROBLEM_MARKER_TYPE =
"org.jboss.tools.jst.web.kb.kbBuilderProblemMarker"; //$NON-NLS-1$
-
- private static IMarker[] getOwnedMarkers(IResource r) {
- ArrayList<IMarker> l = null;
- try {
- if(r!=null && r.isAccessible()) {
- IMarker[] ms = r.findMarkers(null, false, 1);
- if(ms != null) {
- for (int i = 0; i < ms.length; i++) {
- if(ms[i] == null) continue;
-
- String _type = ms[i].getType();
- if(_type == null) continue;
- if(!_type.equals(KB_BUILDER_PROBLEM_MARKER_TYPE)) continue;
- if(!ms[i].isSubtypeOf(IMarker.PROBLEM)) continue;
-
- if(l == null)
- l = new ArrayList<IMarker>();
-
- l.add(ms[i]);
- }
- }
- }
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- return (l == null) ? null : l.toArray(new IMarker[0]);
- }
-
private static IMarker createOrUpdateKbProblemMarker(IMarker m, IResource r, boolean
kbNatureIsAbsent, boolean kbBuilderIsAbsent, String natures) throws CoreException {
ArrayList<String> args = new ArrayList<String>();
@@ -1051,19 +1026,7 @@
args.add(natures);
String message = MessageFormat.format(KbMessages.KBPROBLEM, args.toArray());
- String location = MessageFormat.format(KbMessages.KBPROBLEM_LOCATION, new Object[]
{r.getProject().getName()});
-
- if (m == null) {
- m = r.createMarker(KB_BUILDER_PROBLEM_MARKER_TYPE);
- r.setPersistentProperty(KbProjectFactory.NATURE_MOCK, "true");
//$NON-NLS-1$
- KbProjectFactory.getKbProject(r.getProject(), true);
- }
-
- m.setAttribute(IMarker.LOCATION, location);
- m.setAttribute(IMarker.MESSAGE, message);
- m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
- m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
- return m;
+ return KbBuilderMarker.createOrUpdateKbProblemMarker(m, r, message,
KbBuilderMarker.KIND_KB_NATURE_OR_BUILDER_MISSING);
}
PathCheck pathCheck = new PathCheck();
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/UsedJavaProjectCheck.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/UsedJavaProjectCheck.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/UsedJavaProjectCheck.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -0,0 +1,80 @@
+package org.jboss.tools.jst.web.kb.internal.scanner;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbMessages;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.KbBuilderMarker;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+
+public class UsedJavaProjectCheck {
+
+ public void check(KbProject project) throws CoreException {
+ if(!project.getProject().isAccessible()) {
+ return;
+ }
+ List<IProject> list = getNonKbJavaProjects(project.getProject());
+
+ IMarker[] ms = KbBuilderMarker.getOwnedMarkers(project.getProject(),
KbBuilderMarker.KIND_DEPENDS_ON_NON_KB_POJECTS);
+ if(list.isEmpty()) {
+ if(ms != null) {
+ for (IMarker m: ms) {
+ m.delete();
+ }
+ }
+ } else {
+ IMarker m = (ms == null) ? null : ms[0];
+ String projectList = asText(list);
+ String messageId = list.size() == 1 ? KbMessages.KBPROBLEM_DEPENDS_ON_JAVA_SINGLE :
KbMessages.KBPROBLEM_DEPENDS_ON_JAVA_MANY;
+ String message = MessageFormat.format(messageId, projectList);
+ m = KbBuilderMarker.createOrUpdateKbProblemMarker(m, project.getProject(), message,
KbBuilderMarker.KIND_DEPENDS_ON_NON_KB_POJECTS);
+ }
+ }
+
+ public String asText(List<IProject> list) {
+ StringBuffer projectList = new StringBuffer();
+ for (IProject p: list) {
+ if(projectList.length() > 0) {
+ projectList.append(", "); //$NON-NLS-1$
+ }
+ projectList.append(p.getName());
+ }
+ return projectList.toString();
+ }
+
+ public List<IProject> getNonKbJavaProjects(IProject project) throws CoreException
{
+ List<IProject> list = new ArrayList<IProject>();
+ if(!project.hasNature(IKbProject.NATURE_ID)) {
+ //do not check dependencies in projects without kb nature.
+ return list;
+ }
+ if(project.isAccessible() && project.hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+ for (int i = 0; i < es.length; i++) {
+ if(es[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ IProject p =
ResourcesPlugin.getWorkspace().getRoot().getProject(es[i].getPath().lastSegment());
+ if(p != null && p.isAccessible()
+ && p.hasNature(JavaCore.NATURE_ID)
+ && !p.hasNature(IKbProject.NATURE_ID)) {
+ list.add(p);
+ }
+ }
+ }
+
+ }
+ return list;
+ }
+
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/UsedJavaProjectCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -460,18 +460,19 @@
* @see
org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
*/
public boolean shouldValidate(IProject project) {
+ boolean result = false;
try {
if(validateBuilderOrder(project) && isEnabled(project)) {
for (IELValidationDelegate delegate : DELEGATES) {
if(delegate.shouldValidate(project)) {
- return true;
+ result = true;
}
}
}
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
}
- return false;
+ return result;
}
private boolean validateBuilderOrder(IProject project) throws CoreException {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBSettingsPreferencePage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBSettingsPreferencePage.java 2011-08-02
23:41:16 UTC (rev 33475)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/KBSettingsPreferencePage.java 2011-08-03
00:11:53 UTC (rev 33476)
@@ -14,6 +14,7 @@
import java.beans.PropertyChangeListener;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swt.SWT;
@@ -24,6 +25,7 @@
import org.jboss.tools.common.ui.preferences.SettingsPage;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.KbMessages;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
@@ -129,7 +131,12 @@
}
private boolean isKBEnabled(IProject project) {
- return KbProjectFactory.getKbProject(project, false) != null;
+ try {
+ return(project.isAccessible() && project.hasNature(IKbProject.NATURE_ID));
+ } catch (CoreException e) {
+ //ignore - all checks are done above
+ return false;
+ }
}
private boolean isKBEnabled() {