JBoss Tools SVN: r7573 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-04-17 09:40:44 -0400 (Thu, 17 Apr 2008)
New Revision: 7573
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
Log:
JBIDE-2065
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-17 13:23:51 UTC (rev 7572)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-17 13:40:44 UTC (rev 7573)
@@ -197,7 +197,7 @@
public IVisualContext getPageContext() {
if (pageContext == null) {
- pageContext = new SourceEditorPageContext(parentEditor.getVisualEditor().getController().getPageContext());
+ pageContext = new SourceEditorPageContext(parentEditor);
}
// JBIDE-2046
Runnable runnable = new Runnable() {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-04-17 13:23:51 UTC (rev 7572)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-04-17 13:40:44 UTC (rev 7573)
@@ -53,8 +53,12 @@
*/
private IVisualContext pageContext;
- public SourceEditorPageContext(IVisualContext pageContext) {
- setPageContext(pageContext);
+ public SourceEditorPageContext(JSPMultiPageEditor externalEditor) {
+
+ if((externalEditor!=null)&& (externalEditor.getVisualEditor()!=null)
+ &&(externalEditor.getVisualEditor().getController()!=null))
+
+ setPageContext(externalEditor.getVisualEditor().getController().getPageContext());
}
public void clearAll() {
@@ -217,8 +221,12 @@
}
public List<TaglibData> getIncludeTaglibs() {
-
- return getPageContext().getIncludeTaglibs();
+ if(getPageContext()!=null) {
+
+ return getPageContext().getIncludeTaglibs();
+ } else {
+ return new ArrayList<TaglibData>();
+ }
}
}
17 years, 8 months
JBoss Tools SVN: r7572 - in trunk: seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-17 09:23:51 -0400 (Thu, 17 Apr 2008)
New Revision: 7572
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.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
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
Log:
JBIDE-2007 CA works if class extends Type<Parameter>
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/TypeInfoCollector.java 2008-04-17 13:23:51 UTC (rev 7572)
@@ -13,6 +13,7 @@
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -29,6 +30,7 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -40,6 +42,7 @@
public class TypeInfoCollector {
IType fType;
MemberInfo fMember;
+ TypeInfo fTypeInfo;
List<MethodInfo> fMethods;
List<FieldInfo> fFields;
@@ -220,7 +223,6 @@
private int fModifiers;
private IType fSourceType;
private MemberInfo fParentMember;
- private String[] fParametersNamesOfDeclaringType;
private IType fMemberType;
private boolean isDataModel;
private Type fType;
@@ -239,19 +241,7 @@
setType(type);
}
- protected void initializeParametersOfDeclaringType() {
- if(fParametersNamesOfDeclaringType!=null && fParametersNamesOfDeclaringType.length>0 && getParentMember()!=null) {
- Map<String, Type> parametersOfDeclaringType = new HashMap<String, Type>();
- for (int i = 0; i < fParametersNamesOfDeclaringType.length; i++) {
- String parameterName = getParameterNameFromType(fParametersNamesOfDeclaringType[i]);
- Type paramType = getParentMember().getType().getParameter(i);
- if(paramType!=null) {
- parametersOfDeclaringType.put(parameterName, paramType);
- }
- }
- getType().initializeParameters(parametersOfDeclaringType);
- }
- }
+ abstract void initializeParameters();
protected void setType(Type type) {
fType = type;
@@ -313,22 +303,13 @@
fParentMember = parentMember;
}
- public String[] getParametersNamesOfDeclaringType() {
- return fParametersNamesOfDeclaringType;
- }
-
- void setParametersNamesOfDeclaringType(
- String[] parametersNamesOfDeclaringType) {
- fParametersNamesOfDeclaringType = parametersNamesOfDeclaringType;
- }
-
public IType getMemberType() {
if(fMemberType==null) {
- initializeParametersOfDeclaringType();
+ initializeParameters();
try {
if(isDataModel() && getType().isArray()) {
fMemberType = getSourceType().getJavaProject().findType(getType().getQualifiedTypeNameOfArrayElement());
- } else {
+ } else if(getType().getQualifiedName()!=null) {
fMemberType = getSourceType().getJavaProject().findType(getType().getQualifiedName());
}
} catch (JavaModelException e) {
@@ -359,12 +340,25 @@
public static class TypeInfo extends MemberInfo {
private IType fType;
+ private TypeInfo superType;
+ private Map<String, Type> params = new HashMap<String, Type>();
+ private boolean initialized = false;
public TypeInfo(IType type, MemberInfo parentMember, boolean dataModel) throws JavaModelException {
- super(type.getDeclaringType(), (type.getDeclaringType() == null ? null : type.getDeclaringType().getFullyQualifiedName()), type.getFullyQualifiedName(), type.getFlags(), parentMember, dataModel, Type.valueOf(type.getFullyQualifiedName()));
+ super(type.getDeclaringType(),
+ (type.getDeclaringType() == null ? null : type.getDeclaringType().getFullyQualifiedName()),
+ type.getFullyQualifiedName(),
+ type.getFlags(),
+ parentMember,
+ dataModel,
+ Type.valueOf(type.getFullyQualifiedName()));
this.fType = type;
}
+ public Type getParameterType(String name) {
+ return params.get(name);
+ }
+
@Override
public IType getMemberType() {
return fType;
@@ -374,17 +368,127 @@
public IJavaElement getJavaElement() {
return fType;
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.model.util.TypeInfoCollector.MemberInfo#initializeParameters()
+ */
+ @Override
+ void initializeParameters() {
+ if(!initialized) {
+ try {
+ MemberInfo parent = getParentMember();
+ if(parent!=null && parent instanceof TypeMemberInfo) {
+ ITypeParameter[] parameters = fType.getTypeParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ Type type = parent.getType().getParameter(i);
+ if(type!=null) {
+ params.put(parameters[i].getElementName(), type);
+ }
+ }
+ }
+ if(superType!=null) {
+ superType.initializeParameters(this);
+ }
+ } catch (JavaModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
+ initialized = true;
+ }
+
+ private void initializeParameters(TypeInfo inheritedType) throws JavaModelException {
+ ITypeParameter[] parameters = fType.getTypeParameters();
+ String signature = inheritedType.fType.getSuperclassTypeSignature();
+ Type classType = new Type(signature, inheritedType.fType);
+ for (int i = 0; i < parameters.length; i++) {
+ Type paramType = classType.getParameter(i);
+ if(paramType!=null) {
+ Type resolvedType = inheritedType.getParameterType(paramType.getName());
+ if(resolvedType!=null) {
+ paramType = resolvedType;
+ }
+ params.put(parameters[i].getElementName(), paramType);
+ }
+ }
+ if(superType!=null) {
+ superType.initializeParameters(this);
+ }
+ }
+
+ public TypeInfo getSuperType() {
+ return superType;
+ }
+
+ public void setSuperType(TypeInfo superType) {
+ this.superType = superType;
+ }
}
- public static class FieldInfo extends MemberInfo {
+ public abstract static class TypeMemberInfo extends MemberInfo {
+ private String[] fParametersNamesOfDeclaringType;
+ private TypeInfo declaratedType;
+
+ /**
+ * @param sourceType
+ * @param declaringTypeQualifiedName
+ * @param name
+ * @param modifiers
+ * @param parentMember
+ * @param dataModel
+ * @param type
+ */
+ protected TypeMemberInfo(IType sourceType,
+ String declaringTypeQualifiedName, String name, int modifiers,
+ TypeInfo parentMember, TypeInfo declaratedType, boolean dataModel, Type type) {
+ super(sourceType, declaringTypeQualifiedName, name, modifiers, parentMember,
+ dataModel, type);
+ this.declaratedType = declaratedType;
+ }
+
+ public String[] getParametersNamesOfDeclaringType() {
+ return fParametersNamesOfDeclaringType;
+ }
+
+ void setParametersNamesOfDeclaringType(
+ String[] parametersNamesOfDeclaringType) {
+ fParametersNamesOfDeclaringType = parametersNamesOfDeclaringType;
+ }
+
+ protected void initializeParameters() {
+ if(fParametersNamesOfDeclaringType!=null && fParametersNamesOfDeclaringType.length>0 && getParentMember()!=null) {
+ Map<String, Type> parametersOfDeclaringType = new HashMap<String, Type>();
+ TypeInfo parentTypeInfo = (TypeInfo)getParentMember();
+ parentTypeInfo.initializeParameters();
+ for (int i = 0; i < fParametersNamesOfDeclaringType.length; i++) {
+ String parameterName = getParameterNameFromType(fParametersNamesOfDeclaringType[i]);
+ Type paramType = declaratedType.getParameterType(parameterName);
+ if(paramType!=null) {
+ parametersOfDeclaringType.put(parameterName, paramType);
+ }
+ }
+ getType().initializeParameters(parametersOfDeclaringType);
+ }
+ }
+
+ public TypeInfo getDeclaratedType() {
+ return declaratedType;
+ }
+
+ protected void setDeclaratedType(TypeInfo declaratedType) {
+ this.declaratedType = declaratedType;
+ }
+ }
+
+ public static class FieldInfo extends TypeMemberInfo {
private IJavaElement fJavaElement;
- public FieldInfo(IField field, MemberInfo parentMember, boolean dataModel) throws JavaModelException {
+ public FieldInfo(IField field, TypeInfo parentMember, TypeInfo declaratedType, boolean dataModel) throws JavaModelException {
super(field.getDeclaringType(),
(field.getDeclaringType() == null ? null : field.getDeclaringType().getFullyQualifiedName()),
field.getElementName(),
field.getFlags(),
parentMember,
+ declaratedType,
dataModel,
new Type(field.getTypeSignature(),
field.getDeclaringType()));
@@ -395,6 +499,9 @@
public IJavaElement getJavaElement () {
if(fJavaElement == null) {
try {
+ if(getDeclaringTypeQualifiedName()==null) {
+ return null;
+ }
IType declType = getSourceType().getJavaProject().findType(getDeclaringTypeQualifiedName());
fJavaElement = (declType == null ? null : declType.getField(getName()));
} catch (JavaModelException e) {
@@ -405,7 +512,7 @@
}
}
- public static class MethodInfo extends MemberInfo {
+ public static class MethodInfo extends TypeMemberInfo {
private String[] fParameterTypeNames;
private String[] fParameterTypeQualifiedNames;
private String[] fParameterNames;
@@ -415,19 +522,21 @@
int modifiers, String[] parameterTypeQualifiedNames,
String[] parameterNames,
String returnTypeQualifiedName,
- MemberInfo parentMember,
+ TypeInfo parentMember,
+ TypeInfo declaratedType,
boolean dataModel) {
- super(sourceType, declaringTypeQualifiedName, name, modifiers, parentMember, dataModel, Type.valueOf(name));
+ super(sourceType, declaringTypeQualifiedName, name, modifiers, parentMember, declaratedType, dataModel, Type.valueOf(name));
setParameterTypeNames(parameterTypeQualifiedNames);
setParameterNames(parameterNames);
}
- public MethodInfo(IMethod method, MemberInfo parentMember, boolean dataModel) throws JavaModelException {
+ public MethodInfo(IMethod method, TypeInfo parentMember, TypeInfo declaratedType, boolean dataModel) throws JavaModelException {
super(method.getDeclaringType(),
(method.getDeclaringType() == null ? null : method.getDeclaringType().getFullyQualifiedName()),
method.getElementName(),
method.getFlags(),
parentMember,
+ declaratedType,
dataModel,
new Type(method.getReturnType(),
method.getDeclaringType()));
@@ -474,12 +583,13 @@
}
public boolean isConstructor () {
- return getDeclaringTypeQualifiedName().equals(getName());
+ return getDeclaringTypeQualifiedName()!=null && getDeclaringTypeQualifiedName().equals(getName());
}
public boolean isGetter() {
- if (null == getReturnType())
+ if (null == getType()) {
return false;
+ }
return (((getName().startsWith("get") && !getName().equals("get")) || getName().startsWith("is")) && getNumberOfParameters() == 0);
}
@@ -488,12 +598,33 @@
return ((getName().startsWith("set") && !getName().equals("set")) && getNumberOfParameters() == 1);
}
+ public List<String> getAsPresentedStrings() {
+ List<String> list = new ArrayList<String>(2);
+ StringBuffer name = new StringBuffer(getName());
+
+ // Add method as 'foo'
+ list.add(name.toString());
+
+ // Add method as 'foo(param1,param2)'
+ name.append('(');
+ String[] mParams = getParameterNames();
+ for (int j = 0; mParams != null && j < mParams.length; j++) {
+ if (j > 0) name.append(", "); //$NON-NLS-1$
+ name.append(mParams[j]);
+ }
+ name.append(')');
+ list.add(name.toString());
+ return list;
+ }
+
@Override
public IJavaElement getJavaElement () {
if(fJavaElement == null) {
try {
IType declType = getSourceType().getJavaProject().findType(getDeclaringTypeQualifiedName());
-
+ if(declType==null) {
+ return null;
+ }
IMethod[] allMethods = declType.getMethods();
// filter methods by name
@@ -577,23 +708,36 @@
fFields.clear();
}
- if (fType == null)
+ if (fType == null) {
return;
+ }
try {
IType binType = fType;
+ MemberInfo originalParent = fMember;
+ if(fMember instanceof TypeInfo) {
+ fTypeInfo = (TypeInfo)fMember;
+ } else {
+ fTypeInfo = new TypeInfo(binType, fMember, fMember.isDataModel());
+ }
+ TypeInfo parent = fTypeInfo;
while (binType != null) {
IMethod[] binMethods = binType.getMethods();
for (int i = 0; binMethods != null && i < binMethods.length; i++) {
- if (binMethods[i].isConstructor()) continue;
- fMethods.add(new MethodInfo(binMethods[i], fMember, false));
+ if (binMethods[i].isConstructor()) {
+ continue;
+ }
+ fMethods.add(new MethodInfo(binMethods[i], fTypeInfo, parent, false));
}
binType = getSuperclass(binType);
+ if(binType!=null) {
+ TypeInfo superType = new TypeInfo(binType, originalParent, parent.isDataModel());
+ parent.setSuperType(superType);
+ parent = superType;
+ }
}
- // !!!!!!!
// This inserts here methods "public int size()" and "public boolean isEmpty()" for javax.faces.model.DataModel
// as requested by Gavin in JBIDE-1256
- // !!!!!!!
if(isDataModelObject(fType)) {
addInfoForDataModelObject();
}
@@ -691,7 +835,8 @@
new String[0],
new String[0],
"int",
- fMember,
+ fTypeInfo,
+ fTypeInfo,
false));
}
@@ -702,7 +847,8 @@
new String[0],
new String[0],
"int",
- fMember,
+ fTypeInfo,
+ fTypeInfo,
false));
fMethods.add(new MethodInfo(fType,
fType.getFullyQualifiedName(),
@@ -710,7 +856,8 @@
new String[0],
new String[0],
"boolean",
- fMember,
+ fTypeInfo,
+ fTypeInfo,
false));
}
@@ -803,13 +950,76 @@
}
/**
- * Returns the method presentation strings for the type specified
- *
- * @param type
+ * String presentation of member
+ * @author Alexey Kazakov
+ */
+ public static class MemberPresentation {
+ private String presentation;
+ private MemberInfo member;
+
+ public MemberPresentation(String presentation, MemberInfo member) {
+ super();
+ this.presentation = presentation;
+ this.member = member;
+ }
+
+ public String getPresentation() {
+ return presentation;
+ }
+
+ public MemberInfo getMember() {
+ return member;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj!=null && obj instanceof MemberPresentation) {
+ return presentation.equals(((MemberPresentation)obj).getPresentation());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return presentation.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return presentation;
+ }
+ }
+
+ private static class MemberPresentationComparator implements Comparator<MemberPresentation> {
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(MemberPresentation m1, MemberPresentation m2) {
+ return m1.getPresentation().compareTo(m2.getPresentation());
+ }
+ }
+
+ public final static MemberPresentationComparator MEMBER_PRESENTATION_COMPARATOR = new MemberPresentationComparator();
+
+ /**
+ * Returns the method presentation strings for the type specified
* @return
*/
- public Set<String> getMethodPresentations() {
- Set<String> methods = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ public Set<String> getMethodPresentationStrings() {
+ Set<MemberPresentation> set = getMethodPresentations();
+ Set<String> result = new HashSet<String>();
+ for (MemberPresentation presentation : set) {
+ result.add(presentation.getPresentation());
+ }
+ return result;
+ }
+
+ /**
+ * Returns the method presentations for the type specified
+ * @return
+ */
+ public Set<MemberPresentation> getMethodPresentations() {
+ Set<MemberPresentation> methods = new TreeSet<MemberPresentation>(MEMBER_PRESENTATION_COMPARATOR);
List<MemberInfo> mthds = getMethods();
for (MemberInfo info : mthds) {
if (!(info instanceof MethodInfo))
@@ -820,7 +1030,7 @@
StringBuffer name = new StringBuffer(method.getName());
// Add method as 'foo'
- methods.add(name.toString());
+ methods.add(new MemberPresentation(name.toString(), method));
// Add method as 'foo(param1,param2)'
name.append('(');
@@ -831,7 +1041,7 @@
}
name.append(')');
- methods.add(name.toString());
+ methods.add(new MemberPresentation(name.toString(), method));
}
return methods;
}
@@ -867,22 +1077,46 @@
}
/**
- * Returns the property presentation strings for the type specified
+ * Returns the property presentations for the type specified
*
* @return
*/
- public Set<String> getPropertyPresentations() {
+ public Set<MemberPresentation> getPropertyPresentations() {
return getPropertyPresentations(null);
}
/**
* Returns the property presentation strings for the type specified
*
+ * @return
+ */
+ public Set<String> getPropertyPresentationStrings() {
+ return getPropertyPresentationStrings(null);
+ }
+
+ /**
+ * Returns the property presentation strings for the type specified
+ *
* @param unpairedGettersOrSetters - map of unpaired getters or setters of type's properties. 'key' is property name.
* @return
*/
- public Set<String> getPropertyPresentations(Map<String, MethodInfo> unpairedGettersOrSetters) {
- Set<String> properties = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ public Set<String> getPropertyPresentationStrings(Map<String, MethodInfo> unpairedGettersOrSetters) {
+ Set<MemberPresentation> set = getPropertyPresentations(unpairedGettersOrSetters);
+ Set<String> result = new HashSet<String>();
+ for (MemberPresentation presentation : set) {
+ result.add(presentation.getPresentation());
+ }
+ return result;
+ }
+
+ /**
+ * Returns the property presentations for the type specified
+ *
+ * @param unpairedGettersOrSetters - map of unpaired getters or setters of type's properties. 'key' is property name.
+ * @return
+ */
+ public Set<MemberPresentation> getPropertyPresentations(Map<String, MethodInfo> unpairedGettersOrSetters) {
+ Set<MemberPresentation> properties = new TreeSet<MemberPresentation>(MEMBER_PRESENTATION_COMPARATOR);
List<MemberInfo> props = getProperties();
HashMap<String, MethodInfo> getters = new HashMap<String, MethodInfo>();
HashMap<String, MethodInfo> setters = new HashMap<String, MethodInfo>();
@@ -899,8 +1133,9 @@
}
name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
String propertyName = name.toString();
- if(!properties.contains(propertyName)) {
- properties.add(propertyName);
+ MemberPresentation pr = new MemberPresentation(propertyName, m);
+ if(!properties.contains(pr)) {
+ properties.add(pr);
}
if(unpairedGettersOrSetters!=null) {
MethodInfo previousGetter = getters.get(propertyName);
@@ -918,7 +1153,7 @@
}
}
} else {
- properties.add(info.getName());
+ properties.add(new MemberPresentation(info.getName(), info));
}
}
return properties;
@@ -938,12 +1173,17 @@
MemberInfo result = cache == null ? null : cache.get(member);
if(result != null) return result;
try {
- if (member instanceof IType)
+ if (member instanceof IType) {
result = new TypeInfo((IType)member, null, dataModel);
- else if (member instanceof IField)
- result = new FieldInfo((IField)member, null, dataModel);
- else if (member instanceof IMethod)
- result = new MethodInfo((IMethod)member, null, dataModel);
+ } else if (member instanceof IField) {
+ IField field = (IField)member;
+ TypeInfo declaringType = new TypeInfo(field.getDeclaringType(), null, dataModel);
+ result = new FieldInfo(field, declaringType, declaringType, dataModel);
+ } else if (member instanceof IMethod) {
+ IMethod method = (IMethod)member;
+ TypeInfo declaringType = new TypeInfo(method.getDeclaringType(), null, dataModel);
+ result = new MethodInfo(method, declaringType, declaringType, dataModel);
+ }
} catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
@@ -995,5 +1235,4 @@
}
return Signature.getTypeVariable(typeSignatures);
}
-
}
\ 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 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-04-17 13:23:51 UTC (rev 7572)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.internal.core.el;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -588,7 +589,6 @@
proposals.add(key);
}
}
-// proposals.addAll(((MessagesInfo)mbr).getKeys());
continue;
}
if (mbr.getMemberType() == null) {
@@ -598,17 +598,20 @@
if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
status.setMapOrCollectionOrBundleAmoungTheTokens();
}
- proposals.addAll(infos.getMethodPresentations());
- proposals.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
+ proposals.addAll(infos.getMethodPresentationStrings());
+ proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
}
} else if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
token.getType() == ELOperandToken.EL_METHOD_TOKEN) {
// return filtered methods + properties
- Set<String> proposalsToFilter = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr instanceof MessagesInfo) {
- proposalsToFilter.addAll(((MessagesInfo)mbr).getKeys());
+ Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+ for (String key : keys) {
+ proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
+ }
continue;
}
if (mbr.getMemberType() == null) continue;
@@ -620,7 +623,7 @@
proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
status.setMemberOfResolvedOperand(mbr);
}
- for (String proposal : proposalsToFilter) {
+ for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
// We do expect nothing but name for method tokens (No round brackets)
String filter = token.getText();
if (filter.indexOf('(') != -1) {
@@ -628,8 +631,9 @@
}
if(returnEqualedVariablesOnly) {
// This is used for validation.
- if (proposal.equals(filter)) {
- proposals.add(proposal);
+ if (proposal.getPresentation().equals(filter)) {
+ proposals.add(proposal.getPresentation());
+ status.setMemberOfResolvedOperand(proposal.getMember());
if(status.getUnpairedGettersOrSetters()!=null) {
TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
status.clearUnpairedGettersOrSetters();
@@ -639,11 +643,9 @@
}
break;
}
- } else {
+ } else if (proposal.getPresentation().startsWith(filter)) {
// This is used for CA.
- if (proposal.startsWith(filter)) {
- proposals.add(proposal.substring(filter.length()));
- }
+ proposals.add(proposal.getPresentation().substring(filter.length()));
}
}
}
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 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2008-04-17 13:23:51 UTC (rev 7572)
@@ -23,6 +23,8 @@
import org.jboss.tools.common.model.util.TypeInfoCollector;
import org.jboss.tools.common.model.util.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.model.util.TypeInfoCollector.Type;
+import org.jboss.tools.common.model.util.TypeInfoCollector.TypeInfo;
+import org.jboss.tools.common.model.util.TypeInfoCollector.TypeMemberInfo;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
@@ -174,7 +176,7 @@
* This object wraps "messages" context variable.
* @author Alexey Kazakov
*/
- public static class MessagesInfo extends MemberInfo {
+ public static class MessagesInfo extends TypeMemberInfo {
private ISeamMessages messages;
@@ -184,7 +186,7 @@
* @throws JavaModelException
*/
protected MessagesInfo(MemberInfo parentMember, ISeamMessages messages) throws JavaModelException {
- super(null, null, messages.getName(), 0, null, false, null);
+ super(null, null, messages.getName(), 0, null, null, false, null);
this.messages = messages;
IMember member = (IMember)getJavaElement();
if(member!=null) {
@@ -198,13 +200,20 @@
setName(messages.getName());
setModifiers(type.getFlags());
setParentMember(parentMember);
+ if(parentMember == null || parentMember instanceof TypeMemberInfo) {
+ TypeInfo typeInfo = new TypeInfo(type, null, false);
+ setDeclaratedType(typeInfo);
+ } else {
+ setDeclaratedType((TypeInfo)parentMember);
+ }
setDataModel(false);
setType(type==null?null:new Type(null, type));
}
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.common.model.util.TypeInfoCollector.MemberInfo#getJavaElement()
*/
@Override
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/varAttributes.xhtml 2008-04-17 13:23:51 UTC (rev 7572)
@@ -10,4 +10,9 @@
</h:dataTable>
</h:dataTable>
+ <h:dataTable value="#{arrayItems}" var="arrayItem">
+ <h:dataTable value="#{arrayItem.list}" var="item">
+ <h:outputText value="#{item.}"/>
+ </h:dataTable>
+ </h:dataTable>
</html>
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/demo/TestComponentForVarAttributes.1 2008-04-17 13:23:51 UTC (rev 7572)
@@ -20,7 +20,7 @@
private Map<String, Test> mapItems;
@DataModel
- private Value[] arrayItems;
+ private InerClass[] arrayItems;
public Test getTest() {
return null;
@@ -41,4 +41,13 @@
return null;
}
}
+
+ public static class InerClass extends InerSuperClass<Value> {
+ }
+
+ public static class InerSuperClass<E> {
+ public List<E> getList() {
+ return null;
+ }
+ }
}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-04-17 11:22:42 UTC (rev 7571)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-04-17 13:23:51 UTC (rev 7572)
@@ -76,6 +76,7 @@
/**
* Test for http://jira.jboss.com/jira/browse/JBIDE-1803
+ * http://jira.jboss.com/jira/browse/JBIDE-2007
*/
public void testVarAttributes() {
try {
@@ -96,6 +97,7 @@
EditorTestHelper.joinJobs(1000,10000,500);
checkProposals("/WebContent/varAttributes.xhtml", 458, new String[]{"test.name"}, false);
+ checkProposals("/WebContent/varAttributes.xhtml", 640, new String[]{"item.name"}, false);
try{
component.setContents(emptyComponent.getContents(), true, false, new NullProgressMonitor());
17 years, 8 months
JBoss Tools SVN: r7571 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: jspeditor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-04-17 07:22:42 -0400 (Thu, 17 Apr 2008)
New Revision: 7571
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualContext.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/XmlUtil.java
Log:
JBIDE-2065
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualContext.java 2008-04-17 11:20:58 UTC (rev 7570)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualContext.java 2008-04-17 11:22:42 UTC (rev 7571)
@@ -10,10 +10,14 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.editor;
+import java.util.List;
+
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
+import org.jboss.tools.jst.web.tld.TaglibData;
public interface IVisualContext {
public void refreshBundleValues();
public WtpKbConnector getConnector();
+ public List<TaglibData> getIncludeTaglibs();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-17 11:20:58 UTC (rev 7570)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-04-17 11:22:42 UTC (rev 7571)
@@ -197,7 +197,7 @@
public IVisualContext getPageContext() {
if (pageContext == null) {
- pageContext = new SourceEditorPageContext();
+ pageContext = new SourceEditorPageContext(parentEditor.getVisualEditor().getController().getPageContext());
}
// JBIDE-2046
Runnable runnable = new Runnable() {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-04-17 11:20:58 UTC (rev 7570)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/SourceEditorPageContext.java 2008-04-17 11:22:42 UTC (rev 7571)
@@ -47,7 +47,16 @@
* references node
*/
private Node referenceNode = null;
+ /**
+ * Reference page context
+ * @param pageContext
+ */
+ private IVisualContext pageContext;
+ public SourceEditorPageContext(IVisualContext pageContext) {
+ setPageContext(pageContext);
+ }
+
public void clearAll() {
setTaglibs(null);
@@ -78,11 +87,11 @@
*/
public void setDocument(IDocument iDocument) {
- List<TaglibData> taglibs =XmlUtil.getTaglibsForJSPDocument(iDocument);
+ List<TaglibData> taglibs =XmlUtil.getTaglibsForJSPDocument(iDocument,getIncludeTaglibs());
//if we on jsp page we will set taglibs
//TODO Max Areshkau Find other passability to check if we on jsp page
if(taglibs!=null && taglibs.size()>0) {
- setTaglibs(XmlUtil.getTaglibsForJSPDocument(iDocument));
+ setTaglibs(taglibs);
}
try {
connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, iDocument);
@@ -106,7 +115,7 @@
for(int i=0;i<nodes.getLength();i++) {
Node node =nodes.item(i);
- List<TaglibData> result =XmlUtil.processNode(node);
+ List<TaglibData> result =XmlUtil.processNode(node, getIncludeTaglibs());
if(result!=null&&result.size()>0) {
setTaglibs(result);
break;
@@ -114,7 +123,7 @@
}
} else {
- setTaglibs(XmlUtil.processNode(getReferenceNode()));
+ setTaglibs(XmlUtil.processNode(getReferenceNode(), getIncludeTaglibs()));
}
}
@@ -193,4 +202,23 @@
this.connector = connector;
}
+ /**
+ * @return the pageContext
+ */
+ private IVisualContext getPageContext() {
+ return pageContext;
+ }
+
+ /**
+ * @param pageContext the pageContext to set
+ */
+ private void setPageContext(IVisualContext pageContext) {
+ this.pageContext = pageContext;
+ }
+
+ public List<TaglibData> getIncludeTaglibs() {
+
+ return getPageContext().getIncludeTaglibs();
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/XmlUtil.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/XmlUtil.java 2008-04-17 11:20:58 UTC (rev 7570)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/XmlUtil.java 2008-04-17 11:22:42 UTC (rev 7571)
@@ -32,9 +32,9 @@
public class XmlUtil {
- private static final String XMLNS = "xmlns";
+ private static final String XMLNS = "xmlns"; //$NON-NLS-1$
- private static final String XMLNS_WITH_PREFIX = "xmlns:";
+ private static final String XMLNS_WITH_PREFIX = "xmlns:"; //$NON-NLS-1$
public static Element getDocumentElement(String xmlFileName) throws Exception {
FileInputStream inStream = null;
@@ -77,7 +77,7 @@
* @param node
* @return
*/
- public static List<TaglibData> processNode(Node node) {
+ public static List<TaglibData> processNode(Node node, List<TaglibData> includeTaglibData) {
List<TaglibData> taglibs = new ArrayList<TaglibData>();
@@ -99,6 +99,9 @@
} while(currentNode!=null);
+ for (TaglibData taglibData : includeTaglibData) {
+ addTaglib(taglibs, taglibData.getUri(),taglibData.getPrefix(), true, false);
+ }
return taglibs;
}
@@ -106,7 +109,7 @@
* Finds and returns taglibs for JSP documents
* @return
*/
- public static List<TaglibData> getTaglibsForJSPDocument(IDocument document) {
+ public static List<TaglibData> getTaglibsForJSPDocument(IDocument document,List<TaglibData> includeTaglibs) {
List<TaglibData> taglibData = new ArrayList<TaglibData>();
@@ -117,6 +120,11 @@
addTaglib(taglibData, taglibTracker.getURI(), taglibTracker.getPrefix(), true,false);
}
}
+ //add inner taglibs
+ for (TaglibData taglib : includeTaglibs) {
+
+ addTaglib(taglibData, taglib.getUri(), taglib.getPrefix(), true, false);
+ }
return taglibData;
}
/**
@@ -134,7 +142,7 @@
if(XMLNS.equals(name)) {
- name="";
+ name=""; //$NON-NLS-1$
} else {
name=name.substring(XMLNS_WITH_PREFIX.length());
17 years, 8 months
JBoss Tools SVN: r7570 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: template and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-04-17 07:20:58 -0400 (Thu, 17 Apr 2008)
New Revision: 7570
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java
Log:
JBIDE-2065
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-04-17 10:24:21 UTC (rev 7569)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-04-17 11:20:58 UTC (rev 7570)
@@ -10,17 +10,16 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.context;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
@@ -33,7 +32,6 @@
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
@@ -45,7 +43,6 @@
import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.jboss.tools.vpe.editor.css.TaglibReferenceList;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.FileUtil;
@@ -171,7 +168,7 @@
if (sourcePrefix == null || ((ElementImpl)sourceNode).isJSPTag()) {
return true;
}
- List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,this.getSourceBuilder().getStructuredTextViewer().getDocument());
+ List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,this);
TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourcePrefix, taglibs);
@@ -195,8 +192,7 @@
}
List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,
- this.getSourceBuilder()
- .getStructuredTextViewer().getDocument());
+ this);
TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourcePrefix,
taglibs);
@@ -227,7 +223,7 @@
}
}
- public ResourceReference[] getIncludeTaglibs() {
+ public List<TaglibData> getIncludeTaglibs() {
IEditorInput input = getEditPart().getEditorInput();
IFile file = null;
if (input instanceof IFileEditorInput) {
@@ -237,7 +233,12 @@
if (file != null) {
resourceReferences = TaglibReferenceList.getInstance().getAllResources(file);
}
- return resourceReferences;
+ //added by Max Areshkau Fix for JBIDE-2065
+ List<TaglibData> taglibData = new ArrayList<TaglibData>();
+ for (ResourceReference resourceReference : resourceReferences) {
+ taglibData.add(new TaglibData(0,resourceReference.getLocation(), resourceReference.getProperties()));
+ }
+ return taglibData;
}
public ResourceReference[] getIncludeCss() {
@@ -254,13 +255,13 @@
}
public void installIncludeElements() {
- ResourceReference[] list = getIncludeTaglibs();
- for (int i = 0; i < list.length; i++) {
- ResourceReference reference = list[i];
-// setTaglib(i, reference.getLocation(), reference.getProperties(), false);
- }
+// ResourceReference[] list = getIncludeTaglibs();
+// for (int i = 0; i < list.length; i++) {
+// ResourceReference reference = list[i];
+//// setTaglib(i, reference.getLocation(), reference.getProperties(), false);
+// }
- list = getIncludeCss();
+ ResourceReference[] list = getIncludeCss();
for (int i = 0; i < list.length; i++) {
visualBuilder.addLinkNodeToHead(list[i].getLocation(), "yes");
}
@@ -307,7 +308,7 @@
public List<TaglibData> getTagLibs(Node sourceNode) {
- return XmlUtil.getTaglibsForNode(sourceNode, this.getSourceBuilder().getStructuredTextViewer().getDocument());
+ return XmlUtil.getTaglibsForNode(sourceNode, this);
}
public void removeTaglibListener(VpeTaglibListener listener) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-04-17 10:24:21 UTC (rev 7569)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-04-17 11:20:58 UTC (rev 7570)
@@ -29,6 +29,7 @@
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.XmlUtil;
@@ -307,7 +308,8 @@
return sourceNode.getNodeName();
}
- List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext.getSourceBuilder().getStructuredTextViewer().getDocument());
+ List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext);
+
TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourcePrefix, taglibs);
if(sourceNodeTaglib == null) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java 2008-04-17 10:24:21 UTC (rev 7569)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java 2008-04-17 11:20:58 UTC (rev 7570)
@@ -84,7 +84,7 @@
return new VpeValue(false);
}
- List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext.getSourceBuilder().getStructuredTextViewer().getDocument());
+ List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext);
TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourceNode.getPrefix(), taglibs);
//this function works only for jsp files
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java 2008-04-17 10:24:21 UTC (rev 7569)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java 2008-04-17 11:20:58 UTC (rev 7570)
@@ -13,17 +13,18 @@
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -109,9 +110,11 @@
* @param document
* @return collection of taglibs
*/
- public static List<TaglibData> getTaglibsForNode(Node source,IDocument document) {
+ public static List<TaglibData> getTaglibsForNode(Node source,VpePageContext pageContext) {
List<TaglibData> taglibData = new ArrayList<TaglibData>();
+
+ IDocument document = pageContext.getSourceBuilder().getStructuredTextViewer().getDocument();
//TODO Max Areshkau Looks like exist possability to check is it jsp document
//node.getOwnerDocument return null for jsp apply it for CA
TLDCMDocumentManager tldcmDocumentManager= TaglibController.getTLDCMDocumentManager(document);
@@ -126,7 +129,11 @@
taglibData = getTaglibsForNode(source);
}
-
+ //add internal taglibs JBIDE-2065
+ List<TaglibData> includeTaglibs = pageContext.getIncludeTaglibs();
+ for (TaglibData includedTaglib : includeTaglibs) {
+ addTaglib(taglibData, includedTaglib.getUri(), includedTaglib.getPrefix(), true);
+ }
return taglibData;
}
/**
@@ -137,7 +144,7 @@
*/
private static void processAttribute(List<TaglibData> taglibs, Attr attr) {
- String startStr = "xmlns:";
+ String startStr = "xmlns:"; //$NON-NLS-1$
String name = attr.getName();
if (!name.startsWith(startStr)) {
return;
17 years, 8 months
JBoss Tools SVN: r7569 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2008-04-17 06:24:21 -0400 (Thu, 17 Apr 2008)
New Revision: 7569
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
Log:
JBIDE-2076
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-04-17 09:39:04 UTC (rev 7568)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-04-17 10:24:21 UTC (rev 7569)
@@ -29,6 +29,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
@@ -65,14 +66,26 @@
public class DeployAction implements IObjectActionDelegate {
protected ISelection selection;
+ private Shell shell;
+
public DeployAction() {
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ if(targetPart!=null && targetPart.getSite()!=null) {
+ shell = targetPart.getSite().getShell();
+ }
}
public void run(IAction action) {
- IServer server = getServer();
+ IServer[] deployableServersAsIServers = ServerConverter.getDeployableServersAsIServers();
+ if(deployableServersAsIServers.length==0) {
+ MessageDialog.openInformation(shell, "No deployable servers found", "There are no servers that support deploying single files.");
+ }
+ IServer server = getServer(shell,deployableServersAsIServers);
+ if(server==null) { // User pressed cancel.
+ return;
+ }
IStatus errorStatus = null;
String errorTitle, errorMessage;
errorTitle = errorMessage = null;
@@ -121,14 +134,13 @@
}
- protected IServer getServer() {
+ protected IServer getServer(Shell shell, IServer[] servers) {
- IServer[] servers = ServerConverter.getDeployableServersAsIServers();
if( servers.length == 0 ) return null;
if( servers.length == 1 ) return servers[0];
// Throw up a dialog
- SelectServerDialog d = new SelectServerDialog(null);
+ SelectServerDialog d = new SelectServerDialog(shell);
int result = d.open();
if( result == Dialog.OK ) {
return d.getSelectedServer();
17 years, 8 months
JBoss Tools SVN: r7568 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-04-17 05:39:04 -0400 (Thu, 17 Apr 2008)
New Revision: 7568
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2008
use dialog style instead of Wizard style
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java 2008-04-17 09:12:56 UTC (rev 7567)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/SaveQueryEditorListener.java 2008-04-17 09:39:04 UTC (rev 7568)
@@ -134,8 +134,10 @@
return;
}
- final String newQuery = editor.getQueryString();
+ final String newQuery = editor.getQueryString();
+ final String wizard_title = NLS.bind(JdtUIMessages.SaveQueryEditorListener_refactoringTitle, editor_name);
+
Refactoring ref = new Refactoring(){
@Override
@@ -167,10 +169,10 @@
}
};
- RefactoringWizard wizard = new RefactoringWizard(ref, RefactoringWizard.WIZARD_BASED_USER_INTERFACE){
+ RefactoringWizard wizard = new RefactoringWizard(ref, RefactoringWizard.DIALOG_BASED_USER_INTERFACE){
@Override
protected void addUserInputPages() {
- UserInputWizardPage page = new UserInputWizardPage(""){ //$NON-NLS-1$
+ UserInputWizardPage page = new UserInputWizardPage(wizard_title){
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
@@ -187,8 +189,8 @@
}
};
- String wizard_title = NLS.bind(JdtUIMessages.SaveQueryEditorListener_refactoringTitle, editor_name);
wizard.setWindowTitle(wizard_title);
+ wizard.setDefaultPageTitle(wizard_title);
IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
17 years, 8 months
JBoss Tools SVN: r7567 - trunk/vpe/plugins/org.jboss.tools.vpe.html/templates.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-17 05:12:56 -0400 (Thu, 17 Apr 2008)
New Revision: 7567
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
Log:
make "body" tag non case-sensitive
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2008-04-17 09:11:37 UTC (rev 7566)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2008-04-17 09:12:56 UTC (rev 7567)
@@ -289,7 +289,7 @@
</vpe:template>
</vpe:tag>
- <vpe:tag name="body" case-sensitive="yes">
+ <vpe:tag name="body" case-sensitive="no">
<vpe:template children="yes" modify="yes"
class="org.jboss.tools.vpe.html.template.HtmlBodyTemplate">
<vpe:resize>
17 years, 8 months
JBoss Tools SVN: r7566 - in trunk: jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-17 05:11:37 -0400 (Thu, 17 Apr 2008)
New Revision: 7566
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfFacet.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2001
http://jira.jboss.com/jira/browse/JBIDE-2002
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfFacet.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfFacet.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfFacet.java 2008-04-17 09:11:37 UTC (rev 7566)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author sdzmitrovich
+ *
+ */
+public class JsfFacet extends VpeAbstractTemplate {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+
+ VpeCreationData creationData = new VpeCreationData(div);
+
+ NodeList children = sourceNode.getChildNodes();
+
+ /*
+ * <f:facet .../> can contain only one element. so we find first visible
+ * node and add to "div"
+ */
+
+ for (int i = 0; i < children.getLength(); i++) {
+
+ Node child = children.item(i);
+
+ // we add to "div" non-empty text node or tag
+ if (((child.getNodeType() == Node.TEXT_NODE) && !(child
+ .getNodeValue().trim().length() == 0))
+ || child.getNodeType() == (Node.ELEMENT_NODE)) {
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(div);
+
+ childrenInfo.addSourceChild(children.item(i));
+
+ creationData.addChildrenInfo(childrenInfo);
+
+ break;
+ }
+ }
+
+ return creationData;
+ }
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-17 06:23:01 UTC (rev 7565)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-17 09:11:37 UTC (rev 7566)
@@ -546,6 +546,7 @@
title="{tagstring()}" table-size="{@columns}" />
<vpe:resize>
<vpe:width width-attr="width" />
+ <vpe:height height-attr="style.height" />
</vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes" />
@@ -568,7 +569,7 @@
class="{@styleClass}" style="{@style}" title="{tagstring()}" dir="{@dir}"/>
<vpe:resize>
<vpe:width width-attr="width" />
- <vpe:height height-attr="height" />
+ <vpe:height height-attr="style.height" />
</vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes" />
@@ -604,14 +605,8 @@
<vpe:if test="@name='popup'">
<vpe:template children="yes" modify="yes"></vpe:template>
</vpe:if>
- <vpe:if
- test="parentname()='h:dataTable'|parentname()='t:tree'">
- <vpe:template children="yes" modify="yes">
- <vpe:facet />
- </vpe:template>
- </vpe:if>
- <vpe:template children="yes" modify="yes">
- <div />
+
+ <vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.jsf.template.JsfFacet" >
<vpe:dnd>
<vpe:drag start-enable="yes" />
<vpe:drop container="yes" />
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-04-17 06:23:01 UTC (rev 7565)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-04-17 09:11:37 UTC (rev 7566)
@@ -759,6 +759,9 @@
nsIDOMNode visualNode = getTargetVisualNodeBySourceNode(focusNode,
elementMapping);
+ if (visualNode == null)
+ return;
+
setSelectionRange(selectionController
.getSelection(nsISelectionController.SELECTION_NORMAL),
visualNode, new Point(visualFocus, visualAnchor - visualFocus));
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-04-17 06:23:01 UTC (rev 7565)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-04-17 09:11:37 UTC (rev 7566)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.vpe.editor.template;
import java.util.ArrayList;
@@ -50,67 +50,82 @@
private final String ZERO = "0"; //$NON-NLS-1$
private final String ONE = "1"; //$NON-NLS-1$
private final String HUNDRED_PERCENTS = "100%"; //$NON-NLS-1$
-
+
private final String ATTR_CAPTION_STYLE = "captionStyle"; //$NON-NLS-1$
private final String ATTR_CAPTION_CLASS = "captionClass"; //$NON-NLS-1$
+ private final String ATTR_HEADER_CLASS = "headerClass"; //$NON-NLS-1$
+ private final String ATTR_FOOTER_CLASS = "footerClass"; //$NON-NLS-1$
private final String ATTR_STYLE = "style"; //$NON-NLS-1$
private final String ATTR_CLASS = "class"; //$NON-NLS-1$
private final String ATTR_WIDTH = "width"; //$NON-NLS-1$
private final String ATTR_BORDER = "border"; //$NON-NLS-1$
private final String ATTR_RULES = "rules"; //$NON-NLS-1$
private final String ATTR_RULES_VALUE_ROWS = "rows"; //$NON-NLS-1$
- private final String TD_HIDDEN_BORDER_STYLE = "padding: 0px; border: 0px hidden;"; //$NON-NLS-1$
- private final String TD_RULES_ROWS_BORDER_STYLE = "padding: 0px;"; //$NON-NLS-1$
- private final String RULES_HIDDEN_BORDER_STYLE = "border: 0px hidden;"; //$NON-NLS-1$
+ private final String TD_HIDDEN_BORDER_STYLE = "padding: 0px; border: 0px hidden;"; //$NON-NLS-1$
+ private final String TD_RULES_ROWS_BORDER_STYLE = "padding: 0px;"; //$NON-NLS-1$
+ private final String RULES_HIDDEN_BORDER_STYLE = "border: 0px hidden;"; //$NON-NLS-1$
private List propertyCreators;
- VpeDataTableCreator(Element gridElement, VpeDependencyMap dependencyMap, boolean caseSensitive) {
+ VpeDataTableCreator(Element gridElement, VpeDependencyMap dependencyMap,
+ boolean caseSensitive) {
this.caseSensitive = caseSensitive;
build(gridElement, dependencyMap);
}
private void build(Element element, VpeDependencyMap dependencyMap) {
- Attr headerClassAttr = element.getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS);
+ Attr headerClassAttr = element
+ .getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS);
if (headerClassAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder.buildCompletedExpression(headerClassAttr.getValue(), caseSensitive);
+ VpeExpressionInfo info = VpeExpressionBuilder
+ .buildCompletedExpression(headerClassAttr.getValue(),
+ caseSensitive);
headerClassExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
- } catch(VpeExpressionBuilderException e) {
+ } catch (VpeExpressionBuilderException e) {
VpePlugin.reportProblem(e);
}
}
- Attr footerClassAttr = element.getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS);
+ Attr footerClassAttr = element
+ .getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS);
if (footerClassAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder.buildCompletedExpression(footerClassAttr.getValue(), caseSensitive);
+ VpeExpressionInfo info = VpeExpressionBuilder
+ .buildCompletedExpression(footerClassAttr.getValue(),
+ caseSensitive);
footerClassExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
- } catch(VpeExpressionBuilderException e) {
+ } catch (VpeExpressionBuilderException e) {
VpePlugin.reportProblem(e);
}
}
- Attr rowClassesAttr = element.getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES);
+ Attr rowClassesAttr = element
+ .getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES);
if (rowClassesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder.buildCompletedExpression(rowClassesAttr.getValue(), caseSensitive);
+ VpeExpressionInfo info = VpeExpressionBuilder
+ .buildCompletedExpression(rowClassesAttr.getValue(),
+ caseSensitive);
rowClassesExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
- } catch(VpeExpressionBuilderException e) {
+ } catch (VpeExpressionBuilderException e) {
VpePlugin.reportProblem(e);
}
}
- Attr columnClassesAttr = element.getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES);
+ Attr columnClassesAttr = element
+ .getAttributeNode(VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES);
if (columnClassesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder.buildCompletedExpression(columnClassesAttr.getValue(), caseSensitive);
+ VpeExpressionInfo info = VpeExpressionBuilder
+ .buildCompletedExpression(columnClassesAttr.getValue(),
+ caseSensitive);
columnClassesExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
- } catch(VpeExpressionBuilderException e) {
+ } catch (VpeExpressionBuilderException e) {
VpePlugin.reportProblem(e);
}
}
@@ -120,53 +135,61 @@
String attrName = VpeTemplateManager.ATTR_DATATABLE_PROPERTIES[i];
Attr attr = element.getAttributeNode(attrName);
if (attr != null) {
- if (propertyCreators == null) propertyCreators = new ArrayList();
- propertyCreators.add(new VpeAttributeCreator(attrName, attr.getValue(), dependencyMap, caseSensitive));
+ if (propertyCreators == null)
+ propertyCreators = new ArrayList();
+ propertyCreators.add(new VpeAttributeCreator(attrName, attr
+ .getValue(), dependencyMap, caseSensitive));
}
}
}
-
+
}
- public VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument, nsIDOMElement visualElement, Map visualNodeMap) {
+ public VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument, nsIDOMElement visualElement,
+ Map visualNodeMap) {
- SourceDataTableElements sourceElements = new SourceDataTableElements(sourceNode);
+ SourceDataTableElements sourceElements = new SourceDataTableElements(
+ sourceNode);
VisualDataTableElements visualElements = new VisualDataTableElements();
+
+ Element element = (Element) sourceNode;
/*
- * Fixes http://jira.jboss.com/jira/browse/JBIDE-2001
- * Selection borders are fixed.
+ * Fixes http://jira.jboss.com/jira/browse/JBIDE-2001 Selection borders
+ * are fixed.
*/
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
- nsIDOMElement selectionTable = visualDocument.createElement(HTML.TAG_TABLE);
+ nsIDOMElement selectionTable = visualDocument
+ .createElement(HTML.TAG_TABLE);
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
-
+
td.appendChild(div);
tr.appendChild(td);
selectionTable.appendChild(tr);
-
+
VpeCreatorInfo creatorInfo = new VpeCreatorInfo(selectionTable);
/*
- * Table with caption, header, footer,
- * that wraps table with content
+ * Table with caption, header, footer, that wraps table with content
*/
- nsIDOMElement outterTable = visualDocument.createElement(HTML.TAG_TABLE);
-
+ nsIDOMElement outterTable = visualDocument
+ .createElement(HTML.TAG_TABLE);
+
/*
* Table with main content
*/
- nsIDOMElement visualTable = visualDocument.createElement(HTML.TAG_TABLE);
- nsIDOMElement section = null;
+ nsIDOMElement visualTable = visualDocument
+ .createElement(HTML.TAG_TABLE);
+ nsIDOMElement section = null;
nsIDOMElement row = null;
nsIDOMElement caption = null;
-
+
/*
- * Fixes http://jira.jboss.com/jira/browse/JBIDE-1944
- * author: Denis Maliarevich
- * Any text which is placed outside of the tags
- * will be displayed above the table.
+ * Fixes http://jira.jboss.com/jira/browse/JBIDE-1944 author: Denis
+ * Maliarevich Any text which is placed outside of the tags will be
+ * displayed above the table.
*/
String redundantText = REDUNDANT_TEXT_SEPARATOR;
for (int i = 0; i < sourceElements.getRedundantTextNodesCount(); i++) {
@@ -184,12 +207,13 @@
info.addSourceChild(sourceElements.getTableCaption());
creatorInfo.addChildrenInfo(info);
}
-
+
/*
- * Everything concerning table caption
- * lies here (was removed from VpeFacetCreator)
+ * Everything concerning table caption lies here (was removed from
+ * VpeFacetCreator)
*/
- Node attr = sourceNode.getAttributes().getNamedItem(ATTR_CAPTION_STYLE);
+ Node attr = sourceNode.getAttributes().getNamedItem(
+ ATTR_CAPTION_STYLE);
if (attr != null) {
caption.setAttribute(ATTR_STYLE, attr.getNodeValue());
}
@@ -206,8 +230,14 @@
row = visualDocument.createElement(HTML.TAG_TR);
section.appendChild(row);
visualElements.setTableHeaderRow(row);
+
+ nsIDOMElement thHeader = visualDocument.createElement(HTML.TAG_TH);
+ thHeader.setAttribute(HTML.ATTR_CLASS, element
+ .getAttribute(ATTR_HEADER_CLASS));
+ row.appendChild(thHeader);
if (sourceElements.getTableHeader() != null) {
- VpeChildrenInfo info = new VpeChildrenInfo(row);
+
+ VpeChildrenInfo info = new VpeChildrenInfo(thHeader);
info.addSourceChild(sourceElements.getTableHeader());
creatorInfo.addChildrenInfo(info);
}
@@ -219,9 +249,13 @@
section = visualDocument.createElement(HTML.TAG_TFOOT);
row = visualDocument.createElement(HTML.TAG_TR);
section.appendChild(row);
+ nsIDOMElement tdFooter = visualDocument.createElement(HTML.TAG_TD);
+ tdFooter.setAttribute(HTML.ATTR_CLASS, element
+ .getAttribute(ATTR_FOOTER_CLASS));
+ row.appendChild(tdFooter);
visualElements.setTableFooterRow(row);
if (sourceElements.getTableFooter() != null) {
- VpeChildrenInfo info = new VpeChildrenInfo(row);
+ VpeChildrenInfo info = new VpeChildrenInfo(tdFooter);
info.addSourceChild(sourceElements.getTableFooter());
creatorInfo.addChildrenInfo(info);
}
@@ -253,40 +287,41 @@
section.appendChild(row);
visualTable.appendChild(section);
visualElements.setContentTableBodyRow(row);
- //visualElements.setBody(section);
+ // visualElements.setBody(section);
}
VpeChildrenInfo info = null;
if (sourceElements.getColumnCount() > 0) {
- nsIDOMElement group = visualDocument.createElement(HTML.TAG_COLGROUP);
+ nsIDOMElement group = visualDocument
+ .createElement(HTML.TAG_COLGROUP);
visualTable.appendChild(group);
info = new VpeChildrenInfo(group);
creatorInfo.addChildrenInfo(info);
}
-
+
for (int i = 0; i < sourceElements.getColumnCount(); i++) {
SourceColumnElements column = sourceElements.getColumn(i);
info.addSourceChild(column.getColumn());
}
- nsIDOMElement outterTBODY = visualDocument.createElement(HTML.TAG_TBODY);
+ nsIDOMElement outterTBODY = visualDocument
+ .createElement(HTML.TAG_TBODY);
nsIDOMElement outterTR = visualDocument.createElement(HTML.TAG_TR);
nsIDOMElement outterTD = visualDocument.createElement(HTML.TAG_TD);
/*
- * To create appropriate visual appearance
- * borders of the body cell and content table
- * were set via styles.
+ * To create appropriate visual appearance borders of the body cell and
+ * content table were set via styles.
*/
outterTD.setAttribute(ATTR_STYLE, TD_HIDDEN_BORDER_STYLE);
visualTable.setAttribute(ATTR_WIDTH, HUNDRED_PERCENTS);
visualTable.setAttribute(ATTR_BORDER, ZERO);
-
+
outterTD.appendChild(visualTable);
outterTR.appendChild(outterTD);
outterTBODY.appendChild(outterTR);
outterTable.appendChild(outterTBODY);
-
+
visualElements.setBodyRow(outterTR);
visualElements.setBody(outterTBODY);
@@ -296,61 +331,69 @@
visualNodeMap.put(this, elements);
for (int i = 0; i < propertyCreators.size(); i++) {
- VpeCreator creator = (VpeCreator)propertyCreators.get(i);
+ VpeCreator creator = (VpeCreator) propertyCreators.get(i);
if (creator != null) {
-
+
/*
- * Sets attributes for the wrapper table
+ * Sets attributes for the wrapper table
*/
- VpeCreatorInfo info1 = creator.create(pageContext, (Element) sourceNode, visualDocument, outterTable, visualNodeMap);
+ VpeCreatorInfo info1 = creator.create(pageContext,
+ (Element) sourceNode, visualDocument, outterTable,
+ visualNodeMap);
if (info1 != null && info1.getVisualNode() != null) {
nsIDOMAttr attr = (nsIDOMAttr) info1.getVisualNode();
-
+
/*
- * Fixes creation 'border="1"'
- * when setting border attribute to the table.
- * Also skips empty attributes to fix layout problems.
+ * Fixes creation 'border="1"' when setting border attribute
+ * to the table. Also skips empty attributes to fix layout
+ * problems.
*/
- if (null == attr.getNodeValue() || EMPTY.equalsIgnoreCase(attr.getNodeValue())) {
+ if (null == attr.getNodeValue()
+ || EMPTY.equalsIgnoreCase(attr.getNodeValue())) {
continue;
}
outterTable.setAttributeNode(attr);
}
-
+
/*
- * Sets attributes for the content table
+ * Sets attributes for the content table
*/
- VpeCreatorInfo info2 = creator.create(pageContext, (Element) sourceNode, visualDocument, visualTable, visualNodeMap);
+ VpeCreatorInfo info2 = creator.create(pageContext,
+ (Element) sourceNode, visualDocument, visualTable,
+ visualNodeMap);
if (info2 != null && info2.getVisualNode() != null) {
nsIDOMAttr attr = (nsIDOMAttr) info2.getVisualNode();
-
+
/*
- * Fixes creation 'border="1"'
- * when setting border attribute to the table.
- * Also skips empty attributes to fix layout problems.
+ * Fixes creation 'border="1"' when setting border attribute
+ * to the table. Also skips empty attributes to fix layout
+ * problems.
*/
- if (null == attr.getNodeValue() || EMPTY.equalsIgnoreCase(attr.getNodeValue())) {
+ if (null == attr.getNodeValue()
+ || EMPTY.equalsIgnoreCase(attr.getNodeValue())) {
continue;
}
/*
- * Sets attributes for the content table
- */
- if (VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES.equalsIgnoreCase(attr.getNodeName())) {
- setRowClass(visualElements.getContentTableBodyRow(), attr.getNodeValue());
+ * Sets attributes for the content table
+ */
+ if (VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES
+ .equalsIgnoreCase(attr.getNodeName())) {
+ setRowClass(visualElements.getContentTableBodyRow(),
+ attr.getNodeValue());
continue;
}
-
+
/*
- * Skip setting content table border
+ * Skip setting content table border
*/
if (ATTR_BORDER.equalsIgnoreCase(attr.getNodeName())) {
-
+
/*
- * If attribute border is set then table cells have borders.
- * Because two table are used border should appear
- * around content table cells but not the table itself.
- * By default content table has no border.
+ * If attribute border is set then table cells have
+ * borders. Because two table are used border should
+ * appear around content table cells but not the table
+ * itself. By default content table has no border.
*/
String value = attr.getNodeValue();
int val = -1;
@@ -363,19 +406,22 @@
}
if (val > 0) {
visualTable.setAttribute(ATTR_BORDER, ONE);
- visualTable.setAttribute(ATTR_STYLE, RULES_HIDDEN_BORDER_STYLE);
+ visualTable.setAttribute(ATTR_STYLE,
+ RULES_HIDDEN_BORDER_STYLE);
}
-
+
continue;
}
-
+
/*
- * Fixes creation of a border around content table
- * when attribute rules="rows" is set
+ * Fixes creation of a border around content table when
+ * attribute rules="rows" is set
*/
if (ATTR_RULES.equalsIgnoreCase(attr.getNodeName())) {
- if (ATTR_RULES_VALUE_ROWS.equalsIgnoreCase(attr.getNodeValue())) {
- outterTD.setAttribute(ATTR_STYLE, TD_RULES_ROWS_BORDER_STYLE);
+ if (ATTR_RULES_VALUE_ROWS.equalsIgnoreCase(attr
+ .getNodeValue())) {
+ outterTD.setAttribute(ATTR_STYLE,
+ TD_RULES_ROWS_BORDER_STYLE);
}
}
visualTable.setAttributeNode(attr);
@@ -384,25 +430,40 @@
}
return creatorInfo;
}
-
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Map visualNodeMap, String name, String value) {
+
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Map visualNodeMap, String name, String value) {
VisualDataTableElements visualElements = getVisualDataTableElements(visualNodeMap);
if (visualElements != null) {
- if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS.equals(name) : VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS.equalsIgnoreCase(name)) {
+ if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS
+ .equalsIgnoreCase(name)) {
setCellsClass(visualElements.getTableHeaderRow(), value);
setCellsClass(visualElements.getColumnsHeaderRow(), value);
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS.equals(name) : VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS
+ .equalsIgnoreCase(name)) {
setCellsClass(visualElements.getColumnsFooterRow(), value);
setCellsClass(visualElements.getTableFooterRow(), value);
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES.equals(name) : VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES
+ .equalsIgnoreCase(name)) {
setRowClass(visualElements.getContentTableBodyRow(), value);
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES.equals(name) : VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES
+ .equalsIgnoreCase(name)) {
setCellsClass(visualElements.getContentTableBodyRow(), value);
}
}
}
- public void validate(VpePageContext pageContext, Element sourceElement, Document visualDocument, Element visualParent, Element visualElement, Map visualNodeMap) {
+ public void validate(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Element visualParent,
+ Element visualElement, Map visualNodeMap) {
VisualDataTableElements visualElements = null;
SourceDataTableElements sourceElements = null;
if (visualNodeMap != null) {
@@ -412,39 +473,76 @@
sourceElements = new SourceDataTableElements(sourceElement);
nsIDOMNode visualNode = pageContext.getCurrentVisualNode();
if (visualNode != null) {
- visualElements = VpeDataTableElements.getVisualDataTableElements(visualNode);
+ visualElements = VpeDataTableElements
+ .getVisualDataTableElements(visualNode);
}
}
if (visualElements != null) {
- setCellsClass(visualElements.getTableHeaderRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS));
- setCellsClass(visualElements.getColumnsHeaderRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS));
- setCellsClass(visualElements.getColumnsFooterRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS));
- setCellsClass(visualElements.getTableFooterRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS));
+ setCellsClass(
+ visualElements.getTableHeaderRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS));
+ setCellsClass(
+ visualElements.getColumnsHeaderRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS));
+ setCellsClass(
+ visualElements.getColumnsFooterRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS));
+ setCellsClass(
+ visualElements.getTableFooterRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS));
- setRowClass(visualElements.getBodyRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES));
- setCellsClass(visualElements.getBodyRow(), sourceElement.getAttribute(VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES));
+ setRowClass(
+ visualElements.getBodyRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES));
+ setCellsClass(
+ visualElements.getBodyRow(),
+ sourceElement
+ .getAttribute(VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES));
}
if (sourceElements != null && visualElements != null) {
- setRowDisplayStyle(visualElements.getTableHeaderRow(), sourceElements.hasTableHeader());
- setRowDisplayStyle(visualElements.getColumnsHeaderRow(), sourceElements.hasColumnsHeader());
- setRowDisplayStyle(visualElements.getBodyRow(), sourceElements.hasBodySection());
- setRowDisplayStyle(visualElements.getColumnsFooterRow(), sourceElements.hasColumnsFooter());
- setRowDisplayStyle(visualElements.getTableFooterRow(), sourceElements.hasTableFooter());
+ setRowDisplayStyle(visualElements.getTableHeaderRow(),
+ sourceElements.hasTableHeader());
+ setRowDisplayStyle(visualElements.getColumnsHeaderRow(),
+ sourceElements.hasColumnsHeader());
+ setRowDisplayStyle(visualElements.getBodyRow(), sourceElements
+ .hasBodySection());
+ setRowDisplayStyle(visualElements.getColumnsFooterRow(),
+ sourceElements.hasColumnsFooter());
+ setRowDisplayStyle(visualElements.getTableFooterRow(),
+ sourceElements.hasTableFooter());
}
}
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, Map visualNodeMap, String name) {
+ public void removeAttribute(VpePageContext pageContext,
+ Element sourceElement, Map visualNodeMap, String name) {
VisualDataTableElements visualElements = getVisualDataTableElements(visualNodeMap);
if (visualElements != null) {
- if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS.equals(name) : VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS.equalsIgnoreCase(name)) {
+ if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_HEADER_CLASS
+ .equalsIgnoreCase(name)) {
removeCellsClass(visualElements.getTableHeaderRow());
removeCellsClass(visualElements.getColumnsHeaderRow());
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS.equals(name) : VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_FOOTER_CLASS
+ .equalsIgnoreCase(name)) {
removeCellsClass(visualElements.getColumnsFooterRow());
removeCellsClass(visualElements.getTableFooterRow());
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES.equals(name) : VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_ROW_CLASSES
+ .equalsIgnoreCase(name)) {
removeRowClass(visualElements.getBodyRow());
- } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES.equals(name) : VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES.equalsIgnoreCase(name)) {
+ } else if (caseSensitive ? VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES
+ .equals(name)
+ : VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES
+ .equalsIgnoreCase(name)) {
removeCellsClass(visualElements.getBodyRow());
}
}
@@ -466,14 +564,15 @@
long count = children != null ? children.getLength() : 0;
for (long i = 0; i < count; i++) {
nsIDOMNode child = children.item(i);
- if (child != null && child.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
+ if (child != null
+ && child.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
try {
nsIDOMHTMLTableCellElement cell = (nsIDOMHTMLTableCellElement) child
- .queryInterface(nsIDOMHTMLTableCellElement.NS_IDOMHTMLTABLECELLELEMENT_IID);
+ .queryInterface(nsIDOMHTMLTableCellElement.NS_IDOMHTMLTABLECELLELEMENT_IID);
cell.setAttribute(ATTR_CLASS, classes[ind]);
ind = ind < (classes.length - 1) ? ind + 1 : 0;
} catch (XPCOMException ex) {
- // just ignore this exception
+ // just ignore this exception
}
}
}
@@ -486,13 +585,14 @@
long count = children != null ? children.getLength() : 0;
for (long i = 0; i < count; i++) {
nsIDOMNode child = children.item(i);
- if (child != null && child.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
+ if (child != null
+ && child.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
try {
nsIDOMHTMLTableCellElement cell = (nsIDOMHTMLTableCellElement) child
- .queryInterface(nsIDOMHTMLTableCellElement.NS_IDOMHTMLTABLECELLELEMENT_IID);
+ .queryInterface(nsIDOMHTMLTableCellElement.NS_IDOMHTMLTABLECELLELEMENT_IID);
cell.removeAttribute(ATTR_CLASS);
} catch (XPCOMException ex) {
- // just ignore this exception
+ // just ignore this exception
}
}
}
@@ -502,7 +602,8 @@
private void setRowClass(nsIDOMElement row, String value) {
if (row != null && value != null) {
String[] rowClasses = getClasses(value);
- String rowClass = (rowClasses != null && rowClasses.length > 0) ? rowClasses[0] : null;
+ String rowClass = (rowClasses != null && rowClasses.length > 0) ? rowClasses[0]
+ : null;
if (rowClass.trim().length() > 0) {
row.setAttribute(ATTR_CLASS, rowClass);
} else {
@@ -513,7 +614,8 @@
private void setRowDisplayStyle(nsIDOMElement row, boolean visible) {
if (row != null) {
- row.setAttribute(ATTR_STYLE, DISPLAY_STYLE_NAME + (visible ? EMPTY : NONE));
+ row.setAttribute(ATTR_STYLE, DISPLAY_STYLE_NAME
+ + (visible ? EMPTY : NONE));
}
}
@@ -527,8 +629,9 @@
if (visualNodeMap != null) {
Object o = visualNodeMap.get(this);
try {
- if (o != null && o instanceof Object[] && ((Object[])o)[0] instanceof VisualDataTableElements) {
- return (VisualDataTableElements)((Object[])o)[0];
+ if (o != null && o instanceof Object[]
+ && ((Object[]) o)[0] instanceof VisualDataTableElements) {
+ return (VisualDataTableElements) ((Object[]) o)[0];
}
} catch (Exception e) {
}
@@ -540,8 +643,9 @@
if (visualNodeMap != null) {
Object o = visualNodeMap.get(this);
try {
- if (o != null && o instanceof Object[] && ((Object[])o)[1] instanceof SourceDataTableElements) {
- return (SourceDataTableElements)((Object[])o)[1];
+ if (o != null && o instanceof Object[]
+ && ((Object[]) o)[1] instanceof SourceDataTableElements) {
+ return (SourceDataTableElements) ((Object[]) o)[1];
}
} catch (Exception e) {
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2008-04-17 06:23:01 UTC (rev 7565)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2008-04-17 09:11:37 UTC (rev 7566)
@@ -34,7 +34,7 @@
public class VpePanelGridCreator extends VpeAbstractCreator {
- private final String REDUNDANT_TEXT_SEPARATOR = "\n\n";
+ private final String REDUNDANT_TEXT_SEPARATOR = "\n\n"; //$NON-NLS-1$
private boolean caseSensitive;
private VpeExpression tableSizeExpr;
@@ -301,9 +301,7 @@
nsIDOMElement visualHead = null;
nsIDOMElement visualFoot = null;
nsIDOMElement visualCaption = null;
- nsIDOMElement visualBody = visualDocument
- .createElement(HTML.TAG_TBODY);
- visualTable.appendChild(visualBody);
+
if (caption != null) {
visualCaption = visualDocument
.createElement(HTML.TAG_CAPTION);
@@ -317,7 +315,7 @@
String captionClass = captionClassExpr.exec(
pageContext, caption.getParentNode())
.stringValue();
- visualCaption.setAttribute("class", captionClass);
+ visualCaption.setAttribute(HTML.ATTR_CLASS, captionClass);
}
if (captionStyleExpr != null
@@ -325,7 +323,7 @@
String captionStyle = captionStyleExpr.exec(
pageContext, caption.getParentNode())
.stringValue();
- visualCaption.setAttribute("style", captionStyle);
+ visualCaption.setAttribute(HTML.ATTR_STYLE, captionStyle);
}
}
if (header != null) {
@@ -337,6 +335,10 @@
visualTable.appendChild(visualFoot);
}
+ nsIDOMElement visualBody = visualDocument
+ .createElement(HTML.TAG_TBODY);
+ visualTable.appendChild(visualBody);
+
List rowClasses = getClasses(rowClassesExpr, sourceNode,
pageContext);
List columnClasses = getClasses(columnClassesExpr, sourceNode,
@@ -346,7 +348,7 @@
nsIDOMElement visualRow = visualDocument
.createElement(HTML.TAG_TR);
if (rowClasses.size() > 0) {
- visualRow.setAttribute("class", rowClasses.get(rci)
+ visualRow.setAttribute(HTML.ATTR_CLASS, rowClasses.get(rci)
.toString());
rci++;
if (rci >= rowClasses.size())
@@ -356,7 +358,7 @@
nsIDOMElement visualCell = visualDocument
.createElement(HTML.TAG_TD);
if (columnClasses.size() > 0) {
- visualCell.setAttribute("class", columnClasses.get(
+ visualCell.setAttribute(HTML.ATTR_CLASS, columnClasses.get(
cci).toString());
cci++;
if (cci >= columnClasses.size())
@@ -381,9 +383,9 @@
}
}
makeSpecial(header, visualHead, visualDocument, tableSize,
- creatorInfo, "th", headerClassExpr, pageContext);
+ creatorInfo, HTML.TAG_TH, headerClassExpr, pageContext);
makeSpecial(footer, visualFoot, visualDocument, tableSize,
- creatorInfo, "td", footerClassExpr, pageContext);
+ creatorInfo, HTML.TAG_TD, footerClassExpr, pageContext);
for (int i = 0; i < propertyCreators.size(); i++) {
VpeCreator creator = (VpeCreator) propertyCreators.get(i);
@@ -429,11 +431,11 @@
nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
visualHead.appendChild(visualRow);
nsIDOMElement visualCell = visualDocument.createElement(cellTag);
- visualCell.setAttribute("colspan", "" + tableSize);
+ visualCell.setAttribute(HTML.ATTR_COLSPAN, "" + tableSize);
if (headerClassExpr != null && header.getParentNode() != null) {
String headerClass = headerClassExpr.exec(pageContext,
header.getParentNode()).stringValue();
- visualCell.setAttribute("class", headerClass);
+ visualCell.setAttribute(HTML.ATTR_CLASS, headerClass);
}
visualRow.appendChild(visualCell);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCell);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-17 06:23:01 UTC (rev 7565)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TemplateManagingUtil.java 2008-04-17 09:11:37 UTC (rev 7566)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.util;
+import java.util.List;
+
import org.eclipse.swt.graphics.Point;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
@@ -23,6 +25,7 @@
import org.mozilla.interfaces.nsIDOMNSHTMLInputElement;
import org.mozilla.interfaces.nsIDOMNSHTMLTextAreaElement;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMRange;
import org.mozilla.interfaces.nsISelection;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -269,15 +272,21 @@
*/
public static nsIDOMNode getSelectedNode(nsISelection selection) {
- if (selection.getFocusNode() != null) {
- if ((selection.getFocusNode().getNodeType() != nsIDOMNode.TEXT_NODE)
- && (selection.getFocusOffset() != 0)) {
+ if (selection.getIsCollapsed()) {
+ if (selection.getFocusNode() != null) {
+ if ((selection.getFocusNode().getNodeType() != nsIDOMNode.TEXT_NODE)
+ && (selection.getFocusOffset() != 0)) {
- return selection.getFocusNode().getChildNodes().item(
- selection.getFocusOffset() - 1);
- } else
- return selection.getFocusNode();
+ return selection.getFocusNode().getChildNodes().item(
+ selection.getFocusOffset() - 1);
+ } else
+ return selection.getFocusNode();
+ }
+ } else {
+ nsIDOMRange range = selection.getRangeAt(0);
+ nsIDOMNode visualAncestor = range.getCommonAncestorContainer();
+ return visualAncestor;
}
return null;
}
17 years, 8 months
JBoss Tools SVN: r7565 - in trunk: ws and 18 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-04-17 02:23:01 -0400 (Thu, 17 Apr 2008)
New Revision: 7565
Added:
trunk/ws/
trunk/ws/docs/
trunk/ws/features/
trunk/ws/plugins/
trunk/ws/plugins/org.jboss.tools.ws.ui/
trunk/ws/plugins/org.jboss.tools.ws.ui/.classpath
trunk/ws/plugins/org.jboss.tools.ws.ui/.project
trunk/ws/plugins/org.jboss.tools.ws.ui/.settings/
trunk/ws/plugins/org.jboss.tools.ws.ui/.settings/org.eclipse.jdt.core.prefs
trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/
trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/Activator.class
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUIMessages.class
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/UIUtils.class
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$1.class
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$2.class
trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.class
trunk/ws/plugins/org.jboss.tools.ws.ui/build.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.ui/src/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/Activator.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/UIUtils.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java
trunk/ws/tests/
Log:
./qq.log
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/.classpath
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/.classpath (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/.classpath 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/.project
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/.project (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/.project 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.ws.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/.settings/org.eclipse.jdt.core.prefs 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,7 @@
+#Thu Apr 17 13:45:00 CST 2008
+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/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %PLUGIN_NAME
+Bundle-SymbolicName: org.jboss.tools.ws.ui;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.ws.ui.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources
+Eclipse-LazyStart: true
+Export-Package: org.jboss.tools.ws.ui,
+ org.jboss.tools.ws.ui.preferences
+Bundle-Vendor: %PLUGIN_PROVIDER
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/Activator.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/Activator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUI.properties (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUI.properties 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,38 @@
+LABEL_BROUSE=Browse...
+LABEL_WEB_SERVICE_CODEGEN=Web service code generation options
+LABEL_WEB_SERVICE_CLIENT_CODEGEN=Web service client code generation options
+LABEL_WEB_SERVICE_AAR=Web service archive options
+LABEL_DATABINDING=Default Databinding:
+LABEL_AAR_EXTENTION=AAR default extension:
+LABEL_JBOSSWS_RUNTIME_LOAD=JBossWS runtime loaded successfully
+LABEL_JBOSSWS_RUNTIME_LOAD_ERROR=Error occurred while loading JBossWS runtime. Select the correct JBossWS runtime folder.
+LABEL_GENERATE_TESTCASE_CAPTION=Generate a JUnit test case to test the service
+LABEL_GENERATE_SERVERSIDE_INTERFACE=Generate an interface for the skeleton
+LABEL_GENERATE_ALL=Generate all types for all elements referred to by schemas
+LABEL_CLIENT_SIDE=Client mode
+LABEL_SYNC_AND_ASYNC=Generate a client which supports both synchronous and asynchronous invocation
+LABEL_SYNC=Generate a synchronous client
+LABEL_ASYNC=Generate an asynchronous client
+
+JBOSSWS_LOCATION=JBossWS Runtime
+JBOSSWS_RUNTIME=JBossWS Runtime
+JBOSSWS_PREFERENCES=JBossWS Preferences
+JBOSSWS_RUNTIME_TOOLTIP=Select the JBossWS binary distribution folder or the folder which contains the JBossWS war distribution
+JBOSSWS_PREFERENCES_TOOLTIP=Select the default preferences for JBossWS runtime
+JBOSSWS_RUNTIME_LOCATION=JBossWS runtime location:
+JBOSSWS_RUNTIME_PREFERENCES=JBossWS Runtime Preferences
+LABEL_JBOSSWS_RUNTIME_NOT_EXIT=Select the location of the JBossWS binary distribution or the folder which contains the JBossWS war distribution.
+ERROR_INVALID_JBOSSWS_SERVER_LOCATION=Invalid JBossWS runtime location
+
+ERROR_INVALID_FILE_READ_WRITEL=Exception occurred while reading or writing file {0}
+ERROR_SERVER_IS_NOT_SET=The JBossWS facets cannot be installed since the JBossWS runtime location has not been set. \nGo to the Web Services preference page and set the JBossWS runtime location under JBossWS Preferences.
+
+PROGRESS_INSTALL_JBOSSWS_RUNTIME=Installing JBossWS Runtime
+PROGRESS_UNINSTALL_JBOSSWS_RUNTIME=Uninstalling the JBossWS Runtime
+
+DIR_DOT_METADATA=.metadata
+DIR_DOT_PLUGINS=.plugins
+TEMP_JBOSSWS_FACET_DIR=org.jboss.tools.ws.facet
+WEBAPP_EXPLODED_SERVER_LOCATION_FILE=server.properties
+SERVER_STATUS_LOCATION_FILE=status.properties
+WAR_STATUS_LOCATION_FILE=war.properties
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUIMessages.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/JbossWSUIMessages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/UIUtils.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/UIUtils.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$1.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$2.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.class
===================================================================
(Binary files differ)
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/bin/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/build.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/build.properties (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/build.properties 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,3 @@
+JBOSSWS_PREFERENCE_PAGE=JbossWS Preferences
+PLUGIN_NAME=JbossWS UI
+PLUGIN_PROVIDER=Red Hat, Inc.
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,10 @@
+<plugin>
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ name="%JBOSSWS_PREFERENCE_PAGE"
+ category="org.eclipse.wst.ws.internal.ui.preferences.name"
+ class="org.jboss.tools.ws.ui.preferences.JbossWSRuntimePreferencePage"
+ id="org.jboss.tools.ws.ui.preferences.JbossWSRuntimePreferencePage">
+ </page>
+ </extension>
+</plugin>
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/Activator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/Activator.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/Activator.java 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,50 @@
+package org.jboss.tools.ws.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.ui";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUI.properties (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUI.properties 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,38 @@
+LABEL_BROUSE=Browse...
+LABEL_WEB_SERVICE_CODEGEN=Web service code generation options
+LABEL_WEB_SERVICE_CLIENT_CODEGEN=Web service client code generation options
+LABEL_WEB_SERVICE_AAR=Web service archive options
+LABEL_DATABINDING=Default Databinding:
+LABEL_AAR_EXTENTION=AAR default extension:
+LABEL_JBOSSWS_RUNTIME_LOAD=JBossWS runtime loaded successfully
+LABEL_JBOSSWS_RUNTIME_LOAD_ERROR=Error occurred while loading JBossWS runtime. Select the correct JBossWS runtime folder.
+LABEL_GENERATE_TESTCASE_CAPTION=Generate a JUnit test case to test the service
+LABEL_GENERATE_SERVERSIDE_INTERFACE=Generate an interface for the skeleton
+LABEL_GENERATE_ALL=Generate all types for all elements referred to by schemas
+LABEL_CLIENT_SIDE=Client mode
+LABEL_SYNC_AND_ASYNC=Generate a client which supports both synchronous and asynchronous invocation
+LABEL_SYNC=Generate a synchronous client
+LABEL_ASYNC=Generate an asynchronous client
+
+JBOSSWS_LOCATION=JBossWS Runtime
+JBOSSWS_RUNTIME=JBossWS Runtime
+JBOSSWS_PREFERENCES=JBossWS Preferences
+JBOSSWS_RUNTIME_TOOLTIP=Select the JBossWS binary distribution folder or the folder which contains the JBossWS war distribution
+JBOSSWS_PREFERENCES_TOOLTIP=Select the default preferences for JBossWS runtime
+JBOSSWS_RUNTIME_LOCATION=JBossWS runtime location:
+JBOSSWS_RUNTIME_PREFERENCES=JBossWS Runtime Preferences
+LABEL_JBOSSWS_RUNTIME_NOT_EXIT=Select the location of the JBossWS binary distribution or the folder which contains the JBossWS war distribution.
+ERROR_INVALID_JBOSSWS_SERVER_LOCATION=Invalid JBossWS runtime location
+
+ERROR_INVALID_FILE_READ_WRITEL=Exception occurred while reading or writing file {0}
+ERROR_SERVER_IS_NOT_SET=The JBossWS facets cannot be installed since the JBossWS runtime location has not been set. \nGo to the Web Services preference page and set the JBossWS runtime location under JBossWS Preferences.
+
+PROGRESS_INSTALL_JBOSSWS_RUNTIME=Installing JBossWS Runtime
+PROGRESS_UNINSTALL_JBOSSWS_RUNTIME=Uninstalling the JBossWS Runtime
+
+DIR_DOT_METADATA=.metadata
+DIR_DOT_PLUGINS=.plugins
+TEMP_JBOSSWS_FACET_DIR=org.jboss.tools.ws.facet
+WEBAPP_EXPLODED_SERVER_LOCATION_FILE=server.properties
+SERVER_STATUS_LOCATION_FILE=status.properties
+WAR_STATUS_LOCATION_FILE=war.properties
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUIMessages.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JbossWSUIMessages.java 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.ws.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class JbossWSUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME =
+ "org.jboss.tools.ws.ui.JbossWSUI"; //$NON-NLS-1$
+
+ private JbossWSUIMessages() {
+ // Do not instantiate
+ }
+
+ public static String LABEL_BROUSE;
+ public static String LABEL_WEB_SERVICE_CODEGEN;
+ public static String LABEL_WEB_SERVICE_CLIENT_CODEGEN;
+ public static String LABEL_WEB_SERVICE_AAR;
+ public static String LABEL_AAR_EXTENTION;
+ public static String LABEL_DATABINDING;
+ public static String LABEL_JBOSSWS_RUNTIME_LOAD;
+ public static String LABEL_JBOSSWS_RUNTIME_LOAD_ERROR;
+ public static String LABEL_JBOSSWS_RUNTIME_NOT_EXIT;
+ public static String LABEL_GENERATE_TESTCASE_CAPTION;
+ public static String LABEL_GENERATE_SERVERSIDE_INTERFACE;
+ public static String LABEL_GENERATE_ALL;
+ public static String LABEL_CLIENT_SIDE;
+ public static String LABEL_SYNC_AND_ASYNC;
+ public static String LABEL_SYNC;
+ public static String LABEL_ASYNC;
+
+ public static String JBOSSWS_LOCATION;
+ public static String JBOSSWS_RUNTIME;
+ public static String JBOSSWS_PREFERENCES;
+ public static String JBOSSWS_RUNTIME_TOOLTIP;
+ public static String JBOSSWS_PREFERENCES_TOOLTIP;
+ public static String JBOSSWS_RUNTIME_LOCATION;
+ public static String JBOSSWS_RUNTIME_PREFERENCES;
+
+ public static String ERROR_INVALID_JBOSSWS_SERVER_LOCATION;
+ public static String ERROR_INVALID_FILE_READ_WRITEL;
+ public static String ERROR_SERVER_IS_NOT_SET;
+
+ public static String PROGRESS_INSTALL_JBOSSWS_RUNTIME;
+ public static String PROGRESS_UNINSTALL_JBOSSWS_RUNTIME;
+
+ //generate for jbossws lib
+ public static String DIR_DOT_METADATA;
+ public static String DIR_DOT_PLUGINS;
+ public static String TEMP_JBOSSWS_FACET_DIR;
+ public static String WEBAPP_EXPLODED_SERVER_LOCATION_FILE;
+ public static String SERVER_STATUS_LOCATION_FILE;
+ public static String WAR_STATUS_LOCATION_FILE;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JbossWSUIMessages.class);
+ }
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/UIUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/UIUtils.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/UIUtils.java 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,538 @@
+/*******************************************************************************
+ * 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.ws.ui;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+
+public class UIUtils {
+ /**
+ * A default padding value for horizontalResize().
+ */
+ public final static int DEFAULT_PADDING = 35;
+
+ String infoPopid_;
+
+ // verify the jbossws jar directory
+ private static boolean alreadyComputedTempAxis2Directory = false;
+ private static String tempJbosswsDir = null;
+
+ public UIUtils(String infoPopid) {
+ infoPopid_ = infoPopid;
+ }
+
+ public Button createRadioButton(Composite parent, String labelName,
+ String tooltip, String infopop) {
+ return createButton(SWT.RADIO, parent, labelName, tooltip, infopop);
+ }
+
+ public Button createCheckbox(Composite parent, String labelName,
+ String tooltip, String infopop) {
+ return createButton(SWT.CHECK, parent, labelName, tooltip, infopop);
+ }
+
+ public Button createPushButton(Composite parent, String labelName,
+ String tooltip, String infopop) {
+ return createButton(SWT.NONE, parent, labelName, tooltip, infopop);
+ }
+
+ public Button createButton(int kind, Composite parent, String labelName,
+ String tooltip, String infopop) {
+ Button button = new Button(parent, kind);
+
+ tooltip = tooltip == null ? labelName : tooltip;
+ button.setText(labelName);
+ button.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(button,
+ infoPopid_ + "." + infopop);
+
+ return button;
+ }
+
+ public Combo createCombo(Composite parent, String labelName,
+ String tooltip, String infopop, int style) {
+ tooltip = tooltip == null ? labelName : tooltip;
+
+ if (labelName != null) {
+ Label label = new Label(parent, SWT.WRAP);
+ label.setText(labelName);
+ label.setToolTipText(tooltip);
+ }
+
+ Combo combo = new Combo(parent, style);
+ GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL);
+
+ combo.setLayoutData(griddata);
+ combo.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,
+ infoPopid_ + "." + infopop);
+
+ return combo;
+ }
+
+ public Text createText(Composite parent, String labelName, String tooltip,
+ String infopop, int style) {
+ tooltip = tooltip == null ? labelName : tooltip;
+
+ if (labelName != null) {
+ Label label = new Label(parent, SWT.WRAP);
+ label.setText(labelName);
+ label.setToolTipText(tooltip);
+ }
+
+ Text text = new Text(parent, style);
+ GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL);
+
+ text.setLayoutData(griddata);
+ text.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(text,
+ infoPopid_ + "." + infopop);
+
+ return text;
+ }
+
+ public Composite createComposite(Composite parent, int columns) {
+ return createComposite(parent, columns, -1, -1);
+ }
+
+ public Composite createComposite(Composite parent, int columns,
+ int marginHeight, int marginWidth) {
+ Composite composite = new Composite(parent, SWT.NONE);
+
+ GridLayout gridlayout = new GridLayout();
+ gridlayout.numColumns = columns;
+
+ if (marginHeight >= 0)
+ gridlayout.marginHeight = marginHeight;
+ if (marginWidth >= 0)
+ gridlayout.marginWidth = marginWidth;
+
+ composite.setLayout(gridlayout);
+ GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL);
+ composite.setLayoutData(griddata);
+
+ return composite;
+
+ }
+
+ public Group createGroup(Composite parent, String groupName,
+ String tooltip, String infopop) {
+ return createGroup(parent, groupName, tooltip, infopop, 1, -1, -1);
+ }
+
+ public Group createGroup(Composite parent, String groupName,
+ String tooltip, String infopop, int columns, int marginHeight,
+ int marginWidth) {
+ Group newGroup = new Group(parent, SWT.NONE);
+ GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL);
+ GridLayout gridlayout = new GridLayout();
+
+ gridlayout.numColumns = columns;
+
+ if (marginHeight >= 0)
+ gridlayout.marginHeight = marginHeight;
+ if (marginWidth >= 0)
+ gridlayout.marginWidth = marginWidth;
+
+ tooltip = tooltip == null ? groupName : tooltip;
+ newGroup.setLayout(gridlayout);
+ newGroup.setText(groupName);
+ newGroup.setLayoutData(griddata);
+ newGroup.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newGroup,
+ infoPopid_ + "." + infopop);
+
+ return newGroup;
+ }
+
+ public Tree createTree(Composite parent, String tooltip, String infopop,
+ int style) {
+
+ tooltip = tooltip == null ? "" : tooltip;
+
+ Tree tree = new Tree(parent, style);
+
+ tree.setLayoutData(createFillAll());
+ tree.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(tree,
+ infoPopid_ + "." + infopop);
+
+ return tree;
+
+ }
+
+ public Table createTable(Composite parent, String tooltip, String infopop,
+ int style) {
+
+ tooltip = tooltip == null ? "" : tooltip;
+
+ Table table = new Table(parent, style);
+
+ // table.setLayoutData( createFillAll() );
+ table.setToolTipText(tooltip);
+
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(table,
+ infoPopid_ + "." + infopop);
+
+ return table;
+
+ }
+
+ public Label createHorizontalSeparator(Composite parent, int spacing) {
+ Composite composite = createComposite(parent, 1, spacing, -1);
+
+ Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+
+ GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL);
+ separator.setLayoutData(griddata);
+
+ return separator;
+ }
+
+ public GridData createFillAll() {
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
+ | GridData.GRAB_VERTICAL);
+ return data;
+ }
+
+ public void createInfoPop(Control ctrl, String infopop) {
+ if (infopop != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl,
+ infoPopid_ + "." + infopop);
+ }
+
+ /**
+ * Resizes the width of the target composite so that it is as wide as the
+ * reference composite plus a padding value.
+ *
+ * @param target
+ * The composite to resize.
+ * @param reference
+ * The reference composite
+ * @param padding
+ * The padding value
+ */
+ public void horizontalResize(Composite target, Composite reference,
+ int padding) {
+
+ Point originalSize = target.getSize();
+ Point referenceSize = reference.getSize();
+
+ padding = padding >= 0 ? padding : DEFAULT_PADDING;
+
+ if (referenceSize.x + padding > originalSize.x)
+ target.setSize(referenceSize.x + padding, originalSize.y);
+ }
+
+ //
+ // jboss ws lib copy
+
+ public static String tempAxis2Directory() {
+ if (!alreadyComputedTempAxis2Directory){
+ String[] nodes = {JbossWSUIMessages.DIR_DOT_METADATA,
+ JbossWSUIMessages.DIR_DOT_PLUGINS,
+ JbossWSUIMessages.TEMP_JBOSSWS_FACET_DIR};
+ tempJbosswsDir =addNodesToPath(
+ ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(), nodes);
+ alreadyComputedTempAxis2Directory= true;
+ }
+ return tempJbosswsDir;
+ }
+
+ public static String tempAxis2WebappFileLocation() {
+ return
+ addAnotherNodeToPath(tempAxis2Directory(),
+ JbossWSUIMessages.WEBAPP_EXPLODED_SERVER_LOCATION_FILE);
+ }
+
+
+ public static String tempRuntimeStatusFileLocation() {
+ return
+ addAnotherNodeToPath(tempAxis2Directory(),
+ JbossWSUIMessages.SERVER_STATUS_LOCATION_FILE);
+ }
+
+ public static String tempWarStatusFileLocation() {
+ return
+ addAnotherNodeToPath(tempAxis2Directory(),
+ JbossWSUIMessages.WAR_STATUS_LOCATION_FILE);
+ }
+
+ public static void writePropertyToFile(File file,String key, String value) throws IOException {
+ Writer out = new BufferedWriter(new OutputStreamWriter(
+ new FileOutputStream(file), "8859_1"));
+ out.write(key+"="+value+"\n");
+ out.close();
+ }
+
+ // file util
+ public static void copyFile(String src, String dest) {
+ InputStream is = null;
+ FileOutputStream fos = null;
+
+ try
+ {
+ is = new FileInputStream(src);
+ fos = new FileOutputStream(dest);
+ int c = 0;
+ byte[] array = new byte[1024];
+ while ((c = is.read(array)) >= 0){
+ fos.write(array, 0, c);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ try {
+ fos.close();
+ is.close();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static File createFileAndParentDirectories(String fileName) throws Exception {
+ File file = new File(fileName);
+ File parent = file.getParentFile();
+ if (!parent.exists()){
+ parent.mkdirs();
+ }
+ file.createNewFile();
+ return file;
+ }
+
+ public static boolean deleteDir(File dir) {
+ if (dir.isDirectory()) {
+ String[] children = dir.list();
+ for (int i=0; i<children.length; i++) {
+ boolean success = deleteDir(new File(dir, children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+ return dir.delete();
+ }
+
+ public static void deleteDirectories(File dir) {
+ File[] children = dir.listFiles();
+ for (int i = 0; i < children.length; i++){
+ if (children[i].list() != null && children[i].list().length > 0){
+ deleteDirectories(children[i]);
+ }
+ else{
+ children[i].delete();
+ }
+ }
+ dir.delete();
+ }
+
+ public static void deleteDirectories(String dir) {
+ File directory = new File(dir);
+ deleteDirectories(directory);
+ }
+
+ public static void createTargetFile(String sourceFileName, String targetFileName)
+ throws Exception {
+ createTargetFile(sourceFileName, targetFileName, false);
+ }
+
+ public static void createTargetFile(String sourceFileName, String targetFileName,
+ boolean overwrite) throws Exception{
+ File idealResultFile = new File(targetFileName);
+ if (overwrite || !idealResultFile.exists())
+ {
+ createFileAndParentDirectories(targetFileName);
+ copyFile(sourceFileName, targetFileName);
+ }
+ }
+
+ public static boolean createDirectory(String directory){
+ // Create a directory; all ancestor directories must exist
+ boolean success = (new File(directory)).mkdir();
+ if (!success) {
+ // Directory creation failed
+ }
+ return success;
+ }
+
+ public static boolean createDirectorys(String directory){
+ // Create a directory; all ancestor directories must exist
+ boolean success = (new File(directory)).mkdirs();
+ if (!success) {
+ // Directory creation failed
+ }
+ return success;
+ }
+
+ //Copies all files under srcDir to dstDir.
+ // If dstDir does not exist, it will be created.
+ public static void copyDirectory(File srcDir, File dstDir) throws IOException {
+ if (srcDir.isDirectory()) {
+ if (!dstDir.exists()) {
+ dstDir.mkdir();
+ }
+
+ String[] children = srcDir.list();
+ for (int i=0; i<children.length; i++) {
+ copyDirectory(new File(srcDir, children[i]),
+ new File(dstDir, children[i]));
+ }
+ } else {
+ copy(srcDir, dstDir);
+ }
+ }
+
+ //Copies src file to dst file.
+ // If the dst file does not exist, it is created
+ public static void copy(File src, File dst) throws IOException {
+ InputStream in = new FileInputStream(src);
+ OutputStream out = new FileOutputStream(dst);
+
+ // Transfer bytes from in to out
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ in.close();
+ out.close();
+ }
+
+ public static String addAnotherNodeToPath(String currentPath, String newNode) {
+ return currentPath + File.separator + newNode;
+ }
+
+ public static String addNodesToPath(String currentPath, String[] newNode) {
+ String returnPath=currentPath;
+ for (int i = 0; i < newNode.length; i++) {
+ returnPath = returnPath + File.separator + newNode[i];
+ }
+ return returnPath;
+ }
+
+ public static String addNodesToPath(StringBuffer currentPath, String[] pathNodes) {
+ for (int i = 0; i < pathNodes.length; i++){
+ currentPath.append(File.separator);
+ currentPath.append(pathNodes[i]);
+ }
+ return currentPath.toString();
+ }
+
+ public static String addNodesToURL(String currentPath, String[] newNode) {
+ String returnPath=currentPath;
+ for (int i = 0; i < newNode.length; i++) {
+ returnPath = returnPath + "/" + newNode[i];
+ }
+ return returnPath;
+ }
+
+ /**
+ * Get the list of file with a prefix of <code>fileNamePrefix</code> & an extension of
+ * <code>extension</code>
+ *
+ * @param sourceDir The directory in which to search the files
+ * @param fileNamePrefix The prefix to look for
+ * @param extension The extension to look for
+ * @return The list of file with a prefix of <code>fileNamePrefix</code> & an extension of
+ * <code>extension</code>
+ */
+ public static File[] getMatchingFiles(String sourceDir, String fileNamePrefix, String extension) {
+ List fileList = new ArrayList();
+ File libDir = new File(sourceDir);
+ String libDirPath = libDir.getAbsolutePath();
+ String[] items = libDir.list();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ String item = items[i];
+ if (fileNamePrefix != null && extension != null) {
+ if (item.startsWith(fileNamePrefix) && item.endsWith(extension)) {
+ fileList.add(new File(libDirPath + File.separator + item));
+ }
+ } else if (fileNamePrefix == null && extension != null) {
+ if (item.endsWith(extension)) {
+ fileList.add(new File(libDirPath + File.separator + item));
+ }
+ } else if (fileNamePrefix != null && extension == null) {
+ if (item.startsWith(fileNamePrefix)) {
+ fileList.add(new File(libDirPath + File.separator + item));
+ }
+ } else {
+ fileList.add(new File(libDirPath + File.separator + item));
+ }
+ }
+ return (File[]) fileList.toArray(new File[fileList.size()]);
+ }
+ return new File[0];
+ }
+
+ /**
+ * Filter out files inside a <code>sourceDir</code> with matching <codefileNamePrefix></code>
+ * and <code>extension</code>
+ * @param sourceDir The directory to filter the files
+ * @param fileNamePrefix The filtering filename prefix
+ * @param extension The filtering file extension
+ */
+ public static void filterOutRestrictedFiles(String sourceDir, String fileNamePrefix, String extension){
+ File[] resultedMatchingFiles = getMatchingFiles(sourceDir, fileNamePrefix, extension);
+ for (int i = 0; i < resultedMatchingFiles.length; i++) {
+ File matchingFilePath = new File(resultedMatchingFiles[i].getAbsolutePath());
+ matchingFilePath.delete();
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage.java 2008-04-17 06:23:01 UTC (rev 7565)
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * 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.ws.ui.preferences;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.preference.PreferencePage;
+import org.jboss.tools.ws.ui.UIUtils;
+import org.jboss.tools.ws.ui.Activator;
+import org.jboss.tools.ws.ui.JbossWSUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class JbossWSRuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private Text axis2Path;
+ private Text statusLabel;
+ private Combo aarExtensionCombo;
+ private Combo serviceDatabindingCombo;
+ private Combo clientDatabindingCombo;
+ private Button generateServerSideInterfaceCheckBoxButton;
+ private Button generateAllCheckBoxButton;
+ private Button syncAndAsyncRadioButton;
+ private Button syncOnlyRadioButton;
+ private Button asyncOnlyRadioButton;
+ private Button clientTestCaseCheckBoxButton;
+ private Button clientGenerateAllCheckBoxButton;
+
+ protected Control createContents(Composite superparent) {
+
+ UIUtils uiUtils = new UIUtils(Activator.PLUGIN_ID);
+ final Composite mainComp = uiUtils.createComposite(superparent, 1);
+
+ TabFolder axis2PreferenceTab = new TabFolder(mainComp, SWT.WRAP);
+ axis2PreferenceTab.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH) );
+
+
+ //-----------------------------Axis2 Runtime Location Group------------------------------//
+ TabItem runtimeInstalLocationItem = new TabItem(axis2PreferenceTab, SWT.WRAP);
+ runtimeInstalLocationItem.setText(JbossWSUIMessages.JBOSSWS_RUNTIME);
+ runtimeInstalLocationItem.setToolTipText(JbossWSUIMessages.JBOSSWS_RUNTIME_TOOLTIP);
+
+ Composite runtimeTab = uiUtils.createComposite(axis2PreferenceTab, 1);
+ runtimeTab.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH ) );
+ Composite runtimeGroup = uiUtils.createComposite(runtimeTab, 3);
+
+ runtimeInstalLocationItem.setControl(runtimeTab);
+ runtimeTab.setToolTipText(JbossWSUIMessages.JBOSSWS_RUNTIME_TOOLTIP);
+
+ axis2Path = uiUtils.createText(runtimeGroup, JbossWSUIMessages.JBOSSWS_RUNTIME_LOCATION , null, null , SWT.BORDER);
+
+ Button browseButton = uiUtils.createPushButton(runtimeGroup, JbossWSUIMessages.LABEL_BROUSE, null, null);
+ browseButton.addSelectionListener( new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse(mainComp.getShell());
+ }
+ });
+
+ axis2Path.addModifyListener( new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ statusUpdate(runtimeExist(axis2Path.getText()));
+ // runtimeTab.layout();
+ }
+ });
+ new org.eclipse.swt.widgets.Label(runtimeTab, SWT.HORIZONTAL); // Leave some vertical space.
+ statusLabel = new Text(runtimeTab, SWT.BACKGROUND | SWT.READ_ONLY | SWT.CENTER | SWT.WRAP | SWT.H_SCROLL);
+ statusLabel.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH) );
+
+ //--------------------------------Axis2 Runtime Preferences------------------------------//
+
+ TabItem codegenPreferencesItem = new TabItem(axis2PreferenceTab, SWT.WRAP);
+ codegenPreferencesItem.setText(JbossWSUIMessages.JBOSSWS_PREFERENCES);
+ codegenPreferencesItem.setToolTipText(JbossWSUIMessages.JBOSSWS_PREFERENCES_TOOLTIP);
+
+ Composite codegenGroup = uiUtils.createComposite(axis2PreferenceTab, 1);
+ codegenPreferencesItem.setControl(codegenGroup);
+ codegenGroup.setToolTipText(JbossWSUIMessages.JBOSSWS_PREFERENCES_TOOLTIP);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ //Service Codegen Options
+ Composite serviceCodegenGroup = uiUtils.createComposite(codegenGroup, 1);
+
+ Text serviceCodegenGroupLabel= new Text(serviceCodegenGroup, SWT.READ_ONLY |SWT.WRAP);
+ serviceCodegenGroupLabel.setText(JbossWSUIMessages.LABEL_WEB_SERVICE_CODEGEN);
+
+ Composite dataBindComp = uiUtils.createComposite(serviceCodegenGroup, 2);
+ //Data binding
+ serviceDatabindingCombo = uiUtils.createCombo(dataBindComp, JbossWSUIMessages.LABEL_DATABINDING, null, null, SWT.READ_ONLY);
+
+ //the server side interface option
+ generateServerSideInterfaceCheckBoxButton = uiUtils.createCheckbox(serviceCodegenGroup, JbossWSUIMessages.LABEL_GENERATE_SERVERSIDE_INTERFACE, null, null);
+
+ // generate all
+ generateAllCheckBoxButton = uiUtils.createCheckbox(serviceCodegenGroup, JbossWSUIMessages.LABEL_GENERATE_ALL, null,null);
+
+ uiUtils.createHorizontalSeparator(codegenGroup,2);
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ ///Client Codegen Options
+ Composite clientCodegenGroup = uiUtils.createComposite(codegenGroup, 1);
+ Text clientCodegenGroupLabel= new Text(clientCodegenGroup, SWT.READ_ONLY);
+ clientCodegenGroupLabel.setText(JbossWSUIMessages.LABEL_WEB_SERVICE_CLIENT_CODEGEN);
+
+ Group clientModeRadioComp = uiUtils.createGroup(clientCodegenGroup, JbossWSUIMessages.LABEL_CLIENT_SIDE, null, null);
+
+ //client side buttons
+ syncAndAsyncRadioButton = uiUtils.createRadioButton(clientModeRadioComp, JbossWSUIMessages.LABEL_SYNC_AND_ASYNC, null, null);
+ syncOnlyRadioButton = uiUtils.createRadioButton(clientModeRadioComp,JbossWSUIMessages.LABEL_SYNC, null, null);
+ asyncOnlyRadioButton = uiUtils.createRadioButton(clientModeRadioComp, JbossWSUIMessages.LABEL_ASYNC, null, null);
+
+ Composite dataBind = uiUtils.createComposite(clientCodegenGroup, 2);
+ clientDatabindingCombo = uiUtils.createCombo(dataBind, JbossWSUIMessages.LABEL_DATABINDING, null, null, SWT.READ_ONLY);
+
+ // generate test case option
+ clientTestCaseCheckBoxButton = uiUtils.createCheckbox(clientCodegenGroup, JbossWSUIMessages.LABEL_GENERATE_TESTCASE_CAPTION, null, null);
+
+ // generate all
+ clientGenerateAllCheckBoxButton = uiUtils.createCheckbox(clientCodegenGroup, JbossWSUIMessages.LABEL_GENERATE_ALL, null, null);
+
+
+ uiUtils.createHorizontalSeparator(codegenGroup,2);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+
+ ///AAR Options
+ Composite aarGroup = uiUtils.createComposite(codegenGroup,1);
+
+ Text arrGroupLabel= new Text(aarGroup, SWT.READ_ONLY);
+ arrGroupLabel.setText(JbossWSUIMessages.LABEL_WEB_SERVICE_AAR);
+
+ Composite aarExtGroup = uiUtils.createComposite(aarGroup,2);
+
+ //aar extention
+ aarExtensionCombo = uiUtils.createCombo(aarExtGroup, JbossWSUIMessages.LABEL_AAR_EXTENTION, null, null, SWT.READ_ONLY );
+
+ initializeValues();
+ axis2PreferenceTab.setEnabled(true);
+ axis2PreferenceTab.setVisible(true);
+ return mainComp;
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+
+ /**
+ * Pops up the file browse dialog box
+ */
+ private void handleBrowse(Shell parent) {
+ DirectoryDialog fileDialog = new DirectoryDialog(parent);
+ String fileName = fileDialog.open();
+ if (fileName != null) {
+ axis2Path.setText(fileName);
+ }
+ }
+
+ private void statusUpdate(boolean status){
+ if(statusLabel != null){
+ if(!axis2Path.getText().equals("")){
+ if (status) {
+ statusLabel.setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_LOAD);
+ } else {
+ statusLabel.setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_LOAD_ERROR);
+ }
+ }else{
+ statusLabel.setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_NOT_EXIT);
+ }
+ }
+ }
+
+ private boolean runtimeExist(String path){
+
+ File axis2HomeDir = new File(path);
+ if (!axis2HomeDir.isDirectory())
+ return false;
+
+// String axis2LibPath = Axis2CoreUtils.addAnotherNodeToPath(axis2HomeDir.getAbsolutePath(), "lib");
+// String axis2WebappPath = Axis2CoreUtils.addAnotherNodeToPath(axis2HomeDir.getAbsolutePath(), "webapp");
+// if (new File(axis2LibPath).isDirectory() && new File(axis2WebappPath).isDirectory())
+// return true;
+// else {
+// String axis2WarPath = Axis2CoreUtils.addAnotherNodeToPath( path, "axis2.war");
+// if (new File(axis2WarPath).isFile()) {
+// RuntimePropertyUtils.writeWarStausToPropertiesFile(true);
+// return true;
+// } else
+// return false;
+// }
+ return true;
+ }
+
+ private void storeValues(){
+// // set values in the persistent context
+// Axis2EmitterContext context = WebServiceAxis2CorePlugin.getDefault().getAxisEmitterContext();
+// context.setAxis2RuntimeLocation( axis2Path.getText());
+// RuntimePropertyUtils.writeServerPathToPropertiesFile(axis2Path.getText());
+// context.setServiceDatabinding(serviceDatabindingCombo.getItem(serviceDatabindingCombo.getSelectionIndex()));
+// context.setServiceInterfaceSkeleton( generateServerSideInterfaceCheckBoxButton.getSelection());
+// context.setServiceGenerateAll(generateAllCheckBoxButton.getSelection());
+// context.setAsync(asyncOnlyRadioButton.getSelection());
+// context.setSync(syncOnlyRadioButton.getSelection());
+// context.setClientDatabinding(clientDatabindingCombo.getItem(clientDatabindingCombo.getSelectionIndex()));
+// context.setClientTestCase(clientTestCaseCheckBoxButton.getSelection());
+// context.setClientGenerateAll(clientGenerateAllCheckBoxButton.getSelection());
+// context.setAarExtention(aarExtensionCombo.getText());
+ }
+
+ /**
+ * Initializes states of the controls using default values
+ * in the preference store.
+ */
+ private void initializeDefaults() {
+// aarExtensionCombo.select(0);
+// serviceDatabindingCombo.select(0);
+// clientDatabindingCombo.select(0);
+// generateServerSideInterfaceCheckBoxButton.setSelection(Axis2EmitterDefaults.isServiceInterfaceSkeleton());
+// generateAllCheckBoxButton.setSelection(Axis2EmitterDefaults.isServiceGenerateAll());
+// syncAndAsyncRadioButton.setSelection(((Axis2EmitterDefaults.isClientSync() || Axis2EmitterDefaults.isClientAsync())==false)?true:
+// (Axis2EmitterDefaults.isClientSync()) && Axis2EmitterDefaults.isClientAsync());
+// syncOnlyRadioButton.setSelection( Axis2EmitterDefaults.isClientSync() && !Axis2EmitterDefaults.isClientAsync());
+// asyncOnlyRadioButton.setSelection(
+// Axis2EmitterDefaults.isClientAsync() && !Axis2EmitterDefaults.isClientSync());
+//
+// clientTestCaseCheckBoxButton.setSelection(Axis2EmitterDefaults.isClientTestCase());
+// clientGenerateAllCheckBoxButton.setSelection(Axis2EmitterDefaults.isClientGenerateAll());
+// axis2Path.setText(Axis2EmitterDefaults.getAxis2RuntimeLocation());
+ }
+
+ private void initializeValues()
+ {
+// Axis2EmitterContext context = WebServiceAxis2CorePlugin.getDefault().getAxisEmitterContext();
+//
+// String[] databindingItems = {context.getServiceDatabinding().toUpperCase()};
+// serviceDatabindingCombo.setItems(databindingItems);
+// serviceDatabindingCombo.select(0);
+// clientDatabindingCombo.setItems(databindingItems);
+// clientDatabindingCombo.select(0);
+//
+// generateServerSideInterfaceCheckBoxButton.setSelection( context.isServiceInterfaceSkeleton());
+// generateAllCheckBoxButton.setSelection(context.isServiceGenerateAll());
+//
+// syncAndAsyncRadioButton.setSelection(((context.isSync() || context.isAsync())==false) ?true
+// :(context.isSync()) && context.isAsync());
+// syncOnlyRadioButton.setSelection(context.isSync() && !context.isAsync() );
+// asyncOnlyRadioButton.setSelection(context.isAsync() && !context.isSync());
+//
+// clientTestCaseCheckBoxButton.setSelection(context.isClientTestCase());
+// clientGenerateAllCheckBoxButton.setSelection(context.isClientGenerateAll());
+//
+// String[] aarExtentionItems = { Axis2Constants.AAR };
+// aarExtensionCombo.setItems(aarExtentionItems);
+// aarExtensionCombo.select(0);
+//
+// String serverPath = context.getAxis2RuntimeLocation();
+// if ( serverPath != null){
+// axis2Path.setText(serverPath);
+// statusUpdate(runtimeExist(serverPath));
+// RuntimePropertyUtils.writeWarStausToPropertiesFile(false);
+// }
+// else
+// statusUpdate(false);
+ }
+
+ /**
+ * Default button has been pressed.
+ */
+ protected void performDefaults() {
+ super.performDefaults();
+ initializeDefaults();
+ }
+
+ /**
+ * Apply button has been pressed.
+ */
+ protected void performApply() {
+ performOk();
+ }
+
+ /**
+ * OK button has been pressed.
+ */
+ public boolean performOk() {
+ storeValues();
+ return true;
+ }
+
+ }
17 years, 8 months
JBoss Tools SVN: r7564 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: jspeditor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-04-16 23:55:22 -0400 (Wed, 16 Apr 2008)
New Revision: 7564
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
Log:
JBIDE-2081 Exception appears when open jsp/html/xhtml file after Default Editor Tab was set to Source.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java 2008-04-17 03:55:17 UTC (rev 7563)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java 2008-04-17 03:55:22 UTC (rev 7564)
@@ -27,5 +27,7 @@
public void createPreviewBrowser();
public Object getVisualEditor();
public void createVisualEditor();
+ public void maximizeSource();
+ public void maximizeVisual();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-17 03:55:17 UTC (rev 7563)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-17 03:55:22 UTC (rev 7564)
@@ -410,8 +410,22 @@
// switchOutlineToJSPEditor();
}
loadSelectedTab();
- setActivePage(selectedPageIndex);
- pageChange(selectedPageIndex);
+
+ if (selectedPageIndex == 2) {
+ setActivePage(0);
+ pageChange(0);
+ if (visualEditor != null)
+ visualEditor.maximizeSource();
+ selectedPageIndex=0;
+ } else if (selectedPageIndex == 1) {
+ setActivePage(0);
+ pageChange(0);
+ if (visualEditor != null)
+ visualEditor.maximizeVisual();
+ selectedPageIndex=0;
+ }
+ //setActivePage(selectedPageIndex);
+ //pageChange(selectedPageIndex);
new ResourceChangeListener(this, getContainer());
if (getModelObject() != null) {
17 years, 8 months