JBoss Tools SVN: r2656 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2007-07-25 13:54:39 -0400 (Wed, 25 Jul 2007)
New Revision: 2656
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java
Log:
minor
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java 2007-07-25 17:07:45 UTC (rev 2655)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java 2007-07-25 17:54:39 UTC (rev 2656)
@@ -60,7 +60,7 @@
static public List getProjectClassPathURLs (IJavaProject project)
{
- ArrayList pathElements = new ArrayList();
+ List pathElements = new ArrayList();
try {
IClasspathEntry paths[] = project.getResolvedClasspath(true);
17 years, 5 months
JBoss Tools SVN: r2655 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-07-25 13:07:45 -0400 (Wed, 25 Jul 2007)
New Revision: 2655
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
Log:
JBIDE-617, JBIDE-502
Clean build was destroying workspace.
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2007-07-25 16:07:11 UTC (rev 2654)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/project/ArchivesBuilder.java 2007-07-25 17:07:45 UTC (rev 2655)
@@ -94,7 +94,7 @@
IArchiveModelNode root = ArchivesModel.instance().getRoot(p);
IArchiveNode[] nodes = root.getChildren(IArchiveNode.TYPE_ARCHIVE);
for( int i = 0; i < nodes.length; i++ ) {
- IPath path = ((IArchive)nodes[i]).getGlobalDestinationPath();
+ IPath path = ((IArchive)nodes[i]).getArchiveFilePath();
TrueZipUtil.deleteAll(path);
}
}
17 years, 5 months
JBoss Tools SVN: r2654 - in trunk/seam/tests/org.jboss.tools.seam.core.test: src/org/jboss/tools/seam/core/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-25 12:07:11 -0400 (Wed, 25 Jul 2007)
New Revision: 2654
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
EXIN-336 ScannerTest updated to current seam model implementation.
Method testSeamProjectObject() added which will include cases of
various ways to define components and their properties.
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2007-07-25 15:18:25 UTC (rev 2653)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2007-07-25 16:07:11 UTC (rev 2654)
@@ -1,10 +1,12 @@
<?xml version="1.0"?>
<components xmlns="http://jboss.com/products/seam/components"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd">
<component class="java.lang.Boolean" name="myComponent" scope="page">
<property name="property1">value1</property>
<property name="myList">
<value>value1</value>
</property>
</component>
+ <core:managed-persistence-context name="myPersistenceContext1"/>
</components>
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-07-25 15:18:25 UTC (rev 2653)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2007-07-25 16:07:11 UTC (rev 2654)
@@ -27,9 +27,13 @@
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamCoreBuilder;
+import org.jboss.tools.seam.core.event.ISeamValueList;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
+import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
+import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
public class ScannerTest extends TestCase {
TestProjectProvider provider = null;
@@ -46,10 +50,14 @@
} catch (Exception e) {
e.printStackTrace();
}
- XJob.waitForJob();
+ try {
+ XJob.waitForJob();
+ } catch (InterruptedException e) {
+ //ignore
+ }
}
-
- public void testXMLScanner() {
+
+ private ISeamProject getSeamProject() {
try {
XJob.waitForJob();
} catch (Exception e) {
@@ -68,8 +76,20 @@
fail("Cannot get seam nature.");
}
assertNotNull("Seam project is null", seamProject);
-
-
+ return seamProject;
+ }
+
+ /**
+ * This empty test is meaningful as it gives Eclipse opportunity
+ * to pass for the first time setUp() and show the license dialog
+ * that may cause InterruptedException for XJob.waitForJob()
+ */
+ public void testCreatingProject() {
+ }
+
+ public void testXMLScanner() {
+ ISeamProject seamProject = getSeamProject();
+
IFile f = project.getFile("WebContent/WEB-INF/components.xml");
assertTrue("Cannot find components.xml in test project", f != null && f.exists());
@@ -98,26 +118,14 @@
assertTrue("Property myList is not found in components.xml", prs.size() == 1);
ISeamProperty property = prs.get(0);
Object o = property.getValue();
- assertTrue("Property myList in myComponent must be instanceof java.util.List.", o instanceof List);
- List<?> oList = (List<?>)o;
- assertTrue("Property myList misses value 'value1.", "value1".equals(oList.get(0)));
+ assertTrue("Property myList in myComponent must be instanceof ISeamValueList", o instanceof ISeamValueList);
+ ISeamValueList oList = (ISeamValueList)o;
+ assertTrue("Property myList misses value 'value1.", "value1".equals(oList.getValues().get(0).getValue().getValue()));
}
public void testJavaScanner() {
- try {
- XJob.waitForJob();
- } catch (Exception e) {
- fail("Interrupted");
- }
- ISeamProject seamProject = null;
- try {
- seamProject = (ISeamProject)project.getNature(SeamProject.NATURE_ID);
- } catch (Exception e) {
- fail("Cannot get seam nature.");
- }
- assertNotNull("Seam project is null", seamProject);
+ ISeamProject seamProject = getSeamProject();
-
IFile f = project.getFile("JavaSource/demo/User.java");
assertTrue("Cannot find User.java in test project", f != null && f.exists());
@@ -144,40 +152,32 @@
}
public void testLibraryScanner() {
+ ISeamProject seamProject = getSeamProject();
- try {
- XJob.waitForJob();
- } catch (Exception e) {
- fail("Interrupted");
- }
- ISeamProject seamProject = null;
- try {
- seamProject = (ISeamProject)project.getNature(SeamProject.NATURE_ID);
- } catch (Exception e) {
- fail("Cannot get seam nature.");
- }
- assertNotNull("Seam project is null", seamProject);
-
-
IFile f = project.getFile("WebContent/WEB-INF/lib/jboss-seam.jar");
assertTrue("Cannot find User.java in test project", f != null && f.exists());
- IFileScanner scanner = SeamCoreBuilder.getLibraryScanner();
+ LibraryScanner scanner =(LibraryScanner)SeamCoreBuilder.getLibraryScanner();
+ ClassPath cp = ((SeamProject)seamProject).getClassPath();
+ scanner.setClassPath(cp);
+ cp.update();
+
assertTrue("Scanner cannot recognise jboss-seam.jar", scanner.isRelevant(f));
assertTrue("Scanner cannot recognise jboss-seam.jar content", scanner.isLikelyComponentSource(f));
-
+
ISeamFactory[] cs = null;
try {
cs = scanner.parse(f).getFactories().toArray(new ISeamFactory[0]);
} catch (Exception e) {
+ e.printStackTrace();
fail("Error in library scanner:" + e.getMessage());
}
assertTrue("Factories are not found in jboss-seam.jar", cs != null && cs.length > 0);
boolean hasActor = false;
for (int i = 0; i < cs.length && !hasActor; i++) {
- if("actor".equals(cs[0].getName())) hasActor = true;
+ if("actor".equals(cs[i].getName())) hasActor = true;
}
assertTrue("Factory " + "actor" + " is not found in jboss-seam.jar", hasActor);
@@ -197,4 +197,23 @@
assertTrue("Seam builder must put actor to project.", components.size()==1);
}
-}
\ No newline at end of file
+
+ /**
+ * This method is to cover most cases of configuring components
+ */
+ public void testSeamProjectObjects() {
+ ISeamProject seamProject = getSeamProject();
+
+ //1. components.xml has entry
+ // <core:managed-persistence-context name="myPersistenceContext1"/>
+ // check that myPersistenceContext1 exists and has scope CONVERSATION
+
+ ISeamComponent c = seamProject.getComponent("myPersistenceContext1");
+ assertNotNull("Component myPersistenceContext1 not found.", c);
+ ScopeType scope = c.getScope();
+ assertTrue("Component myPersistenceContext1 has scope=" + (scope == null ? null : scope.getLabel()) + ", but has to have " + ScopeType.CONVERSATION.getLabel(), ScopeType.CONVERSATION == scope);
+
+
+ }
+
+}
17 years, 5 months
JBoss Tools SVN: r2653 - in trunk/seam/plugins/org.jboss.tools.seam.core: src/org/jboss/tools/seam/internal/core/el and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-07-25 11:18:25 -0400 (Wed, 25 Jul 2007)
New Revision: 2653
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ISeamValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationHelper.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
Log:
http://jira.jboss.com/jira/browse/EXIN-327 EL Incremental validation.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-25 15:18:25 UTC (rev 2653)
@@ -130,8 +130,8 @@
<extension
point="org.eclipse.wst.validation.validator"
- id="SeamCoreValidator"
- name="Seam Core Validator">
+ id="SeamValidator"
+ name="Seam Validator">
<validator>
<projectNature id="org.jboss.tools.seam.core.seamnature" />
<filter
@@ -140,33 +140,8 @@
<filter
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.xml"/>
- <markerId
- markerIdValue="seamCoreProblem">
- </markerId>
- <helper
- class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper">
- </helper>
- <run
- class="org.jboss.tools.seam.internal.core.validation.SeamCoreValidator"
- incremental="true"
- fullBuild="true"
- />
- </validator>
- </extension>
- <extension
- point="org.eclipse.wst.validation.validator"
- id="SeamELValidator"
- name="Seam EL Validator">
- <validator>
- <projectNature id="org.jboss.tools.seam.core.seamnature" />
<filter
objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.java"/>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.xml"/>
- <filter
- objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.xhtml"/>
<filter
objectClass="org.eclipse.core.resources.IFile"
@@ -192,36 +167,27 @@
<contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspfragmentsource"/>
<contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.tagsource"/>
<markerId
- markerIdValue="seamELProblem">
+ markerIdValue="seamProblem">
</markerId>
<helper
- class="org.jboss.tools.seam.internal.core.validation.SeamELValidationHelper">
+ class="org.jboss.tools.seam.internal.core.validation.SeamValidationHelper">
</helper>
<run
- class="org.jboss.tools.seam.internal.core.validation.SeamELValidator"
+ class="org.jboss.tools.seam.internal.core.validation.SeamValidatorManager"
incremental="true"
fullBuild="true"
/>
</validator>
- </extension>
+ </extension>
<extension
- id="seamCoreProblem"
- name="Seam Core Problem"
+ id="seamProblem"
+ name="Seam Problem"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.wst.validation.problemmarker"/>
<persistent
value="true">
</persistent>
</extension>
- <extension
- id="seamELProblem"
- name="Seam EL Problem"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.wst.validation.problemmarker"/>
- <persistent
- value="true">
- </persistent>
- </extension>
-</plugin>
+</plugin>
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -102,11 +102,11 @@
List<List<ELToken>> variations = getPossibleVarsFromPrefix(tokens);
if (variations.isEmpty()) {
- resolvedVariables = resolveVariables(project, scope, tokens, tokens);
+ resolvedVariables = resolveVariables(project, scope, tokens, tokens, returnEqualedVariablesOnly);
} else {
for (List<ELToken> variation : variations) {
List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
- resolvedVars = resolveVariables(project, scope, variation, tokens);
+ resolvedVars = resolveVariables(project, scope, variation, tokens, returnEqualedVariablesOnly);
if (resolvedVars != null && !resolvedVars.isEmpty()) {
resolvedVariables = resolvedVars;
resolvedExpressionPart = variation;
@@ -140,7 +140,7 @@
int startTokenIndex = (resolvedExpressionPart == null ? 0 : resolvedExpressionPart.size());
Set<IMember> members = new HashSet<IMember>();
for (ISeamContextVariable var : resolvedVariables) {
- IMember member = SeamExpressionResolver.getMemberByVariable(var);
+ IMember member = SeamExpressionResolver.getMemberByVariable(var, returnEqualedVariablesOnly);
if (member != null && !members.contains(member))
members.add(member);
}
@@ -327,11 +327,11 @@
* @param tokens
* @return
*/
- private List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, List<ELToken>part, List<ELToken> tokens) {
+ private List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, List<ELToken>part, List<ELToken> tokens, boolean onlyEqualNames) {
List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
String varName = computeVariableName(part);
if (varName != null) {
- resolvedVars = SeamExpressionResolver.resolveVariables(project, scope, varName);
+ resolvedVars = SeamExpressionResolver.resolveVariables(project, scope, varName, onlyEqualNames);
}
if (resolvedVars != null && resolvedVars.size() > 0) {
List<ISeamContextVariable> newResolvedVars = new ArrayList<ISeamContextVariable>();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -51,10 +51,10 @@
* @param name
* @return
*/
- public static List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, String name) {
+ public static List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, String name, boolean onlyEqualNames) {
if (project == null || name == null) return null;
- return (scope == null ? internalResolveVariables(project, name) :
- internalResolveVariablesByScope(project, scope, name));
+ return (scope == null ? internalResolveVariables(project, name, onlyEqualNames) :
+ internalResolveVariablesByScope(project, scope, name, onlyEqualNames));
}
/**
@@ -65,12 +65,18 @@
* @param name
* @return
*/
- private static List<ISeamContextVariable> internalResolveVariables(ISeamProject project, String name) {
+ private static List<ISeamContextVariable> internalResolveVariables(ISeamProject project, String name, boolean onlyEqualNames) {
List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
Set<ISeamContextVariable> variables = project.getVariables();
for (ISeamContextVariable variable : variables) {
- if (variable.getName().startsWith(name)) {
- resolvedVariables.add(variable);
+ if(onlyEqualNames) {
+ if (variable.getName().equals(name)) {
+ resolvedVariables.add(variable);
+ }
+ } else {
+ if (variable.getName().startsWith(name)) {
+ resolvedVariables.add(variable);
+ }
}
}
return resolvedVariables;
@@ -85,12 +91,18 @@
* @param name
* @return
*/
- private static List<ISeamContextVariable> internalResolveVariablesByScope(ISeamProject project, ScopeType scope, String name) {
+ private static List<ISeamContextVariable> internalResolveVariablesByScope(ISeamProject project, ScopeType scope, String name, boolean onlyEqualNames) {
List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
Set<ISeamContextVariable> variables = project.getVariablesByScope(scope);
for (ISeamContextVariable variable : variables) {
- if (variable.getName().startsWith(name)) {
- resolvedVariables.add(variable);
+ if(onlyEqualNames) {
+ if (variable.getName().equals(name)) {
+ resolvedVariables.add(variable);
+ }
+ } else {
+ if (variable.getName().startsWith(name)) {
+ resolvedVariables.add(variable);
+ }
}
}
return resolvedVariables;
@@ -102,7 +114,7 @@
* @param variable
* @return
*/
- public static IMember getMemberByVariable(ISeamContextVariable variable) {
+ public static IMember getMemberByVariable(ISeamContextVariable variable, boolean onlyEqualNames) {
IMember member = null;
if (variable instanceof ISeamComponent) {
ISeamComponent component = (ISeamComponent)variable;
@@ -132,10 +144,10 @@
ISeamProject project = ((ISeamElement)factory).getSeamProject();
// ISeamProject project = getSeamProject(factory.getResource());
if (project != null) {
- List<ISeamContextVariable> resolvedValues = resolveVariables(project, factory.getScope(), value);
+ List<ISeamContextVariable> resolvedValues = resolveVariables(project, factory.getScope(), value, onlyEqualNames);
for (ISeamContextVariable var : resolvedValues) {
if (var.getName().equals(value)) {
- member = getMemberByVariable(var);
+ member = getMemberByVariable(var, onlyEqualNames);
break;
}
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ISeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ISeamValidator.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/ISeamValidator.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -0,0 +1,45 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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.seam.internal.core.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+
+/**
+ * Seam valodator that is managed by SeamValidatorManager.
+ * @author Alexey Kazakov
+ */
+public interface ISeamValidator {
+
+ public static final String MARKED_SEAM_RESOURCE_MESSAGE_GROUP = "markedSeamResource";
+
+ /**
+ * @return true if validator is enabled.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Incremental Validation
+ * @return
+ * @throws ValidationException
+ */
+ public IStatus validate(Set<IFile> changedFiles) throws ValidationException;
+
+ /**
+ * Full Validation
+ * @return
+ * @throws ValidationException
+ */
+ public IStatus validateAll() throws ValidationException;
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -40,6 +40,7 @@
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
@@ -59,14 +60,43 @@
*/
public class SeamCoreValidator extends SeamValidator {
+ protected static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
+ protected static final String UNKNOWN_VARIABLE_NAME_MESSAGE_ID = "UNKNOWN_VARIABLE_NAME";
+ protected static final String STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTAIN_";
+ protected static final String DUPLICATE_METHOD_PREFIX_MESSAGE_ID = "DUPLICATE_";
+ protected static final String REMOVE_METHOD_SUFIX_MESSAGE_ID = "REMOVE";
+ protected static final String DESTROY_METHOD_SUFIX_MESSAGE_ID = "DESTROY";
+ protected static final String CREATE_METHOD_SUFIX_MESSAGE_ID = "CREATE";
+ protected static final String UNWRAP_METHOD_SUFIX_MESSAGE_ID = "UNWRAP";
+ protected static final String OBSERVER_METHOD_SUFIX_MESSAGE_ID = "OBSERVER";
+ protected static final String NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID = "_DOESNT_BELONG_TO_COMPONENT";
+ protected static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
+ protected static final String ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "ENTITY_COMPONENT_WRONG_SCOPE";
+ protected static final String UNKNOWN_FACTORY_NAME_MESSAGE_ID = "UNKNOWN_FACTORY_NAME";
+ protected static final String MULTIPLE_DATA_BINDER_MESSAGE_ID = "MULTIPLE_DATA_BINDER";
+ protected static final String DUPLICATE_VARIABLE_NAME_MESSAGE_ID = "DUPLICATE_VARIABLE_NAME";
+ protected static final String UNKNOWN_DATA_MODEL_MESSAGE_ID = "UNKNOWN_DATA_MODEL";
+ protected static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID = "UNKNOWN_COMPONENT_CLASS_NAME";
+ protected static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID = "UNKNOWN_COMPONENT_PROPERTY";
+
+ public SeamCoreValidator(SeamValidatorManager validatorManager,
+ SeamValidationHelper coreHelper, IReporter reporter,
+ SeamValidationContext validationContext, ISeamProject project) {
+ super(validatorManager, coreHelper, reporter, validationContext, project);
+ }
+
/* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.validation.SeamValidator#validate(java.util.Set)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#isEnabled()
*/
- @Override
+ public boolean isEnabled() {
+ return SeamPreferences.isValidateCore(project);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validate(java.util.Set)
+ */
public IStatus validate(Set<IFile> changedFiles) throws ValidationException {
- if(!SeamPreferences.isValidateCore(project)) {
- return OK_STATUS;
- }
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
Set<ISeamComponent> checkedComponents = new HashSet<ISeamComponent>();
Set<String> markedDuplicateFactoryNames = new HashSet<String>();
@@ -77,9 +107,9 @@
if(reporter.isCancelled()) {
break;
}
- if (currentFile != null) {
- // Get all variable names that were linked with this resource.
- Set<String> oldVariablesNamesOfChangedFile = validationContext.getVariableNamesByResource(currentFile.getFullPath());
+ if (checkFileExtension(currentFile)) {
+ // Get all variable names which were linked with this resource.
+ Set<String> oldVariablesNamesOfChangedFile = validationContext.getVariableNamesByCoreResource(currentFile.getFullPath());
if(oldVariablesNamesOfChangedFile!=null) {
// Check if variable name was changed in source file
Set<String> newVariableNamesOfChangedFile = getVariablesNameByResource(currentFile.getFullPath());
@@ -87,7 +117,7 @@
if(!oldVariablesNamesOfChangedFile.contains(newVariableName)) {
// Name was changed.
// Collect resources with new component name.
- Set<IPath> linkedResources = validationContext.getResourcesByVariableName(newVariableName);
+ Set<IPath> linkedResources = validationContext.getCoreResourcesByVariableName(newVariableName);
if(linkedResources!=null) {
resources.addAll(linkedResources);
}
@@ -97,10 +127,12 @@
// Collect all linked resources with old variable names.
for (String name : oldVariablesNamesOfChangedFile) {
- Set<IPath> linkedResources = validationContext.getResourcesByVariableName(name);
+ Set<IPath> linkedResources = validationContext.getCoreResourcesByVariableName(name);
if(linkedResources!=null) {
resources.addAll(linkedResources);
}
+ // Save old names for EL validation. We need to validate all EL resources which use this variable name.
+ validationContext.addVariableNameForELValidation(name);
}
} else {
// Validate new (unlinked) source file.
@@ -111,17 +143,17 @@
}
// Validate all collected linked resources.
// Remove all links between collected resources and variables names because they will be linked again during validation.
- validationContext.removeLinkedResources(resources);
+ validationContext.removeLinkedCoreResources(resources);
for (IPath linkedResource : resources) {
// Remove markers from collected source file
IFile sourceFile = root.getFile(linkedResource);
- reporter.removeMessageSubset(this, sourceFile, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ reporter.removeMessageSubset(validationManager, sourceFile, ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
validateComponent(linkedResource, checkedComponents);
validateFactory(linkedResource, markedDuplicateFactoryNames);
}
// Validate all unnamed resources.
- Set<IPath> unnamedResources = validationContext.getUnnamedResources();
+ Set<IPath> unnamedResources = validationContext.getUnnamedCoreResources();
newResources.addAll(unnamedResources);
for (IPath path : newResources) {
Set<SeamJavaComponentDeclaration> declarations = ((SeamProject)project).findJavaDeclarations(path);
@@ -133,30 +165,36 @@
return OK_STATUS;
}
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.validation.SeamValidator#validateAll()
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validateAll()
*/
- @Override
public IStatus validateAll() throws ValidationException {
- reporter.removeAllMessages(this);
- validationContext.clear();
- if(SeamPreferences.isValidateCore(project)) {
- Set<ISeamComponent> components = project.getComponents();
- for (ISeamComponent component : components) {
- validateComponent(component);
+ Set<ISeamComponent> components = project.getComponents();
+ for (ISeamComponent component : components) {
+ if(reporter.isCancelled()) {
+ return OK_STATUS;
}
- Set<ISeamFactory> factories = project.getFactories();
- Set<String> markedDuplicateFactoryNames = new HashSet<String>();
- for (ISeamFactory factory : factories) {
- validateFactory(factory, markedDuplicateFactoryNames);
+ validateComponent(component);
+ }
+ Set<ISeamFactory> factories = project.getFactories();
+ Set<String> markedDuplicateFactoryNames = new HashSet<String>();
+ for (ISeamFactory factory : factories) {
+ if(reporter.isCancelled()) {
+ return OK_STATUS;
}
+ validateFactory(factory, markedDuplicateFactoryNames);
+ }
- Map<String,SeamJavaComponentDeclaration> declarations = ((SeamProject)project).getAllJavaComponentDeclarations();
- Collection<SeamJavaComponentDeclaration> values = declarations.values();
- for (SeamJavaComponentDeclaration d : values) {
- validateMethodsOfUnknownComponent(d);
+ Map<String,SeamJavaComponentDeclaration> declarations = ((SeamProject)project).getAllJavaComponentDeclarations();
+ Collection<SeamJavaComponentDeclaration> values = declarations.values();
+ for (SeamJavaComponentDeclaration d : values) {
+ if(reporter.isCancelled()) {
+ return OK_STATUS;
}
+ validateMethodsOfUnknownComponent(d);
}
+
return OK_STATUS;
}
@@ -234,16 +272,16 @@
if(!firstDuplicateVariableWasMarked) {
firstDuplicateVariableWasMarked = true;
// mark original factory
- validationContext.addLinkedResource(factoryName, factory.getSourcePath());
+ validationContext.addLinkedCoreResource(factoryName, factory.getSourcePath());
location = coreHelper.getLocationOfName(factory);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, factory.getResource());
}
// mark duplicate variable
IResource resource = coreHelper.getComponentResourceWithName(variable);
if(!coreHelper.isJar(resource)) {
- validationContext.addLinkedResource(factoryName, resource.getFullPath());
+ validationContext.addLinkedCoreResource(factoryName, resource.getFullPath());
location = coreHelper.getLocationOfName(variable);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, resource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, resource);
}
markedDuplicateFactoryNames.add(factoryName);
}
@@ -256,8 +294,8 @@
if(unknownVariable && validateUnknownName) {
// mark unknown factory name
// save link to factory resource
- validationContext.addLinkedResource(factoryName, factory.getSourcePath());
- this.addError(UNKNOWN_FACTORY_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_FACTORY_NAME, new String[]{factoryName}, coreHelper.getLocationOfName(factory), factory.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ validationContext.addLinkedCoreResource(factoryName, factory.getSourcePath());
+ this.addError(UNKNOWN_FACTORY_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_FACTORY_NAME, new String[]{factoryName}, coreHelper.getLocationOfName(factory), factory.getResource());
}
}
@@ -280,17 +318,11 @@
Set<String> result = new HashSet<String>();
for (ISeamContextVariable variable : variables) {
String name = variable.getName();
- if(!result.contains(name)) {
- result.add(name);
- }
+ result.add(name);
}
return result;
}
- public void cleanup(IReporter reporter) {
- super.cleanup(reporter);
- }
-
/*
* Validates the component
*/
@@ -308,7 +340,7 @@
boolean sourceJavaDeclaration = !((IType)jd.getSourceMember()).isBinary();
if(sourceJavaDeclaration) {
// Save link between component name and java source file.
- validationContext.addLinkedResource(component.getName(), declaration.getSourcePath());
+ validationContext.addLinkedCoreResource(component.getName(), declaration.getSourcePath());
}
if(declaration!=firstJavaDeclaration) {
// Validate @Name
@@ -327,7 +359,7 @@
IResource checkedDeclarationResource = checkedDeclaration.getResource();
ISeamTextSourceReference location = ((SeamComponentDeclaration)checkedDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, checkedDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, checkedDeclarationResource);
}
markedDeclarations.add(checkedDeclaration);
}
@@ -335,7 +367,7 @@
markedDeclarations.add(javaDeclaration);
ISeamTextSourceReference location = ((SeamComponentDeclaration)javaDeclaration).getLocationFor(SeamComponentDeclaration.PATH_OF_NAME);
if(location!=null) {
- addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, javaDeclarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(NONUNIQUE_COMPONENT_NAME_MESSAGE_ID, SeamPreferences.NONUNIQUE_COMPONENT_NAME, new String[]{component.getName()}, location, javaDeclarationResource);
}
}
}
@@ -358,7 +390,7 @@
if(coreHelper.isJar(declaration)) {
return;
}
- validationContext.addLinkedResource(componentName, declaration.getSourcePath());
+ validationContext.addLinkedCoreResource(componentName, declaration.getSourcePath());
String className = declaration.getClassName();
if(className!=null) {
IType type = null;
@@ -376,9 +408,9 @@
if(location==null) {
location = declaration;
}
- addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, new String[]{className}, location, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, new String[]{className}, location, declaration.getResource());
} else if(!type.isBinary()) {
- validationContext.addLinkedResource(componentName, type.getResource().getFullPath());
+ validationContext.addLinkedCoreResource(componentName, type.getResource().getFullPath());
}
} catch (JavaModelException e) {
SeamCorePlugin.getDefault().logError("Error validating Seam Core", e);
@@ -395,7 +427,7 @@
}
boolean ok = type.isBinary() || coreHelper.findSetter(type, name)!=null;
if(!ok) {
- addError(UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, new String[]{type.getElementName(), componentName, name}, property, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID, SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, new String[]{type.getElementName(), componentName, name}, property, declaration.getResource());
}
}
}
@@ -409,7 +441,7 @@
ScopeType scope = component.getScope();
if(scope == ScopeType.STATELESS) {
ISeamTextSourceReference location = getScopeLocation(component);
- addError(ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.ENTITY_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.ENTITY_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource());
}
}
}
@@ -443,7 +475,7 @@
ScopeType scope = component.getScope();
if(scope == ScopeType.PAGE || scope == ScopeType.STATELESS) {
ISeamTextSourceReference location = getScopeLocation(component);
- addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID, SeamPreferences.STATEFUL_COMPONENT_WRONG_SCOPE, new String[]{component.getName()}, location, javaDeclaration.getResource());
}
}
}
@@ -453,7 +485,7 @@
ISeamTextSourceReference classNameLocation = getClassNameLocation(javaDeclaration);
Set<ISeamComponentMethod> methods = javaDeclaration.getMethodsByType(methodType);
if(methods==null || methods.size()==0) {
- addError(STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{component.getName()}, classNameLocation, javaDeclaration.getResource());
}
}
@@ -471,7 +503,7 @@
for (ISeamComponentMethod method : methods) {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- addError(DUPLICATE_METHOD_PREFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{methodName}, method, javaDeclaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(DUPLICATE_METHOD_PREFIX_MESSAGE_ID + postfixMessageId, preferenceKey, new String[]{methodName}, method, javaDeclaration.getResource());
}
}
}
@@ -504,7 +536,7 @@
return;
}
// save link between java source and variable name
- validationContext.addLinkedResource(name, declaration.getSourcePath());
+ validationContext.addLinkedCoreResource(name, declaration.getSourcePath());
// Validate @In
if(bijection.isOfType(BijectedAttributeType.IN)) {
@@ -512,7 +544,7 @@
if(variables==null || variables.size()<1) {
// Injection has unknown name. Mark it.
IResource declarationResource = declaration.getResource();
- addError(UNKNOWN_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_VARIABLE_NAME, new String[]{name}, bijection, declarationResource, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_VARIABLE_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_VARIABLE_NAME, new String[]{name}, bijection, declarationResource);
}
}
}
@@ -524,19 +556,19 @@
Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByType(BijectedAttributeType.DATA_BINDER);
if(dataBinders.size()>0) {
for (IBijectedAttribute dataBinder : dataBinders) {
- addError(MULTIPLE_DATA_BINDER_MESSAGE_ID, SeamPreferences.MULTIPLE_DATA_BINDER, dataBinder, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(MULTIPLE_DATA_BINDER_MESSAGE_ID, SeamPreferences.MULTIPLE_DATA_BINDER, dataBinder, declaration.getResource());
}
}
} else {
// save link between java source and variable name
- validationContext.addLinkedResource(name, declaration.getSourcePath());
+ validationContext.addLinkedCoreResource(name, declaration.getSourcePath());
Set<IBijectedAttribute> dataBinders = declaration.getBijectedAttributesByName(name);
for (IBijectedAttribute dataBinder : dataBinders) {
if(dataBinder.isOfType(BijectedAttributeType.DATA_BINDER) || dataBinder.isOfType(BijectedAttributeType.OUT)) {
return;
}
}
- addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{name}, coreHelper.getLocationOfName(bijection), declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNKNOWN_DATA_MODEL_MESSAGE_ID, SeamPreferences.UNKNOWN_DATA_MODEL, new String[]{name}, coreHelper.getLocationOfName(bijection), declaration.getResource());
}
}
@@ -545,7 +577,7 @@
*/
private void validateMethodsOfUnknownComponent(ISeamJavaComponentDeclaration declaration) {
if(project.getComponentsByPath(declaration.getSourcePath()).size()>0) {
- validationContext.removeUnnamedResource(declaration.getSourcePath());
+ validationContext.removeUnnamedCoreResource(declaration.getSourcePath());
return;
}
validateMethodOfUnknownComponent(SeamComponentMethodType.DESTROY, declaration, DESTROY_METHOD_SUFIX_MESSAGE_ID, SeamPreferences.DESTROY_DOESNT_BELONG_TO_COMPONENT);
@@ -560,11 +592,23 @@
for (ISeamComponentMethod method : methods) {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, preferenceKey, new String[]{methodName}, method, declaration.getResource(), MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
- validationContext.addUnnamedResource(declaration.getSourcePath());
+ addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, preferenceKey, new String[]{methodName}, method, declaration.getResource());
+ validationContext.addUnnamedCoreResource(declaration.getSourcePath());
}
} else {
- validationContext.removeUnnamedResource(declaration.getSourcePath());
+ validationContext.removeUnnamedCoreResource(declaration.getSourcePath());
}
}
+
+ private final static String[] extns = new String[]{"java", "xml"};
+
+ private boolean checkFileExtension(IFile file) {
+ String ext = file.getFileExtension();
+ for (int i = 0; i < extns.length; i++) {
+ if(extns[i].equalsIgnoreCase(ext)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationHelper.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationHelper.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -1,24 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 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.seam.internal.core.validation;
-
-import java.util.Collection;
-
-/**
- * Helper for EL Seam valodator
- * @author Alexey Kazakov
- */
-public class SeamELValidationHelper extends SeamValidationHelper {
-
- public Collection getAllFilesForValidation() {
- return getFiles(SeamELValidator.class.getName());
- }
-}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -11,7 +11,6 @@
package org.jboss.tools.seam.internal.core.validation;
import java.io.IOException;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -19,7 +18,10 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
@@ -36,10 +38,12 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
@@ -50,32 +54,58 @@
*/
public class SeamELValidator extends SeamValidator {
+ protected static final String INVALID_EXPRESSION_MESSAGE_ID = "INVALID_EXPRESSION";
+ protected static final String UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID = "UNPAIRED_GETTER_OR_SETTER";
+
private SeamELCompletionEngine engine= new SeamELCompletionEngine();
- private IJavaProject javaProject = null;
+ private IJavaProject javaProject;
+ public SeamELValidator(SeamValidatorManager validatorManager,
+ SeamValidationHelper coreHelper, IReporter reporter,
+ SeamValidationContext validationContext, ISeamProject project) {
+ super(validatorManager, coreHelper, reporter, validationContext, project);
+ }
+
/* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.validation.SeamValidator#validate(java.util.Set)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#isEnabled()
*/
- @Override
+ public boolean isEnabled() {
+ return SeamPreferences.isValidateEL(project);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validate(java.util.Set)
+ */
public IStatus validate(Set<IFile> changedFiles) throws ValidationException {
- // TODO Incremental validation
- validateAll();
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ Set<IPath> files = validationContext.getElResourcesForValidation(changedFiles);
+ validationContext.removeLinkedElResources(files);
+ for (IPath path : files) {
+ if(!reporter.isCancelled()) {
+ validationContext.removeUnnamedElResource(path);
+ IFile file = wsRoot.getFile(path);
+ if(file.exists()) {
+ reporter.removeMessageSubset(validationManager, file, ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ validateFile(file);
+ }
+ }
+ }
+
+ validationContext.clearOldVariableNameForElValidation();
return OK_STATUS;
}
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.internal.core.validation.SeamValidator#validateAll()
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validateAll()
*/
- @Override
public IStatus validateAll() throws ValidationException {
- reporter.removeAllMessages(this);
- if(SeamPreferences.isValidateEL(project)) {
- SeamELValidationHelper vlh = (SeamELValidationHelper)coreHelper;
- Collection files = vlh.getAllFilesForValidation();
- for (Object file : files) {
- if(file instanceof IFile && !reporter.isCancelled()) {
- validateFile((IFile)file);
- }
+ validationContext.clearElResourceLinks();
+ Set<IFile> files = validationContext.getRegisteredFiles();
+ for (IFile file : files) {
+ if(!reporter.isCancelled()) {
+ validateFile(file);
}
}
return OK_STATUS;
@@ -205,29 +235,34 @@
String prefix = SeamELCompletionEngine.getPrefix(exp, offset);
if(prefix!=null) {
int possition = 0;
-
+
Set<ISeamContextVariable> usedVariables = new HashSet<ISeamContextVariable>();
Map<String, IMethod> unpairedGettersOrSetters = new HashMap<String, IMethod>();
-
+
List<String> suggestions = engine.getCompletions(project, file, exp, prefix, possition, true, usedVariables, unpairedGettersOrSetters);
+ if(usedVariables.size()==0 && suggestions.size()==0) {
+ // Save resources with unknown variables names
+ validationContext.addUnnamedElResource(file.getFullPath());
+ } else {
+ // Save links between resource and used variables names
+ for(ISeamContextVariable variable: usedVariables) {
+ validationContext.addLinkedElResource(variable.getName(), file.getFullPath());
+ }
+ }
+
// Check pair for getter/setter
if(unpairedGettersOrSetters.size()>0) {
IMethod unpairedMethod = unpairedGettersOrSetters.values().iterator().next();
String methodName = unpairedMethod.getElementName();
-// int indexOfPropertyName = 3;
-// if(methodName.startsWith("i")) {
-// indexOfPropertyName = 2;
-// }
String propertyName = unpairedGettersOrSetters.keySet().iterator().next();
-// propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
String missingMethodName = "Setter";
String existedMethodName = "Getter";
if(methodName.startsWith("s")) {
missingMethodName = existedMethodName;
existedMethodName = "Setter";
}
- addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, el.getLength(), el.getOffset(), file, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, SeamPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, el.getLength(), el.getOffset(), file);
}
if (suggestions != null && suggestions.size() > 0) {
@@ -241,7 +276,7 @@
SeamCorePlugin.getDefault().logError("Error validating Seam EL", e);
}
// Mark invalid EL
- addError(INVALID_EXPRESSION_MESSAGE_ID, SeamPreferences.INVALID_EXPRESSION, new String[]{el.getValue()}, el.getLength(), el.getOffset(), file, MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ addError(INVALID_EXPRESSION_MESSAGE_ID, SeamPreferences.INVALID_EXPRESSION, new String[]{el.getValue()}, el.getLength(), el.getOffset(), file);
}
private IJavaProject getJavaProject() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -16,6 +16,7 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.xml.XMLUtilities;
@@ -29,162 +30,195 @@
*/
public class SeamValidationContext {
- private Map<String, Set<IPath>> resourcesByVariableName = new HashMap<String, Set<IPath>>();
- private Map<IPath, Set<String>> variableNamesByResource = new HashMap<IPath, Set<String>>();
- private Set<IPath> unnamedResources = new HashSet<IPath>();
+ // We should load/save these collections between eclipse sessions.
+ private LinkCollection coreLinks = new LinkCollection();
+ private LinkCollection elLinks = new LinkCollection();
private Set<IFile> removedFiles = new HashSet<IFile>();
private Set<IFile> registeredResources = new HashSet<IFile>();
+ private Set<String> oldVariableNamesForELValidation = new HashSet<String>();
/**
- * Save link between resource and variable name.
+ * Save link between core resource and variable name.
* It's needed for incremental validation because we must save all linked resources of changed java file.
*/
- public void addLinkedResource(String variableName, IPath linkedResourcePath) {
- if(linkedResourcePath==null) {
- throw new RuntimeException("Linked resource path must not be null!");
- }
- if(variableName==null) {
- throw new RuntimeException("Variable name must not be null!");
- }
- Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
- if(linkedResources==null) {
- // create set of linked resources with variable name.
- linkedResources = new HashSet<IPath>();
- resourcesByVariableName.put(variableName, linkedResources);
- }
- // save linked resources.
- linkedResources.add(linkedResourcePath);
-
- // Save link between resource and variable names. It's needed if variable name changes in resource file.
- Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
- if(variableNames==null) {
- variableNames = new HashSet<String>();
- variableNamesByResource.put(linkedResourcePath, variableNames);
- }
- variableNames.add(variableName);
+ public void addLinkedCoreResource(String variableName, IPath linkedResourcePath) {
+ coreLinks.addLinkedResource(variableName, linkedResourcePath);
}
/**
- * Removes link between resource and variable name.
+ * Removes link between core resource and variable name.
* @param oldVariableName
* @param linkedResourcePath
*/
- public void removeLinkedResource(String name, IPath linkedResourcePath) {
- Set<IPath> linkedResources = resourcesByVariableName.get(name);
- if(linkedResources!=null) {
- // remove linked resource.
- linkedResources.remove(linkedResourcePath);
- }
- // Remove link between resource and variable names.
- Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
- if(variableNames!=null) {
- variableNames.remove(name);
- }
+ public void removeLinkedCoreResource(String name, IPath linkedResourcePath) {
+ coreLinks.removeLinkedResource(name, linkedResourcePath);
}
/**
- * Removes link between resources and variable names.
+ * Removes link between core resources and variable names.
* @param linkedResources
*/
- public void removeLinkedResources(Set<IPath> resources) {
- for (IPath resource : resources) {
- Set<String> resourceNames = variableNamesByResource.get(resource);
- if(resourceNames!=null) {
- for (String name : resourceNames) {
- Set<IPath> linkedResources = resourcesByVariableName.get(name);
- if(linkedResources!=null) {
- linkedResources.remove(resource);
- }
- }
- }
- variableNamesByResource.remove(resource);
- }
+ public void removeLinkedCoreResources(Set<IPath> resources) {
+ coreLinks.removeLinkedResources(resources);
}
- public Set<IPath> getResourcesByVariableName(String variableName) {
- return resourcesByVariableName.get(variableName);
+ public Set<IPath> getCoreResourcesByVariableName(String variableName) {
+ return coreLinks.getResourcesByVariableName(variableName);
}
- public Set<String> getVariableNamesByResource(IPath fullPath) {
- return variableNamesByResource.get(fullPath);
+ public Set<String> getVariableNamesByCoreResource(IPath fullPath) {
+ return coreLinks.getVariableNamesByResource(fullPath);
}
/**
- * Adds resource without any link to any context variable name.
+ * Adds core resource without any link to any context variable name.
* @param fullPath
*/
- public void addUnnamedResource(IPath fullPath) {
- unnamedResources.add(fullPath);
+ public void addUnnamedCoreResource(IPath fullPath) {
+ coreLinks.addUnnamedResource(fullPath);
}
/**
- * @return Set of resources without any link to any context variable name.
+ * @return Set of coreresources without any link to any context variable name.
* @param fullPath
*/
- public Set<IPath> getUnnamedResources() {
- return unnamedResources;
+ public Set<IPath> getUnnamedCoreResources() {
+ return coreLinks.getUnnamedResources();
}
/**
- * Removes unnamed resource.
+ * Removes unnamed EL resource.
* @param fullPath
*/
- public void removeUnnamedResource(IPath fullPath) {
- unnamedResources.remove(fullPath);
+ public void removeUnnamedCoreResource(IPath fullPath) {
+ coreLinks.removeUnnamedResource(fullPath);
}
- public void clear() {
- resourcesByVariableName.clear();
- variableNamesByResource.clear();
- unnamedResources.clear();
+ /**
+ * Adds EL resource without any link to any context variable name.
+ * @param fullPath
+ */
+ public void addUnnamedElResource(IPath fullPath) {
+ elLinks.addUnnamedResource(fullPath);
+ }
+
+ /**
+ * @return Set of EL resources without any link to any context variable name.
+ * @param fullPath
+ */
+ public Set<IPath> getUnnamedElResources() {
+ return elLinks.getUnnamedResources();
+ }
+
+ /**
+ * Removes unnamed EL resource.
+ * @param fullPath
+ */
+ public void removeUnnamedElResource(IPath fullPath) {
+ elLinks.removeUnnamedResource(fullPath);
+ }
+
+ /**
+ * We should validate all EL resources which use these names.
+ * @param name
+ */
+ public void addVariableNameForELValidation(String name) {
+ oldVariableNamesForELValidation.add(name);
+ }
+
+ /**
+ * Save link between EL resource and variable name.
+ * It's needed for incremental validation because we must save all linked resources of changed java file.
+ */
+ public void addLinkedElResource(String variableName, IPath linkedResourcePath) {
+ elLinks.addLinkedResource(variableName, linkedResourcePath);
+ }
+
+ /**
+ * Removes link between resources and variable names.
+ * @param linkedResources
+ */
+ public void removeLinkedElResources(Set<IPath> resources) {
+ elLinks.removeLinkedResources(resources);
+ }
+
+ /**
+ * @param changedFiles - files which were changed.
+ * @return Set of resources which we should validate during incremental EL validation.
+ */
+ public Set<IPath> getElResourcesForValidation(Set<IFile> changedFiles) {
+ Set<IPath> result = new HashSet<IPath>();
+ // Collect all resources which use old variables names.
+ for(String name : oldVariableNamesForELValidation) {
+ Set<IPath> oldResources = elLinks.getResourcesByVariableName(name);
+ if(oldResources!=null) {
+ result.addAll(oldResources);
+ }
+ }
+ // Collect all resources which use new variables names
+ for(IResource resource : changedFiles) {
+ result.add(resource.getFullPath());
+ Set<String> names = getVariableNamesByCoreResource(resource.getFullPath());
+ if(names!=null) {
+ for (String name : names) {
+ Set<IPath> newResources = elLinks.getResourcesByVariableName(name);
+ if(newResources!=null) {
+ result.addAll(newResources);
+ }
+ }
+ }
+ }
+ result.addAll(elLinks.getUnnamedResources());
+ return result;
+ }
+
+ public void clearAll() {
removedFiles.clear();
registeredResources.clear();
+ oldVariableNamesForELValidation.clear();
+ coreLinks.clearAll();
+ elLinks.clearAll();
}
+ public void clearAllResourceLinks() {
+ oldVariableNamesForELValidation.clear();
+ coreLinks.clearAll();
+ elLinks.clearAll();
+ }
+
+ public void clearRegisteredFiles() {
+ removedFiles.clear();
+ registeredResources.clear();
+ }
+
+ public void clearElResourceLinks() {
+ oldVariableNamesForELValidation.clear();
+ elLinks.clearAll();
+ }
+
+ public void clearOldVariableNameForElValidation() {
+ oldVariableNamesForELValidation.clear();
+ }
+
public void store(Element root) {
Element validation = XMLUtilities.createElement(root, "validation");
- Set<String> variables = resourcesByVariableName.keySet();
- for (String name: variables) {
- Set<IPath> paths = resourcesByVariableName.get(name);
- if(paths == null) continue;
- for (IPath path: paths) {
- Element linkedResource = XMLUtilities.createElement(validation, "linked-resource");
- linkedResource.setAttribute("name", name);
- linkedResource.setAttribute("path", path.toString());
- }
- }
- for (IPath unnamedPath: unnamedResources) {
- Element unnamedPathElement = XMLUtilities.createElement(validation, "unnamed-path");
- unnamedPathElement.setAttribute("path", unnamedPath.toString());
- }
+ Element core = XMLUtilities.createElement(validation, "core");
+ coreLinks.store(core);
+ Element el = XMLUtilities.createElement(validation, "el");
+ elLinks.store(el);
}
public void load(Element root) {
Element validation = XMLUtilities.getUniqueChild(root, "validation");
if(validation == null) return;
- Element[] linkedResources = XMLUtilities.getChildren(validation, "linked-resource");
- if(linkedResources != null) for (int i = 0; i < linkedResources.length; i++) {
- String name = linkedResources[i].getAttribute("name");
- if(name == null || name.trim().length() == 0) continue;
- String path = linkedResources[i].getAttribute("path");
- if(path == null || path.trim().length() == 0) continue;
- try {
- IPath pathObject = new Path(path);
- addLinkedResource(name, pathObject);
- } catch (Exception e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
+ Element core = XMLUtilities.getUniqueChild(validation, "core");
+ if(core != null) {
+ coreLinks.load(core);
}
- Element[] unnamedPathElement = XMLUtilities.getChildren(validation, "unnamed-path");
- if(unnamedPathElement != null) for (int i = 0; i < unnamedPathElement.length; i++) {
- String path = unnamedPathElement[i].getAttribute("path");
- try {
- IPath pathObject = new Path(path);
- addUnnamedResource(pathObject);
- } catch (Exception e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
+ Element el = XMLUtilities.getUniqueChild(validation, "el");
+ if(el != null) {
+ elLinks.load(el);
}
}
@@ -203,4 +237,161 @@
public void registerFile(IFile file) {
registeredResources.add(file);
}
+
+ public static class LinkCollection {
+ private Map<String, Set<IPath>> resourcesByVariableName = new HashMap<String, Set<IPath>>();
+ private Map<IPath, Set<String>> variableNamesByResource = new HashMap<IPath, Set<String>>();
+ private Set<IPath> unnamedResources = new HashSet<IPath>();
+
+ /**
+ * Save link between resource and variable name.
+ * It's needed for incremental validation because we must save all linked resources of changed java file.
+ */
+ public void addLinkedResource(String variableName, IPath linkedResourcePath) {
+ if(linkedResourcePath==null) {
+ throw new RuntimeException("Linked resource path must not be null!");
+ }
+ if(variableName==null) {
+ throw new RuntimeException("Variable name must not be null!");
+ }
+ Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
+ if(linkedResources==null) {
+ // create set of linked resources with variable name.
+ linkedResources = new HashSet<IPath>();
+ resourcesByVariableName.put(variableName, linkedResources);
+ }
+ // save linked resources.
+ linkedResources.add(linkedResourcePath);
+
+ // Save link between resource and variable names. It's needed if variable name changes in resource file.
+ Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByResource.put(linkedResourcePath, variableNames);
+ }
+ variableNames.add(variableName);
+ }
+
+ /**
+ * Removes link between resource and variable name.
+ * @param oldVariableName
+ * @param linkedResourcePath
+ */
+ public void removeLinkedResource(String name, IPath linkedResourcePath) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
+ if(linkedResources!=null) {
+ // remove linked resource.
+ linkedResources.remove(linkedResourcePath);
+ }
+ // Remove link between resource and variable names.
+ Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
+ if(variableNames!=null) {
+ variableNames.remove(name);
+ }
+ }
+
+ /**
+ * Removes link between resources and variable names.
+ * @param linkedResources
+ */
+ public void removeLinkedResources(Set<IPath> resources) {
+ for (IPath resource : resources) {
+ Set<String> resourceNames = variableNamesByResource.get(resource);
+ if(resourceNames!=null) {
+ for (String name : resourceNames) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
+ if(linkedResources!=null) {
+ linkedResources.remove(resource);
+ if(linkedResources.isEmpty()) {
+ resourcesByVariableName.remove(name);
+ }
+ }
+ }
+ }
+ variableNamesByResource.remove(resource);
+ }
+ }
+
+ public Set<IPath> getResourcesByVariableName(String variableName) {
+ return resourcesByVariableName.get(variableName);
+ }
+
+ public Set<String> getVariableNamesByResource(IPath fullPath) {
+ return variableNamesByResource.get(fullPath);
+ }
+
+ /**
+ * Adds resource without any link to any context variable name.
+ * @param fullPath
+ */
+ public void addUnnamedResource(IPath fullPath) {
+ unnamedResources.add(fullPath);
+ }
+
+ /**
+ * @return Set of resources without any link to any context variable name.
+ * @param fullPath
+ */
+ public Set<IPath> getUnnamedResources() {
+ return unnamedResources;
+ }
+
+ /**
+ * Removes unnamed resource.
+ * @param fullPath
+ */
+ public void removeUnnamedResource(IPath fullPath) {
+ unnamedResources.remove(fullPath);
+ }
+
+ public void clearAll() {
+ resourcesByVariableName.clear();
+ variableNamesByResource.clear();
+ unnamedResources.clear();
+ }
+
+ public void store(Element root) {
+ Set<String> variables = resourcesByVariableName.keySet();
+ for (String name: variables) {
+ Set<IPath> paths = resourcesByVariableName.get(name);
+ if(paths == null) continue;
+ for (IPath path: paths) {
+ Element linkedResource = XMLUtilities.createElement(root, "linked-resource");
+ linkedResource.setAttribute("name", name);
+ linkedResource.setAttribute("path", path.toString());
+ }
+ }
+ for (IPath unnamedPath: unnamedResources) {
+ Element unnamedPathElement = XMLUtilities.createElement(root, "unnamed-path");
+ unnamedPathElement.setAttribute("path", unnamedPath.toString());
+ }
+ }
+
+ public void load(Element root) {
+ if(root == null) return;
+ Element[] linkedResources = XMLUtilities.getChildren(root, "linked-resource");
+ if(linkedResources != null) for (int i = 0; i < linkedResources.length; i++) {
+ String name = linkedResources[i].getAttribute("name");
+ if(name == null || name.trim().length() == 0) continue;
+ String path = linkedResources[i].getAttribute("path");
+ if(path == null || path.trim().length() == 0) continue;
+ try {
+ IPath pathObject = new Path(path);
+ addLinkedResource(name, pathObject);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ Element[] unnamedPathElement = XMLUtilities.getChildren(root, "unnamed-path");
+ if(unnamedPathElement != null) for (int i = 0; i < unnamedPathElement.length; i++) {
+ String path = unnamedPathElement[i].getAttribute("path");
+ try {
+ IPath pathObject = new Path(path);
+ addUnnamedResource(pathObject);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-25 14:11:35 UTC (rev 2652)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -1,153 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.validation;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.wst.validation.internal.core.Message;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.ISeamTextSourceReference;
-import org.jboss.tools.seam.core.SeamPreferences;
-import org.jboss.tools.seam.internal.core.SeamProject;
-
-/**
- * Basic seam validator.
- * @author Alexey Kazakov
- */
-public abstract class SeamValidator implements IValidatorJob {
-
- protected static final String MARKED_SEAM_RESOURCE_MESSAGE_GROUP = "markedSeamCoreResource";
-
- protected static final String NONUNIQUE_COMPONENT_NAME_MESSAGE_ID = "NONUNIQUE_COMPONENT_NAME_MESSAGE";
- protected static final String UNKNOWN_VARIABLE_NAME_MESSAGE_ID = "UNKNOWN_VARIABLE_NAME";
- protected static final String STATEFUL_COMPONENT_DOES_NOT_CONTAIN_METHOD_SUFIX_MESSAGE_ID = "STATEFUL_COMPONENT_DOES_NOT_CONTAIN_";
- protected static final String DUPLICATE_METHOD_PREFIX_MESSAGE_ID = "DUPLICATE_";
- protected static final String REMOVE_METHOD_SUFIX_MESSAGE_ID = "REMOVE";
- protected static final String DESTROY_METHOD_SUFIX_MESSAGE_ID = "DESTROY";
- protected static final String CREATE_METHOD_SUFIX_MESSAGE_ID = "CREATE";
- protected static final String UNWRAP_METHOD_SUFIX_MESSAGE_ID = "UNWRAP";
- protected static final String OBSERVER_METHOD_SUFIX_MESSAGE_ID = "OBSERVER";
- protected static final String NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID = "_DOESNT_BELONG_TO_COMPONENT";
- protected static final String STATEFUL_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "STATEFUL_COMPONENT_WRONG_SCOPE";
- protected static final String ENTITY_COMPONENT_WRONG_SCOPE_MESSAGE_ID = "ENTITY_COMPONENT_WRONG_SCOPE";
- protected static final String UNKNOWN_FACTORY_NAME_MESSAGE_ID = "UNKNOWN_FACTORY_NAME";
- protected static final String MULTIPLE_DATA_BINDER_MESSAGE_ID = "MULTIPLE_DATA_BINDER";
- protected static final String DUPLICATE_VARIABLE_NAME_MESSAGE_ID = "DUPLICATE_VARIABLE_NAME";
- protected static final String UNKNOWN_DATA_MODEL_MESSAGE_ID = "UNKNOWN_DATA_MODEL";
- protected static final String UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID = "UNKNOWN_COMPONENT_CLASS_NAME";
- protected static final String UNKNOWN_COMPONENT_PROPERTY_MESSAGE_ID = "UNKNOWN_COMPONENT_PROPERTY";
- protected static final String INVALID_EXPRESSION_MESSAGE_ID = "INVALID_EXPRESSION";
- protected static final String UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID = "UNPAIRED_GETTER_OR_SETTER";
-
- protected SeamValidationHelper coreHelper;
- protected IReporter reporter;
- protected SeamValidationContext validationContext;
-
- protected ISeamProject project;
-
- public SeamValidator() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext)
- */
- public ISchedulingRule getSchedulingRule(IValidationContext helper) {
- return null;
- }
-
- public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
- this.coreHelper = (SeamValidationHelper)helper;
- this.reporter = reporter;
- this.project = coreHelper.getSeamProject();
- IStatus status = null;
- try {
- this.validationContext = ((SeamProject)project).getValidationContext();
- Set<IFile> changedFiles = coreHelper.getChangedFiles();
- if(changedFiles.size()>0) {
- status = validate(changedFiles);
- } else {
- status = validateAll();
- }
- } finally {
- validationContext.getRemovedFiles().clear();
- validationContext.getRegisteredFiles().clear();
- }
- return status;
- }
-
- /**
- * Incremental Validation
- * @return
- * @throws ValidationException
- */
- abstract public IStatus validate(Set<IFile> changedFiles) throws ValidationException;
-
- /**
- * Full Validation
- * @return
- * @throws ValidationException
- */
- abstract public IStatus validateAll() throws ValidationException;
-
- public void cleanup(IReporter reporter) {
- reporter = null;
- }
-
- public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
- validateInJob(helper, reporter);
- }
-
- protected String getBaseName() {
- return "org.jboss.tools.seam.internal.core.validation.messages";
- }
-
- protected void addError(String messageId, String preferenceKey, String[] messageArguments, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(messageId, preferenceKey, messageArguments, location.getLength(), location.getStartPosition(), target, messageGroup);
- }
-
- protected void addError(String messageId, String preferenceKey, ISeamTextSourceReference location, IResource target, String messageGroup) {
- addError(messageId, preferenceKey, new String[0], location, target, messageGroup);
- }
-
- protected void addError(String messageId, String preferenceKey, String[] messageArguments, int length, int offset, IResource target, String messageGroup) {
- String preferenceValue = SeamPreferences.getProjectPreference(project, preferenceKey);
- boolean ignore = false;
- int messageSeverity = IMessage.HIGH_SEVERITY;
- if(SeamPreferences.WARNING.equals(preferenceValue)) {
- messageSeverity = IMessage.NORMAL_SEVERITY;
- } else if(SeamPreferences.IGNORE.equals(preferenceValue)) {
- ignore = true;
- }
-
- IMessage message = new Message(getBaseName(), messageSeverity, messageId, messageArguments, target, messageGroup);
- message.setLength(length);
- message.setOffset(offset);
- if(!ignore) {
- reporter.addMessage(this, message);
- }
- }
-
- protected void removeMessagesFromResources(Set<IResource> resources, String messageGroup) {
- for (IResource r : resources) {
- reporter.removeMessageSubset(this, r, messageGroup);
- }
- }
-}
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -0,0 +1,82 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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.seam.internal.core.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamTextSourceReference;
+import org.jboss.tools.seam.core.SeamPreferences;
+
+/**
+ * Abstract implementation of ISeamvalidator
+ * @author Alexey Kazakov
+ */
+public abstract class SeamValidator implements ISeamValidator {
+
+ IStatus OK_STATUS = new Status(IStatus.OK, "org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
+
+ protected SeamValidatorManager validationManager;
+ protected SeamValidationHelper coreHelper;
+ protected IReporter reporter;
+ protected SeamValidationContext validationContext;
+ protected ISeamProject project;
+
+ public SeamValidator(SeamValidatorManager validatorManager, SeamValidationHelper coreHelper, IReporter reporter, SeamValidationContext validationContext, ISeamProject project) {
+ this.validationManager = validatorManager;
+ this.coreHelper = coreHelper;
+ this.project = project;
+ this.reporter = reporter;
+ this.validationContext = validationContext;
+ }
+
+ protected String getBaseName() {
+ return "org.jboss.tools.seam.internal.core.validation.messages";
+ }
+
+ protected void addError(String messageId, String preferenceKey, String[] messageArguments, ISeamTextSourceReference location, IResource target) {
+ addError(messageId, preferenceKey, messageArguments, location.getLength(), location.getStartPosition(), target);
+ }
+
+ protected void addError(String messageId, String preferenceKey, ISeamTextSourceReference location, IResource target) {
+ addError(messageId, preferenceKey, new String[0], location, target);
+ }
+
+ protected void addError(String messageId, String preferenceKey, String[] messageArguments, int length, int offset, IResource target) {
+ String preferenceValue = SeamPreferences.getProjectPreference(project, preferenceKey);
+ boolean ignore = false;
+ int messageSeverity = IMessage.HIGH_SEVERITY;
+ if(SeamPreferences.WARNING.equals(preferenceValue)) {
+ messageSeverity = IMessage.NORMAL_SEVERITY;
+ } else if(SeamPreferences.IGNORE.equals(preferenceValue)) {
+ ignore = true;
+ }
+
+ IMessage message = new Message(getBaseName(), messageSeverity, messageId, messageArguments, target, ISeamValidator.MARKED_SEAM_RESOURCE_MESSAGE_GROUP);
+ message.setLength(length);
+ message.setOffset(offset);
+ if(!ignore) {
+ reporter.addMessage(validationManager, message);
+ }
+ }
+
+ protected void removeMessagesFromResources(Set<IResource> resources, String messageGroup) {
+ for (IResource r : resources) {
+ reporter.removeMessageSubset(validationManager, r, messageGroup);
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java (from rev 2650, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidator.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidatorManager.java 2007-07-25 15:18:25 UTC (rev 2653)
@@ -0,0 +1,105 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.internal.core.SeamProject;
+
+/**
+ * This Manager invokes all dependent seam validators that should be invoked in one job.
+ * We need this one because wst validation framework does not let us invoke
+ * dependent validators in the same job.
+ * @author Alexey Kazakov
+ */
+public class SeamValidatorManager implements IValidatorJob {
+
+ public SeamValidatorManager() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext)
+ */
+ public ISchedulingRule getSchedulingRule(IValidationContext helper) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
+ SeamValidationHelper coreHelper = (SeamValidationHelper)helper;
+ ISeamProject project = coreHelper.getSeamProject();
+ SeamValidationContext validationContext = ((SeamProject)project).getValidationContext();
+ IStatus status = null;
+ try {
+ ISeamValidator coreValidator = new SeamCoreValidator(this, coreHelper, reporter, validationContext, project);
+ ISeamValidator elValidator = new SeamELValidator(this, coreHelper, reporter, validationContext, project);
+ ISeamValidator[] validators = new ISeamValidator[]{coreValidator, elValidator};
+
+ Set<IFile> changedFiles = coreHelper.getChangedFiles();
+ if(changedFiles.size()>0) {
+ status = validate(validators, changedFiles);
+ } else {
+ reporter.removeAllMessages(this);
+ validationContext.clearAllResourceLinks();
+ status = validateAll(validators);
+ }
+ } finally {
+ validationContext.clearRegisteredFiles();
+ }
+ return status;
+ }
+
+ private IStatus validate(ISeamValidator[] validator, Set<IFile> changedFiles) throws ValidationException {
+ for (int i = 0; i < validator.length; i++) {
+ if(validator[i].isEnabled()) {
+ validator[i].validate(changedFiles);
+ }
+ }
+ return OK_STATUS;
+ }
+
+ private IStatus validateAll(ISeamValidator[] validator) throws ValidationException {
+ for (int i = 0; i < validator.length; i++) {
+ if(validator[i].isEnabled()) {
+ validator[i].validateAll();
+ }
+ }
+ return OK_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void cleanup(IReporter reporter) {
+ reporter = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#validate(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
+ validateInJob(helper, reporter);
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2652 - in trunk/documentation/GettingStartedGuide/docs/userguide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sabrashevich
Date: 2007-07-25 10:11:35 -0400 (Wed, 25 Jul 2007)
New Revision: 2652
Added:
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/Buttons.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/chooselanguage.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/choosinglocation.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/definingnewjbossserver.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/ejbprofile.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/installationtype.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/jbossruntime.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/licenseagreement.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/selectingpacks.png
trunk/documentation/GettingStartedGuide/docs/userguide/en/images/servertype.png
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
Log:
http://jira.jboss.com/jira/browse/EXIN-401 a "Manage JBoss AS from Red Hat Developer Studio" chapter is added
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/Buttons.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/Buttons.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/chooselanguage.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/chooselanguage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/choosinglocation.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/choosinglocation.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/definingnewjbossserver.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/definingnewjbossserver.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/ejbprofile.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/ejbprofile.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/installationtype.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/installationtype.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/jbossruntime.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/jbossruntime.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/licenseagreement.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/licenseagreement.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/selectingpacks.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/selectingpacks.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/servertype.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/GettingStartedGuide/docs/userguide/en/images/servertype.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-25 11:24:28 UTC (rev 2651)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/ManageJBossAS.xml 2007-07-25 14:11:35 UTC (rev 2652)
@@ -1,16 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="ManageJBossAS" xreflabel="ManageJBossAS">
- <?dbhtml filename="ManageJBossAS.html"?>
+<chapter id="ManageJBossASFromRedHatDeveloperStudio" xreflabel="ManageJBossASFromRedHatDeveloperStudio">
+ <?dbhtml filename="ManageJBossASFromRedHatDeveloperStudio.html"?>
<chapterinfo>
<keywordset>
<keyword>Red Hat Developer Studio</keyword>
<keyword>Eclipse</keyword>
- <keyword>Java</keyword>
+ <keyword>Deploy</keyword>
+ <keyword>Deployment</keyword>
<keyword>JBoss</keyword>
- <keyword>JBoss AS</keyword>
</keywordset>
</chapterinfo>
<title>Manage JBoss AS from Red Hat Developer Studio</title>
+ <section id="JBossInstalling">
+ <?dbhtml filename="JBossInstalling.html"?>
+ <title>JBoss AS Installation</title>
+ <para>If you followed the default installation of Red Hat Developer Studio, you will already have a JBoss 4.2 server installed and defined. You have to do nothing to deploy your project. Just start JBoss server using a JBoss icon from command panel and launch your application. Registration to default JBoss AS is being done when you are creating an appication, in the second screen of wizard called "Web" ("Target Server" section). Simply do not uncheck the control in this section.</para>
+<para>Besides that you can deploy your application to some servers that Red Hat Developer Studio supports directly (through the bundled Eclipse WTP plug-ins). Say you want to deploy the application to JBoss 4.0.5 server. First of all you need to install it.</para>
+<orderedlist>
+<listitem><para>Download the installation pack of JBoss 4.0.5 and save it on your computer: <ulink url="http://labs.jboss.com/jbossas/downloads">http://labs.jboss.com/jbossas/downloads</ulink></para></listitem>
+<listitem><para>Double-click this file or launch the installation from terminal like this:</para></listitem>
+</orderedlist>
+<programlisting role="JAVA"><![CDATA[java -jar jems.installer-1.2.0.GA.jar
+]]></programlisting>
+<para>This will start the installation wizard and in the first window you will be proposed to choose the language for installing instructions:</para>
+<figure>
+<title>Choose your language</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/chooselanguage.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
-</chapter>
+<orderedlist continuation="continues">
+<listitem><para>Choose preferred language and click OK. In the next two dialogs click the Next button.</para></listitem>
+<listitem><para>In the following window accept the license agreement and press the Next button.</para></listitem>
+</orderedlist>
+<figure>
+<title>Accept the license</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/licenseagreement.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>Choose the place where JBoss server will be installed and click Next.</para></listitem>
+</orderedlist>
+
+<figure>
+<title>Choosing installation path</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/choosinglocation.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>On the next step select EJB profile.</para></listitem>
+</orderedlist>
+
+<figure>
+<title>Selecting EJB profile</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/ejbprofile.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+
+<orderedlist continuation="continues">
+<listitem><para>In the following window choose packs you want to be installed and click Next.</para></listitem>
+</orderedlist>
+
+<figure>
+<title>Selecting installing packs</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/selectingpacks.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>Then select installation type (advanced or standard):</para></listitem>
+</orderedlist>
+
+<figure>
+<title>Selecting installation type</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/installationtype.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>When all this is done you will see the information dialog with installation settings. Click the Next button to start installation.</para></listitem>
+</orderedlist>
+<orderedlist continuation="continues">
+<listitem><para>After installation process is complete click the button Next > Done.</para></listitem>
+</orderedlist>
+<para>That's it. JBoss server is installed. Now you should add it to server manager in Red Hat Developer Studio.</para>
+</section>
+
+ <section id="AddingJBossServer">
+ <?dbhtml filename="AddingJBossServer.html"?>
+ <title>Adding and configuring JBoss server</title>
+ <para>Now we should add just installed server into server manager in Red Hat Developer Studio.</para>
+ <orderedlist>
+ <listitem><para>In the main menu select Window > Preferences > Server > Installed Runtimes.</para></listitem>
+ <listitem><para>Click the Add button to add a new server.</para></listitem>
+ </orderedlist>
+ <figure>
+<title>Selecting server type</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/servertype.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+ <orderedlist continuation="continues">
+<listitem><para>In the dialog that appeared choose JBoss > JBoss v4.0 and click Next.</para></listitem>
+</orderedlist>
+<figure>
+<title>Defining JBoss Runtime</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/jbossruntime.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+
+<orderedlist continuation="continues">
+<listitem><para>In the next step locate the place where you have installed the server and click the Finish button.</para></listitem>
+</orderedlist>
+<para>After that JBoss server should appear in "Installed server runtimes" section.</para>
+<orderedlist continuation="continues">
+<listitem><para>Close this window by clicking OK.</para></listitem>
+<listitem><para>Open the Servers View by selecting Window > Show View > Other > Server > Servers. You will see Servers view.</para></listitem>
+<listitem><para>Right click anywhere in this view and select New > Server.</para></listitem>
+<listitem><para>Select JBoss, a division of Red Hat > JBoss AS 4.0 and press Next.</para></listitem>
+</orderedlist>
+
+<figure>
+<title>Defining new JBoss server</title>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/definingnewjbossserver.png"/>
+ </imageobject>
+</mediaobject>
+</figure>
+<orderedlist continuation="continues">
+<listitem><para>Give a name to the server, locate its home directory and define JRE.
+<note>
+ <title>Note:</title>
+ <para>When adding a new server you will need to specify what JRE to use. It is important to set this value to a full JDK, not JRE. Again, you need a full JDK to run Web applications, JRE will not be enough.</para>
+ </note>
+</para></listitem>
+</orderedlist>
+ </section>
+ </chapter>
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r2651 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-07-25 07:24:28 -0400 (Wed, 25 Jul 2007)
New Revision: 2651
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
Log:
Loading of entity recognizers improved.
Old algorithm immediately created instances
of recognizers, and while loading processed
queries incorrectly, which could
cause ClassCastException.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2007-07-25 09:37:08 UTC (rev 2650)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2007-07-25 11:24:28 UTC (rev 2651)
@@ -18,10 +18,11 @@
public class ModelEntityRecognizer implements EntityRecognizer {
private XModelMetaData meta = null;
- private HashMap<String,Object> ext_rec = new HashMap<String,Object>();
- private HashMap<String,EntityRecognizer> cls_rec = new HashMap<String,EntityRecognizer>();
+ private HashMap<String,EntityRecognizer[]> recognizers = new HashMap<String,EntityRecognizer[]>();
public ModelEntityRecognizer() {}
+
+ boolean loaded = false;
public void setMetaData(XModelMetaData meta) {
if(this.meta != null) return;
@@ -31,7 +32,7 @@
public String getEntityName(String ext, String body) {
if(ext != null) ext = ext.toLowerCase();
- EntityRecognizer[] list = (EntityRecognizer[])ext_rec.get(ext);
+ EntityRecognizer[] list = recognizers.get(ext);
if(list == null || list.length == 0) return "FileAny";
for (int i = 0; i < list.length; i++) {
String n = list[i].getEntityName(ext, body);
@@ -43,44 +44,45 @@
private void load() {
XMapping m = meta.getMapping("Recognizers");
if(m == null) return;
+ HashMap<String,RL> ext_list = new HashMap<String,RL>();
+ HashMap<String,EntityRecognizer> cls_recw = new HashMap<String,EntityRecognizer>();
String[] keys = m.getKeys();
for (int i = 0; i < keys.length; i++) {
String k = keys[i];
- EntityRecognizer r = find(m.getValue(k));
- if(r == null) continue;
+ String clsname = m.getValue(k);
+ if(clsname == null || clsname.trim().length() == 0) continue;
+ EntityRecognizer r = cls_recw.get(clsname);
+ if(r == null) {
+ r = new EntityRecognizerWrapper(clsname);
+ cls_recw.put(clsname, r);
+ }
+
int d = k.indexOf('$');
String ext = (d < 0) ? k : k.substring(0, d);
- RL rl = findList(ext);
+ RL rl = ext_list.get(ext);
+ if(rl == null) {
+ rl = new RL();
+ ext_list.put(ext, rl);
+ }
int p = (d < 0) ? 0 : parsePriority(k.substring(d + 1));
rl.add(r, p);
}
- String[] ks = (String[])ext_rec.keySet().toArray(new String[0]);
+ String[] ks = ext_list.keySet().toArray(new String[0]);
for (int i = 0; i < ks.length; i++) {
- RL rl = (RL)ext_rec.get(ks[i]);
+ RL rl = ext_list.get(ks[i]);
EntityRecognizer[] rs = rl.list();
- if(rs.length == 0) ext_rec.remove(ks[i]);
- else ext_rec.put(ks[i], rs);
+ ext_list.remove(ks[i]);
+ if(rs.length > 0) {
+ recognizers.put(ks[i], rs);
+ }
}
}
-
- private RL findList(String ext) {
- RL rl = (RL)ext_rec.get(ext);
- if(rl == null) {
- rl = new RL();
- ext_rec.put(ext, rl);
- }
- return rl;
- }
-
+
private EntityRecognizer find(String clsname) {
- EntityRecognizer r = (EntityRecognizer)cls_rec.get(clsname);
- if(r != null) return r;
try {
- r = (EntityRecognizer)ModelFeatureFactory.getInstance().createFeatureInstance(clsname);
- cls_rec.put(clsname, r);
- return r;
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError("ModelEntityRecognizer:Cannot load recognizer " + clsname);
+ return (EntityRecognizer)ModelFeatureFactory.getInstance().createFeatureInstance(clsname);
+ } catch (ClassCastException e) {
+ ModelPlugin.getPluginLog().logError("Entity recognizer " + clsname + " must be instanceof EntityRecognizer", e);
}
return null;
}
@@ -110,7 +112,7 @@
private R resolve(EntityRecognizer r, int p) {
for (int i = 0; i < v.size(); i++) {
- R x = (R)v.elementAt(i);
+ R x = v.elementAt(i);
if(x.r != r) continue;
if(p < x.p) x.p = p;
v.removeElement(x);
@@ -138,6 +140,23 @@
this.p = p;
}
}
+
+ private class EntityRecognizerWrapper implements EntityRecognizer {
+ String clsname;
+ EntityRecognizer resolved;
+
+ public EntityRecognizerWrapper(String clsname) {
+ this.clsname = clsname;
+ }
+ public String getEntityName(String ext, String body) {
+ if(resolved == null && clsname != null) {
+ resolved = find(clsname);
+ clsname = null;
+ }
+ return (resolved != null) ? resolved.getEntityName(ext, body) : null;
+ }
+ }
+
}
17 years, 5 months
JBoss Tools SVN: r2650 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-07-25 05:37:08 -0400 (Wed, 25 Jul 2007)
New Revision: 2650
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-586
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-25 09:02:07 UTC (rev 2649)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-25 09:37:08 UTC (rev 2650)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.editor.bundle;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -32,17 +33,16 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.ELParser;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
+import org.jboss.tools.vpe.VpePlugin;
public class BundleMap {
// private static final String BEGIN_BUNDLE = "#{";
@@ -202,8 +202,8 @@
try {
file = new File(javaSources[i]).getCanonicalFile();
urls[i] = file.toURL();
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
+ } catch (IOException ioe) {
+ VpePlugin.reportProblem(ioe);
return null;
}
}
@@ -214,10 +214,8 @@
}
} catch (MissingResourceException ex) {
// Ignore this exception
- }
- catch(Exception e) {
- VpePlugin.getPluginLog().logError(e);
}
+
return null;
}
17 years, 5 months
JBoss Tools SVN: r2649 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2007-07-25 05:02:07 -0400 (Wed, 25 Jul 2007)
New Revision: 2649
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-586 add ignore MissingResourceException
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-25 08:40:20 UTC (rev 2648)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-25 09:02:07 UTC (rev 2649)
@@ -19,6 +19,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
@@ -211,7 +212,10 @@
return bundle;
}
- } catch(Exception e) {
+ } catch (MissingResourceException ex) {
+ // Ignore this exception
+ }
+ catch(Exception e) {
VpePlugin.getPluginLog().logError(e);
}
return null;
17 years, 5 months
JBoss Tools SVN: r2648 - in trunk: seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-25 04:40:20 -0400 (Wed, 25 Jul 2007)
New Revision: 2648
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
Log:
http://jira.jboss.org/jira/browse/EXIN-221
creating ear seam project
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/PostInstallJsfFacetDelegate.java 2007-07-25 08:40:20 UTC (rev 2648)
@@ -0,0 +1,92 @@
+package org.jboss.tools.jsf.project.facet;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class PostInstallJsfFacetDelegate implements IDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ writeXModel(project);
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ EclipseResourceUtil.addNatureToProject(project, "org.jboss.tools.jsf.jsfnature");
+ }
+
+ private void writeXModel(IProject project) {
+ String projectName = project.getName();
+ String webContent = "WebContent";
+
+ IVirtualComponent com = ComponentCore.createComponent(project);
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+
+ webContent = folder.getLocation().lastSegment();
+
+ if(webContent == null) {
+ webContent = "WebContent";
+ }
+ String src = "src";
+
+ String[] srcs = EclipseResourceUtil.getJavaProjectSrcLocations(project);
+ if (srcs.length > 0) {
+ src = srcs[0].replace('\\','/').substring(srcs[0].lastIndexOf('/') + 1);
+ }
+ File location = new File(project.getLocation().toFile(),".settings/org.jboss.tools.jst.web.xml");
+
+ Object[] arguments = {
+ projectName,
+ webContent,
+ src
+ };
+ String body = MessageFormat.format(XMODEL, arguments);
+
+ org.jboss.tools.common.util.FileUtil.writeFile(location, body);
+ }
+
+ /**
+ * {0} - project name
+ * {1} - WebContent folder name
+ * {2} - src folder name
+ */
+ private static String XMODEL =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<FILESYSTEMS APPLICATION_NAME=\"{0}\" ENTITY=\"FileSystems\"" +
+ " VERSION=\"2.0.0\" WORKSPACE_HOME=\"./{1}/WEB-INF\">" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\" LOCATION=\"%redhat.workspace%\" NAME=\"WEB-INF\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\" INFO=\"Content-Type=Web\"" +
+ " LOCATION=\"%redhat.workspace%/..\" NAME=\"WEB-ROOT\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
+ " LOCATION=\"%redhat.workspace%/../../{2}\" NAME=\"src\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\" LOCATION=\"%redhat.workspace%/lib\" NAME=\"lib\"/>" +
+ "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
+ " LOCATION=\"%redhat.workspace%/classes\" NAME=\"classes\"/>" +
+ "<WEB ENTITY=\"JstWeb\" MODEL_PATH=\"/web.xml\" SERVLET_VERSION=\"2.4\">" +
+ " <MODULE ENTITY=\"WebJSFModule\" MODEL_PATH=\"/faces-config.xml\"" +
+ " ROOT=\"WEB-ROOT\" SRC=\"src\" URI=\"/WEB-INF/faces-config.xml\"/>" +
+ "</WEB>" +
+ "</FILESYSTEMS>"
+ ;
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.component 2007-07-25 08:40:20 UTC (rev 2648)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="@projectName@">
+<wb-resource deploy-path="/" source-path="/EarContent"/>
+<dependent-module deploy-path="/" handle="module:/resource/@projectName@-ejb/@projectName@-ejb">
+<dependency-type>uses</dependency-type>
+</dependent-module>
+<dependent-module deploy-path="/" handle="module:/resource/@projectName@/@projectName@">
+<dependency-type>uses</dependency-type>
+</dependent-module>
+</wb-module>
+</project-modules>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/application.xml 2007-07-25 08:40:20 UTC (rev 2648)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application 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/application_5.xsd"
+ version="5">
+
+ <display-name>t2</display-name>
+
+ <module>
+ <web>
+ <web-uri>@projectName@.war</web-uri>
+ <context-root>/@projectName@</context-root>
+ </web>
+ </module>
+
+ <module>
+ <ejb>@projectName(a)-ejb.jar</ejb>
+ </module>
+
+ <!-- Seam and EL -->
+ <module>
+ <java>jboss-seam.jar</java>
+ </module>
+
+ <!-- jBPM -->
+ <module>
+ <java>jbpm-3.1.4.jar</java>
+ </module>
+
+ <!-- Drools and dependencies -->
+ <module>
+ <java>drools-core-3.0.5.jar</java>
+ </module>
+ <module>
+ <java>drools-compiler-3.0.5.jar</java>
+ </module>
+ <module>
+ <java>janino-2.4.3.jar</java>
+ </module>
+ <module>
+ <java>antlr-2.7.6.jar</java>
+ </module>
+ <module>
+ <java>antlr-3.0ea8.jar</java>
+ </module>
+ <module>
+ <java>commons-jci-core-1.0-406301.jar</java>
+ </module>
+ <module>
+ <java>commons-jci-janino-2.4.3.jar</java>
+ </module>
+ <module>
+ <java>stringtemplate-2.3b6.jar</java>
+ </module>
+
+</application>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.component 2007-07-25 08:40:20 UTC (rev 2648)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="@projectName@-ejb">
+<wb-resource deploy-path="/" source-path="/ejbModule"/>
+<property name="java-output-path" value="build/classes"/>
+</wb-module>
+</project-modules>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-07-25 08:40:20 UTC (rev 2648)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path: jboss-seam.jar
17 years, 5 months
JBoss Tools SVN: r2647 - in trunk: jsf/plugins/org.jboss.tools.jsf and 23 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-07-25 04:39:40 -0400 (Wed, 25 Jul 2007)
New Revision: 2647
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/facet/
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.project
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/EarContent/META-INF/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.classpath
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.project
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.jdt.core.prefs
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam16.png
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/sample.gif
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_jsp_file.gif
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/build.properties
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
trunk/struts/plugins/org.jboss.tools.struts.ui/images/xstudio/wizards/new_jsp_file.gif
Log:
http://jira.jboss.org/jira/browse/EXIN-221
creating ear seam project
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -234,7 +234,7 @@
}
resource.refreshLocal(IResource.DEPTH_ONE, null);
} catch (Exception e) {
- ModelPlugin.getPluginLog().logError("Exception caught in FolderImpl.update()");
+ ModelPlugin.getPluginLog().logError("Exception caught in FolderImpl.update()",e);
} finally {
fsi.unlockUpdate();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2007-07-25 08:39:40 UTC (rev 2647)
@@ -43,7 +43,10 @@
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.wst.web,
- org.eclipse.jdt.core.manipulation
+ org.eclipse.jdt.core.manipulation,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.wst.common.modulecore
Bundle-Version: 2.0.0
Eclipse-LazyStart: true
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2007-07-25 08:39:40 UTC (rev 2647)
@@ -1908,5 +1908,16 @@
<xclass id="org.jboss.tools.jsf.model.helpers.autolayout.JSFItems"
class="org.jboss.tools.jsf.model.helpers.autolayout.JSFItems"/>
</extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <event-handler
+ facet="jst.jsf"
+ type="PRE_INSTALL"
+ version="[1.1">
+ <delegate
+ class="org.jboss.tools.jsf.project.facet.PostInstallJsfFacetDelegate">
+ </delegate>
+ </event-handler>
+ </extension>
-</plugin>
\ No newline at end of file
+</plugin>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_jsp_file.gif
===================================================================
(Binary files differ)
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-25 08:39:40 UTC (rev 2647)
@@ -25,6 +25,7 @@
org.eclipse.jst.j2ee,
org.eclipse.jst.ws,
org.eclipse.jface.text,
+ org.eclipse.jdt.launching,
org.eclipse.wst.sse.core,
org.eclipse.wst.xml.core
Provide-Package: org.jboss.tools.seam.core,
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/build.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/build.properties 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/build.properties 2007-07-25 08:39:40 UTC (rev 2647)
@@ -2,5 +2,12 @@
bin.includes = plugin.xml,\
META-INF/,\
seam-core.jar,\
- plugin.properties
+ plugin.properties,\
+ templates/
jars.compile.order = seam-core.jar
+src.includes = templates/,\
+ src/,\
+ plugin.xml,\
+ plugin.properties,\
+ build.properties,\
+ META-INF/
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-25 08:39:40 UTC (rev 2647)
@@ -224,4 +224,4 @@
</persistent>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -106,13 +106,15 @@
//ignore - all checks are done above
return null;
}
- try {
- ISeamProject seamProject = (ISeamProject)project.getNature(ISeamProject.NATURE_ID);
- if(resolve) seamProject.resolve();
- return seamProject;
- } catch (Exception e) {
- getPluginLog().logError(e);
- }
+
+ ISeamProject seamProject;
+ try {
+ seamProject = (ISeamProject)project.getNature(ISeamProject.NATURE_ID);
+ if(resolve) seamProject.resolve();
+ return seamProject;
+ } catch (CoreException e) {
+ getPluginLog().logError(e);
+ }
return null;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
@@ -117,7 +118,7 @@
id = s.id;
resource = s.resource;
- return null;
+ return new ArrayList<Change>();
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/AntCopyUtils.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -10,18 +10,16 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
+import java.io.FileFilter;
import java.io.IOException;
-import java.util.Properties;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
-import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.ResourceUtils;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDelegete.FileSetFileFilter;
/**
*
@@ -30,12 +28,114 @@
*/
public class AntCopyUtils {
+ public static class FileSet {
+
+ File dir = null;
+
+ List<Pattern> include = new ArrayList<Pattern>();
+
+ List<Pattern> exclude = new ArrayList<Pattern>();
+
+ public FileSet(String dir) {
+ this.dir = new File(dir);
+ }
+
+ public FileSet(File dir) {
+ this.dir = dir;
+ }
+
+ public FileSet(FileSet template) {
+ addTemplate(template);
+ }
+
+ public void addTemplate(FileSet template){
+ include.addAll(template.getIncluded());
+ exclude.addAll(template.getExcluded());
+ }
+
+ public FileSet() {
+
+ }
+
+ public FileSet add(FileSet set) {
+ addTemplate(set);
+ return this;
+ }
+
+ public FileSet dir(String dir) {
+ this.dir = new File(dir);
+ return this;
+ }
+
+ public FileSet dir(File dir) {
+ this.dir = dir;
+ return this;
+ }
+
+ public FileSet include(String pattern) {
+ include.add(Pattern.compile(pattern));
+ return this;
+
+ }
+
+ public FileSet exclude(String pattern) {
+ exclude.add(Pattern.compile(pattern));
+ return this;
+ }
+
+ public boolean isIncluded(String file) {
+ int i = dir.getAbsolutePath().length()+1;
+ String relatedPath = file.substring(i);
+ if(new File(file).isDirectory())return true;
+ for (Pattern pattern : include) {
+ if(pattern.matcher(relatedPath.replace('\\', '/')).matches() ) {
+ return !isExcluded(relatedPath);
+ }
+ }
+ return false;
+ }
+
+ public boolean isExcluded(String file){
+ for (Pattern pattern : exclude) {
+ if(pattern.matcher(file.replace('\\', '/')).matches()) return true;
+ }
+ return false;
+ }
+
+ public List<Pattern> getExcluded() {
+ return Collections.unmodifiableList(exclude);
+ }
+
+ public List<Pattern> getIncluded() {
+ return Collections.unmodifiableList(include);
+ }
+
+ /**
+ * @return
+ */
+ public File getDir() {
+ return dir;
+ }
+ }
+
+ public static class FileSetFileFilter implements FileFilter {
+
+ FileSet set;
+ public FileSetFileFilter(FileSet set) {
+ this.set = set;
+ }
+
+ public boolean accept(File pathname){
+ return set.isIncluded(pathname.getAbsolutePath());
+ }
+ }
+
public static void copyFilesAndFolders(File sourceFolder, File destinationFolder, FilterSetCollection set, boolean override) {
- copyFilesAndFolders(sourceFolder, destinationFolder, null, set, override);
+ copyFilesAndFolders(sourceFolder, destinationFolder,null, set, override);
}
public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
- FileSetFileFilter fileSetFilter,
+ AntCopyUtils.FileSetFileFilter fileSetFilter,
FilterSetCollection filterSetCollection, boolean override) {
File[] files = fileSetFilter==null?sourceFolder.listFiles():sourceFolder.listFiles(fileSetFilter);
for (File file : files) {
@@ -65,6 +165,7 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
+
public static void copyFileToFile(File source, File dest, FilterSetCollection filterSetCollection, boolean override ) {
try {
FileUtils.getFileUtils().copyFile(source, dest,filterSetCollection,override);
@@ -72,4 +173,16 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
+
+ public static void copyFiles(File source, File dest, FileFilter filter) {
+ dest.mkdir();
+ for (File file:source.listFiles(filter)) {
+ if(file.isDirectory())continue;
+ try {
+ FileUtils.getFileUtils().copyFile(file, new File(dest,file.getName()),new FilterSetCollection(),true);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -11,9 +11,6 @@
package org.jboss.tools.seam.internal.core.project.facet;
-import java.util.HashMap;
-import java.util.Map;
-
import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
/**
@@ -23,7 +20,7 @@
*/
public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
- public static final String SEAM_PROJECT_NAME = "seam.project.name";
+ public static final String SEAM_PROJECT_NAME = "project.name";
public static final String SEAM_PROJECT_INSTANCE = "seam.project.instance";
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -10,12 +10,16 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+import org.jboss.tools.seam.core.SeamCorePlugin;
/**
* Data model provider for Seam facet wizard page
@@ -82,4 +86,8 @@
}
return super.getDefaultProperty(propertyName);
}
+
+ public static File getTemplatesFolder() throws IOException {
+ return new File(FileLocator.resolve(Platform.getBundle(SeamCorePlugin.PLUGIN_ID).getEntry("/templates")).getPath());
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -11,24 +11,21 @@
package org.jboss.tools.seam.internal.core.project.facet;
import java.io.File;
-import java.io.FileFilter;
import java.io.IOException;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
import org.apache.tools.ant.types.FilterSet;
import org.apache.tools.ant.types.FilterSetCollection;
-import org.apache.tools.ant.util.FileUtils;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -39,12 +36,14 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.SeamResourceVisitor;
public class SeamFacetInstallDelegete extends Object implements IDelegate {
- public static String PROFILE = "dev-war";
+ public static String DEV_WAR_PROFILE = "dev-war";
+ public static String DEV_EAR_PROFILE = "dev";
- public static FileSet TOMCAT_WAR_LIB_FILESET = new FileSet()
+ public static AntCopyUtils.FileSet TOMCAT_WAR_LIB_FILESET = new AntCopyUtils.FileSet()
.include("activation\\.jar")
.include("ajax4jsf*.\\.jar")
.include("commons-beanutils.*\\.jar")
@@ -76,10 +75,9 @@
.include("spring\\.jar")
.include("thirdparty-all\\.jar");
- public static FileSet JBOSS_WAR_LIB_FILESET = new FileSet()
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_WAR_CONFIG = new AntCopyUtils.FileSet()
.include("ajax4jsf.*\\.jar")
.include("antlr.*\\.jar")
- .include("antlr.*\\.jar")
.include("commons-beanutils.*\\.jar")
.include("commons-collections.*\\.jar")
.include("commons-digester.*\\.jar")
@@ -101,13 +99,37 @@
.include("stringtemplate.*\\.jar")
.include("testng-.*\\.jar");
- public static FileSet EAR_LIB_FILESET = new FileSet()
- .include("jboss-aop-jdk50\\.jar")
- .include("jboss-cache-jdk50\\.jar")
- .include("jboss-seam\\.jar")
- .include("jgroups\\.jar");
+ public static AntCopyUtils.FileSet JBOSS_WAR_LIB_FILESET_EAR_CONFIG = new AntCopyUtils.FileSet()
+ .include("ajax4jsf.*\\.jar")
+ .include("commons-beanutils.*\\.jar")
+ .include("commons-digester.*\\.jar")
+ .include("commons-collections.*\\.jar")
+ .include("jboss-seam-debug\\.jar")
+ .include("jboss-seam-ioc\\.jar")
+ .include("jboss-seam-mail\\.jar")
+ .include("jboss-seam-pdf\\.jar")
+ .include("jboss-seam-remoting\\.jar")
+ .include("jboss-seam-ui\\.jar")
+ .include("jsf-facelets\\.jar")
+ .include("oscache.*\\.jar");
+
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT = new AntCopyUtils.FileSet()
+ .include("antlr.*\\.jar")
+ .include("commons-jci-core.*\\.jar")
+ .include("commons-jci-janino.*\\.jar")
+ .include("drools-compiler.*\\.jar")
+ .include("drools-core.*\\.jar")
+ .include("janino.*\\.jar")
+ .include("jboss-seam.jar")
+ .include("jbpm.*\\.jar")
+ .include("security\\.drl")
+ .include("stringtemplate.*\\.jar");
- public static FileSet VIEW_FILESET = new FileSet()
+ public static AntCopyUtils.FileSet JBOSS_EAR_CONTENT_META_INF = new AntCopyUtils.FileSet()
+ .include("META-INF/application\\.xml")
+ .include("META-INF/jboss-app\\.xml");
+
+ public static AntCopyUtils.FileSet VIEW_FILESET = new AntCopyUtils.FileSet()
.include("home\\.xhtml")
.include("error\\.xhtml")
.include("login\\.xhtml")
@@ -120,28 +142,31 @@
.include("img")
.exclude(".*/.*\\.ftl");
- public static FileSet JBOOS_WAR_WEBINF_SET = new FileSet()
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEBINF_SET = new AntCopyUtils.FileSet()
.include("WEB-INF/web\\.xml")
.include("WEB-INF/pages\\.xml")
.include("WEB-INF/jboss-web\\.xml")
.include("WEB-INF/faces-config\\.xml")
.include("WEB-INF/componets\\.xml");
- public static FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new FileSet()
+ public static AntCopyUtils.FileSet JBOOS_WAR_WEB_INF_CLASSES_SET = new AntCopyUtils.FileSet()
.include("import\\.sql")
.include("security\\.drl")
.include("seam\\.properties")
.include("messages_en\\.properties");
+ public static AntCopyUtils.FileSet JBOSS_EAR_META_INF_SET = new AntCopyUtils.FileSet()
+ .include("META-INF/jboss-app\\.xml");
+
public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib";
public static String SEAM_LIB_RELATED_PATH = "lib";
public static String WEB_LIBRARIES_RELATED_PATH = "WEB-INF/lib";
- public void execute(IProject project, IProjectFacetVersion fv,
+ public void execute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- IDataModel model = (IDataModel)config;
+ final IDataModel model = (IDataModel)config;
// get WebContents folder path from DWP model
WebArtifactEdit edit = WebArtifactEdit.getWebArtifactEditForRead(project);
@@ -151,78 +176,70 @@
IContainer folder = webRootFolder.getUnderlyingFolder();
model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
- File webContentFolder = folder.getLocation().toFile();
- File webInfFolder = new File(webContentFolder,"WEB-INF");
- File webInfClasses = new File(webInfFolder,"classes");
- File webInfClassesMetaInf = new File(webInfClasses, "META-INF");
+ final File webContentFolder = folder.getLocation().toFile();
+ final File webInfFolder = new File(webContentFolder,"WEB-INF");
+ final File webInfClasses = new File(webInfFolder,"classes");
+ final File webInfClassesMetaInf = new File(webInfClasses, "META-INF");
webInfClassesMetaInf.mkdirs();
- File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
- File srcFolder = srcRootFolder.getUnderlyingFolder().getLocation().toFile();
- File srcWebInf = new File(srcFolder, "META-INF");
- String seamHomePath = model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString();
+ final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
+ final File srcFolder = srcRootFolder.getUnderlyingFolder().getLocation().toFile();
+ final File srcWebInf = new File(srcFolder, "META-INF");
- File seamHomeFolder = new File(seamHomePath);
- File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
- File seamGenResFolder = new File(seamHomePath,"seam-gen/resources");
- File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
- File securityDrools = new File(seamGenResFolder,"security.drl");
- File seamGenHomeFolder = new File(seamHomePath,"seam-gen");
- File seamGenViewSource = new File(seamGenHomeFolder,"view");
- File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml");
-
- File jdbcDriverFile = new File(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH).toString());
- File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch");
- File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties");
- File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs");
- File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + PROFILE + ".xml");
+ final String seamHomePath = model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString();
- FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
- FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
- FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+ final File seamHomeFolder = new File(seamHomePath);
+ final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
+ final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources");
+ final File droolsLibFolder = new File(seamHomePath,DROOLS_LIB_SEAM_RELATED_PATH);
+ final File seamGenHomeFolder = new File(seamHomePath,"seam-gen");
+ final File seamGenViewSource = new File(seamGenHomeFolder,"view");
+ final File dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml");
+ final File componentsFile = new File(seamGenResFolder,"WEB-INF/components"+(isWarConfiguration(model)?"-war":"")+".xml");
+ final File jdbcDriverFile = new File(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH).toString());
+ final File hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch");
+ final File hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties");
+ final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs");
+ final File persistenceFile = new File(seamGenResFolder,"META-INF/persistence-" + (isWarConfiguration(model)?DEV_WAR_PROFILE:DEV_EAR_PROFILE) + ".xml");
+
+ final File applicationFile = new File(seamGenResFolder,"META-INF/application.xml");
+
+ final FilterSet jdbcFilterSet = SeamFacetFilterSetFactory.createJdbcFilterSet(model);
+ final FilterSet projectFilterSet = SeamFacetFilterSetFactory.createProjectFilterSet(model);
+ final FilterSet filtersFilterSet = SeamFacetFilterSetFactory.createFiltersFilterSet(model);
+
// ****************************************************************
// Copy view folder from seam-gen installation to WebContent folder
// ****************************************************************
-
- FileSet viewFileSet = new FileSet(VIEW_FILESET).dir(seamGenViewSource);
- FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
+ final AntCopyUtils.FileSet viewFileSet = new AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
+ final FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
viewFilterSetCollection.addFilterSet(jdbcFilterSet);
viewFilterSetCollection.addFilterSet(projectFilterSet);
+
AntCopyUtils.copyFilesAndFolders(
seamGenViewSource,
webContentFolder,
- new FileSetFileFilter(viewFileSet),
+ new AntCopyUtils.FileSetFileFilter(viewFileSet),
viewFilterSetCollection,
true);
// *******************************************************************
// Copy manifest and configuration resources the same way as view
// *******************************************************************
+ AntCopyUtils.FileSet webInfSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
- FileSet webInfSet = new FileSet(JBOOS_WAR_WEBINF_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,webContentFolder,new FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
-
- FileSet webInfClassesSet = new FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(
- seamGenResFolder,srcFolder,new FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
-
AntCopyUtils.copyFileToFile(
- dataSourceDsFile,
- new File(srcFolder,project.getName()+"-ds.xml"),
- viewFilterSetCollection, true);
-
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(project.getLocation().toFile(),project.getName()+".launch"),
+ componentsFile,
+ new File(webInfFolder,"components.xml"),
new FilterSetCollection(projectFilterSet), true);
-
- AntCopyUtils.copyFileToFile(
- persistenceFile,
- new File(srcWebInf,"persistence.xml"),
- new FilterSetCollection(projectFilterSet), true);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,webContentFolder,new AntCopyUtils.FileSetFileFilter(webInfSet), viewFilterSetCollection, true);
+ AntCopyUtils.FileSet webInfClassesSet = new AntCopyUtils.FileSet(JBOOS_WAR_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
+
FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
@@ -232,23 +249,6 @@
hibernateConsolePropsFile,
project.getLocation().toFile(),
hibernateDialectFilterSet, true);
-
- // add copy for /hibernatetools/seam-gen.reveng.xml
-
-
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePref,
- new File(project.getLocation().toFile(),".settings"),
- new FilterSetCollection(projectFilterSet), true);
-
- // ********************************************************************************************
- // Copy libraries libraries (seam jars, seam dependencies jars, drols jars, jdbc jar)
- // ********************************************************************************************
- copyFiles(seamHomeFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamHomeFolder)));
- copyFiles(seamLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamLibFolder)));
- copyFiles(droolsLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(droolsLibFolder)));
- copyFiles(seamHomeFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamHomeFolder)));
- copyFiles(seamLibFolder,webLibFolder,new FileSetFileFilter(new FileSet(JBOSS_WAR_LIB_FILESET).dir(seamLibFolder)));
// ********************************************************************************************
// Copy JDBC driver if there is any
@@ -256,221 +256,166 @@
if(jdbcDriverFile.exists())
AntCopyUtils.copyFileToFolder(jdbcDriverFile, webLibFolder, true);
- // Copy sources to src
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder,"src/Authenticator.java"),
- new File(project.getLocation().toFile(),"src/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"),
- new FilterSetCollection(filtersFilterSet), true);
-
+
// TODO may be generate RHDS studio feature to show it on projects view
// ********************************************************************************************
// Handle WAR/EAR configurations
// ********************************************************************************************
- if(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS).equals("war")) {
- AntCopyUtils.copyFileToFile(
- new File(seamGenResFolder,"WEB-INF/components-war.xml"),
- new File(webInfFolder,"components.xml"),
+ if(isWarConfiguration(model)) {
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(project.getLocation().toFile(),".settings"),
new FilterSetCollection(projectFilterSet), true);
+
+ // In case of WAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_WAR_CONFIG).dir(droolsLibFolder)));
- // ********************************************************************************************
- // TODO replace with appropriate one to handle Dynamic Web Project Structure
- // ********************************************************************************************
- AntCopyUtils.copyFileToFile(
- new File(seamHomeFolder,"seam-gen/build-scripts/build-war.xml"),
- new File(project.getLocation().toFile(),"build.xml"),
- new FilterSetCollection(projectFilterSet), true);
// ********************************************************************************************
// Copy seam project indicator
// ********************************************************************************************
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), srcFolder, true);
- } else {
- // copy ear files
+ // Copy sources to src
AntCopyUtils.copyFileToFile(
- new File(seamGenResFolder,"WEB-INF/components.xml"),
- new File(webInfFolder,"components.xml"),
- new FilterSetCollection(projectFilterSet), true);
+ new File(seamGenHomeFolder,"src/Authenticator.java"),
+ new File(project.getLocation().toFile(),"src/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"),
+ new FilterSetCollection(filtersFilterSet), true);
+
AntCopyUtils.copyFileToFile(
- new File(seamHomeFolder,"seam-gen/build-scripts/build.xml"),
- new File(project.getLocation().toFile(),"build.xml"),
- new FilterSetCollection(projectFilterSet), true);
- }
-
- writeXModel(project, model);
-
-
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
-
- EclipseResourceUtil.addNatureToProject(project, "org.jboss.tools.jsf.jsfnature");
- EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ persistenceFile,
+ new File(project.getLocation().toFile(),"src/META-INF/persistence.xml"),
+ viewFilterSetCollection, true);
- }
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(srcFolder,project.getName()+"-ds.xml"),
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(project.getLocation().toFile(),project.getName()+".launch"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ if(jdbcDriverFile.exists())
+ AntCopyUtils.copyFileToFolder(jdbcDriverFile, webLibFolder, true);
+
+ } else {
+
+ // In case of EAR configuration
+ AntCopyUtils.copyFiles(seamHomeFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,webLibFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_WAR_LIB_FILESET_EAR_CONFIG).dir(droolsLibFolder)));
- public static void copyFiles(File source, File dest, FileFilter filter) {
- dest.mkdir();
- for (File file:source.listFiles(filter)) {
- if(file.isDirectory())continue;
- try {
- FileUtils.getFileUtils().copyFile(file, new File(dest,file.getName()),new FilterSetCollection(),true);
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- }
- }
+ Job create = new Job("New WTP") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ IProject ear = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear", monitor);
+
+ try {
+ FilterSet filterSet = new FilterSet();
+ filterSet.addFilter("projectName", project.getName());
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimename(project));
+
+ File earContentsFolder = new File(ear.getLocation().toFile(),"EarContent");
+ File earContentsMetaInfFolder = new File(earContentsFolder,"META-INF");
+
+ AntCopyUtils.copyFilesAndFolders(
+ seamGenResFolder,
+ earContentsFolder,
+ new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_META_INF_SET).dir(seamGenResFolder)),
+ viewFilterSetCollection,true);
- public static class FileSet {
-
- File dir = null;
-
- List<Pattern> include = new ArrayList<Pattern>();
-
- List<Pattern> exclude = new ArrayList<Pattern>();
-
- public FileSet(String dir) {
- this.dir = new File(dir);
- }
-
- public FileSet(File dir) {
- this.dir = dir;
- }
-
- public FileSet(FileSet template) {
- addTemplate(template);
- }
-
- public void addTemplate(FileSet template){
- include.addAll(template.getIncluded());
- exclude.addAll(template.getExcluded());
- }
-
- public FileSet() {
+ // Copy configuration files from template
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ear"),
+ ear.getLocation().toFile(),
+ new FilterSetCollection(filterSet), true);
+
+ // Fill ear contents
+ AntCopyUtils.copyFiles(seamHomeFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(droolsLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(droolsLibFolder)));
+ AntCopyUtils.copyFiles(seamLibFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)));
+ AntCopyUtils.copyFiles(seamGenResFolder,earContentsFolder,new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamGenResFolder)));
- }
-
- public FileSet add(FileSet set) {
- addTemplate(set);
- return this;
- }
-
- public FileSet dir(String dir) {
- this.dir = new File(dir);
- return this;
- }
-
- public FileSet dir(File dir) {
- this.dir = dir;
- return this;
- }
-
- public FileSet include(String pattern) {
- include.add(Pattern.compile(pattern));
- return this;
-
- }
-
- public FileSet exclude(String pattern) {
- exclude.add(Pattern.compile(pattern));
- return this;
- }
-
- public boolean isIncluded(String file) {
- int i = dir.getAbsolutePath().length()+1;
- String relatedPath = file.substring(i);
- if(new File(file).isDirectory())return true;
- for (Pattern pattern : include) {
- if(pattern.matcher(relatedPath.replace('\\', '/')).matches() ) {
- return !isExcluded(relatedPath);
+ // ********************************************************************************************
+ // Copy JDBC driver if there is any
+ // ********************************************************************************************
+ if(jdbcDriverFile.exists())
+ AntCopyUtils.copyFileToFolder(jdbcDriverFile, earContentsFolder, true);
+
+ IProject ejb = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb", monitor);
+
+
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),"ejb"),
+ ejb.getLocation().toFile(),
+ new FilterSetCollection(filterSet), true);
+
+ // *******************************************************************************************
+ // Copy sources to ejb project in case of EAR configuration
+ // *******************************************************************************************
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder,"src/Authenticator.java"),
+ new File(ejb.getLocation().toFile(),"ejbModule/" + model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.', '/')+"/"+"Authenticator.java"),
+ new FilterSetCollection(filtersFilterSet), true);
+ AntCopyUtils.copyFileToFile(
+ persistenceFile,
+ new File(ejb.getLocation().toFile(),"ejbModule/META-INF/persistence.xml"),
+ viewFilterSetCollection, true);
+ // ********************************************************************************************
+ // Copy seam project indicator
+ // ********************************************************************************************
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"), new File(ejb.getLocation().toFile(),"ejbModule/"), true);
+
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile,
+ new File(ejb.getLocation().toFile(),"ejbModule/"+project.getName()+"-ds.xml"),
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder,"META-INF/ejb-jar.xml"),
+ new File(ejb.getLocation().toFile(),"ejbModule/META-INF/"),
+ viewFilterSetCollection, true);
+
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePref,
+ new File(ejb.getLocation().toFile(),".settings"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(ejb.getLocation().toFile(),ejb.getName()+".launch"),
+ new FilterSetCollection(projectFilterSet), true);
+
+ ear.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ ejb.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return Status.OK_STATUS;
}
- }
- return false;
+ };
+ create.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ create.schedule();
}
- public boolean isExcluded(String file){
- for (Pattern pattern : exclude) {
- if(pattern.matcher(file.replace('\\', '/')).matches()) return true;
- }
- return false;
- }
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- public List<Pattern> getExcluded() {
- return Collections.unmodifiableList(exclude);
- }
-
- public List<Pattern> getIncluded() {
- return Collections.unmodifiableList(include);
- }
+ EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
- /**
- * @return
- */
- public File getDir() {
- return dir;
- }
}
-
- public static class FileSetFileFilter implements FileFilter {
-
- FileSet set;
- public FileSetFileFilter(FileSet set) {
- this.set = set;
- }
-
- public boolean accept(File pathname){
- return set.isIncluded(pathname.getAbsolutePath());
- }
- }
- private void writeXModel(IProject project, IDataModel model) {
- String projectName = project.getName();
- String webContent = "WebContent";
-
- //TODO This returns null. Why? How else can we get WebContent folder name?
- webContent = (String)model.getProperty(ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER);
-
- if(webContent == null) {
- webContent = "WebContent";
- }
- String src = "src";
-
- String[] srcs = EclipseResourceUtil.getJavaProjectSrcLocations(project);
- if (srcs.length > 0) {
- src = srcs[0].replace('\\','/').substring(srcs[0].lastIndexOf('/') + 1);
- }
- File location = new File(project.getLocation().toFile(),".settings/org.jboss.tools.jst.web.xml");
-
- Object[] arguments = {
- projectName,
- webContent,
- src
- };
- String body = MessageFormat.format(XMODEL, arguments);
-
- org.jboss.tools.common.util.FileUtil.writeFile(location, body);
+ public static boolean isWarConfiguration(IDataModel model) {
+ return "war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
}
-
- /**
- * {0} - project name
- * {1} - WebContent folder name
- * {2} - src folder name
- */
- private static String XMODEL =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<FILESYSTEMS APPLICATION_NAME=\"{0}\" ENTITY=\"FileSystems\"" +
- " VERSION=\"2.0.0\" WORKSPACE_HOME=\"./{1}/WEB-INF\">" +
- "<FILESYSTEM ENTITY=\"FileSystemFolder\" LOCATION=\"%redhat.workspace%\" NAME=\"WEB-INF\"/>" +
- "<FILESYSTEM ENTITY=\"FileSystemFolder\" INFO=\"Content-Type=Web\"" +
- " LOCATION=\"%redhat.workspace%/..\" NAME=\"WEB-ROOT\"/>" +
- "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
- " LOCATION=\"%redhat.workspace%/../../{2}\" NAME=\"src\"/>" +
- "<FILESYSTEM ENTITY=\"FileSystemFolder\" LOCATION=\"%redhat.workspace%/lib\" NAME=\"lib\"/>" +
- "<FILESYSTEM ENTITY=\"FileSystemFolder\"" +
- " LOCATION=\"%redhat.workspace%/classes\" NAME=\"classes\"/>" +
- "<WEB ENTITY=\"JstWeb\" MODEL_PATH=\"/web.xml\" SERVLET_VERSION=\"2.4\">" +
- " <MODULE ENTITY=\"WebJSFModule\" MODEL_PATH=\"/faces-config.xml\"" +
- " ROOT=\"WEB-ROOT\" SRC=\"src\" URI=\"/WEB-INF/faces-config.xml\"/>" +
- "</WEB>" +
- "</FILESYSTEMS>"
- ;
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -10,10 +10,25 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.project.facet;
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -30,10 +45,10 @@
/* (non-Javadoc)
* @see org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
*/
- public void execute(IProject project, IProjectFacetVersion fv,
+ public void execute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
IEclipsePreferences prefs = SeamCorePlugin.getSeamFacetPreferences(project);
- IDataModel model = (IDataModel)config;
+ final IDataModel model = (IDataModel)config;
for (Object propertyName : model.getAllProperties()) {
Object value = model.getProperty(propertyName.toString());
prefs.put(propertyName.toString(), value==null?"":value.toString());
@@ -43,5 +58,6 @@
} catch (BackingStoreException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
+
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetUninstallDelegate.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -13,7 +13,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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 org.jboss.tools.seam.internal.core.project.facet;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author eskimo
+ *
+ */
+public class WtpUtils {
+ public static IProject createEclipseProject(String projectName, IProgressMonitor monitor) {
+
+ IProject newProjectHandle = ResourcesPlugin.getWorkspace()
+ .getRoot().getProject(projectName);
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProjectDescription description = workspace
+ .newProjectDescription(projectName);
+
+ String eclWsPath = ResourcesPlugin.getWorkspace().getRoot()
+ .getRawLocation().toString();
+ try {
+ newProjectHandle.create(description,new NullProgressMonitor());
+ newProjectHandle.open(monitor);
+
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return newProjectHandle;
+ }
+
+ public static IProject createEarProject(String projectName, IProgressMonitor monitor) {
+ IProject earProject = createEclipseProject(projectName,monitor);
+ return null;
+ }
+
+ public static IProject createDefaultEjbProject(String projectName,IProgressMonitor monitor) {
+ IProject ejbProject = createEclipseProject(projectName,monitor);
+ //J2EEComponentClasspathContainer.CONTAINER_ID;
+ addJavaNature(ejbProject, new Path("build/classes"), new Path("ejbModule"), monitor);
+ return null;
+ }
+
+ public static void addJavaNature(IProject project, IPath outputLocation, IPath srcLocation, IProgressMonitor monitor) {
+ try {
+ IProjectDescription newDescr = project.getDescription();
+ newDescr.setNatureIds(new String[] {JavaCore.NATURE_ID});
+ ICommand builderCmd = project.getDescription().newCommand();
+ builderCmd.setBuilderName(JavaCore.BUILDER_ID);
+ newDescr.setBuildSpec(new ICommand[] {builderCmd});
+ project.setDescription(newDescr, monitor);
+ IJavaProject newJavaPr = JavaCore.create(project);
+ project.getFolder(outputLocation).create(IFolder.FORCE, true, monitor);
+ project.getFolder(srcLocation).create(IFolder.FORCE, true, monitor);
+
+ newJavaPr.setRawClasspath(
+ new IClasspathEntry[]{
+ JavaCore.newSourceEntry(Path.ROOT.append(srcLocation)),
+ JavaCore.newContainerEntry(new Path(JavaRuntime.JRE_CONTAINER))},
+ monitor);
+ newJavaPr.setOutputLocation(outputLocation, monitor);
+ newJavaPr.save(monitor, true);
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ public static String getServerRuntimename(IProject project) {
+ IJavaProject javaProject = JavaCore.create(project);
+ if(javaProject!=null) {
+ try {
+ IClasspathEntry[] entries = javaProject.getRawClasspath();
+ IClasspathContainer container = JavaCore.getClasspathContainer(Path.ROOT.append("org.eclipse.jst.server.core.container"), javaProject);
+ for (IClasspathEntry classpathEntry : entries) {
+ if(Path.ROOT.append("org.eclipse.jst.server.core.container").isPrefixOf(classpathEntry.getPath())) {
+ return classpathEntry.getPath().lastSegment();
+ }
+ }
+ System.out.println(container.getPath().lastSegment());
+ } catch (JavaModelException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ return "";
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -32,7 +32,6 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsLoader;
import org.jboss.tools.common.model.filesystems.impl.JarSystemImpl;
-import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.project
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.project (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.project 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>@projectName@-ear</name>
+ <comment></comment>
+ <projects>
+ <project>@projectName@-ejb</project>
+ <project>@projectName@</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ear/.settings/org.eclipse.wst.common.project.facet.core.xml 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="@runtimeName@"/>
+ <fixed facet="jst.ear"/>
+ <installed facet="jst.ear" version="5.0"/>
+</faceted-project>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.classpath
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.classpath (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.classpath 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="ejbModule"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/@runtimeName@"/>
+ <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.project
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.project (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.project 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>@projectName@</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.jdt.core.prefs 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,7 @@
+#Thu Jul 19 17:20:50 PDT 2007
+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/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/.settings/org.eclipse.wst.common.project.facet.core.xml 2007-07-25 08:39:40 UTC (rev 2647)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="@runtimeName@"/>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.ejb"/>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.ejb" version="3.0"/>
+</faceted-project>
Deleted: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/sample.gif
===================================================================
(Binary files differ)
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam16.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-25 08:39:40 UTC (rev 2647)
@@ -11,7 +11,7 @@
<wizard
category="org.jboss.tools.seam.ui"
class="org.jboss.tools.seam.ui.wizard.SeamProjectWizard"
- icon="icons/sample.gif"
+ icon="icons/view/seam_project_new.gif"
id="org.jboss.tools.seam.ui.wizards.SeamProjectWizard"
name="Seam Project"
project="true">
@@ -25,7 +25,7 @@
<wizard
category="org.jboss.tools.seam.ui"
class="org.jboss.tools.seam.ui.wizard.SeamActionWizard"
- icon="icons/sample.gif"
+ icon="icons/view/component_new.gif"
id="org.jboss.tools.seam.ui.wizard.SeamActionWizard"
name="Seam Action">
<description>
@@ -38,7 +38,7 @@
<wizard
category="org.jboss.tools.seam.ui"
class="org.jboss.tools.seam.ui.wizard.SeamFofrmWizard"
- icon="icons/sample.gif"
+ icon="icons/view/component_new.gif"
id="org.jboss.tools.seam.ui.wizard2"
name="Seam Form">
<description>
@@ -90,7 +90,7 @@
<view
category="org.jboss.tools.seam.ui"
class="org.eclipse.ui.navigator.CommonNavigator"
- icon="icons/sample.gif"
+ icon="icons/seam16.png"
id="org.jboss.tools.seam.ui.views.SeamComponentsNavigator"
name="Seam Components">
</view>
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -86,7 +86,9 @@
ITaggedFieldEditor jdbcUrlForDb = IFieldEditorFactory.INSTANCE.createComboEditor(
ISeamFacetDataModelProperties.JDBC_URL_FOR_DB,
"JDBC Url for Your Database:",
- Arrays.asList(HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))[0])),HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))[0])[0]);
+ Arrays.asList(HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(
+ HIBERNATE_HELPER.getDialectClass("HSQL"))[0])),
+ HIBERNATE_HELPER.getConnectionURLS(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass("HSQL"))[0])[0].replace("<", "").replace(">", ""));
IFieldEditor dbUserName = IFieldEditorFactory.INSTANCE.createTextEditor(
ISeamFacetDataModelProperties.DB_USER_NAME,
"Database User Name:", "username");
@@ -246,7 +248,13 @@
if(evt.getNewValue()==null) {
jdbcUrlForDb.setTags(new String[]{});
} else {
- jdbcUrlForDb.setTags(HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString()));
+ String[] connectionUrls = HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString());
+ String[] newUrls = new String[connectionUrls.length];
+ int i = 0;
+ for (String string : connectionUrls) {
+ newUrls[i++] = string.replace("<", "").replace(">", "");
+ }
+ jdbcUrlForDb.setTags(newUrls);
}
}
});
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -12,6 +12,8 @@
package org.jboss.tools.seam.ui.text.java;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -249,10 +251,17 @@
if (string.length() > 0)
result.add(createProposal(string, prefix, offset));
}
-
+
if (result == null || result.size() == 0)
return NO_PROPOSALS;
- return (ICompletionProposal[]) result.toArray(new ICompletionProposal[result.size()]);
+ ICompletionProposal[] resultArray = (ICompletionProposal[]) result.toArray(new ICompletionProposal[uniqueSuggestions.size()]);
+ Arrays.sort(resultArray, new Comparator<ICompletionProposal>() {
+
+ public int compare(ICompletionProposal arg0,
+ ICompletionProposal arg1) {
+ return arg1.getDisplayString().compareTo(arg1.getDisplayString());
+ }});
+ return resultArray;
} catch (BadLocationException x) {
return NO_PROPOSALS;
} catch (StringIndexOutOfBoundsException e) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -23,6 +23,8 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Combo;
@@ -60,35 +62,31 @@
});
comboControl.addSelectionChangedListener(this);
+ comboControl.getCombo().addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ firePropertyChange(new Object(), comboControl.getCombo().getText());
+ }});
comboControl.setLabelProvider(new ILabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
+ public void addListener(ILabelProviderListener listener) {
}
- public void dispose() {
- // TODO Auto-generated method stub
-
+ public void dispose() {
}
public boolean isLabelProperty(Object element, String property) {
- // TODO Auto-generated method stub
return false;
}
public void removeListener(ILabelProviderListener listener) {
- // TODO Auto-generated method stub
-
}
public Image getImage(Object element) {
- // TODO Auto-generated method stub
return null;
}
public String getText(Object element) {
- // TODO Auto-generated method stub
return element.toString();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -10,31 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.tools.ant.types.FilterSet;
-import org.apache.tools.ant.types.FilterSetCollection;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.internal.core.project.facet.SeamFacetFilterSetFactory;
/**
*
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2007-07-25 08:32:20 UTC (rev 2646)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2007-07-25 08:39:40 UTC (rev 2647)
@@ -68,7 +68,6 @@
Control findControlByClass(Composite comp, Class claz) {
for (Control child : comp.getChildren()) {
- System.out.println(child.getClass().getName());
if(child.getClass()==claz) {
return child;
} else if(child instanceof Composite){
@@ -82,7 +81,6 @@
Control findGroupByText(Composite comp, String text) {
for (Control child : comp.getChildren()) {
- System.out.println(child.getClass().getName());
if(child instanceof Group && ((Group)child).getText().equals(text)) {
return child;
} else if(child instanceof Composite){
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/images/xstudio/wizards/new_jsp_file.gif
===================================================================
(Binary files differ)
17 years, 5 months