Author: yzhishko
Date: 2010-04-08 11:57:56 -0400 (Thu, 08 Apr 2010)
New Revision: 21354
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5803 - fixed.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java 2010-04-08
15:55:56 UTC (rev 21353)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java 2010-04-08
15:57:56 UTC (rev 21354)
@@ -12,6 +12,8 @@
import java.util.HashSet;
import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
@@ -103,22 +105,19 @@
.getPersistentProperty(IS_JSF_NATURES_CHECK_NEED));
isKBNaturesCheck = Boolean.parseBoolean(project
.getPersistentProperty(IS_KB_NATURES_CHECK_NEED));
- if (isJSFCheck) {
- String missingNature = checkMissingNatures(project);
- if (missingNature != null) {
- KbProject.checkKBBuilderInstalled(project);
- ProjectNaturesInfoDialog dialog = null;
- if (KbProject.NATURE_ID.equals(missingNature)
- && isKBNaturesCheck) {
- dialog = new KBNaturesInfoDialog(project);
- } else if (WebProject.JSF_NATURE_ID.equals(missingNature)
- && isJSFNaturesCheck) {
- dialog = new JSFNaturesInfoDialog(project);
- }
- if (dialog != null) {
- dialog.open();
- }
+ KbProject.checkKBBuilderInstalled(project);
+ String missingNature = checkMissingNatures(project);
+ if (missingNature != null) {
+ ProjectNaturesInfoDialog dialog = null;
+ if (KbProject.NATURE_ID.equals(missingNature) && isKBNaturesCheck) {
+ dialog = new KBNaturesInfoDialog(project);
+ } else if (WebProject.JSF_NATURE_ID.equals(missingNature)
+ && isJSFNaturesCheck && isJSFCheck) {
+ dialog = new JSFNaturesInfoDialog(project);
}
+ if (dialog != null) {
+ dialog.open();
+ }
}
}
@@ -129,7 +128,7 @@
if (project.getNature(WebProject.JSF_NATURE_ID) == null) {
return WebProject.JSF_NATURE_ID;
}
- if (project.getNature(IKbProject.NATURE_ID) == null) {
+ if (getKBProblemMarker(project) != null) {
return IKbProject.NATURE_ID;
}
return null;
@@ -233,4 +232,22 @@
}
}
+ private IMarker getKBProblemMarker(IProject project) {
+ IMarker kbProblemMarker = null;
+ try {
+ IMarker[] markers = project.findMarkers(null, false, 1);
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker = markers[i];
+ String _type = marker.getType();
+ if (_type != null
+ && _type.equals(KbProject.KB_PROBLEM_MARKER_TYPE)) {
+ kbProblemMarker = marker;
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ }
+ return kbProblemMarker;
+ }
+
}