JBoss Tools SVN: r19198 - in trunk: cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-12-10 16:02:27 -0500 (Thu, 10 Dec 2009)
New Revision: 19198
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFImplicitObjectELResolver.java
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
Log:
https://jira.jboss.org/jira/browse/JBIDE-5383
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -24,6 +24,13 @@
public interface IBeanManager {
/**
+ * Returns all @Named beans.
+ *
+ * @return all @Named beans
+ */
+ Set<IBean> getNamedBeans();
+
+ /**
* Returns the set of beans which match the given EL name.
*
* @param name
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -11,39 +11,24 @@
package org.jboss.tools.cdi.internal.core.el;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.cdi.core.CDICorePlugin;
-import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanManager;
import org.jboss.tools.cdi.core.IBeanMember;
-import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
-import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.core.IParametedType;
-import org.jboss.tools.cdi.core.IStereotypeDeclaration;
-import org.jboss.tools.cdi.core.ITypeDeclaration;
-import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
-import org.jboss.tools.common.text.ITextSourceReference;
/**
* @author Alexey Kazakov
@@ -103,12 +88,14 @@
String varName = expr.toString();
+ Set<IBean> resolvedBeans = null;
if (varName != null) {
IBeanManager manager = CDICorePlugin.getCDI(project, false).getDelegate();
- Set<IBean> resolvedBeans = manager.getBeans(varName, true);
if(onlyEqualNames) {
+ resolvedBeans = manager.getBeans(varName, true);
beans.addAll(resolvedBeans);
} else {
+ resolvedBeans = manager.getNamedBeans();
for (IBean bean : resolvedBeans) {
if(bean.getName().startsWith(varName)) {
beans.add(bean);
@@ -116,22 +103,20 @@
}
}
}
- if (beans.isEmpty() && varName != null && (varName.startsWith("\"") || varName.startsWith("'"))
- && (varName.endsWith("\"") || varName.endsWith("'"))) {
- IJavaProject jp = EclipseUtil.getJavaProject(project.getProject());
- try {
- IType type = jp.findType("java.lang.String");
- if(type != null) {
- IMethod m = type.getMethod("toString", new String[0]);
- if(m != null) {
- IBean bean = new StringVariable(m);
- beans.add(bean);
+ if (resolvedBeans != null && !resolvedBeans.isEmpty()) {
+ List<IBean> newResolvedVars = new ArrayList<IBean>();
+ for (IBean var : resolvedBeans) {
+ if(!isFinal) {
+ // Do filter by equals (name)
+ // In case of the last pass - do not filter by startsWith(name) instead of equals
+ if (varName.equals(var.getName())) {
+ newResolvedVars.add(var);
}
+ } else {
+ newResolvedVars.add(var);
}
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
}
-
+ return newResolvedVars;
}
return beans;
}
@@ -143,97 +128,4 @@
public ELParserFactory getParserFactory() {
return factory;
}
-
- private static class StringVariable implements IBean {
-
- private IMember member;
-
- public StringVariable(IMember member) {
- this.member = member;
- }
-
- public Set<ITypeDeclaration> getAllTypeDeclarations() {
- return Collections.emptySet();
- }
-
- public IAnnotationDeclaration getAlternativeDeclaration() {
- return null;
- }
-
- public IType getBeanClass() {
- return member.getDeclaringType();
- }
-
- public Set<IInjectionPoint> getInjectionPoints() {
- return Collections.emptySet();
- }
-
- public Set<IParametedType> getLegalTypes() {
- return Collections.emptySet();
- }
-
- public String getName() {
- return null;
- }
-
- public ITextSourceReference getNameLocation() {
- return null;
- }
-
- public Set<IAnnotationDeclaration> getQualifierDeclarations() {
- return Collections.emptySet();
- }
-
- public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
- return Collections.emptySet();
- }
-
- public IBean getSpecializedBean() {
- return null;
- }
-
- public IAnnotationDeclaration getSpecializesAnnotationDeclaration() {
- return null;
- }
-
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
- return Collections.emptySet();
- }
-
- public boolean isAlternative() {
- return false;
- }
-
- public boolean isDependent() {
- return false;
- }
-
- public boolean isEnabled() {
- return false;
- }
-
- public boolean isSpecializing() {
- return false;
- }
-
- public IType getScope() {
- return null;
- }
-
- public Set<IAnnotationDeclaration> getScopeDeclarations() {
- return Collections.emptySet();
- }
-
- public ICDIProject getCDIProject() {
- return null;
- }
-
- public IResource getResource() {
- return member.getResource();
- }
-
- public IPath getSourcePath() {
- return member.getPath();
- }
- }
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -34,7 +34,6 @@
import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IStereotype;
-import org.jboss.tools.cdi.internal.core.impl.definition.AbstractTypeDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.common.text.INodeReference;
@@ -347,4 +346,12 @@
bs.add(bean);
}
-}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IBeanManager#getNamedBeans()
+ */
+ public Set<IBean> getNamedBeans() {
+ // TODO
+ return new HashSet<IBean>();
+ }
+}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -14,7 +14,11 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
@@ -69,7 +73,7 @@
*/
public List<IJSFVariable> resolveVariables(IFile file, ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
IModelNature project = EclipseResourceUtil.getModelNature(file.getProject());
- return resolveVariables(project, expr, isFinal, onlyEqualNames);
+ return resolveVariables(file, project, expr, isFinal, onlyEqualNames);
}
/**
@@ -80,7 +84,7 @@
* @param onlyEqualNames
* @return
*/
- public List<IJSFVariable> resolveVariables(IModelNature project, ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
+ public List<IJSFVariable> resolveVariables(IFile file, IModelNature project, ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
List<IJSFVariable>resolvedVars = new ArrayList<IJSFVariable>();
if (project == null)
@@ -105,6 +109,24 @@
}
}
return newResolvedVars;
+ } else if (varName != null && (varName.startsWith("\"") || varName.startsWith("'")) && (varName.endsWith("\"") || varName.endsWith("'"))) {
+ IJavaProject jp = EclipseResourceUtil.getJavaProject(file.getProject());
+ if(jp!=null) {
+ try {
+ IType type = jp.findType("java.lang.String");
+ if (type != null) {
+ IMethod m = type.getMethod("toString", new String[0]);
+ if (m != null) {
+ IJSFVariable v = new Variable("String", m);
+ List<IJSFVariable> newResolvedVars = new ArrayList<IJSFVariable>();
+ newResolvedVars.add(v);
+ return newResolvedVars;
+ }
+ }
+ } catch (JavaModelException e) {
+ JSFModelPlugin.getDefault().logError(e);
+ }
+ }
}
return new ArrayList<IJSFVariable>();
}
@@ -139,4 +161,31 @@
public static interface IJSFVariable extends IVariable {
public IMember getSourceMember();
}
+
+ public static class Variable implements IJSFVariable {
+
+ private String name;
+ private IMember source;
+
+ public Variable(String name, IMember source) {
+ this.name = name;
+ this.source = source;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jsf.model.JSFELCompletionEngine.IJSFVariable#getSourceMember()
+ */
+ public IMember getSourceMember() {
+ return source;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine.IVariable#getName()
+ */
+ public String getName() {
+ return name;
+ }
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFImplicitObjectELResolver.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFImplicitObjectELResolver.java 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFImplicitObjectELResolver.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -18,7 +18,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.text.BadLocationException;
@@ -153,31 +152,4 @@
}
return list;
}
-
- public static class Variable implements IJSFVariable {
-
- private String name;
- private IMember source;
-
- public Variable(String name, IMember source) {
- this.name = name;
- this.source = source;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jsf.model.JSFELCompletionEngine.IJSFVariable#getSourceMember()
- */
- public IMember getSourceMember() {
- return source;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine.IVariable#getName()
- */
- public String getName() {
- return name;
- }
- }
}
\ 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 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -12,22 +12,14 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -48,10 +40,6 @@
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegment;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.Var;
-import org.jboss.tools.common.java.IJavaSourceReference;
-import org.jboss.tools.common.model.project.ext.event.Change;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
@@ -64,7 +52,6 @@
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.el.SeamExpressionResolver.MessagesInfo;
-import org.w3c.dom.Element;
/**
* Utility class used to collect info for EL
@@ -277,25 +264,6 @@
}
return newResolvedVars;
}
- else if(varName != null && (varName.startsWith("\"") || varName.startsWith("'"))
- && (varName.endsWith("\"") || varName.endsWith("'"))) {
- IJavaProject jp = EclipseResourceUtil.getJavaProject(project.getProject());
- try {
- IType type = jp.findType("java.lang.String");
- if(type != null) {
- IMethod m = type.getMethod("toString", new String[0]);
- if(m != null) {
- ISeamContextVariable v = new StringVariable(m);
- List<ISeamContextVariable> newResolvedVars = new ArrayList<ISeamContextVariable>();
- newResolvedVars.add(v);
- return newResolvedVars;
- }
- }
- } catch (JavaModelException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
-
- }
return new ArrayList<ISeamContextVariable>();
}
@@ -414,59 +382,4 @@
public static boolean isSeamMessagesComponentVariable(ISeamContextVariable variable) {
return (null != getSeamMessagesComponentVariable(variable));
}
-}
-
-class StringVariable implements ISeamContextVariable, IJavaSourceReference {
- IMember member;
- public StringVariable(IMember member) {
- this.member = member;
- }
- public ScopeType getScope() {
- return ScopeType.APPLICATION;
- }
- public void setName(String name) {
- }
- public void setScope(ScopeType type) {
- }
- public ITextSourceReference getLocationFor(String path) {
- return null;
- }
- public String getName() {
- return "String";
- }
- public ISeamElement getParent() {
- return null;
- }
- public IResource getResource() {
- return null;
- }
- public ISeamProject getSeamProject() {
- return null;
- }
- public IPath getSourcePath() {
- return null;
- }
- public void loadXML(Element element, Properties context) {
- }
- public List<Change> merge(ISeamElement s) {
- return null;
- }
- public Element toXML(Element parent, Properties context) {
- return null;
- }
- public Object getAdapter(Class adapter) {
- return null;
- }
- public IMember getSourceMember() {
- return member;
- }
- public int getLength() {
- return 0;
- }
- public int getStartPosition() {
- return 0;
- }
- public StringVariable clone() throws CloneNotSupportedException {
- throw new CloneNotSupportedException();
- }
}
\ No newline at end of file
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 2009-12-10 20:20:20 UTC (rev 19197)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2009-12-10 21:02:27 UTC (rev 19198)
@@ -105,14 +105,8 @@
}
for (ISeamContextVariable variable : variables) {
String n = variable.getName();
- if(onlyEqualNames) {
- if (n.equals(name)) {
- resolvedVariables.add(variable);
- }
- } else {
- if (n.startsWith(name)) {
- resolvedVariables.add(variable);
- }
+ if (n.startsWith(name)) {
+ resolvedVariables.add(variable);
}
}
return resolvedVariables;
15 years, 1 month
JBoss Tools SVN: r19197 - tags.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2009-12-10 15:20:20 -0500 (Thu, 10 Dec 2009)
New Revision: 19197
Added:
tags/jbosstools-3.0.3.GA/
Log:
tag for 3.0.3.GA
Copied: tags/jbosstools-3.0.3.GA (from rev 19196, branches/jbosstools-3.0.x)
15 years, 1 month
JBoss Tools SVN: r19196 - in trunk: hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2009-12-10 12:30:34 -0500 (Thu, 10 Dec 2009)
New Revision: 19196
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/lib/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/lib/hsqldb.jar
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/.classpath
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/build.properties
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Hibernate bot test ongoing update - embedded hsql server added, generated java code check, etc. BotExt methods improved
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/.classpath
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/.classpath 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/.classpath 2009-12-10 17:30:34 UTC (rev 19196)
@@ -3,7 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.jboss.tools.ui.bot.ext"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/HSQLDB"/>
+ <classpathentry exported="true" kind="lib" path="lib/hsqldb.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/META-INF/MANIFEST.MF 2009-12-10 17:30:34 UTC (rev 19196)
@@ -21,3 +21,5 @@
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j
Import-Package: org.eclipse.jdt.internal.ui
+Bundle-ClassPath: lib/hsqldb.jar,
+ .
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/build.properties
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/build.properties 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/build.properties 2009-12-10 17:30:34 UTC (rev 19196)
@@ -2,4 +2,5 @@
resources/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ lib/hsqldb.jar
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/lib/hsqldb.jar
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/lib/hsqldb.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/CodeGenerationLauncherTest.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -12,15 +12,18 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.hamcrest.Matcher;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,6 +35,9 @@
public static boolean generationDone = false;
@BeforeClass
+ /**
+ * Setup prerequisites for this test
+ */
public static void setUp() {
prepareProject();
@@ -58,8 +64,34 @@
bot.button(IDELabel.Button.RUN).click();
log.info("HB Code Generation FINISHED");
+ util.waitForNonIgnoredJobs();
+
+ checkGeneratedFiles();
+
generationDone = true;
}
+ /**
+ * Checks existence generated files after code generation
+ */
+ private void checkGeneratedFiles() {
+
+ SWTBot viewBot = eclipse.showView(ViewType.PROJECT_EXPLORER);
+ SWTBotTreeItem item;
+
+ item = eclipse.selectTreeLocation(viewBot, Project.PROJECT_NAME,"gen","org","test","Customers.java");
+ item.doubleClick();
+ item = eclipse.selectTreeLocation(viewBot, Project.PROJECT_NAME,"gen","org","test","Employees.java");
+ item.doubleClick();
+ item = eclipse.selectTreeLocation(viewBot, Project.PROJECT_NAME,"gen","org","test","Offices.java");
+ item.doubleClick();
+
+ log.info("Generated files check DONE");
+ bot.sleep(TIME_10S);
+ }
+
+ /**
+ *
+ */
private void createNewHibernateCodeGenerationConfiguration() {
SWTBotMenu menu = null;
menu = bot.menu("Run");
@@ -68,7 +100,7 @@
mainShell = bot.activeShell();
}
-
+
/**
* TC 09
*/
@@ -138,5 +170,4 @@
log.info("HB Code Generation Common tab DONE");
bot.sleep(TIME_1S);
}
-
}
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -76,7 +76,7 @@
bot.buttonInGroup(IDELabel.HBConsoleWizard.SETUP_BUTTON,IDELabel.HBConsoleWizard.CONFIGURATION_FILE_GROUP).click();
bot.button(IDELabel.HBConsoleWizard.CREATE_NEW_BUTTON).click();
eclipse.selectTreeLocation(Project.PROJECT_NAME, "src");
- eclipse.button(IDELabel.Button.NEXT).click();
+ bot.button(IDELabel.Button.NEXT).click();
bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DATABASE_DIALECT).setSelection(Project.DB_DIALECT);
bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.DRIVER_CLASS).setSelection(Project.DRIVER_CLASS);
bot.comboBoxWithLabel(IDELabel.HBConsoleWizard.CONNECTION_URL).setText(Project.JDBC_STRING);
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/HibernateTest.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -19,6 +19,11 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.datatools.connectivity.ConnectionProfileException;
@@ -30,6 +35,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.IViewReference;
import org.hamcrest.Matcher;
+import org.hsqldb.Server;
import org.jboss.tools.hibernate.ui.bot.testcase.Activator;
import org.jboss.tools.hibernate.ui.bot.testcase.ConsoleTest;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
@@ -37,6 +43,7 @@
import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.helper.DatabaseHelper;
+import org.jboss.tools.ui.bot.ext.types.DriverEntity;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
import org.jboss.tools.ui.bot.ext.types.ViewType;
@@ -47,14 +54,23 @@
private static boolean classesCreated = false;
private static boolean projectCreated = false;
private static boolean databasePrepared = false;
+ private static boolean dbRunning = false;
+ private static Thread hsqlThread = null;
+
//private static Properties properties;
+ /**
+ * Prepare project and classes
+ */
public static void prepare() {
prepareProject();
prepareClasses();
}
+ /**
+ * Create testing classes for the project
+ */
public static void prepareClasses() {
if (classesCreated) return;
@@ -75,6 +91,9 @@
classesCreated = true;
}
+ /**
+ * Create Java project for testing hibernate features
+ */
public static void prepareProject() {
if (projectCreated) return;
@@ -100,6 +119,9 @@
projectCreated = true;
}
+ /**
+ * Copy driver into project and add to classpath
+ */
public static void addDriver() {
try {
addDriverIntoProject();
@@ -110,7 +132,10 @@
}
addDriverClassPath();
}
-
+
+ /**
+ * Add Driver to classpath
+ */
public static void addDriverClassPath() {
eclipse.showView(ViewType.PROJECT_EXPLORER);
@@ -161,21 +186,31 @@
log.info("Driver hsqldb.jar copied");
}
+ /**
+ * Clean after tests
+ */
public static void clean() {
if (finished) return;
log.info("Clean finished");
}
+ /**
+ * Run's console tests (prerequisite for other tests to be able to execute them separately)
+ */
public static void prepareConsole() {
ConsoleTest consoleTest = new ConsoleTest();
consoleTest.createConsole();
}
-
+ /**
+ * Prepares database and insert test data by using connection profile and sql scrapbook
+ */
public static void prepareDatabase() {
if (databasePrepared) return;
+ runHSQLDBServer(Project.DB_FILE,Project.DB_NAME);
+
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(Platform.getLocation());
stringBuilder.append(File.separator);
@@ -184,10 +219,13 @@
stringBuilder.append("hsqldb.jar");
try {
- DatabaseHelper.createDriver(stringBuilder.toString());
+ DriverEntity entity = new DriverEntity();
+ entity.setDrvPath(stringBuilder.toString());
+ entity.setJdbcString("jdbc:hsqldb:hsql://localhost/xdb");
+ DatabaseHelper.createDriver(entity);
} catch (ConnectionProfileException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error("Unable to create HSQL Driver" + e);
+ fail();
}
eclipse.openPerspective(PerspectiveType.DB_DEVELOPMENT);
@@ -209,7 +247,7 @@
item.contextMenu("Open SQL Scrapbook").click();
// Set SQL Scrapbook
- SWTBotEditor editor = eclipse.editorByTitle("SQL Scrapbook 0");
+ SWTBotEditor editor = bot.editorByTitle("SQL Scrapbook 0");
editor.setFocus();
bot.comboBoxWithLabelInGroup("Type:","Connection profile").setSelection("HSQLDB_1.8");
bot.comboBoxWithLabelInGroup("Name:","Connection profile").setSelection("DefaultDS");
@@ -224,4 +262,54 @@
bot.sleep(TIME_5S);
}
+
+ /**
+ * Run HSQLDB database in server mode
+ * @param file
+ * @param dbname
+ */
+ public static void runHSQLDBServer(final String file, final String dbname) {
+ if (dbRunning) return;
+
+ log.info("Starting HSQLDB");
+ Runnable runable = new Runnable() {
+
+ public void run() {
+ Server.main(new String[] {"-database.0","file:" + file,"-dbname.0",dbname });
+ }
+ };
+
+ hsqlThread = new Thread(runable);
+ hsqlThread.start();
+ log.info("HSQLDB started");
+ dbRunning = true;
+ }
+
+ /**
+ * Stop HSQL Database by sending SHUTDOWN command
+ */
+ public static void stopHSQLDBServer() {
+
+ try {
+ Class.forName("org.hsqldb.jdbcDriver");
+
+ Connection connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/xdb");
+
+ Statement statement = connection.createStatement();
+ ResultSet resultset = statement.executeQuery("SHUTDOWN");
+
+ resultset.close();
+ statement.close();
+ connection.close();
+
+
+ } catch (SQLException e) {
+
+ }
+ catch (ClassNotFoundException e) {
+ log.error("Unable to stop HSQLDB " + e);
+ }
+
+
+ }
}
\ No newline at end of file
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testsuite/Project.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -25,5 +25,6 @@
public static final String JDBC_STRING = "jdbc:hsqldb:hsql://localhost/xdb";
public static final String HSQLDB_PATH = "/home/jpeterka/lib/hsqldb";
public static final String CONF_FILE_NAME2 = "hibernate2.cfg.xml";
-
+ public static final String DB_FILE = "mydb";
+ public static final String DB_NAME = "xdb";
}
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -37,12 +37,17 @@
* @author jpeterka
*
*/
-public class SWTEclipseExt extends SWTBotExt{
+public class SWTEclipseExt {
- SWTBotExt bot = new SWTBotExt();
- SWTUtilExt util = new SWTUtilExt();
+ SWTBotExt bot;
+ SWTUtilExt util;
Logger log = Logger.getLogger(SWTEclipseExt.class);
-
+
+ public SWTEclipseExt(SWTBotExt bot) {
+ this.bot = bot;
+ util = new SWTUtilExt(bot);
+ }
+
// ------------------------------------------------------------
// View related methods
// ------------------------------------------------------------
@@ -58,11 +63,14 @@
*
* @param type
*/
- public void showView(ViewType type) {
+ public SWTBot showView(ViewType type) {
bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.SHOW_VIEW).menu(
IDELabel.Menu.OTHER).click();
bot.tree().expandNode(type.getGroupLabel()).expandNode(type.getViewLabel()).select();
bot.button(IDELabel.Button.OK).click();
+
+ SWTBot viewBot = bot.viewByTitle(type.getViewLabel()).bot();
+ return viewBot;
}
// ------------------------------------------------------------
// Perspective related methods
@@ -184,12 +192,22 @@
* Select element in tree
* @return
*/
- public SWTBotTreeItem selectTreeLocation(String... path) {
+ public SWTBotTreeItem selectTreeLocation(String... path) {
+ return selectTreeLocation(bot, path);
+ }
+ /**
+ * Select element in tree with given bot
+ * @return
+ */
+ public SWTBotTreeItem selectTreeLocation(SWTBot bot, String... path) {
+
+ SWTBot viewBot = bot;
+
SWTBotTreeItem item = null;
// Go through path
for ( String nodeName: path ) {
if ( item == null ) {
- item = bot.tree().expandNode(nodeName);
+ item = viewBot.tree().expandNode(nodeName);
} else {
item = item.expandNode(nodeName);
}
@@ -197,8 +215,7 @@
}
return item.select();
}
-
-
+
// ------------------------------------------------------------
// Subroutines
// ------------------------------------------------------------
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -24,8 +24,8 @@
public static final Logger log = Logger.getLogger(SWTTestExt.class);
public static final SWTBotExt bot = new SWTBotExt();
- public static final SWTUtilExt util = new SWTUtilExt();
- public static final SWTEclipseExt eclipse = new SWTEclipseExt();
+ public static final SWTUtilExt util = new SWTUtilExt(bot);
+ public static final SWTEclipseExt eclipse = new SWTEclipseExt(bot);
// Views
public static final PackageExplorer packageExplorer = new PackageExplorer();
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -39,8 +39,12 @@
public class SWTUtilExt extends SWTUtils {
private Logger log = Logger.getLogger(SWTUtilExt.class);
- protected SWTBotExt bot = new SWTBotExt();
+ protected SWTBotExt bot;
+ public SWTUtilExt(SWTBotExt bot) {
+ this.bot = bot;
+ }
+
// ------------------------------------------------------------
// Waiting methods
// ------------------------------------------------------------
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2009-12-10 17:15:34 UTC (rev 19195)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -19,30 +19,31 @@
import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
import org.jboss.tools.ui.bot.ext.Activator;
+import org.jboss.tools.ui.bot.ext.types.DriverEntity;
public class DatabaseHelper {
-
+
/**
* Create HSQLDB Driver
* @throws ConnectionProfileException
* @return driver instance
*/
- public static void createDriver(String path) throws ConnectionProfileException {
+ public static void createDriver(DriverEntity entity) throws ConnectionProfileException {
String driverPath;
try {
- driverPath = new File(path).getCanonicalPath(); //$NON-NLS-1$
+ driverPath = new File(entity.getDrvPath()).getCanonicalPath(); //$NON-NLS-1$
} catch (IOException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
Activator.PLUGIN_ID, "Can't create driver", e));
return;
}
- DriverInstance driver = DriverManager.getInstance().getDriverInstanceByName("Hypersonic DB");
+ DriverInstance driver = DriverManager.getInstance().getDriverInstanceByName(entity.getInstanceName());
if (driver == null) {
TemplateDescriptor descr = TemplateDescriptor.getDriverTemplateDescriptor("org.eclipse.datatools.enablement.hsqldb.1_8.driver");
- IPropertySet instance = new PropertySetImpl("Hypersonic DB", "DriverDefn.Hypersonic DB");
- instance.setName("Hypersonic DB");
+ IPropertySet instance = new PropertySetImpl(entity.getInstanceName(), "DriverDefn.Hypersonic DB");
+ instance.setName(entity.getInstanceName());
instance.setID("DriverDefn.Hypersonic DB");
Properties props = new Properties();
@@ -55,7 +56,7 @@
props.setProperty(id, value == null ? "" : value); //$NON-NLS-1$
}
//props.setProperty("org.eclipse.datatools.connectivity.db.URL", "jdbc:hsqldb:file:testdb"); //$NON-NLS-1$
- props.setProperty("org.eclipse.datatools.connectivity.db.URL", "jdbc:hsqldb:hsql://localhost/xdb");
+ props.setProperty("org.eclipse.datatools.connectivity.db.URL", entity.getJdbcString());
props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
@@ -65,7 +66,7 @@
DriverManager.getInstance().addDriverInstance(instance);
}
- driver = DriverManager.getInstance().getDriverInstanceByName("Hypersonic DB");
+ driver = DriverManager.getInstance().getDriverInstanceByName(entity.getInstanceName());
if (driver != null && ProfileManager.getInstance().getProfileByName("DefaultDS") == null) { //$NON-NLS-1$
// create profile
Properties props = new Properties();
@@ -74,13 +75,13 @@
props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
- props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, "Default"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, entity.getDatabaseName()); //$NON-NLS-1$
props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, ""); //$NON-NLS-1$
props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, "false"); //$NON-NLS-1$
props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
- ProfileManager.getInstance().createProfile("DefaultDS", "Hypersonic embedded database", IDBConnectionProfileConstants.CONNECTION_PROFILE_ID, props, "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ProfileManager.getInstance().createProfile(entity.getProfileName(), entity.getProfileDescription(), IDBConnectionProfileConstants.CONNECTION_PROFILE_ID, props, "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
Added: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java 2009-12-10 17:30:34 UTC (rev 19196)
@@ -0,0 +1,64 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 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.ui.bot.ext.types;
+
+/**
+ * Driver entity for usage for DatabaseHelper
+ * @author jpeterka
+ *
+ */
+public class DriverEntity {
+ String instanceName = "Hypersonic DB";
+ String drvPath = "";
+ String jdbcString = "";
+ String profileName = "DefaultDS";
+ String profileDescription = "Hypersonic embedded database";
+ String databaseName = "Default";
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+ public String getDrvPath() {
+ return drvPath;
+ }
+ public void setDrvPath(String drvPath) {
+ this.drvPath = drvPath;
+ }
+ public String getJdbcString() {
+ return jdbcString;
+ }
+ public void setJdbcString(String jdbcString) {
+ this.jdbcString = jdbcString;
+ }
+ public String getProfileName() {
+ return profileName;
+ }
+ public void setProfileName(String profileName) {
+ this.profileName = profileName;
+ }
+ public String getProfileDescription() {
+ return profileDescription;
+ }
+ public void setProfileDescription(String profileDescription) {
+ this.profileDescription = profileDescription;
+ }
+ public String getDatabaseName() {
+ return databaseName;
+ }
+ public void setDatabaseName(String databaseName) {
+ this.databaseName = databaseName;
+ }
+
+
+}
Property changes on: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/DriverEntity.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
JBoss Tools SVN: r19195 - in documentation/trunk/movies: HQL_JPA-QL_queries and 17 other directories.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-12-10 12:15:34 -0500 (Thu, 10 Dec 2009)
New Revision: 19195
Modified:
documentation/trunk/movies/HQL_JPA-QL_queries/HQL_JPA-QL_queries.wnk
documentation/trunk/movies/Reverse_engineering_and_code_generation/Reverse_engineering_and_code_generation.wnk
documentation/trunk/movies/create_console_config/create_console_config.wnk
documentation/trunk/movies/cust_tag_lib_to_palette/cust_tag_lib_to_palette.wnk
documentation/trunk/movies/edit_and_run_criteria/edit_and_run_criteria.wnk
documentation/trunk/movies/hbm_xml_editing/hbm_xml_editing.wnk
documentation/trunk/movies/new_seam_project/new_seam_project.wnk
documentation/trunk/movies/ootb_new_seam_project.wnk
documentation/trunk/movies/rename_context_variables_java/rename_context_variables_java.wnk
documentation/trunk/movies/rename_context_variables_properties/rename_context_variables_properties.wnk
documentation/trunk/movies/rename_context_variables_vpe/rename_context_variables_vpe.wnk
documentation/trunk/movies/rename_context_variables_xml/rename_context_variables_xml.wnk
documentation/trunk/movies/rename_seam_components_comp_view/rename_seam_components_comp_view.wnk
documentation/trunk/movies/rename_seam_components_comp_xml/rename_seam_components_comp_xml.wnk
documentation/trunk/movies/rename_seam_components_java/rename_seam_components_java.wnk
documentation/trunk/movies/rich_faces_demo/rich_faces_demo.wnk
documentation/trunk/movies/seam2_plus_ejb3/seam2_plus_ejb3.wnk
documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
documentation/trunk/movies/seam_demo/seam_demo_part2.wnk
documentation/trunk/movies/welcome_to_JBDS/welcome_jbds.wnk
Log:
https://jira.jboss.org/jira/browse/JBDS-951 Support for tag libs - section on taglibs - updated
Modified: documentation/trunk/movies/HQL_JPA-QL_queries/HQL_JPA-QL_queries.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/Reverse_engineering_and_code_generation/Reverse_engineering_and_code_generation.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/create_console_config/create_console_config.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/cust_tag_lib_to_palette/cust_tag_lib_to_palette.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/edit_and_run_criteria/edit_and_run_criteria.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/hbm_xml_editing/hbm_xml_editing.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/new_seam_project/new_seam_project.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/ootb_new_seam_project.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_context_variables_java/rename_context_variables_java.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_context_variables_properties/rename_context_variables_properties.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_context_variables_vpe/rename_context_variables_vpe.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_context_variables_xml/rename_context_variables_xml.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_seam_components_comp_view/rename_seam_components_comp_view.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_seam_components_comp_xml/rename_seam_components_comp_xml.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rename_seam_components_java/rename_seam_components_java.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/rich_faces_demo/rich_faces_demo.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/seam2_plus_ejb3/seam2_plus_ejb3.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/seam_demo/seam_demo_part1.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/seam_demo/seam_demo_part2.wnk
===================================================================
(Binary files differ)
Modified: documentation/trunk/movies/welcome_to_JBDS/welcome_jbds.wnk
===================================================================
(Binary files differ)
15 years, 1 month
JBoss Tools SVN: r19193 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-10 11:37:38 -0500 (Thu, 10 Dec 2009)
New Revision: 19193
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -30,6 +30,7 @@
public String ALTERNATIVE_ANNOTATION_TYPE_NAME = "javax.enterprise.inject.Alternative";
public String INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME = "javax.interceptor.InterceptorBinding";
+ public String INTERCEPTOR_ANNOTATION_TYPE_NAME = "javax.interceptor.Interceptor";
public String APPLICATION_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.ApplicationScoped";
public String CONVERSATION_SCOPED_ANNOTATION_TYPE_NAME = "javax.enterprise.context.ConversationScoped";
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -129,8 +129,10 @@
} catch (InstantiationException e2) {
CDICorePlugin.getDefault().logError(e2);
}
- }
+ }
+ n.getDefinitions().newWorkingCopy(kind == FULL_BUILD);
+
if(n.getClassPath().update()) {
List<String> newJars = n.getClassPath().process();
buildJars(newJars);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -39,11 +39,13 @@
boolean isBuilt = false;
- Map<IPath, Object> sourcePaths2 = new HashMap<IPath, Object>(); //TODO
+// Map<IPath, Object> sourcePaths2 = new HashMap<IPath, Object>(); //TODO
private boolean isStorageResolved = false;
- public CDICoreNature() {}
+ public CDICoreNature() {
+ definitions.setProject(this);
+ }
public void configure() throws CoreException {
addToBuildSpec(CDICoreBuilder.BUILDER_ID);
@@ -64,6 +66,7 @@
public void setCDIProject(ICDIProject cdiProject) {
this.cdiProjectDelegate = cdiProject;
+ cdiProject.setNature(this);
}
public DefinitionContext getDefinitions() {
@@ -138,10 +141,15 @@
isBuilt = false;
classPath.clean();
postponeFiring();
- IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
- for (int i = 0; i < ps.length; i++) {
- pathRemoved(ps[i]);
+
+ definitions.clean();
+ if(cdiProjectDelegate != null) {
+ cdiProjectDelegate.update();
}
+// IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
+// for (int i = 0; i < ps.length; i++) {
+// pathRemoved(ps[i]);
+// }
fireChanges();
}
@@ -249,8 +257,10 @@
public List<Long> statistics;
public void pathRemoved(IPath source) {
+// sourcePaths2.remove(source);
definitions.clean(source);
//TODO
}
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -15,4 +15,7 @@
*/
public interface ICDIProject extends IBeanManager {
+ public void setNature(CDICoreNature n);
+ public void update();
+
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -27,11 +27,13 @@
*/
public class AbstractBeanElement extends CDIElement {
protected AbstractMemberDefinition definition;
+
protected AnnotationDeclaration named;
protected AnnotationDeclaration alternative;
protected AnnotationDeclaration specializes;
protected AnnotationDeclaration typed;
protected AnnotationDeclaration decorator;
+ protected AnnotationDeclaration interceptor;
protected AnnotationDeclaration delegate;
public AbstractBeanElement() {}
@@ -56,6 +58,8 @@
decorator = d;
} else if(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME.equals(typeName)) {
delegate = d;
+ } else if(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME.equals(typeName)) {
+ interceptor = d;
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -12,6 +12,7 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,8 +32,11 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IObserverMethod;
+import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IStereotype;
+import org.jboss.tools.cdi.internal.core.impl.definition.AbstractTypeDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.common.text.INodeReference;
/**
@@ -46,12 +50,20 @@
Map<String, StereotypeElement> stereotypes = new HashMap<String, StereotypeElement>();
Map<String, InterceptorBindingElement> interceptorBindings = new HashMap<String, InterceptorBindingElement>();
+ Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath, Set<IBean>>();
+ Map<String, Set<IBean>> beansByName = new HashMap<String, Set<IBean>>();
+
+
public CDIProject() {}
public CDICoreNature getNature() {
return n;
}
+ public void setNature(CDICoreNature n) {
+ this.n = n;
+ }
+
public List<INodeReference> getAlternativeClasses() {
// TODO Auto-generated method stub
return null;
@@ -72,10 +84,22 @@
return null;
}
- public Set<IBean> getBeans(String name,
- boolean attemptToResolveAmbiguousNames) {
- // TODO Auto-generated method stub
- return null;
+ public Set<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames) {
+ Set<IBean> result = new HashSet<IBean>();
+ Set<IBean> beans = beansByName.get(name);
+ if(beans == null || beans.isEmpty()) {
+ return result;
+ }
+ result.addAll(beans);
+ if(result.size() == 1 || !attemptToResolveAmbiguousNames) {
+ return result;
+ }
+ Iterator<IBean> it = result.iterator();
+ while(it.hasNext()) {
+ IBean bean = it.next();
+ if(!bean.isAlternative()) it.remove();
+ }
+ return result;
}
public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
@@ -85,13 +109,16 @@
}
public Set<IBean> getBeans(IInjectionPoint injectionPoints) {
- // TODO Auto-generated method stub
- return null;
+ Set<IBean> result = new HashSet<IBean>();
+ //TODO
+ return result;
}
public Set<IBean> getBeans(IPath path) {
- // TODO Auto-generated method stub
- return null;
+ Set<IBean> result = new HashSet<IBean>();
+ Set<IBean> beans = beansByPath.get(path);
+ if(beans != null && !beans.isEmpty()) result.addAll(beans);
+ return result;
}
public List<INodeReference> getDecoratorClasses() {
@@ -247,6 +274,11 @@
return interceptorBindings.get(qualifiedName);
}
+ public void update() {
+ rebuildAnnotationTypes();
+ rebuildBeans();
+ }
+
public void rebuildAnnotationTypes() {
stereotypes.clear();
interceptorBindings.clear();
@@ -273,4 +305,46 @@
}
}
}
+
+ public void rebuildBeans() {
+ beansByPath.clear();
+ beansByName.clear();
+ List<TypeDefinition> typeDefinitions = n.getDefinitions().getTypeDefinitions();
+ for (TypeDefinition typeDefinition : typeDefinitions) {
+ ClassBean bean = null;
+ if(typeDefinition.getInterceptorAnnotation() != null) {
+ bean = new InterceptorBean();
+ } else if(typeDefinition.getDecoratorAnnotation() != null) {
+ bean = new DecoratorBean();
+ } else {
+ bean = new ClassBean();
+ }
+ bean.setDefinition(typeDefinition);
+ addBean(bean);
+ Set<IProducer> ps = bean.getProducers();
+ for (IProducer producer: ps) {
+ addBean(producer);
+ }
+ }
+ }
+
+ void addBean(IBean bean) {
+ String name = bean.getName();
+ if(name != null && name.length() > 0) {
+ Set<IBean> bs = beansByName.get(name);
+ if(bs == null) {
+ bs = new HashSet<IBean>();
+ beansByName.put(name, bs);
+ }
+ bs.add(bean);
+ }
+ IPath path = bean.getSourcePath();
+ Set<IBean> bs = beansByPath.get(path);
+ if(bs == null) {
+ bs = new HashSet<IBean>();
+ beansByPath.put(path, bs);
+ }
+ bs.add(bean);
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -51,6 +51,7 @@
public ClassBean() {}
public void setDefinition(TypeDefinition definition) {
+ setSourcePath(definition.getType().getPath());
super.setDefinition(definition);
setAnnotations(definition.getAnnotations());
List<MethodDefinition> ms = definition.getMethods();
@@ -63,6 +64,7 @@
bm = new BeanMethod();
}
bm.setDefinition(m);
+ bm.setParent(this);
methods.add(bm);
}
List<FieldDefinition> fs = definition.getFields();
@@ -77,6 +79,7 @@
bf = new BeanField();
}
bf.setDefinition(f);
+ bf.setParent(this);
fields.add(bf);
}
}
@@ -164,13 +167,14 @@
}
public String getName() {
- String name = ((TypeDefinition)definition).getQualifiedName();
+ AnnotationDeclaration named = findNamedAnnotation();
+ if(named == null) return null;
+
+ String name = ((TypeDefinition)definition).getType().getElementName();
if(name.length() > 0) {
name = name.substring(0, 1).toLowerCase() + name.substring(1);
}
- if(named == null) {
- return name;
- }
+
IAnnotation a = named.getDeclaration();
try {
IMemberValuePair[] vs = a.getMemberValuePairs();
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IInterceptor;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class InterceptorBean extends ClassBean implements IInterceptor {
+
+ public InterceptorBean() {}
+
+ public IAnnotationDeclaration getInterceptorAnnotation() {
+ return interceptor;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -39,7 +39,7 @@
}
public void setType(IType type, DefinitionContext context) {
- super.setAnnotatable(type, type,context);
+ super.setAnnotatable(type, type, context);
}
@Override
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -26,7 +26,7 @@
public static final Set<String> SCOPE_ANNOTATION_TYPES = new HashSet<String>();
public static final Set<String> STEREOTYPE_ANNOTATION_TYPES = new HashSet<String>();
- {
+ static {
BASIC_ANNOTATION_TYPES.add(INHERITED_ANNOTATION_TYPE_NAME);
BASIC_ANNOTATION_TYPES.add(TARGET_ANNOTATION_TYPE_NAME);
BASIC_ANNOTATION_TYPES.add(RETENTION_ANNOTATION_TYPE_NAME);
@@ -54,6 +54,7 @@
CDI_ANNOTATION_TYPES.add(INJECT_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(ALTERNATIVE_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(INTERCEPTOR_BINDING_ANNOTATION_TYPE_NAME);
+ CDI_ANNOTATION_TYPES.add(INTERCEPTOR_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.addAll(SCOPE_ANNOTATION_TYPES);
CDI_ANNOTATION_TYPES.addAll(STEREOTYPE_ANNOTATION_TYPES);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -34,7 +34,7 @@
Set<String> types = new HashSet<String>();
Map<IPath, Set<String>> resources = new HashMap<IPath, Set<String>>();
- Map<String, AbstractTypeDefinition> typeDefinitions = new HashMap<String, AbstractTypeDefinition>();
+ Map<String, TypeDefinition> typeDefinitions = new HashMap<String, TypeDefinition>();
Map<String, AnnotationDefinition> annotations = new HashMap<String, AnnotationDefinition>();
DefinitionContext workingCopy;
@@ -42,12 +42,23 @@
public DefinitionContext() {}
- private DefinitionContext copy() {
+ private DefinitionContext copy(boolean clean) {
DefinitionContext copy = new DefinitionContext();
copy.project = project;
copy.javaProject = javaProject;
- copy.types.addAll(types);
- copy.typeDefinitions.putAll(typeDefinitions);
+ if(!clean) {
+ copy.types.addAll(types);
+ copy.typeDefinitions.putAll(typeDefinitions);
+ copy.annotations.putAll(annotations);
+ for (IPath p: resources.keySet()) {
+ Set<String> set = resources.get(p);
+ if(set != null) {
+ Set<String> s1 = new HashSet<String>();
+ s1.addAll(set);
+ copy.resources.put(p, s1);
+ }
+ }
+ }
return copy;
}
@@ -82,12 +93,23 @@
}
} else {
synchronized (typeDefinitions) {
- typeDefinitions.put(def.getQualifiedName(), def);
+ typeDefinitions.put(def.getQualifiedName(), (TypeDefinition)def);
}
}
}
}
+ public void clean() {
+ resources.clear();
+ types.clear();
+ synchronized (typeDefinitions) {
+ typeDefinitions.clear();
+ }
+ synchronized (annotations) {
+ annotations.clear();
+ }
+ }
+
public void clean(IPath path) {
Set<String> ts = resources.remove(path);
if(ts == null) return;
@@ -102,9 +124,11 @@
}
}
+ private Set<String> underConstruction = new HashSet<String>();
+
public int getAnnotationKind(IType annotationType) {
if(annotationType == null) return -1;
- AnnotationDefinition d = annotations.get(annotationType);
+ AnnotationDefinition d = getAnnotation(annotationType);
if(d != null) {
return d.getKind();
}
@@ -127,11 +151,15 @@
if(AnnotationHelper.CDI_ANNOTATION_TYPES.contains(name)) {
return AnnotationDefinition.CDI;
}
-
+ if(underConstruction.contains(name)) {
+ return AnnotationDefinition.BASIC;
+ }
+ System.out.println(name);
return createAnnotation(annotationType, name);
}
private int createAnnotation(IType annotationType, String name) {
+ underConstruction.add(name);
AnnotationDefinition d = new AnnotationDefinition();
d.setType(annotationType, this);
int kind = d.getKind();
@@ -139,9 +167,16 @@
d = null;
}
addType(annotationType.getPath(), name, d);
+ underConstruction.remove(name);
return kind;
}
+ public void newWorkingCopy(boolean forFullBuild) {
+ if(original != null) return;
+ workingCopy = copy(forFullBuild);
+ workingCopy.original = this;
+ }
+
public DefinitionContext getWorkingCopy() {
if(original != null) {
return this;
@@ -149,7 +184,7 @@
if(workingCopy != null) {
return workingCopy;
}
- workingCopy = copy();
+ workingCopy = copy(false);
workingCopy.original = this;
return workingCopy;
}
@@ -162,8 +197,14 @@
if(workingCopy == null) {
return;
}
- //TODO
-
+
+ types = workingCopy.types;
+ resources = workingCopy.resources;
+ typeDefinitions = workingCopy.typeDefinitions;
+ annotations = workingCopy.annotations;
+
+ project.getDelegate().update();
+
workingCopy = null;
}
@@ -178,9 +219,15 @@
result.addAll(annotations.values());
}
return result;
+ }
+ public List<TypeDefinition> getTypeDefinitions() {
+ List<TypeDefinition> result = new ArrayList<TypeDefinition>();
+ synchronized (typeDefinitions) {
+ result.addAll(typeDefinitions.values());
+ }
+ return result;
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -14,9 +14,11 @@
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
/**
@@ -25,8 +27,11 @@
*
*/
public class TypeDefinition extends AbstractTypeDefinition {
+ boolean isAbstract;
List<FieldDefinition> fields = new ArrayList<FieldDefinition>();
List<MethodDefinition> methods = new ArrayList<MethodDefinition>();
+ AnnotationDeclaration decoratorAnnotation;
+ AnnotationDeclaration interceptorAnnotation;
public TypeDefinition() {
}
@@ -34,9 +39,15 @@
@Override
protected void init(IType contextType, DefinitionContext context) throws CoreException {
super.init(contextType, context);
- for (AnnotationDeclaration d: annotations) {
- int kind = context.getAnnotationKind(d.getType());
+ isAbstract = Flags.isAbstract(type.getFlags());
+ for (AnnotationDeclaration a: annotations) {
+ int kind = context.getAnnotationKind(a.getType());
//TODO do we need to create members for specific annotations?
+ if(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME.equals(a.getTypeName())) {
+ decoratorAnnotation = a;
+ } else if(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME.equals(a.getTypeName())) {
+ interceptorAnnotation = a;
+ }
}
IField[] fs = getType().getFields();
for (int i = 0; i < fs.length; i++) {
@@ -64,4 +75,16 @@
return methods;
}
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public AnnotationDeclaration getDecoratorAnnotation() {
+ return decoratorAnnotation;
+ }
+
+ public AnnotationDeclaration getInterceptorAnnotation() {
+ return interceptorAnnotation;
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-10 16:36:43 UTC (rev 19192)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/CDIBuilderDelegate.java 2009-12-10 16:37:38 UTC (rev 19193)
@@ -38,7 +38,6 @@
DefinitionContext context = projectNature.getDefinitions().getWorkingCopy();
Set<IPath> ps = fileSet.getAllPaths();
for (IPath p: ps) context.clean(p);
- context.setProject(projectNature);
Map<IPath, Set<IType>> as = fileSet.getAnnotations();
for (IPath f: as.keySet()) {
Set<IType> ts = as.get(f);
15 years, 1 month
JBoss Tools SVN: r19192 - in trunk/common/plugins: org.jboss.tools.common.el.ui/META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-12-10 11:36:43 -0500 (Thu, 10 Dec 2009)
New Revision: 19192
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-5289
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-12-10 16:36:43 UTC (rev 19192)
@@ -17,10 +17,8 @@
Require-Bundle: org.eclipse.jface.text,
org.eclipse.wst.sse.core,
org.eclipse.wst.sse.ui,
- org.jboss.tools.common,
org.jboss.tools.common.model,
org.jboss.tools.common.resref.core;visibility:=reexport,
org.eclipse.ui,
- org.eclipse.jdt.ui;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.ltk.core.refactoring;bundle-version="[3.5.0,4.0.0)"
+ org.eclipse.jdt.ui;bundle-version="[3.5.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-12-10 16:36:43 UTC (rev 19192)
@@ -9,20 +9,12 @@
org.jboss.tools.common.el.ui.ca
Bundle-Activator: org.jboss.tools.common.el.ui.ElUiPlugin
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
org.jboss.tools.common.el.core;bundle-version="[2.0.0,3.0.0)",
org.jboss.tools.common.resref.ui;bundle-version="[1.0.0,3.0.0)",
- org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.jboss.tools.common.model.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.ltk.core.refactoring;bundle-version="[3.5.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.search;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
- org.jboss.tools.jst.web.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.4.100,4.0.0)",
- org.eclipse.ltk.ui.refactoring;bundle-version="[3.4.100,4.0.0)",
- org.jboss.tools.common.ui;bundle-version="[1.0.0,2.0.0)",
org.eclipse.wst.xml.ui
Bundle-Vendor: %Bundle-Vendor.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
15 years, 1 month
JBoss Tools SVN: r19191 - in trunk: common/plugins/org.jboss.tools.common.el.core/META-INF and 41 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-12-10 11:13:45 -0500 (Thu, 10 Dec 2009)
New Revision: 19191
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/FieldEditorFactory.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameELVariableWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELRenameProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableRefactoring.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.project
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/.jsdtscope
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.jdt.core.prefs
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.component
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.container
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.name
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/User.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/User.class
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/common-annotations.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-beanutils.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-collections.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-digester.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-logging.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jsf-tlds.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jstl.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/standard.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/web.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/index.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/hello.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/inputUserName.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELRefactoringTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java
Removed:
trunk/common/plugins/org.jboss.tools.common.el.core/schema/elProjectSet.exsd
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/testJSFProject/
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELRefactoringTest.java
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELReferencesRenameTest.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/Messages.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFKnowledgeBaseAdapter.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFManagedPropertyNameAdapter.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/JSFDiagramEditPart.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/messages.properties
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
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/refactoring/ELProjectSet.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5289
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -10,7 +10,6 @@
org.jboss.tools.common.el.core.ca,
org.jboss.tools.common.el.core.model,
org.jboss.tools.common.el.core.parser,
- org.jboss.tools.common.el.core.refactoring,
org.jboss.tools.common.el.core.resolver,
org.jboss.tools.common.el.internal.core.parser,
org.jboss.tools.common.el.internal.core.parser.token
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -2,6 +2,5 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="elResolver" name="EL Resolver" schema="schema/elResolver.exsd"/>
- <extension-point id="elProjectSet" name="EL Project Set" schema="schema/elProjectSet.exsd"/>
</plugin>
Deleted: trunk/common/plugins/org.jboss.tools.common.el.core/schema/elProjectSet.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/schema/elProjectSet.exsd 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/schema/elProjectSet.exsd 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,127 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.common.el.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.jboss.tools.common.el.core" id="elSearch" name="EL Search"/>
- </appinfo>
- <documentation>
- This extenion point is used to send information about seam project to search and rename participants. In order to have one search participand and one rename participant for seam and jsf projects.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="project-set" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="project-set">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="projectset-class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.jboss.tools.common.el.core.refactoring.ProjectsSet"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- JBoss Tools 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2009 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
- </documentation>
- </annotation>
-
-</schema>
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -6,8 +6,7 @@
Bundle-SymbolicName: org.jboss.tools.common.el.ui;singleton:=true
Bundle-Version: 1.0.0
Export-Package: org.jboss.tools.common.el.ui,
- org.jboss.tools.common.el.ui.ca,
- org.jboss.tools.common.el.ui.refactoring
+ org.jboss.tools.common.el.ui.ca
Bundle-Activator: org.jboss.tools.common.el.ui.ElUiPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,39 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
- <extension
- point="org.eclipse.jdt.ui.queryParticipants">
- <queryParticipant
- class="org.jboss.tools.common.el.ui.refactoring.ELReferencesQueryParticipant"
- id="org.jboss.tools.common.el.ui.refactoring.ELReferencesQueryParticipant"
- name="jsf-SearchELReferencesParticipant"
- nature="org.jboss.tools.jsf.jsfnature">
- </queryParticipant>
- </extension>
-<extension
- point="org.eclipse.ltk.core.refactoring.renameParticipants">
- <renameParticipant
- class="org.jboss.tools.common.el.ui.refactoring.RenameMethodParticipant"
- id="org.jboss.tools.common.el.ui.refactoring.RenameMethodParticipant"
- name="el-RenameMethodParticipant">
- <enablement>
- <with variable="element">
- <or>
- <instanceof value="org.eclipse.jdt.core.IMethod"/>
- <instanceof value="org.eclipse.jdt.core.IType"/>
- </or>
- </with>
- </enablement>
- </renameParticipant>
- </extension>
-
- <!-- Refactorng -->
- <!--extension
- point="org.eclipse.ui.menus">
- <menuContribution
- class="org.jboss.tools.common.el.ui.refactoring.ELRefactorContributionFactory"
- locationURI="popup:org.eclipse.ui.popup.any?after=save">
- </menuContribution>
- </extension-->
</plugin>
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,11 +1 @@
SUBSTITUTED_EL_EXPRESSIONS=Substituted El expressions
-RENAME_METHOD_PARTICIPANT_GETTER_WARNING=Be sure, may be you also should rename setter method to avoid compilation problems.
-RENAME_METHOD_PARTICIPANT_SETTER_WARNING=Be sure, may be you also should rename getter method to avoid compilation problems.
-RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE=Cannot change file. File ''{0}'' is not in sync.
-RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE=Cannot change phantom file: ''{0}''.
-RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE=Cannot change read-only file: ''{0}''.
-RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES=Update method references in EL
-RESOURCE_BUNDLES_RENAME_PARTICIPANT_UPDATE_BUNDLE_REFERENCES=Update bundle references in EL
-REFACTOR_CONTRIBUTOR_MAIN_MENU=EL Refactor
-REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE=Rename EL Variable
-RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME=Seam component name:
Modified: trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.common.el.core.test;
-import org.jboss.tools.common.el.core.test.refactoring.ELReferencesRenameTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import junit.framework.Test;
@@ -27,10 +26,6 @@
suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(ELParserTest.class);
suite.addTestSuite(ELModelTest.class);
- suite.addTest(new ProjectImportTestSetup(new TestSuite(ELReferencesRenameTest.class),
- "org.jboss.tools.common.el.core.test",
- new String[]{"projects/testJSFProject",},
- new String[]{"testJSFProject"}));
return suite;
}
}
Deleted: trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELRefactoringTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELRefactoringTest.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELRefactoringTest.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,131 +0,0 @@
-package org.jboss.tools.common.el.core.test.refactoring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
-import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ProjectImportTestSetup;
-
-import junit.framework.TestCase;
-
-public class ELRefactoringTest extends TestCase {
- static String jsfProjectName = "testJSFProject";
- static IProject jsfProject;
-
- public ELRefactoringTest(String name){
- super(name);
- }
-
- protected void setUp() throws Exception {
- loadProjects();
- List<IProject> projectList = new ArrayList<IProject>();
- projectList.add(jsfProject);
- J2EEComponentClasspathUpdater.getInstance().forceUpdate(projectList);
- loadProjects();
- }
-
- private void loadProjects() throws Exception {
- jsfProject = ProjectImportTestSetup.loadProject(jsfProjectName);
- jsfProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- }
-
- protected TestChangeStructure findChange(List<TestChangeStructure> changeList, IFile file){
- for(TestChangeStructure tcs : changeList){
- if(tcs.getFileName().equals("/"+file.getFullPath().removeFirstSegments(1).toString()))
- return tcs;
- }
- return null;
- }
-
- protected IType getJavaType(IProject project, String className){
- IJavaProject javaProject = EclipseUtil.getJavaProject(project);
- if(javaProject != null){
- try{
- return javaProject.findType(className);
- }catch(JavaModelException ex){
- fail(ex.getMessage());
- }
- }
-
- return null;
- }
-
- protected IMethod getJavaMethod(IProject project, String className, String methodName){
- IType type = getJavaType(project, className);
- if(type != null){
- return type.getMethod(methodName, new String[0]);
- }
- return null;
- }
-
- class TestChangeStructure{
- private IProject project;
- private String fileName;
- ArrayList<TestTextChange> textChanges = new ArrayList<TestTextChange>();
-
-
- public TestChangeStructure(IProject project, String fileName){
- this.project = project;
- this.fileName = fileName;
- }
-
- public IProject getProject(){
- return project;
- }
-
- public String getFileName(){
- return fileName;
- }
-
- public ArrayList<TestTextChange> getTextChanges(){
- return textChanges;
- }
-
- public void addTextChange(TestTextChange change){
- textChanges.add(change);
- }
-
- public int size(){
- return textChanges.size();
- }
-
- }
-
- class TestTextChange{
- private int offset;
- private int length;
- private String text;
-
- public TestTextChange(int offset, int length, String text){
- this.offset = offset;
- this.length = length;
- this.text = text;
- }
-
- public int getOffset(){
- return offset;
- }
-
- public int getLength(){
- return length;
- }
-
- public String getText(){
- return text;
- }
- }
-}
Deleted: trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELReferencesRenameTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELReferencesRenameTest.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/refactoring/ELReferencesRenameTest.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,109 +0,0 @@
-package org.jboss.tools.common.el.core.test.refactoring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.jboss.tools.common.el.ui.refactoring.RenameMethodParticipant;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.test.util.JobUtils;
-
-public class ELReferencesRenameTest extends ELRefactoringTest {
-
-
- public ELReferencesRenameTest(){
- super("Rename Method Refactoring Test");
- }
-
-
-
- public void testRenameMethod() throws CoreException {
- ArrayList<TestChangeStructure> list = new ArrayList<TestChangeStructure>();
-
-
- TestChangeStructure structure = new TestChangeStructure(jsfProject, "/WebContent/pages/hello.jsp");
- TestTextChange change = new TestTextChange(353, 4, "name");
- structure.addTextChange(change);
- list.add(structure);
-
- structure = new TestChangeStructure(jsfProject, "/WebContent/pages/inputUserName.jsp");
- change = new TestTextChange(499, 4, "name");
- structure.addTextChange(change);
- list.add(structure);
-
- IMethod method = getJavaMethod(jsfProject, "demo.User", "getName");
-
- renameELReferences(method, "alias", list);
- }
-
- public void testRenameClass() throws CoreException {
- ArrayList<TestChangeStructure> list = new ArrayList<TestChangeStructure>();
-
-
- TestChangeStructure structure = new TestChangeStructure(jsfProject, "/WebContent/pages/hello.jsp");
- TestTextChange change = new TestTextChange(348, 4, "user");
- structure.addTextChange(change);
- list.add(structure);
-
- structure = new TestChangeStructure(jsfProject, "/WebContent/pages/inputUserName.jsp");
- change = new TestTextChange(494, 4, "user");
- structure.addTextChange(change);
- list.add(structure);
-
- IType type = getJavaType(jsfProject, "demo.User");
-
- renameELReferences(type, "person", list);
- }
-
- private void renameELReferences(IJavaElement element, String newName, List<TestChangeStructure> changeList) throws CoreException{
- JobUtils.waitForIdle();
-
-
- // Rename EL references
- RenameMethodParticipant participant = new RenameMethodParticipant();
- participant.initialize(element, newName);
- participant.checkConditions(new NullProgressMonitor(), null);
- CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
-
- assertEquals("There is unexpected number of changes",changeList.size(), rootChange.getChildren().length);
-
- for(int i = 0; i < rootChange.getChildren().length;i++){
- TextFileChange fileChange = (TextFileChange)rootChange.getChildren()[i];
-
- MultiTextEdit edit = (MultiTextEdit)fileChange.getEdit();
-
- TestChangeStructure change = findChange(changeList, fileChange.getFile());
- if(change != null){
- assertEquals(change.size(), edit.getChildrenSize());
- }
- }
-
- rootChange.perform(new NullProgressMonitor());
- JobUtils.waitForIdle();
- // Test results
-
- for(TestChangeStructure changeStructure : changeList){
- IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
- String content = null;
- try {
- content = FileUtil.readStream(file);
- } catch (CoreException e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- //System.out.println("File - "+file.getName()+" offset - "+changeStructure.getOffset()+" expected - ["+changeStructure.getText()+"] actual - ["+content.substring(changeStructure.getOffset(), changeStructure.getOffset()+changeStructure.getLength())+"]");
- for(TestTextChange change : changeStructure.getTextChanges()){
- assertEquals("There is unexpected change in resource - "+file.getName(), newName, content.substring(change.getOffset(), change.getOffset()+newName.length()));
- }
- }
- }
-}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -6,6 +6,7 @@
Bundle-SymbolicName: org.jboss.tools.jsf;singleton:=true
Bundle-Localization: plugin
Export-Package: org.jboss.tools.jsf,
+ org.jboss.tools.jsf.el.refactoring,
org.jboss.tools.jsf.facelet.model,
org.jboss.tools.jsf.jsf2.model,
org.jboss.tools.jsf.messages,
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
-
+ <extension-point id="elProjectSet" name="EL Project Set" schema="schemas/elProjectSet.exsd"/>
+
<extension point="org.jboss.tools.common.model.meta">
<meta path="meta/jsf.meta">
</meta>
Added: trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.el.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.common.el.core" id="elSearch" name="EL Search"/>
+ </appinfo>
+ <documentation>
+ This extenion point is used to send information about seam project to search and rename participants. In order to have one search participand and one rename participant for seam and jsf projects.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="project-set" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="project-set">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="projectset-class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.common.el.core.refactoring.ProjectsSet"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ JBoss Tools 3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2009 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
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,47 @@
+package org.jboss.tools.jsf.el.refactoring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+
+public class ELProjectSetExtension {
+ public static String EXTENSION_POINT = "org.jboss.tools.jsf.elProjectSet"; //$NON-NLS-1$
+
+ String id;
+ ProjectsSet searcher;
+
+ public ELProjectSetExtension() {}
+
+ public String getId() {
+ return id;
+ }
+
+ public ProjectsSet getProjectSet() {
+ return searcher;
+ }
+
+ static ELProjectSetExtension[] INSTANCES;
+
+ public static ELProjectSetExtension[] getInstances() {
+ if(INSTANCES != null) return INSTANCES;
+ List<ELProjectSetExtension> list = new ArrayList<ELProjectSetExtension>();
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
+ IConfigurationElement[] es = point.getConfigurationElements();
+ for (IConfigurationElement e: es) {
+ ELProjectSetExtension n = new ELProjectSetExtension();
+ n.id = e.getAttribute("id"); //$NON-NLS-1$
+ try{
+ n.searcher = (ProjectsSet)e.createExecutableExtension("projectset-class"); //$NON-NLS-1$
+ }catch(CoreException ex){
+ ELCorePlugin.getDefault().logError(ex);
+ }
+ list.add(n);
+ }
+ return INSTANCES = list.toArray(new ELProjectSetExtension[0]);
+ }
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELRenameProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELRenameProcessor.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELRenameProcessor.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.el.refactoring;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+import org.jboss.tools.common.el.core.ElCoreMessages;
+import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.common.util.FileUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public abstract class ELRenameProcessor extends RenameProcessor {
+ protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ protected static final String XML_EXT = "xml"; //$NON-NLS-1$
+ protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+
+ protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
+
+ protected static final String SEAM_PROPERTIES_FILE = "seam.properties"; //$NON-NLS-1$
+
+ protected RefactoringStatus status;
+
+ protected CompositeChange rootChange;
+ protected TextFileChange lastChange;
+ protected IFile declarationFile=null;
+
+ private ArrayList<String> keys = new ArrayList<String>();
+
+ private String newName;
+ private String oldName;
+
+ private ELSearcher searcher = null;
+
+ public ELRenameProcessor(IFile file, String oldName){
+ searcher = new ELSearcher(file, oldName);
+ }
+
+
+ protected RefactorSearcher getSearcher(){
+ return searcher;
+ }
+
+ public void setNewName(String newName){
+ this.newName = newName;
+ }
+
+ protected String getNewName(){
+ return newName;
+ }
+
+ protected void setOldName(String oldName){
+ this.oldName = oldName;
+ }
+
+ public String getOldName(){
+ return oldName;
+ }
+
+ // lets collect all changes for the same files in one MultiTextEdit
+ protected TextFileChange getChange(IFile file){
+ if(lastChange != null && lastChange.getFile().equals(file))
+ return lastChange;
+
+ for(int i=0; i < rootChange.getChildren().length; i++){
+ TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
+ if(change.getFile().equals(file)){
+ lastChange = change;
+ return lastChange;
+ }
+ }
+ lastChange = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ lastChange.setEdit(root);
+ rootChange.add(lastChange);
+
+ return lastChange;
+ }
+
+ private boolean isBadLocation(ITextSourceReference location, IFile file){
+ boolean flag;
+ if(location == null)
+ flag = true;
+ else
+ flag = location.getStartPosition() == 0 && location.getLength() == 0;
+
+// if(flag)
+// status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND, file.getFullPath().toString()));
+ return flag;
+ }
+
+ private void changeXMLNode(ITextSourceReference location, IFile file){
+ if(isBadLocation(location, file))
+ return;
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+
+ String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
+ if(text.startsWith("<")){ //$NON-NLS-1$
+ int position = text.lastIndexOf("/>"); //$NON-NLS-1$
+ if(position < 0){
+ position = text.lastIndexOf(">"); //$NON-NLS-1$
+ }
+ change(file, location.getStartPosition()+position, 0, " name=\""+getNewName()+"\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }else{
+ change(file, location.getStartPosition(), location.getLength(), getNewName());
+ }
+ }
+
+ private void changeAnnotation(ITextSourceReference location, IFile file){
+ if(isBadLocation(location, file))
+ return;
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+
+ String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
+ int openBracket = text.indexOf("("); //$NON-NLS-1$
+ int openQuote = text.indexOf("\""); //$NON-NLS-1$
+ if(openBracket >= 0){
+ int closeBracket = text.indexOf(")", openBracket); //$NON-NLS-1$
+
+ int equals = text.indexOf("=", openBracket); //$NON-NLS-1$
+ int value = text.indexOf("value", openBracket); //$NON-NLS-1$
+
+ if(closeBracket == openBracket+1){ // empty brackets
+ String newText = "\""+getNewName()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
+ change(file, location.getStartPosition()+openBracket+1, 0, newText);
+ }else if(value > 0){ // construction value="name" found so change name
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }else if(equals > 0){ // other parameters are found
+ String newText = "value=\""+getNewName()+"\","; //$NON-NLS-1$ //$NON-NLS-2$
+ change(file, location.getStartPosition()+openBracket+1, 0, newText);
+ }else{ // other cases
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }
+ }else if(openQuote >= 0){
+ int closeQuota = text.indexOf("\"", openQuote); //$NON-NLS-1$
+
+ if(closeQuota == openQuote+1){ // empty quotas
+ String newText = "\""+getNewName()+"\""; //$NON-NLS-1$ //$NON-NLS-2$
+ change(file, location.getStartPosition()+openQuote+1, 0, newText);
+ }else{ // the other cases
+ String newText = text.replace(getOldName(), getNewName());
+ change(file, location.getStartPosition(), location.getLength(), newText);
+ }
+ }else{
+ String newText = "(\""+getNewName()+"\")"; //$NON-NLS-1$ //$NON-NLS-2$
+ change(file, location.getStartPosition()+location.getLength(), 0, newText);
+ }
+ }
+
+ private void clearChanges(){
+ keys.clear();
+ }
+
+ private void change(IFile file, int offset, int length, String text){
+ //System.out.println("change file - "+file.getFullPath()+" offset - "+offset+" len - "+length+" text"+text);
+ String key = file.getFullPath().toString()+" "+offset;
+ if(!keys.contains(key)){
+ TextFileChange change = getChange(file);
+ TextEdit edit = new ReplaceEdit(offset, length, text);
+ change.addEdit(edit);
+ keys.add(key);
+ }
+ }
+
+ protected boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+
+ public class ELSearcher extends RefactorSearcher{
+
+ public ELSearcher(IFile file, String oldName){
+ super(file, oldName);
+ }
+
+
+ private boolean checkFolder(IResource resource, IResource[] sources, IPath output){
+ for(IResource folder : sources){
+ if(resource.equals(folder))
+ return false;
+ }
+
+ if(resource.getFullPath().equals(output))
+ return false;
+
+ return true;
+ }
+
+ ArrayList<String> keys = new ArrayList<String>();
+
+ @Override
+ protected IProject[] getProjects() {
+ return new IProject[]{baseFile.getProject()};
+ }
+
+ @Override
+ protected IContainer getViewFolder(IProject project) {
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
+
+ if(path != null)
+ return project.getFolder(path.removeFirstSegments(1));
+
+ return null;
+ }
+
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ change(file, offset, length, newName);
+ }
+
+
+ @Override
+ protected boolean isFileCorrect(IFile file) {
+ return ELRenameProcessor.this.isFileCorrect(file);
+ }
+
+ }
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.el.refactoring;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+
+/**
+ *
+ * @author Daniel
+ *
+ * This interface is used for transmit information about seam project structure from seam plugins through org.jboss.tools.common.el.core.elSearcher extension point
+ */
+public interface ProjectsSet {
+ /**
+ * inits seam project structure
+ * @param project
+ */
+ public void init(IProject project);
+
+ /**
+ * returns all linked seam projects
+ * @return
+ */
+ public IProject[] getLinkedProjects();
+
+ /**
+ * returns view folder (like WEB_CONTENT, EAR_CONTENT) for each seam project
+ * @param project
+ * @return
+ */
+ public IContainer getViewFolder(IProject project);
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RefactorSearcher.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,540 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.el.refactoring;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELMethodInvocation;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.FileUtil;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public abstract class RefactorSearcher {
+ protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ protected static final String XML_EXT = "xml"; //$NON-NLS-1$
+ protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+
+ private static final String GET = "get"; //$NON-NLS-1$
+ private static final String SET = "set"; //$NON-NLS-1$
+ private static final String IS = "is"; //$NON-NLS-1$
+
+ protected static final String SEAM_PROPERTIES_FILE = "seam.properties"; //$NON-NLS-1$
+
+ protected IFile baseFile;
+ protected String propertyName;
+ protected IJavaElement javaElement;
+ protected IJavaSearchScope searchScope;
+
+
+ public RefactorSearcher(IFile baseFile, String propertyName){
+ this.baseFile = baseFile;
+ this.propertyName = propertyName;
+ }
+
+ public RefactorSearcher(IFile baseFile, String propertyName, IJavaElement javaElement){
+ this(baseFile, propertyName);
+ this.javaElement = javaElement;
+ }
+
+ public void setSearchScope(IJavaSearchScope searchScope){
+ this.searchScope = searchScope;
+ }
+
+ public void findELReferences(){
+ if(baseFile == null)
+ return;
+
+ //startStatistics();
+
+ IProject[] projects = getProjects();
+ for (IProject project : projects) {
+ if(project == null) continue;
+
+ if(!containsInSearchScope(project))
+ continue;
+
+ updateEnvironment(project);
+
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+
+ // searching java, xml and property files in source folders
+ if(javaProject != null){
+ for(IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)){
+ if(resource instanceof IFolder)
+ scanForJava((IFolder) resource);
+ else if(resource instanceof IFile)
+ scanForJava((IFile) resource);
+ }
+ }
+
+ // searching jsp, xhtml and xml files in WebContent folders
+
+ if(getViewFolder(project) != null)
+ scan(getViewFolder(project));
+ else
+ scan(project);
+ }
+ //stopStatistic();
+ }
+
+ protected void updateEnvironment(IProject project){
+
+ }
+
+ protected abstract IProject[] getProjects();
+
+ protected abstract IContainer getViewFolder(IProject project);
+
+ private void scanForJava(IContainer container){
+ try{
+ for(IResource resource : container.members()){
+ if(resource instanceof IFolder)
+ scanForJava((IFolder) resource);
+ else if(resource instanceof IFile)
+ scanForJava((IFile) resource);
+ }
+ }catch(CoreException ex){
+ ELCorePlugin.getDefault().logError(ex);
+ }
+ }
+
+ private void scan(IContainer container){
+ try{
+ for(IResource resource : container.members()){
+ if(resource instanceof IFolder)
+ scan((IFolder) resource);
+ else if(resource instanceof IFile)
+ scan((IFile) resource);
+ }
+ }catch(CoreException ex){
+ ELCorePlugin.getDefault().logError(ex);
+ }
+ }
+
+ private String getFileContent(IFile file){
+ try {
+ return FileUtil.readStream(file);
+ //collectStatistic(content.length());
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ return null;
+ }
+
+ private void scanForJava(IFile file){
+ if(isFileCorrect(file)) {
+ String content = null;
+ if(content!= null) {
+ String ext = file.getFileExtension();
+ if(JAVA_EXT.equalsIgnoreCase(ext)){
+ content = getFileContent(file);
+ scanJava(file, content);
+ } else if(XML_EXT.equalsIgnoreCase(ext)) {
+ content = getFileContent(file);
+ scanDOM(file, content);
+ } else if(PROPERTIES_EXT.equalsIgnoreCase(ext)) {
+ content = getFileContent(file);
+ scanProperties(file, content);
+ }
+ }
+ }
+ }
+
+ private void scan(IFile file){
+ if(isFileCorrect(file)) {
+ String ext = file.getFileExtension();
+ if(XML_EXT.equalsIgnoreCase(ext)
+ || XHTML_EXT.equalsIgnoreCase(ext)
+ || JSP_EXT.equalsIgnoreCase(ext)) {
+ String content = getFileContent(file);
+ scanDOM(file, content);
+ }
+ }
+ }
+
+ private void scanJava(IFile file, String content){
+ try {
+ FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
+ Document document = new Document(content);
+ scaner.setRange(document, 0, document.getLength());
+ IToken token = scaner.nextToken();
+ while(token!=null && token!=Token.EOF) {
+ if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
+ int length = scaner.getTokenLength();
+ int offset = scaner.getTokenOffset();
+ String value = document.get(offset, length);
+ if(value.indexOf('{')>-1) {
+ scanString(file, value, offset);
+ }
+ }
+ token = scaner.nextToken();
+ }
+ } catch (BadLocationException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ }
+
+// private void searchInCach(IFile file){
+// //ELResolver[] resolvers = PageContextFactory.createPageContext(file).getElResolvers();
+//
+// }
+
+ private void scanDOM(IFile file, String content){
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager != null) {
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ scanChildNodes(file, document);
+ }
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ ELCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ }
+ }
+
+ private void scanChildNodes(IFile file, Node parent) {
+ NodeList children = parent.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node curentValidatedNode = children.item(i);
+ if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
+ scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
+ } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
+ scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT);
+ }
+ scanChildNodes(file, curentValidatedNode);
+ }
+ }
+
+ private void scanNodeContent(IFile file, IStructuredDocumentRegion node, String regionType) {
+ ITextRegionList regions = node.getRegions();
+ for(int i=0; i<regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ if(region.getType() == regionType) {
+ String text = node.getFullText(region);
+ if(text.indexOf("{")>-1) { //$NON-NLS-1$
+ int offset = node.getStartOffset() + region.getStart();
+ scanString(file, text, offset);
+ }
+ }
+ }
+ }
+
+ // looking for component references in EL
+ private void scanString(IFile file, String string, int offset) {
+ int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl<0)
+ startEl = string.indexOf("${"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(string);
+ for (ELInstance instance : model.getInstances()) {
+ for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
+ ELInvocationExpression expression = findComponentReference(ie);
+ if(expression != null){
+ checkMatch(file, expression, offset+getOffset(expression), getLength(expression));
+ }
+ }
+ }
+ }
+ }
+
+ protected int getOffset(ELInvocationExpression expression){
+ if(expression instanceof ELPropertyInvocation){
+ ELPropertyInvocation pi = (ELPropertyInvocation)expression;
+
+ if(pi.getName() != null)
+ return pi.getName().getStart();
+ }else if(expression instanceof ELMethodInvocation){
+ ELMethodInvocation mi = (ELMethodInvocation)expression;
+
+ if(mi.getName() != null)
+ return mi.getName().getStart();
+ }
+ return 0;
+ }
+
+ private int getLength(ELInvocationExpression expression){
+ if(expression instanceof ELPropertyInvocation){
+ ELPropertyInvocation pi = (ELPropertyInvocation)expression;
+
+ if(pi.getName() != null)
+ return pi.getName().getLength();
+ }else if(expression instanceof ELMethodInvocation){
+ ELMethodInvocation mi = (ELMethodInvocation)expression;
+
+ if(mi.getName() != null)
+ return mi.getName().getLength();
+ }
+ return 0;
+ }
+
+ private void scanProperties(IFile file, String content){
+ scanString(file, content, 0);
+
+ if(!file.getName().equals(SEAM_PROPERTIES_FILE))
+ return;
+
+ StringTokenizer tokenizer = new StringTokenizer(content, "#= \t\r\n\f", true); //$NON-NLS-1$
+
+ String lastToken = "\n"; //$NON-NLS-1$
+ int offset = 0;
+ boolean comment = false;
+ boolean key = true;
+
+ while(tokenizer.hasMoreTokens()){
+ String token = tokenizer.nextToken("#= \t\r\n\f"); //$NON-NLS-1$
+ if(token.equals("\r")) //$NON-NLS-1$
+ token = "\n"; //$NON-NLS-1$
+
+ if(token.equals("#") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
+ comment = true;
+ else if(token.equals("\n") && comment) //$NON-NLS-1$
+ comment = false;
+
+ if(!comment){
+ if(!token.equals("\n") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
+ key = true;
+ else if(key && (token.equals("=") || token.equals(" "))) //$NON-NLS-1$ //$NON-NLS-2$
+ key = false;
+
+ if(key && token.startsWith(propertyName)){
+ match(file, offset, token.length());
+ }
+ }
+
+ lastToken = token;
+ offset += token.length();
+ }
+ }
+
+ protected ELInvocationExpression findComponentReference(ELInvocationExpression invocationExpression){
+ return invocationExpression;
+ }
+
+ protected abstract boolean isFileCorrect(IFile file);
+
+ protected abstract void match(IFile file, int offset, int length);
+
+ protected void checkMatch(IFile file, ELExpression operand, int offset, int length){
+ if(javaElement != null && operand != null)
+ resolve(file, operand, offset-getOffset((ELInvocationExpression)operand));
+ else
+ match(file, offset, length);
+ }
+
+ // TODO: move to util class
+ public static boolean isGetter(IMethod method) {
+ String name = method.getElementName();
+ int numberOfParameters = method.getNumberOfParameters();
+
+ return (((name.startsWith(GET) && !name.equals(GET)) || name.startsWith(IS)) && numberOfParameters == 0);
+ }
+
+ // TODO: move to util class
+ public static boolean isSetter(IMethod method) {
+ String name = method.getElementName();
+ int numberOfParameters = method.getNumberOfParameters();
+
+ return ((name.startsWith(SET) && !name.equals(SET)) && numberOfParameters == 1);
+ }
+
+ // TODO: move to util class
+ public static String getPropertyName(IMethod method, String methodName){
+ if (isGetter(method) || isSetter(method)) {
+ StringBuffer name = new StringBuffer(methodName);
+ if(methodName.startsWith("i")) { //$NON-NLS-1$
+ name.delete(0, 2);
+ } else {
+ name.delete(0, 3);
+ }
+ if(name.length()<2 || Character.isLowerCase(name.charAt(1))) {
+ name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+ }
+ String propertyName = name.toString();
+ return propertyName;
+ }
+ return methodName;
+ }
+
+ public static String getPropertyName(IType method, String className){
+ StringBuffer name = new StringBuffer(className);
+ if(name.length()<2 || Character.isLowerCase(name.charAt(1))) {
+ name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+ }
+ String propertyName = name.toString();
+ return propertyName;
+ }
+
+ private boolean containsInSearchScope(IProject project){
+ if(searchScope == null)
+ return true;
+ IPath[] paths = searchScope.enclosingProjectsAndJars();
+ for(IPath path : paths){
+ if(path.equals(project.getFullPath()))
+ return true;
+ }
+ return false;
+ }
+
+ protected void resolve(IFile file, ELExpression operand, int offset) {
+ ELResolver[] resolvers = ELResolverFactoryManager.getInstance()
+ .getResolvers(file);
+
+ for (ELResolver resolver : resolvers) {
+ if (!(resolver instanceof ELCompletionEngine))
+ continue;
+
+ SimpleELContext context = new SimpleELContext();
+
+ context.setResource(file);
+ context.setElResolvers(resolvers);
+
+ List<Var> vars = ElVarSearcher.findAllVars(context, offset,
+ resolver);
+
+ context.setVars(vars);
+
+ ELResolution resolution = resolver.resolve(context, operand, offset);
+
+ List<ELSegment> segments = resolution.findSegmentsByJavaElement(javaElement);
+
+ for(ELSegment segment : segments){
+ match(file, offset+segment.getSourceReference().getStartPosition(), segment.getSourceReference().getLength());
+ }
+ }
+ }
+ // performance measure
+// private int totalSize = 0;
+// private int filesNumber = 0;
+// private long startTime = 0;
+// private long stopTime = 0;
+// private long startMem = 0;
+// private long stopMem = 0;
+//
+// private boolean log = false;
+//
+// private void clearHistory(){
+// totalSize = 0;
+// filesNumber = 0;
+// startTime = 0;
+// stopTime = 0;
+// startMem = 0;
+// stopMem = 0;
+// }
+//
+// private void startStatistics(){
+// clearHistory();
+// startTime = System.currentTimeMillis();
+// startMem = Runtime.getRuntime().freeMemory();
+// }
+//
+// private void stopStatistic(){
+// stopTime = System.currentTimeMillis();
+// stopMem = Runtime.getRuntime().freeMemory();
+// printELSearchStatistics();
+// }
+//
+// private void collectStatistic(int fileSize){
+// filesNumber++;
+// totalSize += fileSize;
+// }
+//
+// private void printELSearchStatistics(){
+// if(log){
+// System.out.println("EL Search"); //$NON-NLS-1$
+// System.out.println("Total files number: "+getFilesNumber()); //$NON-NLS-1$
+// System.out.println("Total files size: "+getTotlalFilesSize()+" Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Memory usage size: "+getTotlalMemorySize()+" Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Free Memory size: "+getRestMemorySize()+" Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Total time: "+getTotalTime()+" sec"); //$NON-NLS-1$ $NON-NLS-2$
+// }
+// }
+//
+// private double getTotlalFilesSize(){
+// return (double)totalSize/(1024*1025);
+// }
+//
+// private double getTotlalMemorySize(){
+// return (double)(startMem-stopMem)/(1024*1025);
+// }
+//
+// private double getRestMemorySize(){
+// return (double)stopMem/(1024*1025);
+// }
+//
+// private int getFilesNumber(){
+// return filesNumber;
+// }
+//
+// private double getTotalTime(){
+// return (double)(stopTime - startTime)/1000;
+// }
+
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableProcessor.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableProcessor.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,147 @@
+ /*******************************************************************************
+ * Copyright (c) 2009 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.jsf.el.refactoring;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.jboss.tools.common.el.core.ElCoreMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class RenameELVariableProcessor extends ELRenameProcessor {
+ IFile file;
+
+ /**
+ * @param file where refactor was called
+ */
+ public RenameELVariableProcessor(IFile file, String oldName) {
+ super(file, oldName);
+ this.file = file;
+ setOldName(oldName);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+ */
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_TITLE);
+
+ renameELVariable(pm, file);
+
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ RefactoringStatus result = new RefactoringStatus();
+ boolean status = false;
+
+ status = checkELContextVariable();
+
+ if(!status)
+ result.addFatalError(Messages.format(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_EL_VARIABLE, getOldName()));
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#createChange(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+
+ return rootChange;
+ }
+
+
+ private boolean checkELContextVariable(){
+ boolean status = true;
+
+ IProject[] projects = getSearcher().getProjects();
+ for (IProject project : projects) {
+ // TODO:
+ }
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getElements()
+ */
+ @Override
+ public Object[] getElements() {
+ return new String[]{getNewName()};
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getIdentifier()
+ */
+ @Override
+ public String getIdentifier() {
+ return getClass().getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getProcessorName()
+ */
+ @Override
+ public String getProcessorName() {
+ return ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_TITLE;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#isApplicable()
+ */
+ @Override
+ public boolean isApplicable() throws CoreException {
+ return getNewName()!=null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#loadParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus, org.eclipse.ltk.core.refactoring.participants.SharableParticipants)
+ */
+ @Override
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants sharedParticipants) throws CoreException {
+ return EMPTY_REF_PARTICIPANT;
+ }
+
+ private void renameELVariable(IProgressMonitor pm, IFile file){
+ getSearcher().findELReferences();
+ }
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableRefactoring.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableRefactoring.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/RenameELVariableRefactoring.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,24 @@
+ /*******************************************************************************
+ * Copyright (c) 2008 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.jsf.el.refactoring;
+
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class RenameELVariableRefactoring extends RenameRefactoring {
+
+ public RenameELVariableRefactoring(RenameProcessor processor) {
+ super(processor);
+ }
+}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -22,15 +22,16 @@
org.jboss.tools.jsf.ui.editor.palette,
org.jboss.tools.jsf.ui.editor.print,
org.jboss.tools.jsf.ui.editor.wizard,
+ org.jboss.tools.jsf.ui.el.refactoring,
org.jboss.tools.jsf.ui.navigator,
org.jboss.tools.jsf.ui.operation,
org.jboss.tools.jsf.ui.perspective,
org.jboss.tools.jsf.ui.preferences,
org.jboss.tools.jsf.ui.wizard.bean,
+ org.jboss.tools.jsf.ui.wizard.capabilities,
org.jboss.tools.jsf.ui.wizard.newfile,
- org.jboss.tools.jsf.ui.wizard.project,
org.jboss.tools.jsf.ui.wizard.palette,
- org.jboss.tools.jsf.ui.wizard.capabilities
+ org.jboss.tools.jsf.ui.wizard.project
Require-Bundle: org.jboss.tools.common.model.ui,
org.jboss.tools.jst.web.ui,
org.jboss.tools.jst.jsp,
@@ -47,7 +48,11 @@
org.eclipse.core.expressions,
org.eclipse.ui.forms,
org.jboss.tools.common.gef,
- org.jboss.tools.common.ui
+ org.jboss.tools.common.ui,
+ org.eclipse.ltk.ui.refactoring;bundle-version="3.4.100",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
+ org.eclipse.search;bundle-version="3.5.0",
+ org.jboss.tools.common.el.core;bundle-version="2.0.0"
Bundle-Version: 2.0.0
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -417,5 +417,40 @@
</newWizardShortcut>
</perspectiveExtension>
</extension>
+
+ <extension
+ point="org.eclipse.jdt.ui.queryParticipants">
+ <queryParticipant
+ class="org.jboss.tools.jsf.ui.el.refactoring.ELReferencesQueryParticipant"
+ id="org.jboss.tools.jsf.ui.el.refactoring.ELReferencesQueryParticipant"
+ name="jsf-SearchELReferencesParticipant"
+ nature="org.jboss.tools.jsf.jsfnature">
+ </queryParticipant>
+ </extension>
+ <extension
+ point="org.eclipse.ltk.core.refactoring.renameParticipants">
+ <renameParticipant
+ class="org.jboss.tools.jsf.ui.el.refactoring.RenameMethodParticipant"
+ id="org.jboss.tools.jsf.ui..el.refactoring.RenameMethodParticipant"
+ name="el-RenameMethodParticipant">
+ <enablement>
+ <with variable="element">
+ <or>
+ <instanceof value="org.eclipse.jdt.core.IMethod"/>
+ <instanceof value="org.eclipse.jdt.core.IType"/>
+ </or>
+ </with>
+ </enablement>
+ </renameParticipant>
+ </extension>
+
+ <!-- Refactorng -->
+ <!--extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ class="org.jboss.tools.jsf.ui.el.refactoring.ELRefactorContributionFactory"
+ locationURI="popup:org.eclipse.ui.popup.any?after=save">
+ </menuContribution>
+ </extension-->
</plugin>
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java (from rev 19147, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/Messages.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,40 @@
+package org.jboss.tools.jsf.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JsfUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.jsf.ui.messages"; //$NON-NLS-1$
+ public static String DataTableWizardPage_BeanProperties;
+ public static String DataTableWizardPage_DeselectAll;
+ public static String DataTableWizardPage_Properties;
+ public static String DataTableWizardPage_SelectAll;
+ public static String DataTableWizardPage_ValueELNotCorrect;
+ public static String DataTableWizardPage_ValueMustBeSetWithEL;
+ public static String FacesConfigGuiEditor_DiagramTitle;
+ public static String JSFDiagramEditPart_JSFDiagram;
+ public static String JSFKnowledgeBaseAdapter_Browse;
+ public static String JSFKnowledgeBaseAdapter_Edit;
+ public static String JSFManagedPropertyNameAdapter_Rename;
+ public static String LinkEditPart_Link;
+
+ public static String RENAME_METHOD_PARTICIPANT_GETTER_WARNING;
+ public static String RENAME_METHOD_PARTICIPANT_SETTER_WARNING;
+ public static String RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE;
+ public static String RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE;
+ public static String RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE;
+ public static String RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES;
+ public static String RESOURCE_BUNDLES_RENAME_PARTICIPANT_UPDATE_BUNDLE_REFERENCES;
+
+ public static String REFACTOR_CONTRIBUTOR_MAIN_MENU;
+ public static String REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE;
+ public static String EL_REFACTOR_RENAME_HANDLER_ERROR;
+ public static String RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, JsfUIMessages.class);
+ }
+
+ private JsfUIMessages() {
+ }
+}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/Messages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/Messages.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/Messages.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -1,26 +0,0 @@
-package org.jboss.tools.jsf.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.jsf.ui.messages"; //$NON-NLS-1$
- public static String DataTableWizardPage_BeanProperties;
- public static String DataTableWizardPage_DeselectAll;
- public static String DataTableWizardPage_Properties;
- public static String DataTableWizardPage_SelectAll;
- public static String DataTableWizardPage_ValueELNotCorrect;
- public static String DataTableWizardPage_ValueMustBeSetWithEL;
- public static String FacesConfigGuiEditor_DiagramTitle;
- public static String JSFDiagramEditPart_JSFDiagram;
- public static String JSFKnowledgeBaseAdapter_Browse;
- public static String JSFKnowledgeBaseAdapter_Edit;
- public static String JSFManagedPropertyNameAdapter_Rename;
- public static String LinkEditPart_Link;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFKnowledgeBaseAdapter.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFKnowledgeBaseAdapter.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFKnowledgeBaseAdapter.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -16,7 +16,7 @@
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.common.meta.key.WizardKeys;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogContentProposalProvider;
import org.jboss.tools.jst.jsp.outline.*;
@@ -28,7 +28,7 @@
}
public String getCommand() {
- return Messages.JSFKnowledgeBaseAdapter_Browse;
+ return JsfUIMessages.JSFKnowledgeBaseAdapter_Browse;
}
public String invoke(Control control) {
@@ -50,7 +50,7 @@
String query = "/" + nodeName + "@" + attrName; //$NON-NLS-1$ //$NON-NLS-2$
context.setProperty("query", query); //$NON-NLS-1$
context.setProperty("help", query); //$NON-NLS-1$
- context.setProperty("title", MessageFormat.format(Messages.JSFKnowledgeBaseAdapter_Edit, WizardKeys.toDisplayName(attrName))); //$NON-NLS-1$
+ context.setProperty("title", MessageFormat.format(JsfUIMessages.JSFKnowledgeBaseAdapter_Edit, WizardKeys.toDisplayName(attrName))); //$NON-NLS-1$
context.setProperty("subtitle", "<" + context.getProperty("nodeName") + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
if(getValue() instanceof String) context.put("value", getValue()); //$NON-NLS-1$
JSPTreeDialog dialog = new JSPTreeDialog();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFManagedPropertyNameAdapter.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFManagedPropertyNameAdapter.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/attribute/adapter/JSFManagedPropertyNameAdapter.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -14,12 +14,12 @@
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.common.meta.action.XActionInvoker;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
public class JSFManagedPropertyNameAdapter extends DefaultValueAdapter implements IActionHelper, IActionHelperExtension {
public String getCommand() {
- return Messages.JSFManagedPropertyNameAdapter_Rename;
+ return JsfUIMessages.JSFManagedPropertyNameAdapter_Rename;
}
public String invoke(Control control) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/FacesConfigGuiEditor.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -20,7 +20,7 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.jsf.model.JSFConstants;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.editor.model.impl.JSFModel;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.jst.web.model.WebProcess;
@@ -111,7 +111,7 @@
}
public String getTitle() {
- return Messages.FacesConfigGuiEditor_DiagramTitle;
+ return JsfUIMessages.FacesConfigGuiEditor_DiagramTitle;
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/JSFDiagramEditPart.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/JSFDiagramEditPart.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/JSFDiagramEditPart.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -23,7 +23,7 @@
import org.eclipse.gef.tools.MarqueeDragTracker;
import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.editor.figures.DiagramFigure;
import org.jboss.tools.jsf.ui.editor.model.IGroup;
import org.jboss.tools.jsf.ui.editor.model.IJSFModel;
@@ -144,7 +144,7 @@
protected AccessibleEditPart createAccessible() {
return new AccessibleGraphicalEditPart() {
public void getName(AccessibleEvent event) {
- event.result = Messages.JSFDiagramEditPart_JSFDiagram;
+ event.result = JsfUIMessages.JSFDiagramEditPart_JSFDiagram;
}
};
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -34,7 +34,7 @@
import org.jboss.tools.common.gef.figures.GEFLabel;
import org.jboss.tools.common.gef.figures.xpl.CustomLocator;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.editor.JSFEditor;
import org.jboss.tools.jsf.ui.editor.figures.ConnectionFigure;
import org.jboss.tools.jsf.ui.editor.figures.FigureFactory;
@@ -180,7 +180,7 @@
if (acc == null)
acc = new AccessibleGraphicalEditPart() {
public void getName(AccessibleEvent e) {
- e.result = Messages.LinkEditPart_Link;
+ e.result = JsfUIMessages.LinkEditPart_Link;
}
};
return acc;
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.ui.el.refactoring;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+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.IPath;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.internal.services.IWorkbenchLocationService;
+import org.eclipse.ui.menus.AbstractContributionFactory;
+import org.eclipse.ui.menus.IContributionRoot;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.services.IServiceLocator;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.propertieseditor.PropertiesCompoundEditor;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jsf.el.refactoring.RenameELVariableProcessor;
+import org.jboss.tools.jsf.el.refactoring.RenameELVariableRefactoring;
+import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
+import org.jboss.tools.jst.web.ui.editors.WebCompoundEditor;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author Daniel Azarov
+ */
+public class ELRefactorContributionFactory extends AbstractContributionFactory {
+ //private static final String ANNOTATION_NAME = "org.jboss.seam.annotations.Name"; //$NON-NLS-1$
+ private static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ private static final String XML_EXT = "xml"; //$NON-NLS-1$
+ private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ private static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ private static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+ private static final String GET = "get"; //$NON-NLS-1$
+ private static final String SET = "set"; //$NON-NLS-1$
+ private static final String IS = "is"; //$NON-NLS-1$
+
+ static private String selectedText;
+ static private IFile editorFile;
+ private String fileContent;
+ private IEditorPart editor;
+ private Shell shell;
+
+ public ELRefactorContributionFactory(){
+ super("","");
+ }
+
+ public ELRefactorContributionFactory(String location, String namespace){
+ super(location, namespace);
+ }
+
+ @Override
+ public void createContributionItems(IServiceLocator serviceLocator,
+ IContributionRoot additions) {
+
+ if(serviceLocator.hasService(IWorkbenchLocationService.class)){
+ IWorkbenchLocationService service = (IWorkbenchLocationService)serviceLocator.getService(IWorkbenchLocationService.class);
+ editor = service.getWorkbenchWindow().getActivePage().getActiveEditor();
+ shell = service.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+ if(!(editor.getEditorInput() instanceof FileEditorInput))
+ return;
+
+ FileEditorInput input = (FileEditorInput)editor.getEditorInput();
+
+ editorFile = input.getFile();
+ String ext = editorFile.getFileExtension();
+
+ if (!JAVA_EXT.equalsIgnoreCase(ext)
+ && !XML_EXT.equalsIgnoreCase(ext)
+ && !XHTML_EXT.equalsIgnoreCase(ext)
+ && !JSP_EXT.equalsIgnoreCase(ext)
+ && !PROPERTIES_EXT.equalsIgnoreCase(ext))
+ return;
+
+ MenuManager mm = new MenuManager(JsfUIMessages.REFACTOR_CONTRIBUTOR_MAIN_MENU);
+ mm.setVisible(true);
+
+ boolean separatorIsAdded = false;
+
+ ISelection sel = editor.getEditorSite().getSelectionProvider().getSelection();
+
+ if(sel == null || sel.isEmpty())
+ return;
+
+ if(sel instanceof StructuredSelection){
+ if(editor instanceof PropertiesCompoundEditor){
+ sel = ((PropertiesCompoundEditor)editor).getActiveEditor().getSite().getSelectionProvider().getSelection();
+ }else if(editor instanceof EditorPartWrapper){
+ EditorPartWrapper wrapperEditor = (EditorPartWrapper)editor;
+ if(wrapperEditor.getEditor() instanceof WebCompoundEditor){
+ WebCompoundEditor xmlEditor = (WebCompoundEditor)wrapperEditor.getEditor();
+ sel = xmlEditor.getActiveEditor().getSite().getSelectionProvider().getSelection();
+ }
+ }else if(editor instanceof WebCompoundEditor)
+ sel = ((WebCompoundEditor)editor).getActiveEditor().getSite().getSelectionProvider().getSelection();
+ }
+
+ if(sel instanceof TextSelection){
+ TextSelection selection = (TextSelection)sel;
+
+ selectedText = selection.getText();
+
+ try {
+ fileContent = FileUtil.readStream(editorFile);
+ } catch (CoreException e) {
+ JsfUiPlugin.getDefault().logError(e);
+ }
+
+ boolean status = false;
+
+ if(JAVA_EXT.equalsIgnoreCase(ext)){
+ status = checkContextVariableInJava(editorFile, fileContent, selection);
+ } else if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
+ status = checkContextVariableInDOM(editorFile, fileContent, selection);
+ else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
+ status = checkContextVariableInProperties(editorFile, fileContent, selection);
+
+ if(status){
+ mm.add(new RenameELVariableAction());
+
+ if(!separatorIsAdded)
+ additions.addContributionItem(new Separator(), null);
+ additions.addContributionItem(mm, null);
+ }
+ }
+ }
+ }
+
+ private boolean checkContextVariableInJava(IFile file, String content, TextSelection selection){
+ try {
+ FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
+ Document document = new Document(content);
+ scaner.setRange(document, 0, document.getLength());
+ IToken token = scaner.nextToken();
+ while(token!=null && token!=Token.EOF) {
+ if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
+ int length = scaner.getTokenLength();
+ int offset = scaner.getTokenOffset();
+ if(offset <= selection.getOffset() && (offset+length) >= (selection.getOffset()+selection.getLength())){
+ String value = document.get(offset, length);
+ if(value.indexOf('{')>-1) {
+ return scanString(file, value, offset, selection);
+ }
+ }
+ }
+ token = scaner.nextToken();
+ }
+ } catch (BadLocationException e) {
+ JsfUiPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+ private boolean scanString(IFile file, String string, int offset, TextSelection selection) {
+ int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(string);
+ for (ELInstance instance : model.getInstances()) {
+ for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
+ ELPropertyInvocation pi = findELVariable(ie);
+ if(pi != null){
+ if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength() == selection.getLength())
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private ELPropertyInvocation findELVariable(ELInvocationExpression invocationExpression){
+ ELInvocationExpression invExp = invocationExpression;
+ while(invExp != null){
+ if(invExp instanceof ELPropertyInvocation){
+ if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(selectedText))
+ return (ELPropertyInvocation)invExp;
+ else
+ invExp = invExp.getLeft();
+
+ }else{
+ invExp = invExp.getLeft();
+ }
+ }
+ return null;
+ }
+
+ private boolean checkContextVariableInDOM(IFile file, String content, TextSelection selection){
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return false;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ return scanChildNodes(file, document, selection);
+ }
+ } catch (CoreException e) {
+ JsfUiPlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ JsfUiPlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ return false;
+ }
+
+ private boolean scanChildNodes(IFile file, Node parent, TextSelection selection) {
+ boolean status = false;
+ NodeList children = parent.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node curentValidatedNode = children.item(i);
+ if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
+ status = scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, selection);
+ if(status)
+ return status;
+ } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
+ status = scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT, selection);
+ if(status)
+ return status;
+ }
+ status = scanChildNodes(file, curentValidatedNode, selection);
+ if(status)
+ return status;
+ }
+ return false;
+ }
+
+ private boolean scanNodeContent(IFile file, IStructuredDocumentRegion node, String regionType, TextSelection selection) {
+ boolean status = false;
+ ITextRegionList regions = node.getRegions();
+ for(int i=0; i<regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ if(region.getType() == regionType) {
+ String text = node.getFullText(region);
+ if(text.indexOf("{")>-1) { //$NON-NLS-1$
+ int offset = node.getStartOffset() + region.getStart();
+ status = scanString(file, text, offset, selection);
+ if(status)
+ return status;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean checkContextVariableInProperties(IFile file, String content, TextSelection selection){
+ return scanString(file, content, 0, selection);
+ }
+
+ private String getPropertyName(IMethod method){
+ String name = method.getElementName();
+
+ if(name.startsWith(GET) || name.startsWith(SET))
+ return name.substring(3).toLowerCase();
+
+ if(name.startsWith(IS))
+ return name.substring(2).toLowerCase();
+
+ return name.toLowerCase();
+ }
+
+ private static void saveAndBuild(){
+ if(!JsfUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true))
+ return;
+
+ try {
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ }
+
+ public static void invokeRenameELVariableWizard(String oldName, Shell activeShell) {
+ saveAndBuild();
+
+ RenameELVariableProcessor processor = new RenameELVariableProcessor(editorFile, selectedText);
+ RenameELVariableRefactoring refactoring = new RenameELVariableRefactoring(processor);
+ RenameELVariableWizard wizard = new RenameELVariableWizard(refactoring, editorFile);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ try {
+ String titleForFailedChecks = JsfUIMessages.EL_REFACTOR_RENAME_HANDLER_ERROR;
+ op.run(activeShell, titleForFailedChecks);
+ } catch (final InterruptedException irex) {
+ // operation was canceled
+ }
+ }
+
+ class RenameELVariableAction extends Action{
+ public RenameELVariableAction(){
+ super(JsfUIMessages.REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE);
+ }
+ public void run(){
+ saveAndBuild();
+
+ invokeRenameELVariableWizard(selectedText, shell);
+ }
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.ui.el.refactoring;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.ui.search.ElementQuerySpecification;
+import org.eclipse.jdt.ui.search.IMatchPresentation;
+import org.eclipse.jdt.ui.search.IQueryParticipant;
+import org.eclipse.jdt.ui.search.ISearchRequestor;
+import org.eclipse.jdt.ui.search.QuerySpecification;
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.jsf.el.refactoring.ELProjectSetExtension;
+import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
+import org.jboss.tools.jsf.el.refactoring.RefactorSearcher;
+
+public class ELReferencesQueryParticipant implements IQueryParticipant{
+ private ELSearcher searcher;
+
+ public int estimateTicks(QuerySpecification specification) {
+ return 10;
+ }
+
+ public IMatchPresentation getUIParticipant() {
+ return null;
+ }
+
+ public void search(ISearchRequestor requestor,
+ QuerySpecification querySpecification, IProgressMonitor monitor)
+ throws CoreException {
+
+ if(querySpecification instanceof ElementQuerySpecification){
+ if (!isSearchForReferences(querySpecification.getLimitTo()))
+ return;
+
+ ElementQuerySpecification qs = (ElementQuerySpecification)querySpecification;
+ if(qs.getElement() instanceof IMethod || qs.getElement() instanceof IType){
+ IFile file = (IFile)qs.getElement().getResource();
+ String name = qs.getElement().getElementName();
+
+ searcher = new ELSearcher(requestor, qs.getElement(), file, name);
+ searcher.setSearchScope(qs.getScope());
+
+ searcher.findELReferences();
+ }
+ }
+ }
+
+ public boolean isSearchForReferences(int limitTo) {
+ int maskedLimitTo = limitTo & ~(IJavaSearchConstants.IGNORE_DECLARING_TYPE+IJavaSearchConstants.IGNORE_RETURN_TYPE);
+ if (maskedLimitTo == IJavaSearchConstants.REFERENCES || maskedLimitTo == IJavaSearchConstants.ALL_OCCURRENCES) {
+ return true;
+ }
+
+ return false;
+ }
+
+ class ELSearcher extends RefactorSearcher{
+ ISearchRequestor requestor;
+ ProjectsSet projectSet=null;
+
+ public ELSearcher(ISearchRequestor requestor, IJavaElement element, IFile file, String name){
+ super(file, name, element);
+ this.requestor = requestor;
+ ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
+ if(extensions.length > 0){
+ projectSet = extensions[0].getProjectSet();
+ if(projectSet != null)
+ projectSet.init(file.getProject());
+ }
+
+ }
+
+ protected boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ return false;
+ }else if(file.isPhantom()){
+ return false;
+ }else if(file.isReadOnly()){
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ Match match = new Match(file, offset, length);
+ requestor.reportMatch(match);
+ }
+
+ protected IProject[] getProjects(){
+ if(projectSet != null){
+ return projectSet.getLinkedProjects();
+ }
+ return new IProject[]{baseFile.getProject()};
+ }
+
+ protected IContainer getViewFolder(IProject project){
+ if(projectSet != null){
+ return projectSet.getViewFolder(project);
+ }
+
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
+
+ if(path != null)
+ return project.getFolder(path.removeFirstSegments(1));
+
+ return null;
+ }
+ }
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/FieldEditorFactory.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/FieldEditorFactory.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/FieldEditorFactory.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.ui.el.refactoring;
+
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.TextFieldEditor;
+
+public class FieldEditorFactory {
+ public static IFieldEditor createTextEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue)});
+ return editor;
+ }
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameELVariableWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameELVariableWizard.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameELVariableWizard.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,109 @@
+ /*******************************************************************************
+ * Copyright (c) 2009 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.jsf.ui.el.refactoring;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.jsf.el.refactoring.RenameELVariableProcessor;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class RenameELVariableWizard extends RefactoringWizard {
+
+ private String variableName;
+ private IFieldEditor editor;
+
+ public RenameELVariableWizard(Refactoring refactoring, IFile editorFile) {
+ super(refactoring, WIZARD_BASED_USER_INTERFACE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.RefactoringWizard#addUserInputPages()
+ */
+ @Override
+ protected void addUserInputPages() {
+ setDefaultPageTitle(getRefactoring().getName());
+ RenameELVariableProcessor processor= (RenameELVariableProcessor) getRefactoring().getAdapter(RenameELVariableProcessor.class);
+ addPage(new RenameELVariableWizardPage(processor));
+ }
+
+ class RenameELVariableWizardPage extends UserInputWizardPage{
+ private RenameELVariableProcessor processor;
+
+ public RenameELVariableWizardPage(RenameELVariableProcessor processor){
+ super("");
+ this.processor = processor;
+ variableName = processor.getOldName();
+ }
+
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 2;
+
+ String defaultName = variableName;
+ editor = FieldEditorFactory.createTextEditor(variableName, JsfUIMessages.RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME, defaultName);
+ editor.doFillIntoGrid(container);
+
+ ((CompositeEditor)editor).addPropertyChangeListener(new PropertyChangeListener(){
+ public void propertyChange(PropertyChangeEvent evt){
+ validatePage();
+ }
+ });
+ setControl(container);
+ setPageComplete(false);
+ }
+
+ protected final void validatePage() {
+ RefactoringStatus status= new RefactoringStatus();
+ setPageComplete(status);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.UserInputWizardPage#performFinish()
+ */
+ protected boolean performFinish() {
+
+ initializeRefactoring();
+ return super.performFinish();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ltk.ui.refactoring.UserInputWizardPage#getNextPage()
+ */
+ public IWizardPage getNextPage() {
+ initializeRefactoring();
+ return super.getNextPage();
+ }
+
+ private void initializeRefactoring() {
+ //processor.setNewName(editor.getValueAsString());
+ }
+
+ }
+}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jsf.ui.el.refactoring;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.jsf.el.refactoring.ELProjectSetExtension;
+import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
+import org.jboss.tools.jsf.el.refactoring.RefactorSearcher;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
+
+public class RenameMethodParticipant extends RenameParticipant{
+ private IJavaElement element;
+ private String oldName;
+ private String newName;
+ private SeamRenameMethodSearcher searcher;
+ private RefactoringStatus status;
+ private CompositeChange rootChange;
+ private TextFileChange lastChange;
+ private ArrayList<String> keys = new ArrayList<String>();
+
+ private static boolean added = false;
+
+
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws OperationCanceledException {
+ if(searcher == null)
+ return status;
+ if(element instanceof IMethod){
+ IMethod method = (IMethod)element;
+ if(method != null && !added){
+ if(searcher.isGetter(method))
+ status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
+ else if(searcher.isSetter(method))
+ status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
+ added = true;
+ }
+ }
+
+ searcher.findELReferences();
+
+ return status;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ return rootChange;
+ }
+
+ @Override
+ public String getName() {
+ return oldName;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if(element instanceof IMethod){
+ IMethod method = (IMethod)element;
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
+
+ this.element = method;
+
+ oldName = method.getElementName();
+
+ newName = RefactorSearcher.getPropertyName(method, getArguments().getNewName());
+ searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
+ added = false;
+ return true;
+ }else if(element instanceof IType){
+ IType type = (IType)element;
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
+
+ this.element = type;
+
+ oldName = type.getElementName();
+
+ newName = RefactorSearcher.getPropertyName(type, getArguments().getNewName());
+ searcher = new SeamRenameMethodSearcher((IFile)type.getResource(), oldName);
+ added = false;
+ return true;
+ }
+ return false;
+ }
+
+ // for test only
+ public boolean initialize(Object element, String newName) {
+ if(element instanceof IMethod){
+ IMethod method = (IMethod)element;
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
+
+ this.element = method;
+
+ oldName = method.getElementName();
+
+ this.newName = newName;
+ searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
+ added = false;
+ return true;
+ }else if(element instanceof IType){
+ IType type = (IType)element;
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange(JsfUIMessages.RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES);
+
+ this.element = type;
+
+ oldName = type.getElementName();
+
+ this.newName = newName;
+ searcher = new SeamRenameMethodSearcher((IFile)type.getResource(), oldName);
+ added = false;
+ return true;
+ }
+ return false;
+ }
+
+ protected TextFileChange getChange(IFile file){
+ if(lastChange != null && lastChange.getFile().equals(file))
+ return lastChange;
+
+ for(int i=0; i < rootChange.getChildren().length; i++){
+ TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
+ if(change.getFile().equals(file)){
+ lastChange = change;
+ return lastChange;
+ }
+ }
+ lastChange = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ lastChange.setEdit(root);
+ rootChange.add(lastChange);
+
+ return lastChange;
+ }
+
+ private void change(IFile file, int offset, int length, String text){
+ String key = file.getFullPath().toString()+" "+offset;
+ if(!keys.contains(key)){
+ TextFileChange change = getChange(file);
+ TextEdit edit = new ReplaceEdit(offset, length, text);
+ change.addEdit(edit);
+ keys.add(key);
+ }
+ }
+
+ class SeamRenameMethodSearcher extends RefactorSearcher{
+ ProjectsSet projectSet=null;
+ public SeamRenameMethodSearcher(IFile file, String name){
+ super(file, name, element);
+ ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
+ if(extensions.length > 0){
+ projectSet = extensions[0].getProjectSet();
+ if(projectSet != null)
+ projectSet.init(file.getProject());
+ }
+ }
+
+ @Override
+ protected boolean isFileCorrect(IFile file) {
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(JsfUIMessages.RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(JsfUIMessages.RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(JsfUIMessages.RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ change(file, offset, length, newName);
+ }
+
+ protected IProject[] getProjects(){
+ if(projectSet != null){
+ return projectSet.getLinkedProjects();
+ }
+ return new IProject[]{baseFile.getProject()};
+ }
+
+ protected IContainer getViewFolder(IProject project){
+ if(projectSet != null){
+ return projectSet.getViewFolder(project);
+ }
+
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
+
+ if(path != null)
+ return project.getFolder(path.removeFirstSegments(1));
+
+ return null;
+ }
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/messages.properties 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/messages.properties 2009-12-10 16:13:45 UTC (rev 19191)
@@ -10,3 +10,14 @@
JSFKnowledgeBaseAdapter_Edit=Edit {0}
JSFManagedPropertyNameAdapter_Rename=Rename...
LinkEditPart_Link=Link
+RENAME_METHOD_PARTICIPANT_GETTER_WARNING=Be sure, may be you also should rename setter method to avoid compilation problems.
+RENAME_METHOD_PARTICIPANT_SETTER_WARNING=Be sure, may be you also should rename getter method to avoid compilation problems.
+RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE=Cannot change file. File ''{0}'' is not in sync.
+RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE=Cannot change phantom file: ''{0}''.
+RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE=Cannot change read-only file: ''{0}''.
+RENAME_METHOD_PARTICIPANT_UPDATE_METHOD_REFERENCES=Update method references in EL
+RESOURCE_BUNDLES_RENAME_PARTICIPANT_UPDATE_BUNDLE_REFERENCES=Update bundle references in EL
+REFACTOR_CONTRIBUTOR_MAIN_MENU=EL Refactor
+REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE=Rename EL Variable
+RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME=Seam component name:
+
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -43,7 +43,7 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jsf.model.pv.JSFPromptingProvider;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.attribute.adapter.JSFKnowledgeBaseAdapter;
import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
import org.jboss.tools.common.model.ui.editors.dnd.*;
@@ -200,7 +200,7 @@
generalTabContent.setLayoutData(data);
Label properties = new Label(generalTabContent, SWT.NONE);
- properties.setText(Messages.DataTableWizardPage_Properties);
+ properties.setText(JsfUIMessages.DataTableWizardPage_Properties);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
properties.setLayoutData(data);
@@ -223,11 +223,11 @@
try {
boolean b1 = value.matches("[#\\$]\\{[^#\\$\\}\\{]*\\}"); //$NON-NLS-1$
if(!b1) {
- throw new ValidationException(Messages.DataTableWizardPage_ValueMustBeSetWithEL);
+ throw new ValidationException(JsfUIMessages.DataTableWizardPage_ValueMustBeSetWithEL);
}
boolean b2 = value.matches("[#\\$]\\{[^#\\$\\}\\{\\.]+(\\.[^#\\$\\}\\{\\.]+)*\\}"); //$NON-NLS-1$
if(!b2) {
- throw new ValidationException(Messages.DataTableWizardPage_ValueELNotCorrect);
+ throw new ValidationException(JsfUIMessages.DataTableWizardPage_ValueELNotCorrect);
}
} catch (PatternSyntaxException e) {
JsfUiPlugin.getPluginLog().logError(e);
@@ -333,7 +333,7 @@
p.put("data", vs); //$NON-NLS-1$
SelectPropertiesWizard w = new SelectPropertiesWizard();
- p.setProperty("title", Messages.DataTableWizardPage_BeanProperties); //$NON-NLS-1$
+ p.setProperty("title", JsfUIMessages.DataTableWizardPage_BeanProperties); //$NON-NLS-1$
w.setObject(p);
int r = w.execute();
if (r != 0)
@@ -451,17 +451,17 @@
class SelectPropertiesWizardView extends AbstractListWizardView {
protected String[] getActions() {
- return new String[] { Messages.DataTableWizardPage_SelectAll, Messages.DataTableWizardPage_DeselectAll };
+ return new String[] { JsfUIMessages.DataTableWizardPage_SelectAll, JsfUIMessages.DataTableWizardPage_DeselectAll };
}
protected void internalAction(String command) {
- if (command.equals(Messages.DataTableWizardPage_SelectAll)) {
+ if (command.equals(JsfUIMessages.DataTableWizardPage_SelectAll)) {
for (int i = 0; i < boxes.length; i++)
if ("yes".equals(vs[i][1])) { //$NON-NLS-1$
boxes[i].setSelection(true);
apply(i);
}
- } else if (command.equals(Messages.DataTableWizardPage_DeselectAll)) {
+ } else if (command.equals(JsfUIMessages.DataTableWizardPage_DeselectAll)) {
for (int i = 0; i < boxes.length; i++)
if ("no".equals(vs[i][1])) { //$NON-NLS-1$
boxes[i].setSelection(false);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -15,7 +15,9 @@
org.jboss.tools.jst.web.ui;bundle-version="2.0.0",
org.jboss.tools.jst.jsp;bundle-version="2.0.0",
org.jboss.tools.common.model.ui;bundle-version="2.0.0",
- org.eclipse.ui.ide;bundle-version="3.4.1"
+ org.eclipse.ui.ide;bundle-version="3.4.1",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
+ org.eclipse.jst.j2ee;bundle-version="1.1.300"
Bundle-Localization: plugin
Bundle-ClassPath: jsf-ui-test.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.classpath
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.classpath (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.classpath 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="JavaSource"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 4.2 Runtime">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.web"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.project (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.project 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>testJSFProject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.common.verification.verifybuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.jboss.tools.jsf.jsfnature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/.jsdtscope
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/.jsdtscope (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/.jsdtscope 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.jdt.core.prefs 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,7 @@
+#Mon Dec 07 18:26:41 MSK 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.component 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="testJSFProject">
+<wb-resource deploy-path="/" source-path="/WebContent"/>
+<wb-resource deploy-path="/WEB-INF/classes" source-path="/JavaSource"/>
+<property name="context-root" value="testJSFProject"/>
+<property name="java-output-path"/>
+</wb-module>
+</project-modules>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.common.project.facet.core.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="JBoss 4.2 Runtime"/>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.web"/>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.web" version="2.5"/>
+</faceted-project>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.container (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.container 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.name (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/.settings/org.eclipse.wst.jsdt.ui.superType.name 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/Messages.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/Messages.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/Messages.properties 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/User.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/User.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/User.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package demo;
+
+/**
+ * Created by JBoss Developer Studio
+ */
+public class User {
+
+ private String name;
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/META-INF/MANIFEST.MF (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/META-INF/MANIFEST.MF 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/Messages.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/Messages.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/Messages.properties 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/User.class
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/classes/demo/User.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/faces-config.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/faces-config.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/faces-config.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <description>User Name Bean</description>
+ <managed-bean-name>user</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputUserName.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>hello</from-outcome>
+ <to-view-id>/pages/hello.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <locale-config/>
+ </application>
+ <factory/>
+ <lifecycle/>
+</faces-config>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/common-annotations.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/common-annotations.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-beanutils.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-beanutils.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-collections.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-collections.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-digester.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-digester.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/commons-logging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jsf-tlds.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jsf-tlds.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jstl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/jstl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/standard.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/lib/standard.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/web.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/web.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>testJSFProject</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/index.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/index.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/index.jsp 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+ <body>
+ <jsp:forward page="/pages/inputUserName.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/hello.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/hello.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/hello.jsp 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,20 @@
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+<f:loadBundle var="Message" basename="demo.Messages" />
+
+<html>
+ <head>
+ <title>Hello!</title>
+ </head>
+
+ <body>
+ <f:view>
+ <h3>
+ <h:outputText value="#{Message.hello_message}" />,
+ <h:outputText value="#{user.name}" />!
+ </h3>
+ </f:view>
+ </body>
+
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/inputUserName.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/inputUserName.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/pages/inputUserName.jsp 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,28 @@
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+<f:loadBundle var="Message" basename="demo.Messages"/>
+
+<html>
+ <head>
+ <title>Input User Name Page</title>
+ </head>
+ <body>
+
+ <f:view>
+ <h1><h:outputText value="#{Message.header}"/></h1>
+
+ <h:messages style="color: red"/>
+
+ <h:form id="greetingForm">
+ <h:outputText value="#{Message.prompt_message}"/>
+ <h:inputText value="#{user.name}" required="true">
+ <f:validateLength maximum="30" minimum="3"/>
+ </h:inputText>
+
+ <h:commandButton action="hello" value="Say Hello!" />
+
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.properties 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,3 @@
+#
+#Mon Dec 07 18:26:39 MSK 2009
+classpath.external=
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/ant/build.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,74 @@
+<project name="KickStart" default="deploy" basedir="../">
+
+ <!-- Project settings -->
+ <property file="${basedir}/ant/build.properties" />
+
+ <property name="project.name" value="KickStart" />
+ <property name="web.content.dir" value="${basedir}/WebContent" />
+ <property name="web-inf.dir" value="${web.content.dir}/WEB-INF" />
+ <property name="build.dir" value="build" />
+ <property name="war.name" value="${build.dir}/${project.name}.war" />
+
+ <!-- Define a folder for deployment -->
+ <property name="deploy.dir" value="deploy" />
+
+ <!-- Compile classpath -->
+ <path id="compile.classpath">
+ <fileset dir="${webinf.dir}/lib">
+ <include name="**/*.jar" />
+ </fileset>
+ <pathelement path="${classpath}" />
+ <pathelement path="${classpath.external}" />
+ <pathelement path="${webinf.dir}/classes" />
+ </path>
+
+ <!-- Copy any resource or configuration files -->
+ <target name="copyResources">
+ <copy todir="${web-inf.dir}/classes" includeEmptyDirs="no">
+ <fileset dir="JavaSource">
+ <patternset>
+ <include name="**/*.*" />
+ <exclude name="**/*.java" />
+ </patternset>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Check timestamp on files -->
+ <target name="prepare">
+ <tstamp />
+ </target>
+
+ <!-- Remove classes directory for clean build -->
+ <target name="clean" description="Prepare for clean build">
+ <delete dir="${web-inf.dir}/classes" failonerror="false"/>
+ <mkdir dir="${web-inf.dir}/classes" />
+ </target>
+
+ <!-- Normal build of application -->
+ <target name="compile" depends="prepare, copyResources">
+ <javac srcdir="JavaSource" destdir="${web-inf.dir}/classes">
+ <classpath refid="compile.classpath" />
+ </javac>
+ </target>
+
+ <!-- Build Project -->
+ <target name="build" depends="prepare, compile" />
+
+ <!-- Rebuild Project -->
+ <target name="rebuild" depends="clean, prepare, compile" />
+
+ <!-- Build WAR -->
+ <target name="war" depends="build">
+ <mkdir dir="${build.dir}" />
+ <war warfile="${war.name}" basedir="${web.content.dir}" webxml="${web-inf.dir}/web.xml">
+ <exclude name="WEB-INF/web.xml" />
+ </war>
+ </target>
+
+ <target name="deploy" depends="war">
+ <delete dir="${deploy.dir}/${project.name}" failonerror="false"/>
+ <copy file="${war.name}" todir="${deploy.dir}" />
+ </target>
+
+</project>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -12,6 +12,8 @@
package org.jboss.tools.jsf.ui.test;
import org.jboss.tools.jsf.ui.preferences.JSFCapabilitiesPreferencesPage;
+import org.jboss.tools.jsf.ui.test.refactoring.ELReferencesRenameTest;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -31,6 +33,10 @@
suite.addTestSuite(PropertiesNewWizardTest.class);
suite.addTestSuite(XhtmlFileNewWizardTest.class);
suite.addTestSuite(JsfUiPreferencesPagesTest.class);
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(ELReferencesRenameTest.class),
+ "org.jboss.tools.jsf.ui.test",
+ new String[]{"projects/testJSFProject",},
+ new String[]{"testJSFProject"}));
return new TestWizardsProject(suite);
}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELRefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELRefactoringTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELRefactoringTest.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,131 @@
+package org.jboss.tools.jsf.ui.test.refactoring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+import junit.framework.TestCase;
+
+public class ELRefactoringTest extends TestCase {
+ static String jsfProjectName = "testJSFProject";
+ static IProject jsfProject;
+
+ public ELRefactoringTest(String name){
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ loadProjects();
+ List<IProject> projectList = new ArrayList<IProject>();
+ projectList.add(jsfProject);
+ J2EEComponentClasspathUpdater.getInstance().forceUpdate(projectList);
+ loadProjects();
+ }
+
+ private void loadProjects() throws Exception {
+ jsfProject = ProjectImportTestSetup.loadProject(jsfProjectName);
+ jsfProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ }
+
+ protected TestChangeStructure findChange(List<TestChangeStructure> changeList, IFile file){
+ for(TestChangeStructure tcs : changeList){
+ if(tcs.getFileName().equals("/"+file.getFullPath().removeFirstSegments(1).toString()))
+ return tcs;
+ }
+ return null;
+ }
+
+ protected IType getJavaType(IProject project, String className){
+ IJavaProject javaProject = EclipseUtil.getJavaProject(project);
+ if(javaProject != null){
+ try{
+ return javaProject.findType(className);
+ }catch(JavaModelException ex){
+ fail(ex.getMessage());
+ }
+ }
+
+ return null;
+ }
+
+ protected IMethod getJavaMethod(IProject project, String className, String methodName){
+ IType type = getJavaType(project, className);
+ if(type != null){
+ return type.getMethod(methodName, new String[0]);
+ }
+ return null;
+ }
+
+ class TestChangeStructure{
+ private IProject project;
+ private String fileName;
+ ArrayList<TestTextChange> textChanges = new ArrayList<TestTextChange>();
+
+
+ public TestChangeStructure(IProject project, String fileName){
+ this.project = project;
+ this.fileName = fileName;
+ }
+
+ public IProject getProject(){
+ return project;
+ }
+
+ public String getFileName(){
+ return fileName;
+ }
+
+ public ArrayList<TestTextChange> getTextChanges(){
+ return textChanges;
+ }
+
+ public void addTextChange(TestTextChange change){
+ textChanges.add(change);
+ }
+
+ public int size(){
+ return textChanges.size();
+ }
+
+ }
+
+ class TestTextChange{
+ private int offset;
+ private int length;
+ private String text;
+
+ public TestTextChange(int offset, int length, String text){
+ this.offset = offset;
+ this.length = length;
+ this.text = text;
+ }
+
+ public int getOffset(){
+ return offset;
+ }
+
+ public int getLength(){
+ return length;
+ }
+
+ public String getText(){
+ return text;
+ }
+ }
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/refactoring/ELReferencesRenameTest.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -0,0 +1,115 @@
+package org.jboss.tools.jsf.ui.test.refactoring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jsf.ui.el.refactoring.RenameMethodParticipant;
+import org.jboss.tools.test.util.JobUtils;
+
+public class ELReferencesRenameTest extends ELRefactoringTest {
+
+
+ public ELReferencesRenameTest(){
+ super("Rename Method Refactoring Test");
+ }
+
+
+
+ public void testRenameMethod() throws CoreException {
+ ArrayList<TestChangeStructure> list = new ArrayList<TestChangeStructure>();
+
+
+ TestChangeStructure structure = new TestChangeStructure(jsfProject, "/WebContent/pages/hello.jsp");
+ TestTextChange change = new TestTextChange(353, 4, "name");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ structure = new TestChangeStructure(jsfProject, "/WebContent/pages/inputUserName.jsp");
+ change = new TestTextChange(499, 4, "name");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ IMethod method = getJavaMethod(jsfProject, "demo.User", "getName");
+
+ renameELReferences(method, "alias", list);
+ }
+
+ public void testRenameClass() throws CoreException {
+ ArrayList<TestChangeStructure> list = new ArrayList<TestChangeStructure>();
+
+
+ TestChangeStructure structure = new TestChangeStructure(jsfProject, "/WebContent/pages/hello.jsp");
+ TestTextChange change = new TestTextChange(348, 4, "user");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ structure = new TestChangeStructure(jsfProject, "/WebContent/pages/inputUserName.jsp");
+ change = new TestTextChange(494, 4, "user");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ IType type = getJavaType(jsfProject, "demo.User");
+
+ renameELReferences(type, "person", list);
+ }
+
+ private void renameELReferences(IJavaElement element, String newName, List<TestChangeStructure> changeList) throws CoreException{
+ JobUtils.waitForIdle();
+
+
+ // Rename EL references
+ RenameMethodParticipant participant = new RenameMethodParticipant();
+ participant.initialize(element, newName);
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
+
+ assertNotNull("Rename participant returned null status", status);
+
+ assertFalse("There is fatal errors in rename participant", status.hasFatalError());
+
+ CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
+
+ assertEquals("There is unexpected number of changes",changeList.size(), rootChange.getChildren().length);
+
+ for(int i = 0; i < rootChange.getChildren().length;i++){
+ TextFileChange fileChange = (TextFileChange)rootChange.getChildren()[i];
+
+ MultiTextEdit edit = (MultiTextEdit)fileChange.getEdit();
+
+ TestChangeStructure change = findChange(changeList, fileChange.getFile());
+ if(change != null){
+ assertEquals(change.size(), edit.getChildrenSize());
+ }
+ }
+
+ rootChange.perform(new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ // Test results
+
+ for(TestChangeStructure changeStructure : changeList){
+ IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ //System.out.println("File - "+file.getName()+" offset - "+changeStructure.getOffset()+" expected - ["+changeStructure.getText()+"] actual - ["+content.substring(changeStructure.getOffset(), changeStructure.getOffset()+changeStructure.getLength())+"]");
+ for(TestTextChange change : changeStructure.getTextChanges()){
+ assertEquals("There is unexpected change in resource - "+file.getName(), newName, content.substring(change.getOffset(), change.getOffset()+newName.length()));
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-12-10 16:13:45 UTC (rev 19191)
@@ -503,7 +503,7 @@
</extension>
<extension
- point="org.jboss.tools.common.el.core.elProjectSet">
+ point="org.jboss.tools.jsf.elProjectSet">
<project-set id="seam.searcher" projectset-class="org.jboss.tools.seam.internal.core.refactoring.ELProjectSet" />
</extension>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -13,8 +13,8 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.common.el.core.refactoring.ProjectsSet;
import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
import org.jboss.tools.seam.core.SeamProjectsSet;
public class ELProjectSet implements ProjectsSet {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-12-10 16:11:35 UTC (rev 19190)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-12-10 16:13:45 UTC (rev 19191)
@@ -20,7 +20,6 @@
import org.eclipse.jdt.core.IJavaElement;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
import org.jboss.tools.common.el.core.resolver.ELResolution;
import org.jboss.tools.common.el.core.resolver.ELResolver;
@@ -29,6 +28,7 @@
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.jsf.el.refactoring.RefactorSearcher;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
15 years, 1 month
JBoss Tools SVN: r19190 - documentation/trunk/movies/archiving.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-12-10 11:11:35 -0500 (Thu, 10 Dec 2009)
New Revision: 19190
Modified:
documentation/trunk/movies/archiving/archiving.wnk
Log:
JBDS-987 Demos size reduce - demo is checked and compressed
Modified: documentation/trunk/movies/archiving/archiving.wnk
===================================================================
(Binary files differ)
15 years, 1 month
JBoss Tools SVN: r19189 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-12-10 11:00:12 -0500 (Thu, 10 Dec 2009)
New Revision: 19189
Modified:
trunk/jsf/docs/userguide/en/modules/editors.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-814 - new section "Support for Custom Facelets Components" is added;
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2009-12-10 15:54:00 UTC (rev 19188)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2009-12-10 16:00:12 UTC (rev 19189)
@@ -31,16 +31,29 @@
<section id="editors_features">
<title>Editors Features</title>
- <para>JBoss Developer Studio has powerful editor features that help you easily navigate
+ <para><property>JBoss Developer Studio</property> has powerful editor features that help you easily navigate
within your application and make use of content and code assist no matter what project
- file (jsp, xhtml, xml, css, etc...) you are working on.</para>
-
+ file (<literal>.jsp</literal>, <literal>.xhtml</literal>, <literal>.xml</literal>, <literal>.css</literal>, etc.) you are working on.</para>
+ <para>The mentioned features are the following:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link linkend="OpenOnSelection4Hyperlinknavigation">OpenOn</link></para>
+ </listitem>
+ <listitem>
+ <para><link linkend="CodeAssistAndDynamicCodeAssist42BasedOnProjectData">Content Assist</link></para>
+ </listitem>
+ <listitem>
+ <para><link linkend="FullControlOverSourceFiles-SynchronizedSourcAndVisualEditing74">Synchronized Source and Visual Editing</link></para>
+ </listitem>
+ </itemizedlist>
+
<section id="OpenOnSelection4Hyperlinknavigation">
<title>OpenOn</title>
- <para><property>OpenOn</property> lets you easily link directly from one resource to
- another in your project without using the Package Explorer view (project tree). With
+ <para>OpenOn lets you easily link directly from one resource to
+ another in your project without using the <property>Package Explorer</property> view (project tree). With
OpenOn, you can simply use <emphasis>
<property>F3</property>
</emphasis> or <emphasis>
@@ -74,101 +87,135 @@
<title>XML Files</title>
- <para>Press and hold down the Ctrl key. As you move the mouse cursor over different
+ <para>Press and hold down the <emphasis><property>Ctrl</property></emphasis> key. As you move the mouse cursor over different
file references in the file, they display an underline. When you hover the name
- of the file you want to open, click and the file will open in its own editor. In
- this example the managed bean NameBean will open.</para>
- <figure>
- <title>NameBean Managed Bean</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>This is the result of using OpenOn.</para>
- <figure>
- <title>NameBean Java Class</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>You can also use OpenOn with defined attributes.</para>
- <figure>
- <title>OpenOn With Defined Attributes</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>You can also open any JSP pages.</para>
- <figure>
- <title>JSP Page OpenOn</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
+ of the file you want to open, click and the file will open in its own editor.</para>
+
+ <para>Use the OpenOn functionality for the next entries defined in XML file:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Managed beans</para>
+ <para>In this example the managed bean <emphasis><property>"User"</property></emphasis> will open.</para>
+
+ <figure>
+ <title>Opening a Managed Bean</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>This is the result of using OpenOn.</para>
+
+ <figure>
+ <title>Opened Managed Bean</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>Beans properties</para>
+ <figure>
+ <title>OpenOn for the Bean Property</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>JSP file references</para>
+ <figure>
+ <title>OpenOn for JSP Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </orderedlist>
</section>
+
<section id="JSPPages223">
- <title>JSP Pages</title>
+ <title>JSP/XHTML Pages</title>
- <para><property>OpenOn</property> is also very useful in JSP pages. It will allow
+ <para>OpenOn is also available in JSP and XHTML pages edited in the <property>Visual Page Editor</property>. It will allow
you to quickly jump to the reference instead of having to hunt around in the
project structure.</para>
- <para>You can easily open the imported property files.</para>
- <figure>
- <title>OpenOn With Imported Property Files</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_5.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Use OpenOn to open a CSS file used with a JSP page:</para>
- <figure>
- <title>OpenOn With CSS File</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_6.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Open managed beans:</para>
- <figure>
- <title>OpenOn With Managed Beans</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_7.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>You can use OpenOn to open custom tag libraries:</para>
- <figure>
- <title>OpenOn With custom tags</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_7a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>For JSP files in a JSF project, you can also easily open the navigation rules
- by applying <property>OpenOn</property> to the JSF tag for the navigation
- outcome:</para>
- <figure>
- <title>OpenOn With JSF Tag</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/editors_features/editors_features_8.png"/>
- </imageobject>
- </mediaobject>
- </figure>
+
+ <para>You can use OpenOn for the following JSP/XHTML file entries:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Imported property files</para>
+ <figure>
+ <title>OpenOn for Property File Imported to the JSP Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>CSS files used in a JSP/XHTML page</para>
+ <figure>
+ <title>OpenOn With CSS File</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>Managed beans and their properties</para>
+ <figure>
+ <title>OpenOn With Managed Beans</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_7.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>Navigation rules in JSP files</para>
+
+ <para>For JSP files in a JSF project, you can easily open the navigation rules
+ by applying <property>OpenOn</property> to the JSF tag for the navigation
+ outcome:</para>
+
+ <figure>
+ <title>OpenOn With JSF Tag</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_8.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>Custom Facelets tag libraries in XHTML pages</para>
+ <para>For details, see <link linkend="openOnForCustomFacelets">"OpenOn for Custom Facelets Tag Libraries"</link>
+ later in this guide.</para>
+ </listitem>
+ </orderedlist>
</section>
<section id="cssclasses">
@@ -237,6 +284,11 @@
<link linkend="JSPPages434">JSP files</link>
</para>
</listitem>
+ <listitem>
+ <para>
+ <link linkend="ContentAssistForXHTMLPages">XHTML files</link>
+ </para>
+ </listitem>
<listitem>
<para>
<link linkend="ContentAssistForRF">RichFaces components</link>
@@ -663,7 +715,23 @@
</section>
</section>
- <section id="AddingDynamicCodeAssistToCustomComponents8745">
+ <section id="ContentAssistForXHTMLPages">
+ <title>Content Assist for XHTML Pages</title>
+
+ <para>The code completion for the Seam components in a Seam project shows the proposals marked with Seam icon.</para>
+ <figure>
+ <title>Content Assist for Seam Components in the XHTML Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/contentAssistXHTMLpages1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>If XHTML file uses custom Facelets components, the Content Assist should also be available for them. For details, see
+ <link linkend="contentAssistForCustomFacelets">"Content Assist for Custom Facelets Components"</link> later in this guide.</para>
+ </section>
+ <section id="AddingDynamicCodeAssistToCustomComponents8745">
<title>Adding dynamic code assist to custom components that were added to JBoss
Tools Palette</title>
@@ -1092,8 +1160,7 @@
JSF element has different preview in versions 1.1 and 1.2.</para>
</section>
</section>
-
-
+
<section id="pages_styling">
<title>Pages Styling</title>
@@ -1816,39 +1883,161 @@
</inlinemediaobject>) on the VPE toolbar.</para>
</section>
</section>
+
+ <section id="page_preview">
+ <title>Page Preview</title>
+
+ <para><property>VPE</property> comes with design-time preview feature which is available
+ for:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Struts Pages</para>
+ </listitem>
+ <listitem>
+ <para>JSF Pages</para>
+ </listitem>
+ </itemizedlist>
+
+ <para><property>Preview view</property> is read-only, it shows how the page will look
+ like in a browser.</para>
+ <figure>
+ <title>Preview View</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_16.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <!--para>You can even
+ attach your stylesheet to the preview.</para-->
+ </section>
+
+ <section id="custom_facelets_support">
+ <title>Support for Custom Facelets Components</title>
+
+ <para><property>Visual Page Editor</property> (starting from 3.0.0.M3 version of <property>JBoss Tools</property>) supports
+ custom Facelets tag libraries both declared in the <literal>web.xml</literal> file
+ (for details, see
+ <ulink url="http://www.ibm.com/developerworks/java/library/j-facelets/#N10294">Creating a component</ulink>) and packed into the JAR file.</para>
+
+ <tip>
+ <title>Tip:</title>
+ <para>In case of Facelets tag library packed in <literal>.jar</literal>, remember to put <literal>*.taglib.xml</literal> in right place:
+ <literal>[filename].jar/META-INF/*.taglib.xml</literal></para>
+ </tip>
+
+ <para><property>Visual Page Editor</property> recognizes the tags from the custom Facelets tag library and correctly
+ renders them both in source and visual view of the editor.</para>
+
+ <figure>
+ <title>Custom Facelets Tags in the VPE</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/customFacelets1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>While editing an XHTML file that uses a custom Facelets components
+ you can always make use of the following editor's features:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><link linkend="contentAssistForCustomFacelets">Content Assist for Custom Facelets Components</link></para>
+ </listitem>
+ <listitem>
+ <para><link linkend="openOnForCustomFacelets">OpenOn for Custom Facelets Components</link></para>
+ </listitem>
+ </itemizedlist>
+
+ <section id="contentAssistForCustomFacelets">
+ <title>Content Assist for Custom Facelets Components</title>
+ <para>Call the content assist as usual by using <emphasis><property>Ctrl+Space</property></emphasis>
+ when typing a tag. As proposals you should see custom Facelets tags defined in your Facelets tag library.</para>
+
+ <figure>
+ <title>Content Assist for Custom Facelets Tags</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/customFacelets2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+
+ <section id="openOnForCustomFacelets">
+ <title>OpenOn for Custom Facelets Components</title>
+
+ <para>While developing using Facelets you can make use of:</para>
+ <itemizedlist>
+ <listitem><para><link linkend="openOnInXHTML">OpenOn in XHTML Files That Use Custom Facelets Components</link></para></listitem>
+ <listitem><para><link linkend="openOnInCustomFaceletsTaglibs">OpenOn in Custom Facelets Tag File (<literal>*.taglib.xml</literal>)</link></para></listitem>
+ </itemizedlist>
+
+ <section id="openOnInXHTML">
+ <title>OpenOn in XHTML Files That Use Custom Facelets Components</title>
+ <para>OpenOn functionality in XHTML files is available in two views of the <property>Visual Page Editor</property>:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Source view</para>
+
+ <para><emphasis><property>Ctrl+Click</property></emphasis> on the namespace will open the Facelets tag file
+ in a separate window.</para>
+
+ <figure>
+ <title>Opening a Custom Facelets Tag File</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/customFacelets3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para><emphasis><property>Ctrl+Click</property></emphasis> on any custom Facelets tag declared on the page will do the same.
+ The selected tag will be highlighted in the opened file.</para>
+
+ <figure>
+ <title>Opening a Custom Facelets Tag File</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/customFacelets4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+
+ <listitem>
+ <para>Visual view</para>
+
+ <para>In the visual view of the <property>VPE</property>, double-click a custom component and the Facelets tag file
+ (<literal>*.taglib.xml</literal>) where it is declared will be opened.</para>
+ </listitem>
+ </orderedlist>
+ </section>
+
+ <section id="openOnInCustomFaceletsTaglibs">
+ <title>OpenOn in Custom Facelets Tag File (<literal>*.taglib.xml</literal>)</title>
+
+ <para><emphasis><property>Ctrl+Click</property></emphasis> on the path to source of the Facelets tag will
+ open the component in its own editor.</para>
+ <figure>
+ <title>Opening a Custom Facelets Component</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/customFacelets5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
- <section id="page_preview">
- <title>Page Preview</title>
+ </section>
+ </section>
+
+ <section id="SetupnotesforLinu895x">
- <para><property>VPE</property> comes with design-time preview feature which is available
- for:</para>
-
- <itemizedlist>
- <listitem>
- <para>Struts Pages</para>
- </listitem>
- <listitem>
- <para>JSF Pages</para>
- </listitem>
- </itemizedlist>
-
- <para><property>Preview view</property> is read-only, it shows how the page will look
- like in a browser.</para>
- <figure>
- <title>Preview View</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_16.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <!--para>You can even
- attach your stylesheet to the preview.</para-->
- </section>
-
- <section id="SetupnotesforLinu895x">
-
<title>Setup notes for Linux</title>
<para>Linux users who are going to use earlier then JBoss Tools 3.1.0.M4 versions may need to do the following to get the <property>Visual Page
15 years, 1 month