Author: yzhishko
Date: 2010-01-29 08:31:36 -0500 (Fri, 29 Jan 2010)
New Revision: 20014
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesChecker.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5701 ,
https://jira.jboss.org/jira/browse/JBIDE-5761 fixed.
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java 2010-01-29
13:21:42 UTC (rev 20013)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java 2010-01-29
13:31:36 UTC (rev 20014)
@@ -15,7 +15,11 @@
private static final String FIRST_TEST_PAGE_NAME = "inputUserName.jsp";
//$NON-NLS-1$
private static final String TEST_SHELL_NAME = "Missing Natures";
//$NON-NLS-1$
- private static final String TEST_STRING = "The project
\"naturesCheckTest\" doesn't contain following
natures:\norg.jboss.tools.jst.web.kb.kbnature\norg.jboss.tools.jsf.jsfnature\n\nVisual
Editor may not work properly."; //$NON-NLS-1$
+ private static final String TEST_STRING = "JBoss Tools Visual Editor might not
fully work in project \"" //$NON-NLS-1$
+ + JsfAllTests.IMPORT_NATURES_CHECKER_PROJECT +
+ "\" because it does not have JSF and code completion enabled
completely.\n\n" + //$NON-NLS-1$
+ "Please use the Configure menu on the project to enable JSF if " +
//$NON-NLS-1$
+ "you want all features of the editor working."; //$NON-NLS-1$
private static final String SECOND_TEST_PAGE_NAME =
"components/commandButton.jsp"; //$NON-NLS-1$
public NaturesChecker_JBIDE5701(String name) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2010-01-29
13:21:42 UTC (rev 20013)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2010-01-29
13:31:36 UTC (rev 20014)
@@ -253,14 +253,6 @@
sourceEditor = textEditor;
// this.visualMode = visualMode;
this.multiPageEditor = multiPageEditor;
- naturesChecker = VpePlugin.getDefault().getProjectNaturesChecker();
- if (naturesChecker == null) {
- naturesChecker = new ProjectNaturesChecker();
- VpePlugin.getDefault().setProjectNaturesChecker(naturesChecker);
- }
- naturesChecker.addProject(
- (((IFileEditorInput) multiPageEditor.getEditorInput())
- .getFile().getProject()));
}
public IAction getAction(String actionID) {
@@ -1019,8 +1011,15 @@
public void partOpened(IWorkbenchPart part) {
if (part == multiPageEditor) {
try {
- naturesChecker.checkNatures(((IFileEditorInput)multiPageEditor.
- getEditorInput()).getFile().getProject());
+ IEditorInput editorInput = multiPageEditor.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ naturesChecker = VpePlugin.getDefault().getProjectNaturesChecker();
+ if (naturesChecker == null) {
+ naturesChecker = new ProjectNaturesChecker();
+ VpePlugin.getDefault().setProjectNaturesChecker(naturesChecker);
+ }
+ naturesChecker.checkNatures(((IFileEditorInput)editorInput).getFile().getProject());
+ }
} catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesChecker.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesChecker.java 2010-01-29
13:21:42 UTC (rev 20013)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesChecker.java 2010-01-29
13:31:36 UTC (rev 20014)
@@ -43,6 +43,8 @@
public static final QualifiedName IS_JSF_CHECK_NEED = new QualifiedName(
"", "Is JSF check"); //$NON-NLS-1$ //$NON-NLS-2$
private Set<IProject> projectsCollection;
+ private static final String JSF_NATURE = "JavaServer Faces Nature";
//$NON-NLS-1$
+ private static final String KB_NATURE = "Knowledge Base Nature";
//$NON-NLS-1$
public ProjectNaturesChecker() {
projectsCollection = new HashSet<IProject>(0);
@@ -62,6 +64,9 @@
}
public void checkNatures(IProject project) throws CoreException {
+ if (project == null) {
+ return;
+ }
addProject(project);
KbProject.checkKBBuilderInstalled(project);
boolean isJSFCheck = true;
@@ -86,10 +91,10 @@
private String[] getMissingNatures(IProject project) throws CoreException {
List<String> missimgNatures = new ArrayList<String>(0);
if (project.getNature(IKbProject.NATURE_ID) == null) {
- missimgNatures.add(IKbProject.NATURE_ID);
+ missimgNatures.add(JSF_NATURE);
}
if (project.getNature(WebProject.JSF_NATURE_ID) == null) {
- missimgNatures.add(WebProject.JSF_NATURE_ID);
+ missimgNatures.add(KB_NATURE);
}
if (missimgNatures.size() == 0) {
return null;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java 2010-01-29
13:21:42 UTC (rev 20013)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java 2010-01-29
13:31:36 UTC (rev 20014)
@@ -129,6 +129,7 @@
});
}
+ @SuppressWarnings("unused")
private String arrayToString(String[] strings){
StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
for (int i = 0; i < strings.length; i++) {
@@ -138,9 +139,10 @@
}
private String getMessageInfo(String[] missingNatures, IProject project){
- String dialogMessage = "The project \"" + project.getName() +
//$NON-NLS-1$
- "\" doesn't contain following natures:\n" + //$NON-NLS-1$
- arrayToString(missingNatures)+"\n"+"Visual Editor may not work
properly."; //$NON-NLS-1$ //$NON-NLS-2$
+ String dialogMessage = "JBoss Tools Visual Editor might not fully work in project
\"" + project.getName() + //$NON-NLS-1$
+ "\" because it does not have JSF and code completion enabled
completely.\n\n" + //$NON-NLS-1$
+ "Please use the Configure menu on the project to enable JSF if " +
//$NON-NLS-1$
+ "you want all features of the editor working."; //$NON-NLS-1$
return dialogMessage;
}