Author: yzhishko
Date: 2010-01-28 09:19:10 -0500 (Thu, 28 Jan 2010)
New Revision: 19986
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.project
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/.jsdtscope
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.jdt.core.prefs
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.component
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/User.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/User.class
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-api.jar
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-impl.jar
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/web.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/index.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/hello.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/inputUserName.jsp
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/util/ProjectNaturesChecker.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.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/FileUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5701 - fixed
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.classpath
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.classpath
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.classpath 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="JavaSource"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache
Tomcat v6.0">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.web"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_16">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output"
path="WebContent/WEB-INF/classes"/>
+</classpath>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.project
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.project 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>naturesCheckTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.common.verification.verifybuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/.jsdtscope
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/.jsdtscope
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/.jsdtscope 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.jdt.core.prefs 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,7 @@
+#Wed Jan 27 20:01:47 EET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.component 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="naturesCheckProject">
+<wb-resource deploy-path="/" source-path="/WebContent"/>
+<wb-resource deploy-path="/WEB-INF/classes"
source-path="/JavaSource"/>
+<property name="context-root" value="naturesCheckProject"/>
+<property name="java-output-path"/>
+</wb-module>
+</project-modules>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.common.project.facet.core.xml 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="Apache Tomcat v6.0"/>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.web"/>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.web" version="2.5"/>
+</faceted-project>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.container 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/.settings/org.eclipse.wst.jsdt.ui.superType.name 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/Messages.properties
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/Messages.properties
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/Messages.properties 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/User.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/User.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/JavaSource/demo/User.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package demo;
+
+/**
+ * Created by JBoss Developer Studio
+ */
+public class User {
+
+ private String name;
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/META-INF/MANIFEST.MF
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/META-INF/MANIFEST.MF 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/Messages.properties
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/Messages.properties
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/Messages.properties 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/User.class
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/classes/demo/User.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/faces-config.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/faces-config.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/faces-config.xml 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <description>User Name Bean</description>
+ <managed-bean-name>user</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputUserName.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>hello</from-outcome>
+ <to-view-id>/pages/hello.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <locale-config/>
+ </application>
+ <factory/>
+ <lifecycle/>
+</faces-config>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-api.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-impl.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/lib/jsf-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/web.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/web.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/WEB-INF/web.xml 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>naturesCheckProject</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/index.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/index.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/index.jsp 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+ <body>
+ <jsp:forward page="/pages/inputUserName.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/hello.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/hello.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/hello.jsp 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,20 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+<f:loadBundle var="Message" basename="demo.Messages" />
+
+<html>
+ <head>
+ <title>Hello!</title>
+ </head>
+
+ <body>
+ <f:view>
+ <h3>
+ <h:outputText value="#{Message.hello_message}" />,
+ <h:outputText value="#{user.name}" />!
+ </h3>
+ </f:view>
+ </body>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/inputUserName.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/inputUserName.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/WebContent/pages/inputUserName.jsp 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,28 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+<f:loadBundle var="Message" basename="demo.Messages"/>
+
+<html>
+ <head>
+ <title>Input User Name Page</title>
+ </head>
+ <body>
+
+ <f:view>
+ <h1><h:outputText value="#{Message.header}"/></h1>
+
+ <h:messages style="color: red"/>
+
+ <h:form id="greetingForm">
+ <h:outputText value="#{Message.prompt_message}"/>
+ <h:inputText value="#{user.name}" required="true">
+ <f:validateLength maximum="30" minimum="3"/>
+ </h:inputText>
+
+ <h:commandButton action="hello" value="Say Hello!" />
+
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-01-28
13:59:24 UTC (rev 19985)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -68,6 +68,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4510Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4534Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.MessageResolutionInPreviewTabTest;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.NaturesChecker_JBIDE5701;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnInJarPackageFragment_JBIDE5682;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnJsf20Test_JBIDE5382;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnTLDPackedInJar_JBIDE5693;
@@ -110,6 +111,7 @@
public static final String IMPORT_CUSTOM_FACELETS_PROJECT =
"customFaceletsTestProject";//$NON-NLS-1$
public static final String IMPORT_JBIDE3247_PROJECT_NAME = "JBIDE3247";
//$NON-NLS-1$
public static final String IMPORT_I18N_PROJECT_NAME = "i18nTest";
//$NON-NLS-1$
+ public static final String IMPORT_NATURES_CHECKER_PROJECT =
"naturesCheckTest"; //$NON-NLS-1$
public static Test suite() {
@@ -196,6 +198,7 @@
suite.addTestSuite(MessageResolutionInPreviewTabTest.class);
suite.addTestSuite(OpenOnTLDPackedInJar_JBIDE5693.class);
suite.addTestSuite(PreferencesForEditors_JBIDE5692.class);
+ suite.addTestSuite(NaturesChecker_JBIDE5701.class);
// $JUnit-END$
// added by Max Areshkau
@@ -226,6 +229,11 @@
i18nTestProject.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
projectToImport.add(i18nTestProject);
+ ImportBean naturesCheckTestProject = new ImportBean();
+ naturesCheckTestProject.setImportProjectName(JsfAllTests.IMPORT_NATURES_CHECKER_PROJECT);
+ naturesCheckTestProject.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
+ projectToImport.add(naturesCheckTestProject);
+
return new VpeTestSetup(suite, projectToImport);
}
}
Added:
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
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,124 @@
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+public class NaturesChecker_JBIDE5701 extends VpeTest {
+
+ 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 SECOND_TEST_PAGE_NAME =
"components/commandButton.jsp"; //$NON-NLS-1$
+
+ public NaturesChecker_JBIDE5701(String name) {
+ super(name);
+ }
+
+ public void testNaturesChecker() throws Throwable {
+
+ ResultObject resultObject = startCheckerThread();
+
+ openPage(JsfAllTests.IMPORT_NATURES_CHECKER_PROJECT, FIRST_TEST_PAGE_NAME);
+
+ assertEquals(TEST_SHELL_NAME, resultObject.getShellName());
+ assertEquals(TEST_STRING, resultObject.getTextLabel());
+
+ resultObject = startCheckerThread();
+
+ openPage(JsfAllTests.IMPORT_PROJECT_NAME, SECOND_TEST_PAGE_NAME);
+
+ assertEquals("", resultObject.getShellName()); //$NON-NLS-1$
+ assertEquals("", resultObject.getTextLabel()); //$NON-NLS-1$
+
+ }
+
+ private class ResultObject {
+ private String shellName = ""; //$NON-NLS-1$
+ private String textLabel = ""; //$NON-NLS-1$
+
+ public String getShellName() {
+ return shellName;
+ }
+
+ public void setShellName(String shellName) {
+ this.shellName = shellName;
+ }
+
+ public String getTextLabel() {
+ return textLabel;
+ }
+
+ public void setTextLabel(String textLabel) {
+ this.textLabel = textLabel;
+ }
+
+ }
+
+ private ResultObject startCheckerThread() {
+ final ResultObject resultObject = new ResultObject();
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell[] shells = null;
+ while (shells == null) {
+ shells = Display.getCurrent().getShells();
+ }
+ Shell shell = findShellWithText(shells, TEST_SHELL_NAME);
+ if (shell == null) {
+ TestUtil.delay(5000);
+ shells = Display.getCurrent().getShells();
+ shell = findShellWithText(shells, TEST_SHELL_NAME);
+ }
+ if (shell != null) {
+ resultObject.setShellName(TEST_SHELL_NAME);
+ Label label = (Label)shell.getChildren()[1];
+ resultObject.setTextLabel(label.getText());
+ shell.close();
+ }
+ }
+ });
+ }
+ });
+ thread.start();
+ return resultObject;
+ }
+
+ private static Shell findShellWithText (Shell[] shells, String text){
+ for (int i = 0; i < shells.length; i++) {
+ if (text.equals(shells[i].getText())) {
+ return shells[i];
+ }
+ }
+ return null;
+ }
+
+ private void openPage(String projectName, String pagePath) throws Throwable{
+ IFile file = (IFile) TestUtil.getComponentPath(pagePath, projectName);
+
+ assertNotNull("Could not open specified file. componentPage = "
//$NON-NLS-1$
+ + pagePath
+ + ";projectName = " + projectName, file);//$NON-NLS-1$
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
+ // open and get editor
+
+ JSPMultiPageEditor part = openEditor(input);
+
+ assertNotNull("Editor is not opened", part); //$NON-NLS-1$
+
+ TestUtil.delay(3000);
+
+ }
+
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2010-01-28
13:59:24 UTC (rev 19985)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -19,6 +19,7 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.vpe.editor.util.ProjectNaturesChecker;
import org.jboss.tools.vpe.xulrunner.browser.XulRunnerBrowser;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -34,7 +35,7 @@
//The shared instance.
private static VpePlugin plugin;
-
+ private ProjectNaturesChecker projectNaturesChecker;
/**
* The constructor.
@@ -55,6 +56,10 @@
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
+ if (projectNaturesChecker != null) {
+ projectNaturesChecker.dispose();
+ projectNaturesChecker = null;
+ }
super.stop(context);
}
@@ -116,4 +121,12 @@
}
return (url == null) ? null : url.getPath();
}
+
+ public ProjectNaturesChecker getProjectNaturesChecker() {
+ return projectNaturesChecker;
+ }
+
+ public void setProjectNaturesChecker(ProjectNaturesChecker naturesChecker) {
+ this.projectNaturesChecker = naturesChecker;
+ }
}
\ No newline at end of file
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-28
13:59:24 UTC (rev 19985)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -15,10 +15,8 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.text.IRegion;
@@ -29,8 +27,6 @@
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Point;
@@ -40,7 +36,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.IEditorInput;
@@ -84,15 +79,14 @@
import org.jboss.tools.vpe.editor.mozilla.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
+import org.jboss.tools.vpe.editor.util.ProjectNaturesChecker;
import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.vpe.editor.xpl.EditorSettings;
import org.jboss.tools.vpe.editor.xpl.SashSetting;
import org.jboss.tools.vpe.editor.xpl.CustomSashForm.ICustomSashFormListener;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.selbar.SelectionBar;
-import org.jboss.tools.vpe.selbar.VisibilityEvent;
-import org.jboss.tools.vpe.selbar.VisibilityListener;
+@SuppressWarnings("restriction")
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
private IContextActivation fContextActivation;
@@ -112,12 +106,6 @@
private ActivationListener activationListener = new ActivationListener();
private int visualMode = 0;
private EditorPart multiPageEditor;
- private static final QualifiedName SPLITTER_POSITION_KEY1 = new QualifiedName(
- "", "splitter_position1"); //$NON-NLS-1$ //$NON-NLS-2$
- private static final QualifiedName SPLITTER_POSITION_KEY2 = new QualifiedName(
- "", "splitter_position2"); //$NON-NLS-1$ //$NON-NLS-2$
- private static final QualifiedName SPLITTER_POSITION_KEY3 = new QualifiedName(
- "", "splitter_position3"); //$NON-NLS-1$ //$NON-NLS-2$
private int controlCount = 0;
@@ -133,6 +121,7 @@
private Splitter verticalToolbarSplitter = null;
private Composite verticalToolbarEmpty = null;
private ToolBar toolBar = null;
+ private ProjectNaturesChecker naturesChecker;
public StructuredTextEditor getSourceEditor() {
return sourceEditor;
@@ -264,6 +253,14 @@
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) {
@@ -1020,6 +1017,14 @@
}
public void partOpened(IWorkbenchPart part) {
+ if (part == multiPageEditor) {
+ try {
+ naturesChecker.checkNatures(((IFileEditorInput)multiPageEditor.
+ getEditorInput()).getFile().getProject());
+ } catch (CoreException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
}
@Override
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2010-01-28
13:59:24 UTC (rev 19985)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -16,6 +16,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import java.util.zip.ZipEntry;
import org.eclipse.core.resources.IContainer;
@@ -25,11 +28,21 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
@@ -312,5 +325,43 @@
}
return inputPath;
}
+
+ public static IJavaElement searchForClass(IJavaProject javaProject, String className)
throws JavaModelException {
+// Get the search pattern
+ SearchPattern pattern = SearchPattern.createPattern(className,
IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE);
+ // Get the search scope
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {
javaProject });
+ final List<SearchMatch> matches = new ArrayList<SearchMatch>();
+ // Get the search requestor
+ SearchRequestor requestor = new SearchRequestor() {
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ matches.add(match);
+ }
+ };
+
+ // Search
+ SearchEngine searchEngine = new SearchEngine();
+ try {
+ searchEngine.search(pattern, new SearchParticipant[]
{SearchEngine.getDefaultSearchParticipant()}, scope, requestor, null);
+ } catch (CoreException ex) {
+ // Ignore
+// ExtensionsPlugin.log(ex);
+ }
+ for (Iterator i = matches.iterator(); i != null && i.hasNext();) {
+ IJavaElement element = (IJavaElement)((SearchMatch)i.next()).getElement();
+ String classQualifiedName = getQualifiedClassName(element);
+ if (className.equals(classQualifiedName))
+ return element;
+ }
+ return javaProject.findType(className, new NullProgressMonitor());
+ }
+
+ private static String getQualifiedClassName(IJavaElement element) {
+ if(element instanceof IType) {
+ return ((IType)element).getFullyQualifiedName('.');
+ }
+ return null;
+ }
+
}
Added:
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
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesChecker.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.util;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.jboss.tools.jst.web.project.WebProject;
+import org.jboss.tools.vpe.VpePlugin;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class ProjectNaturesChecker implements IResourceChangeListener {
+
+ private static final String SEARCH_CLASS = "javax.faces.context.FacesContext";
//$NON-NLS-1$
+ public static final QualifiedName IS_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is natures check"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final QualifiedName IS_JSF_CHECK_NEED = new QualifiedName(
+ "", "Is JSF check"); //$NON-NLS-1$ //$NON-NLS-2$
+ private Set<IProject> projectsCollection;
+
+ public ProjectNaturesChecker() {
+ projectsCollection = new HashSet<IProject>(0);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ public void resourceChanged(final IResourceChangeEvent event) {
+ Display display = Display.getDefault();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ handleResourceChangeEvent(event);
+ }
+ });
+ }
+ }
+
+ public void checkNatures(IProject project) throws CoreException {
+ addProject(project);
+ KbProject.checkKBBuilderInstalled(project);
+ boolean isJSFCheck = true;
+ boolean isNaturesCheck = true;
+ updateProjectPersistentProperties(project);
+ isJSFCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_JSF_CHECK_NEED));
+ isNaturesCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_NATURES_CHECK_NEED));
+ if (isJSFCheck) {
+ if (isNaturesCheck) {
+ String[] missingNatures = getMissingNatures(project);
+ if (missingNatures != null) {
+ ProjectNaturesInfoDialog dialog = new ProjectNaturesInfoDialog(
+ missingNatures, project);
+ dialog.open();
+ }
+ }
+ }
+ }
+
+ 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);
+ }
+ if (project.getNature(WebProject.JSF_NATURE_ID) == null) {
+ missimgNatures.add(WebProject.JSF_NATURE_ID);
+ }
+ if (missimgNatures.size() == 0) {
+ return null;
+ }
+ return missimgNatures.toArray(new String[0]);
+ }
+
+ private void handleResourceChangeEvent(IResourceChangeEvent changeEvent) {
+ IResourceDelta[] affectedChildren = changeEvent.getDelta()
+ .getAffectedChildren();
+ if (affectedChildren == null) {
+ return;
+ }
+ for (int i = 0; i < affectedChildren.length; i++) {
+ IResourceDelta resourceDelta = affectedChildren[i];
+ if (resourceDelta.getResource() instanceof IProject) {
+ IProject project = (IProject) resourceDelta.getResource();
+ if (resourceDelta.getKind() == IResourceDelta.ADDED) {
+ processAddProject(project);
+ continue;
+ }
+ if (resourceDelta.getKind() == IResourceDelta.REMOVED) {
+ processRemoveProject(project);
+ continue;
+ }
+ try {
+ updateProjectJSFPersistents(project);
+ } catch (CoreException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
+
+ private void updateProjectPersistentProperties(IProject project)
+ throws CoreException {
+ if (project.isAccessible()) {
+ String jsfCheckString = project
+ .getPersistentProperty(IS_JSF_CHECK_NEED);
+ if (jsfCheckString == null) {
+ updateProjectJSFPersistents(project);
+ }
+ if (project.getPersistentProperty(IS_NATURES_CHECK_NEED) == null) {
+ project.setPersistentProperty(IS_NATURES_CHECK_NEED, "true");
//$NON-NLS-1$
+ }
+ }
+ }
+
+ public IProject getProject(IProject project) {
+ return projectsCollection.contains(project) ? project : null;
+ }
+
+ public void addProject(IProject project) {
+ if (getProject(project) == null) {
+ projectsCollection.add(project);
+ }
+ }
+
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ projectsCollection.clear();
+ }
+
+ private void processAddProject(IProject project) {
+ addProject(project);
+ try {
+ updateProjectJSFPersistents(project);
+ } catch (CoreException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ private void processRemoveProject(IProject project) {
+ projectsCollection.remove(project);
+ }
+
+ private void updateProjectJSFPersistents(IProject project)
+ throws CoreException {
+ if (project.isAccessible()) {
+ try {
+ IJavaElement javaElement = FileUtil.searchForClass(JavaCore
+ .create(project), SEARCH_CLASS);
+ if (javaElement == null) {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "false"); //$NON-NLS-1$
+ } else {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "true"); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "false"); //$NON-NLS-1$
+ }
+ }
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ProjectNaturesInfoDialog.java 2010-01-28
14:19:10 UTC (rev 19986)
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.util;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class ProjectNaturesInfoDialog extends MessageDialog {
+
+ private Button button;
+ private Link link;
+ private boolean isRemember = false;
+ private static final String QUESTION = "Don't show this dialog again!";
//$NON-NLS-1$
+ private static final String TITLE = "Missing Natures"; //$NON-NLS-1$
+ private IProject project;
+
+ public ProjectNaturesInfoDialog(String[] missingNatures, IProject project) {
+ super(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ TITLE, null, "", INFORMATION, //$NON-NLS-1$
+ new String[] { IDialogConstants.OK_LABEL }, 0);
+ this.project = project;
+ message = getMessageInfo(missingNatures, project);
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ GridLayout gridLayout = (GridLayout) parent.getLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.makeColumnsEqualWidth = true;
+ parent.setLayout(gridLayout);
+ button = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ button.setLayoutData(gridData);
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ isRemember = !isRemember;
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ isRemember = !isRemember;
+ }
+ });
+ button.setText(QUESTION);
+ link = new Link(parent, SWT.NONE);
+ gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ gridData.grabExcessHorizontalSpace = true;
+ link.setLayoutData(gridData);
+ link.setText("<A>" + VpeUIMessages.MOZILLA_LOADING_ERROR_LINK_TEXT +
"</A>"); //$NON-NLS-1$ //$NON-NLS-2$
+ link.setToolTipText(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK);
+ link.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ processLink(link);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ processLink(link);
+ }
+
+ });
+ return parent;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == 0) {
+ try {
+ project.setPersistentProperty(ProjectNaturesChecker.IS_NATURES_CHECK_NEED,
Boolean.toString(!isRemember));
+ } catch (CoreException e) {
+ }
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ private void processLink(Link link) {
+ BusyIndicator.showWhile(link.getDisplay(), new Runnable() {
+ public void run() {
+ URL theURL = null;
+ ;
+ try {
+ theURL = new URL(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK);
+ } catch (MalformedURLException e) {
+ VpePlugin.reportProblem(e);
+ }
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ try {
+ support.getExternalBrowser().openURL(theURL);
+ } catch (PartInitException e) {
+ VpePlugin.reportProblem(e);
+ }
+ }
+ });
+ }
+
+ private String arrayToString(String[] strings){
+ StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
+ for (int i = 0; i < strings.length; i++) {
+ builder.append(strings[i]+"\n"); //$NON-NLS-1$
+ }
+ return builder.toString();
+ }
+
+ 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$
+ return dialogMessage;
+ }
+
+}