JBoss Tools SVN: r19052 - in trunk: cdi/plugins/org.jboss.tools.cdi.core/META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-12-04 09:57:08 -0500 (Fri, 04 Dec 2009)
New Revision: 19052
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.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.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5383
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2009-12-04 14:17:17 UTC (rev 19051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2009-12-04 14:57:08 UTC (rev 19052)
@@ -14,7 +14,9 @@
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.frameworks,
- org.jboss.tools.jst.web.kb
+ org.jboss.tools.jst.web.kb,
+ org.jboss.tools.common.el.core,
+ org.eclipse.jface.text
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: JBoss by Red Hat
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2009-12-04 14:17:17 UTC (rev 19051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2009-12-04 14:57:08 UTC (rev 19052)
@@ -83,4 +83,12 @@
</facet>
</supported>
</extension>
+
+ <extension
+ point="org.jboss.tools.common.el.core.elResolver">
+ <el-resolver id="cdiELResolver">
+ <project-nature id="org.jboss.tools.cdi.core.cdinature"
+ resolver-class="org.jboss.tools.cdi.internal.core.el.CdiElResolver"/>
+ </el-resolver>
+ </extension>
</plugin>
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2009-12-04 14:17:17 UTC (rev 19051)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2009-12-04 14:57:08 UTC (rev 19052)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.common.el.core.resolver.IVariable;
import org.jboss.tools.common.text.ITextSourceReference;
/**
@@ -20,7 +21,7 @@
*
* @author Alexey Kazakov
*/
-public interface IBean extends IScoped, ICDIElement {
+public interface IBean extends IScoped, ICDIElement, IVariable {
/**
* Returns the corresponding IType of the managed bean or session bean or of
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2009-12-04 14:57:08 UTC (rev 19052)
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.el;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IBeanManager;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IStereotypeDeclaration;
+import org.jboss.tools.cdi.core.ITypeDeclaration;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CdiElResolver extends AbstractELCompletionEngine<IBean> {
+
+ private static ELParserFactory factory = ELParserUtil.getJbossFactory();
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine#getELProposalImage()
+ */
+ @Override
+ public Image getELProposalImage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine#log(java.lang.Exception)
+ */
+ @Override
+ protected void log(Exception e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine#getMemberInfoByVariable(org.jboss.tools.common.el.core.resolver.IVariable, boolean)
+ */
+ @Override
+ protected MemberInfo getMemberInfoByVariable(IBean var, boolean onlyEqualNames) {
+ // TODO
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.el.AbstractELCompletionEngine#resolveVariables(org.eclipse.core.resources.IFile, org.jboss.tools.common.el.core.model.ELInvocationExpression, boolean, boolean)
+ */
+ @Override
+ public List<IBean> resolveVariables(IFile file, ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
+ ArrayList<IBean> beans = new ArrayList<IBean>();
+
+ IProject project = file.getProject();
+ if (project == null) {
+ return beans;
+ }
+
+ String varName = expr.toString();
+
+ if (varName != null) {
+ IBeanManager manager = null;
+ // TODO
+// Set<IBean> resolvedBeans = manager.getBeans(varName, true);
+ Set<IBean> resolvedBeans = new HashSet<IBean>();
+ if(onlyEqualNames) {
+ beans.addAll(resolvedBeans);
+ } else {
+ for (IBean bean : resolvedBeans) {
+ if(bean.getName().startsWith(varName)) {
+ beans.add(bean);
+ }
+ }
+ }
+ }
+ if (beans.isEmpty() && varName != null && (varName.startsWith("\"") || varName.startsWith("'"))
+ && (varName.endsWith("\"") || varName.endsWith("'"))) {
+ IJavaProject jp = EclipseUtil.getJavaProject(project.getProject());
+ try {
+ IType type = jp.findType("java.lang.String");
+ if(type != null) {
+ IMethod m = type.getMethod("toString", new String[0]);
+ if(m != null) {
+ IBean bean = new StringVariable(m);
+ beans.add(bean);
+ }
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+
+ }
+ return beans;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELResolver#getParserFactory()
+ */
+ public ELParserFactory getParserFactory() {
+ return factory;
+ }
+
+ private static class StringVariable implements IBean {
+
+ private IMember member;
+
+ public StringVariable(IMember member) {
+ this.member = member;
+ }
+
+ public Set<ITypeDeclaration> getAllTypeDeclarations() {
+ return Collections.emptySet();
+ }
+
+ public IAnnotationDeclaration getAlternativeDeclaration() {
+ return null;
+ }
+
+ public IType getBeanClass() {
+ return member.getDeclaringType();
+ }
+
+ public Set<IInjectionPoint> getInjectionPoints() {
+ return Collections.emptySet();
+ }
+
+ public Set<IType> getLegalTypes() {
+ return Collections.emptySet();
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public ITextSourceReference getNameLocation() {
+ return null;
+ }
+
+ public Set<IAnnotationDeclaration> getQualifierDeclarations() {
+ return Collections.emptySet();
+ }
+
+ public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+ return Collections.emptySet();
+ }
+
+ public IBean getSpecializedBean() {
+ return null;
+ }
+
+ public IAnnotationDeclaration getSpecializesAnnotationDeclaration() {
+ return null;
+ }
+
+ public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ return Collections.emptySet();
+ }
+
+ public boolean isAlternative() {
+ return false;
+ }
+
+ public boolean isDependent() {
+ return false;
+ }
+
+ public boolean isEnabled() {
+ return false;
+ }
+
+ public boolean isSpecializing() {
+ return false;
+ }
+
+ public IType getScope() {
+ return null;
+ }
+
+ public Set<IAnnotationDeclaration> getScopeDeclarations() {
+ return Collections.emptySet();
+ }
+
+ public ICDIProject getCDIProject() {
+ return null;
+ }
+
+ public IResource getResource() {
+ return member.getResource();
+ }
+
+ public IPath getSourcePath() {
+ return member.getPath();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-12-04 14:17:17 UTC (rev 19051)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-12-04 14:57:08 UTC (rev 19052)
@@ -291,7 +291,7 @@
}
}
} catch (JavaModelException e) {
- //ignore
+ SeamCorePlugin.getDefault().logError(e);
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-12-04 14:17:17 UTC (rev 19051)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-12-04 14:57:08 UTC (rev 19052)
@@ -59,7 +59,6 @@
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.common.ui.wizard.IParameter;
-import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -952,9 +951,6 @@
private void removeSeamSupport() {
try {
EclipseResourceUtil.removeNatureFromProject(project, ISeamProject.NATURE_ID);
- if(!project.hasNature(JSFNature.NATURE_ID)) {
- EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
- }
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
15 years, 1 month
JBoss Tools SVN: r19051 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors: uitls and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 09:17:17 -0500 (Fri, 04 Dec 2009)
New Revision: 19051
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5361
Capture and display error message if not able to parse input message to produce input model
Small tweak to earlier commit from Dart.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-12-04 14:12:02 UTC (rev 19050)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-12-04 14:17:17 UTC (rev 19051)
@@ -115,6 +115,7 @@
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+import org.milyn.SmooksException;
/**
* @author Dart
@@ -1193,8 +1194,11 @@
Throwable t = SelectorCreationDialog.getCurrentException();
if (t != null) {
if (this.getManagedForm() != null) {
+ if(t instanceof SmooksException && t.getCause() != null) {
+ t = t.getCause();
+ }
this.getManagedForm().getMessageManager().addMessage("input error",
- "Input Error : " + t.getMessage(), null, IMessageProvider.ERROR);
+ "Check Reader Configuration. Error creating Input Model from Input Data.\nError: " + t.getMessage(), null, IMessageProvider.ERROR);
}
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-12-04 14:12:02 UTC (rev 19050)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-12-04 14:17:17 UTC (rev 19051)
@@ -201,11 +201,7 @@
// Filter the message through Smooks and capture the result as a DOM in
// the domResult instance...
- try {
- smooks.filterSource(new StreamSource(inputStream), result);
- } catch (Exception t) {
- throw new RuntimeException(t);
- }
+ smooks.filterSource(new StreamSource(inputStream), result);
XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
ByteArrayInputStream byteinputStream = new ByteArrayInputStream(result.getResult().getBytes());
15 years, 1 month
JBoss Tools SVN: r19050 - in branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors: uitls and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 09:12:02 -0500 (Fri, 04 Dec 2009)
New Revision: 19050
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5361
Capture and display error message if not able to parse input message to produce input model
Small tweak to earlier commit from Dart.
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-12-04 13:47:36 UTC (rev 19049)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-12-04 14:12:02 UTC (rev 19050)
@@ -115,6 +115,7 @@
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+import org.milyn.SmooksException;
/**
* @author Dart
@@ -1193,8 +1194,11 @@
Throwable t = SelectorCreationDialog.getCurrentException();
if (t != null) {
if (this.getManagedForm() != null) {
+ if(t instanceof SmooksException && t.getCause() != null) {
+ t = t.getCause();
+ }
this.getManagedForm().getMessageManager().addMessage("input error",
- "Input Error : " + t.getMessage(), null, IMessageProvider.ERROR);
+ "Check Reader Configuration. Error creating Input Model from Input Data.\nError: " + t.getMessage(), null, IMessageProvider.ERROR);
}
}
}
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-12-04 13:47:36 UTC (rev 19049)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-12-04 14:12:02 UTC (rev 19050)
@@ -201,11 +201,7 @@
// Filter the message through Smooks and capture the result as a DOM in
// the domResult instance...
- try {
- smooks.filterSource(new StreamSource(inputStream), result);
- } catch (Exception t) {
- throw new RuntimeException(t);
- }
+ smooks.filterSource(new StreamSource(inputStream), result);
XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
ByteArrayInputStream byteinputStream = new ByteArrayInputStream(result.getResult().getBytes());
15 years, 1 month
JBoss Tools SVN: r19049 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test: jbide and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-12-04 08:47:36 -0500 (Fri, 04 Dec 2009)
New Revision: 19049
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE5218Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5218, junit test class was renamed.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-12-04 13:21:48 UTC (rev 19048)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-12-04 13:47:36 UTC (rev 19049)
@@ -67,7 +67,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4509Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4510Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4534Test;
-import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE5218Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.TestFViewLocaleAttribute_JBIDE5218;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -181,7 +181,7 @@
suite.addTestSuite(VPERefreshTest.class);
suite.addTestSuite(OpenOnInsideJspRoot_JBIDE4852.class);
suite.addTestSuite(NullPointerWithStyleProperty_JBIDE5193.class);
- suite.addTestSuite(JBIDE5218Test.class);
+ suite.addTestSuite(TestFViewLocaleAttribute_JBIDE5218.class);
// $JUnit-END$
// added by Max Areshkau
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE5218Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE5218Test.java 2009-12-04 13:21:48 UTC (rev 19048)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE5218Test.java 2009-12-04 13:47:36 UTC (rev 19049)
@@ -1,171 +0,0 @@
-package org.jboss.tools.jsf.vpe.jsf.test.jbide;
-
-import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Element;
-
-/**
- * Checks f:view's locale workflow.
- *
- * @author dmaliarevich
- */
-public class JBIDE5218Test extends VpeTest {
-
- private static final String DEFAULT_LOCALE_PAGE = "defaultLocale.jsp"; //$NON-NLS-1$
- private static final String LOCALE_ATTRIBUTE_PAGE = "JBIDE/5218/localeAttribute.jsp"; //$NON-NLS-1$
- private static final String LOCALE_ATTRIBUTE_WITH_DEFAULT_LOCALE_PAGE = "localeAndDefault.jsp"; //$NON-NLS-1$
- private static final String SEVERAL_FVIEWS_PAGE = "JBIDE/5218/severalFViews.jsp"; //$NON-NLS-1$
- private static final String CHANGE_LOCALE_AND_REFRESH_PAGE = "JBIDE/5218/changeLocaleAndRefresh.jsp"; //$NON-NLS-1$
-
- private static final String HELLO_DE = "Guten Tag!"; //$NON-NLS-1$
- private static final String HELLO2_DE = "German Hello"; //$NON-NLS-1$
- private static final String HELLO_EN = "Hello"; //$NON-NLS-1$
- private static final String HELLO_EN_US = "US Hello"; //$NON-NLS-1$
- private static final String HELLO_EN_GB = "Great Britain Hello"; //$NON-NLS-1$
-
- private static final String LOCALE_TEXT_ID = "localeText"; //$NON-NLS-1$
- private static final String LOCALE_TEXT1_ID = "localeText1"; //$NON-NLS-1$
- private static final String LOCALE_TEXT2_ID = "localeText2"; //$NON-NLS-1$
- private static final String FVIEW_ID = "fviewid"; //$NON-NLS-1$
-
-
- public JBIDE5218Test(String name) {
- super(name);
- }
-
- /**
- * Tests that the dafault locale is applied by default,
- * f:view has no locale attribute in this case.
- *
- * @throws Throwable
- */
- public void testDefaultLocale() throws Throwable {
- VpeController controller = openInVpe(
- JsfAllTests.IMPORT_I18N_PROJECT_NAME, DEFAULT_LOCALE_PAGE);
- nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
- nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
- String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in Deutch", HELLO_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- closeEditors();
- }
-
- /**
- * f:view has a locale attribute defined,
- * which should be applied.
- * Default locale is empty in this case.
- *
- * @throws Throwable
- */
- public void testLocaleAttribute() throws Throwable {
- VpeController controller = openInVpe(
- JsfAllTests.IMPORT_JSF_20_PROJECT_NAME, LOCALE_ATTRIBUTE_PAGE);
- nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
- nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
- String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be should be in German", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- closeEditors();
- }
-
- /**
- * The default locale is defined,
- * f:view has a locale attribute defined also,
- * The default locale in this case should take an advantage.
- *
- * @throws Throwable
- */
- public void testLocaleAttributeWithDefaultLocale() throws Throwable {
- VpeController controller = openInVpe(
- JsfAllTests.IMPORT_I18N_PROJECT_NAME,
- LOCALE_ATTRIBUTE_WITH_DEFAULT_LOCALE_PAGE);
- nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
- nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
- String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in Deutch", HELLO_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- closeEditors();
- }
-
- /**
- * If there are several f:views on the page.
- * Only the last f:view one should be applied on server,
- * but each f:view should have its own locale.
- *
- * @throws Throwable
- */
- public void testSeveralFViewsWithLocales() throws Throwable {
- VpeController controller = openInVpe(
- JsfAllTests.IMPORT_JSF_20_PROJECT_NAME, SEVERAL_FVIEWS_PAGE);
- nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
- nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT1_ID);
- String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in 'de' locale", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
-
- localeText = doc.getElementById(LOCALE_TEXT2_ID);
- localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in default locale", HELLO_EN.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
-
- localeText = doc.getElementById(LOCALE_TEXT_ID);
- localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in 'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- closeEditors();
- }
-
- /**
- * After the locale attribute value has been changed and
- * Refresh button is clicked - the correct locale should be applied,
- * bundle messages should be updated and showed in the correct locale.
- *
- * @throws Throwable
- */
- public void testChangeLocaleAndRefresh() throws Throwable {
- VpeController controller = openInVpe(
- JsfAllTests.IMPORT_JSF_20_PROJECT_NAME,
- CHANGE_LOCALE_AND_REFRESH_PAGE);
- nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
- nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
- String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in German", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * Change the locale
- */
- Element fViewElement = controller.getSourceBuilder().getSourceDocument().getElementById(FVIEW_ID);
- assertTrue("Previous locale should be 'de'", "de".equalsIgnoreCase(fViewElement.getAttribute("locale"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fViewElement.setAttribute("locale", "en_GB"); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * Wait until new value is applied and children are refreshed.
- */
- TestUtil.waitForIdle();
- assertTrue("Current locale should be 'en_GB'", "en_GB".equalsIgnoreCase(fViewElement.getAttribute("locale"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- doc = controller.getXulRunnerEditor().getDOMDocument();
- localeText = doc.getElementById(LOCALE_TEXT_ID);
- localizedText = getLocalizedText(localeText);
- /*
- * Check the new localized message.
- */
- assertTrue("Text is '"+localizedText+"', but should be in en_GB", HELLO_EN_GB.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
- closeEditors();
- }
-
- /**
- * Gets the text value from the container.
- * Contaner should be a simple tag like div or span.
- * The text node in the VPE is initially wrapped in a span element,
- * thus to get its value two child elements should be skipped.
- *
- * @param textContainer - the tag with text
- * @return localized by VPE string
- */
- private String getLocalizedText(nsIDOMElement textContainer) {
- String text = ""; //$NON-NLS-1$
- if ((textContainer.getFirstChild() != null) && (textContainer.getFirstChild().getFirstChild() != null)
- && HTML.TAG_SPAN.equalsIgnoreCase(textContainer.getFirstChild().getNodeName())) {
- text = textContainer.getFirstChild().getFirstChild().getNodeValue();
- }
- return text;
- }
-
-}
Copied: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java (from rev 19042, trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE5218Test.java)
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2009-12-04 13:47:36 UTC (rev 19049)
@@ -0,0 +1,171 @@
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+
+/**
+ * Checks f:view's locale workflow.
+ *
+ * @author dmaliarevich
+ */
+public class TestFViewLocaleAttribute_JBIDE5218 extends VpeTest {
+
+ private static final String DEFAULT_LOCALE_PAGE = "defaultLocale.jsp"; //$NON-NLS-1$
+ private static final String LOCALE_ATTRIBUTE_PAGE = "JBIDE/5218/localeAttribute.jsp"; //$NON-NLS-1$
+ private static final String LOCALE_ATTRIBUTE_WITH_DEFAULT_LOCALE_PAGE = "localeAndDefault.jsp"; //$NON-NLS-1$
+ private static final String SEVERAL_FVIEWS_PAGE = "JBIDE/5218/severalFViews.jsp"; //$NON-NLS-1$
+ private static final String CHANGE_LOCALE_AND_REFRESH_PAGE = "JBIDE/5218/changeLocaleAndRefresh.jsp"; //$NON-NLS-1$
+
+ private static final String HELLO_DE = "Guten Tag!"; //$NON-NLS-1$
+ private static final String HELLO2_DE = "German Hello"; //$NON-NLS-1$
+ private static final String HELLO_EN = "Hello"; //$NON-NLS-1$
+ private static final String HELLO_EN_US = "US Hello"; //$NON-NLS-1$
+ private static final String HELLO_EN_GB = "Great Britain Hello"; //$NON-NLS-1$
+
+ private static final String LOCALE_TEXT_ID = "localeText"; //$NON-NLS-1$
+ private static final String LOCALE_TEXT1_ID = "localeText1"; //$NON-NLS-1$
+ private static final String LOCALE_TEXT2_ID = "localeText2"; //$NON-NLS-1$
+ private static final String FVIEW_ID = "fviewid"; //$NON-NLS-1$
+
+
+ public TestFViewLocaleAttribute_JBIDE5218(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests that the dafault locale is applied by default,
+ * f:view has no locale attribute in this case.
+ *
+ * @throws Throwable
+ */
+ public void testDefaultLocale() throws Throwable {
+ VpeController controller = openInVpe(
+ JsfAllTests.IMPORT_I18N_PROJECT_NAME, DEFAULT_LOCALE_PAGE);
+ nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
+ nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
+ String localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in Deutch", HELLO_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ closeEditors();
+ }
+
+ /**
+ * f:view has a locale attribute defined,
+ * which should be applied.
+ * Default locale is empty in this case.
+ *
+ * @throws Throwable
+ */
+ public void testLocaleAttribute() throws Throwable {
+ VpeController controller = openInVpe(
+ JsfAllTests.IMPORT_JSF_20_PROJECT_NAME, LOCALE_ATTRIBUTE_PAGE);
+ nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
+ nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
+ String localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be should be in German", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ closeEditors();
+ }
+
+ /**
+ * The default locale is defined,
+ * f:view has a locale attribute defined also,
+ * The default locale in this case should take an advantage.
+ *
+ * @throws Throwable
+ */
+ public void testLocaleAttributeWithDefaultLocale() throws Throwable {
+ VpeController controller = openInVpe(
+ JsfAllTests.IMPORT_I18N_PROJECT_NAME,
+ LOCALE_ATTRIBUTE_WITH_DEFAULT_LOCALE_PAGE);
+ nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
+ nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
+ String localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in Deutch", HELLO_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ closeEditors();
+ }
+
+ /**
+ * If there are several f:views on the page.
+ * Only the last f:view one should be applied on server,
+ * but each f:view should have its own locale.
+ *
+ * @throws Throwable
+ */
+ public void testSeveralFViewsWithLocales() throws Throwable {
+ VpeController controller = openInVpe(
+ JsfAllTests.IMPORT_JSF_20_PROJECT_NAME, SEVERAL_FVIEWS_PAGE);
+ nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
+ nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT1_ID);
+ String localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in 'de' locale", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ localeText = doc.getElementById(LOCALE_TEXT2_ID);
+ localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in default locale", HELLO_EN.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ localeText = doc.getElementById(LOCALE_TEXT_ID);
+ localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in 'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ closeEditors();
+ }
+
+ /**
+ * After the locale attribute value has been changed and
+ * Refresh button is clicked - the correct locale should be applied,
+ * bundle messages should be updated and showed in the correct locale.
+ *
+ * @throws Throwable
+ */
+ public void testChangeLocaleAndRefresh() throws Throwable {
+ VpeController controller = openInVpe(
+ JsfAllTests.IMPORT_JSF_20_PROJECT_NAME,
+ CHANGE_LOCALE_AND_REFRESH_PAGE);
+ nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
+ nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
+ String localizedText = getLocalizedText(localeText);
+ assertTrue("Text is '"+localizedText+"', but should be in German", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Change the locale
+ */
+ Element fViewElement = controller.getSourceBuilder().getSourceDocument().getElementById(FVIEW_ID);
+ assertTrue("Previous locale should be 'de'", "de".equalsIgnoreCase(fViewElement.getAttribute("locale"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ fViewElement.setAttribute("locale", "en_GB"); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Wait until new value is applied and children are refreshed.
+ */
+ TestUtil.waitForIdle();
+ assertTrue("Current locale should be 'en_GB'", "en_GB".equalsIgnoreCase(fViewElement.getAttribute("locale"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ doc = controller.getXulRunnerEditor().getDOMDocument();
+ localeText = doc.getElementById(LOCALE_TEXT_ID);
+ localizedText = getLocalizedText(localeText);
+ /*
+ * Check the new localized message.
+ */
+ assertTrue("Text is '"+localizedText+"', but should be in en_GB", HELLO_EN_GB.equalsIgnoreCase(localizedText)); //$NON-NLS-1$ //$NON-NLS-2$
+ closeEditors();
+ }
+
+ /**
+ * Gets the text value from the container.
+ * Contaner should be a simple tag like div or span.
+ * The text node in the VPE is initially wrapped in a span element,
+ * thus to get its value two child elements should be skipped.
+ *
+ * @param textContainer - the tag with text
+ * @return localized by VPE string
+ */
+ private String getLocalizedText(nsIDOMElement textContainer) {
+ String text = ""; //$NON-NLS-1$
+ if ((textContainer.getFirstChild() != null) && (textContainer.getFirstChild().getFirstChild() != null)
+ && HTML.TAG_SPAN.equalsIgnoreCase(textContainer.getFirstChild().getNodeName())) {
+ text = textContainer.getFirstChild().getFirstChild().getNodeValue();
+ }
+ return text;
+ }
+
+}
15 years, 1 month
JBoss Tools SVN: r19048 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-04 08:21:48 -0500 (Fri, 04 Dec 2009)
New Revision: 19048
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5099
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2009-12-04 13:19:36 UTC (rev 19047)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2009-12-04 13:21:48 UTC (rev 19048)
@@ -16,8 +16,10 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
@@ -25,6 +27,11 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.taglib.AbstractComponent;
+import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+import org.jboss.tools.jst.web.project.list.IWebPromptingProvider;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -55,13 +62,49 @@
openFileInEditor((String)list.get(0));
return;
}
- String error = p.getProperty(WebPromptingProvider.ERROR);
+
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+
+ if(error != null) {
+ String error1 = openJSF2Component(documentFile, p);
+ if(error1 != null) error = error1;
+ }
if ( error != null && error.length() > 0) {
openFileFailed();
}
}
-
+ protected String openJSF2Component(IFile documentFile, Properties p) {
+ String uri = p.getProperty("prefix");
+ if(uri == null || !uri.startsWith("http://java.sun.com/jsf/composite/")) {
+ return null;
+ }
+ ITagLibrary[] ls = KbProjectFactory.getKbProject(documentFile.getProject(), true).getTagLibraries(uri);
+ if(ls == null || ls.length == 0) {
+ return "Cannot find JSF 2 library " + uri;
+ }
+ String error = "";
+ String tagName = p.getProperty(IWebPromptingProvider.NAME);
+// String attributeName = p.getProperty(IWebPromptingProvider.ATTRIBUTE);
+ IComponent c = ls[0].getComponent(tagName);
+ if(c != null) {
+ IResource r = ((AbstractComponent)c).getResource();
+ if(r instanceof IFile) {
+ IFile f = (IFile)r;
+ IEditorPart part = openFileInEditor(f);
+ if(part == null) {
+ error = "Cannot open file " + r;
+ }
+ } else {
+ error = "Cannot find file for tag " + tagName;
+ }
+ } else {
+ error = "Component " + tagName + " not found in library " + p.getProperty("prefix");
+ }
+ return error;
+
+ }
+
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
15 years, 1 month
JBoss Tools SVN: r19047 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal: scanner and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-04 08:19:36 -0500 (Fri, 04 Dec 2009)
New Revision: 19047
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5099
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-12-04 12:28:49 UTC (rev 19046)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-12-04 13:19:36 UTC (rev 19047)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.XModelObject;
@@ -93,6 +94,13 @@
public IResource getResource() {
if(resource != null) return resource;
+ if(resource == null && id instanceof IAdaptable) {
+ IResource r = (IResource)((IAdaptable)id).getAdapter(IResource.class);
+ resource = r;
+ if(resource != null) {
+ source = resource.getFullPath();
+ }
+ }
if(source != null) {
resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2009-12-04 12:28:49 UTC (rev 19046)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2009-12-04 13:19:36 UTC (rev 19047)
@@ -3,6 +3,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
@@ -88,6 +89,10 @@
CompositeComponent component = new CompositeComponent();
component.setId(c);
+ IResource r = (IResource)c.getAdapter(IResource.class);
+ if(r instanceof IFile) {
+ component.setSourcePath(r.getFullPath());
+ }
component.setName(createValueInfo(c.getAttributeValue(XModelObjectConstants.ATTR_NAME)));
library.addComponent(component);
15 years, 1 month
JBoss Tools SVN: r19046 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: graphical/actions and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 07:28:49 -0500 (Fri, 04 Dec 2009)
New Revision: 19046
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5378
Replace table entry on CSV template creation dialog with simple CSV field decl
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -39,7 +39,7 @@
*/
public class SmooksConfigurationFileNewWizard extends Wizard implements INewWizard {
private SmooksFileContainerSelectionPage containerSelectionPage;
- private SmooksVersionSelectionPage versionSelectionPage;
+// private SmooksVersionSelectionPage versionSelectionPage;
private ISelection selection;
/**
@@ -60,8 +60,8 @@
(IStructuredSelection) selection);
addPage(containerSelectionPage);
- versionSelectionPage = new SmooksVersionSelectionPage(Messages.SmooksConfigurationFileNewWizard_VersionPageName);
- addPage(versionSelectionPage);
+// versionSelectionPage = new SmooksVersionSelectionPage(Messages.SmooksConfigurationFileNewWizard_VersionPageName);
+// addPage(versionSelectionPage);
}
/**
@@ -71,7 +71,7 @@
public boolean performFinish() {
final IPath containerPath = containerSelectionPage.getContainerFullPath();
final String fileName = containerSelectionPage.getFileName();
- final String version = versionSelectionPage.getVersion();
+ final String version = SmooksConstants.VERSION_1_2;
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
@@ -193,7 +193,6 @@
+ " <params>\n"//$NON-NLS-1$
+ " <param name=\"stream.filter.type\">SAX</param>\n"//$NON-NLS-1$
+ " </params>\n"//$NON-NLS-1$
-// + " <graph:smooks-graphics-ext platformVersion = \"1.2\"/>\n"//$NON-NLS-1$
+ "</smooks-resource-list>"; //$NON-NLS-1$
}
return new ByteArrayInputStream(contents.getBytes());
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.smooks.graphical.actions;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.edit.command.AddCommand;
@@ -65,15 +62,16 @@
IWizard currentWizard = wizard.getWizard();
if (currentWizard instanceof FreemarkerCSVTemplateCreationWizard) {
- List<String> fields = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getFields();
- String fieldsString = "";
- for (Iterator<?> iterator = fields.iterator(); iterator.hasNext();) {
- String string = (String) iterator.next();
- fieldsString += string + ",";
- }
- if (fieldsString.length() > 0) {
- fieldsString = fieldsString.substring(0, fieldsString.length() - 1);
- }
+ String fieldsString = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getFieldsString();
+ // for (Iterator<?> iterator = fields.iterator();
+ // iterator.hasNext();) {
+ // String string = (String) iterator.next();
+ // fieldsString += string + ",";
+ // }
+ // if (fieldsString.length() > 0) {
+ // fieldsString = fieldsString.substring(0,
+ // fieldsString.length() - 1);
+ // }
String quote = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getQuote();
String seperator = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getSeprator();
@@ -99,12 +97,16 @@
freemarker.getParam().add(speratorParam);
freemarker.getParam().add(quoteParam);
freemarker.getParam().add(fieldsParam);
-
-// SmooksModelUtils.addParam(freemarker.getTemplate(), messageTypeParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), quoteParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), speratorParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), fieldsParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // messageTypeParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // quoteParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // speratorParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // fieldsParam);
+
Command addFreemarkerCommand = AddCommand.create(this.provider.getEditingDomain(),
resourceList,
SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -170,7 +170,7 @@
}
List<TreeNodeConnection> collectionConnections = csvRecordGraphModel.getTargetConnections();
if (collectionConnections.isEmpty()) {
- csvRecordGraphModel.addMessage("Must be linked with source node");
+ csvRecordGraphModel.addMessage("Must be linked with collection java class node");
csvRecordGraphModel.setSeverity(AbstractSmooksGraphicalModel.WARNING);
List<AbstractSmooksGraphicalModel> csvFields = csvRecordGraphModel.getChildren();
for (Iterator<?> iterator2 = csvFields.iterator(); iterator2.hasNext();) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -311,11 +311,7 @@
break;
}
}
-
Collection<?> deletedObjs = null;
- // if(command instanceof AddCommand){
- // deletedObjs = ((AddCommand)command).getCollection();
- // }
if (command instanceof DeleteCommand) {
deletedObjs = ((DeleteCommand) command).getCollection();
}
@@ -329,10 +325,6 @@
refreshInputModel = true;
break;
}
- // if (needToLayoutWhenAddModel(object2)) {
- // refreshInputModel = true;
- // break;
- // }
}
}
if (refreshInputModel)
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -14,26 +14,16 @@
import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -46,7 +36,10 @@
private List<FieldText> fieldsList = new ArrayList<FieldText>();
private Text seperatorText;
private Text quoteText;
+ private Text fieldsText;
+
+
public FreemarkerCSVCreationWizardPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
@@ -56,7 +49,15 @@
this.setTitle(Messages.FreemarkerCSVCreationWizardPage_WizardTitle);
this.setDescription(Messages.FreemarkerCSVCreationWizardPage_WizardDes);
}
+
+ public Text getFieldsText() {
+ return fieldsText;
+ }
+ public void setFieldsText(Text fieldsText) {
+ this.fieldsText = fieldsText;
+ }
+
/**
* @return the fieldsList
*/
@@ -101,162 +102,176 @@
gd = new GridData(GridData.FILL_HORIZONTAL);
seperatorText.setLayoutData(gd);
seperatorText.setTextLimit(1);
-
+
Label quoteLabel = new Label(mainComposite, SWT.NONE);
quoteLabel.setText(Messages.FreemarkerCSVCreationWizardPage_QuoteCharLabel);
quoteText = new Text(mainComposite, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
quoteText.setLayoutData(gd);
quoteText.setTextLimit(1);
-
-
+ Label filedsLabel = new Label(mainComposite, SWT.NONE);
+ filedsLabel.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
+ fieldsText = new Text(mainComposite, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 200;
- gd.horizontalSpan = 2;
- Group fieldsComposite = new Group(mainComposite, SWT.NONE);
- fieldsComposite.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
- fieldsComposite.setLayoutData(gd);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- fieldsComposite.setLayout(gl);
+ fieldsText.setLayoutData(gd);
- gd = new GridData(GridData.FILL_BOTH);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // gd.heightHint = 200;
+ // gd.horizontalSpan = 2;
+ // Group fieldsComposite = new Group(mainComposite, SWT.NONE);
+ // fieldsComposite.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
+ // fieldsComposite.setLayoutData(gd);
+ // GridLayout gl = new GridLayout();
+ // gl.numColumns = 2;
+ // fieldsComposite.setLayout(gl);
+ //
+ // gd = new GridData(GridData.FILL_BOTH);
+ //
+ // String fields = null;
+ //
+ // final TableViewer fieldsViewer = new TableViewer(fieldsComposite,
+ // SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ // fieldsViewer.getControl().setLayoutData(gd);
+ // fieldsViewer.getTable().setLinesVisible(true);
+ // fieldsViewer.setContentProvider(new FieldsContentProvider());
+ // fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+ //
+ // CellEditor fieldCellEditor = new
+ // TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+ //
+ // fieldsViewer.getTable().setLinesVisible(true);
+ //
+ // fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
+ //
+ // fieldsViewer.setColumnProperties(new String[] { "field" }); //$NON-NLS-1$
+ //
+ // fieldsViewer.setCellModifier(new ICellModifier() {
+ //
+ // public void modify(Object element, String property, Object value) {
+ // Object el = null;
+ // if (element instanceof Item) {
+ // el = ((Item) element).getData();
+ // }
+ // if (el == null)
+ // return;
+ // if (el instanceof FieldText && value instanceof String) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // if (value.toString().equals(((FieldText) el).getText())) {
+ // return;
+ // }
+ // ((FieldText) el).setText(value.toString());
+ // fieldsViewer.refresh(el);
+ // updatePage();
+ // }
+ // }
+ // }
+ //
+ // public Object getValue(Object element, String property) {
+ // if (element instanceof FieldText) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // return ((FieldText) element).getText();
+ // }
+ // }
+ //
+ // return null;
+ // }
+ //
+ // public boolean canModify(Object element, String property) {
+ // if (element instanceof FieldText) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+ // });
+ // if (fields == null) {
+ // fields = ""; //$NON-NLS-1$
+ // }
+ // fillFieldsList(fields);
+ // fieldsViewer.setInput(fieldsList);
+ //
+ // Composite buttonComposite = new Composite(fieldsComposite, SWT.NONE);
+ // gd = new GridData(GridData.FILL_VERTICAL);
+ // gd.widthHint = 100;
+ // buttonComposite.setLayoutData(gd);
+ //
+ // GridLayout bgl = new GridLayout();
+ // buttonComposite.setLayout(bgl);
+ //
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ //
+ // final Button addButton = new Button(buttonComposite, SWT.NONE);
+ // addButton.setLayoutData(gd);
+ // addButton.setText(Messages.FreemarkerCSVCreationWizardPage_AddFieldButtonText);
+ //
+ // final Button removeButton = new Button(buttonComposite, SWT.NONE);
+ // removeButton.setLayoutData(gd);
+ // removeButton.setText(Messages.FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel);
+ //
+ // addButton.addSelectionListener(new SelectionListener() {
+ //
+ // public void widgetSelected(SelectionEvent e) {
+ // addButton.setEnabled(false);
+ // try {
+ // FieldText field = new FieldText("field"); //$NON-NLS-1$
+ // fieldsList.add(field);
+ // fieldsViewer.refresh();
+ // updatePage();
+ // } catch (Throwable t) {
+ //
+ // } finally {
+ // addButton.setEnabled(true);
+ // }
+ // }
+ //
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // // TODO Auto-generated method stub
+ //
+ // }
+ // });
+ //
+ // removeButton.addSelectionListener(new SelectionListener() {
+ //
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection s = (IStructuredSelection)
+ // fieldsViewer.getSelection();
+ // fieldsList.removeAll(s.toList());
+ // fieldsViewer.refresh();
+ // updatePage();
+ // }
+ //
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ //
+ // }
+ // });
- String fields = null;
+ this.setControl(mainComposite);
- final TableViewer fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- fieldsViewer.getControl().setLayoutData(gd);
- fieldsViewer.getTable().setLinesVisible(true);
- fieldsViewer.setContentProvider(new FieldsContentProvider());
- fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+ seperatorText.setText(","); //$NON-NLS-1$
+ quoteText.setText("\""); //$NON-NLS-1$
- CellEditor fieldCellEditor = new TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+ seperatorText.addModifyListener(new ModifyListener() {
- fieldsViewer.getTable().setLinesVisible(true);
-
- fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
-
- fieldsViewer.setColumnProperties(new String[] { "field" }); //$NON-NLS-1$
-
- fieldsViewer.setCellModifier(new ICellModifier() {
-
- public void modify(Object element, String property, Object value) {
- Object el = null;
- if (element instanceof Item) {
- el = ((Item) element).getData();
- }
- if (el == null)
- return;
- if (el instanceof FieldText && value instanceof String) {
- if (property.equals("field")) { //$NON-NLS-1$
- if (value.toString().equals(((FieldText) el).getText())) {
- return;
- }
- ((FieldText) el).setText(value.toString());
- fieldsViewer.refresh(el);
- updatePage();
- }
- }
+ public void modifyText(ModifyEvent e) {
+ updatePage();
}
-
- public Object getValue(Object element, String property) {
- if (element instanceof FieldText) {
- if (property.equals("field")) { //$NON-NLS-1$
- return ((FieldText) element).getText();
- }
- }
-
- return null;
- }
-
- public boolean canModify(Object element, String property) {
- if (element instanceof FieldText) {
- if (property.equals("field")) { //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
});
- if (fields == null) {
- fields = ""; //$NON-NLS-1$
- }
- fillFieldsList(fields);
- fieldsViewer.setInput(fieldsList);
+ quoteText.addModifyListener(new ModifyListener() {
- Composite buttonComposite = new Composite(fieldsComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.widthHint = 100;
- buttonComposite.setLayoutData(gd);
-
- GridLayout bgl = new GridLayout();
- buttonComposite.setLayout(bgl);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
-
- final Button addButton = new Button(buttonComposite, SWT.NONE);
- addButton.setLayoutData(gd);
- addButton.setText(Messages.FreemarkerCSVCreationWizardPage_AddFieldButtonText);
-
- final Button removeButton = new Button(buttonComposite, SWT.NONE);
- removeButton.setLayoutData(gd);
- removeButton.setText(Messages.FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel);
-
- addButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- addButton.setEnabled(false);
- try {
- FieldText field = new FieldText("field"); //$NON-NLS-1$
- fieldsList.add(field);
- fieldsViewer.refresh();
- updatePage();
- } catch (Throwable t) {
-
- } finally {
- addButton.setEnabled(true);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- removeButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
- fieldsList.removeAll(s.toList());
- fieldsViewer.refresh();
+ public void modifyText(ModifyEvent e) {
updatePage();
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
});
- this.setControl(mainComposite);
-
- seperatorText.setText(","); //$NON-NLS-1$
- quoteText.setText("\""); //$NON-NLS-1$
-
- seperatorText.addModifyListener(new ModifyListener() {
+ fieldsText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updatePage();
}
});
- quoteText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updatePage();
- }
- });
-
this.setPageComplete(false);
}
@@ -285,6 +300,7 @@
String error = null;
String seperator = seperatorText.getText();
String quote = quoteText.getText();
+ String fields = fieldsText.getText();
if (seperator == null || seperator.length() == 0) {
error = Messages.FreemarkerCSVCreationWizardPage_SeperatorEmptyErrorMessage;
}
@@ -298,9 +314,44 @@
if (quote != null && quote.length() > 1) {
error = "Quote must be only one character"; //$NON-NLS-1$
}
- if (fieldsList.isEmpty()) {
- error = Messages.FreemarkerCSVCreationWizardPage_FieldEmptyErrorMessage;
+ if (fields == null) {
+ error = "Fields can't be empty";
+ } else {
+ fields = fields.trim();
+ if ("".equals(fields)) { //$NON-NLS-1$
+ error = "Fields can't be empty";
+ } else {
+ char[] chars = fields.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ char c = chars[i];
+ if (c == ',') {
+ continue;
+ }
+ if (Character.isLetterOrDigit(c)) {
+
+ } else {
+ error = "The '" + c + "' is incorrect in the fields string";
+ break;
+ }
+ }
+
+ String[] fieldsArray = fields.split(",");
+ if(fieldsArray.length == 0){
+ error = "Fields can't be empty";
+ }
+ for (int i = 0; i < fieldsArray.length; i++) {
+ String f = fieldsArray[i];
+ if(f == null || "".equals(f.trim())){
+ error = "Fields can't be empty";
+ break;
+ }
+ }
+ }
}
+ // if (fieldsList.isEmpty()) {
+ // error =
+ // Messages.FreemarkerCSVCreationWizardPage_FieldEmptyErrorMessage;
+ // }
this.setErrorMessage(error);
this.setPageComplete(error == null);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java 2009-12-04 12:28:49 UTC (rev 19046)
@@ -11,11 +11,9 @@
package org.jboss.tools.smooks.graphical.wizard.freemarker;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.wizard.Wizard;
-import org.jboss.tools.smooks.graphical.wizard.freemarker.FreemarkerCSVCreationWizardPage.FieldText;
/**
* @author Dart
@@ -28,6 +26,7 @@
private String quote;
private List<String> fields = new ArrayList<String>();
+ private String fieldsString;
public FreemarkerCSVTemplateCreationWizard() {
super();
@@ -51,9 +50,9 @@
/**
* @return the fields
*/
- public List<String> getFields() {
- return fields;
- }
+// public List<String> getFields() {
+// return fields;
+// }
/*
* (non-Javadoc)
@@ -68,7 +67,13 @@
this.addPage(page);
super.addPages();
}
+
+
+ public String getFieldsString() {
+ return fieldsString;
+ }
+
/*
* (non-Javadoc)
*
@@ -79,11 +84,12 @@
if (page != null) {
seprator = page.getSeperatorText().getText();
quote = page.getQuoteText().getText();
- List<FieldText> fieldList = page.getFieldsList();
- for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();) {
- FieldText fieldText = (FieldText) iterator.next();
- fields.add(fieldText.getText());
- }
+ fieldsString = page.getFieldsText().getText();
+// List<FieldText> fieldList = page.getFieldsList();
+// for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();) {
+// FieldText fieldText = (FieldText) iterator.next();
+// fields.add(fieldText.getText());
+// }
return true;
}
return true;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties 2009-12-04 12:22:40 UTC (rev 19045)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties 2009-12-04 12:28:49 UTC (rev 19046)
@@ -6,5 +6,5 @@
FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel=Remove
FreemarkerCSVCreationWizardPage_SeperatorCharLabel=Seperator Character :
FreemarkerCSVCreationWizardPage_SeperatorEmptyErrorMessage=Seperator can't be null
-FreemarkerCSVCreationWizardPage_WizardDes=Configurate CSV Template
+FreemarkerCSVCreationWizardPage_WizardDes=Configurate CSV Template. Use ',' to seperate the CSV field string.
FreemarkerCSVCreationWizardPage_WizardTitle=CSV Template Configuration
15 years, 1 month
JBoss Tools SVN: r19045 - in branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: graphical/actions and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-04 07:22:40 -0500 (Fri, 04 Dec 2009)
New Revision: 19045
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5378
Replace table entry on CSV template creation dialog with simple CSV field decl
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -39,7 +39,7 @@
*/
public class SmooksConfigurationFileNewWizard extends Wizard implements INewWizard {
private SmooksFileContainerSelectionPage containerSelectionPage;
- private SmooksVersionSelectionPage versionSelectionPage;
+// private SmooksVersionSelectionPage versionSelectionPage;
private ISelection selection;
/**
@@ -60,8 +60,8 @@
(IStructuredSelection) selection);
addPage(containerSelectionPage);
- versionSelectionPage = new SmooksVersionSelectionPage(Messages.SmooksConfigurationFileNewWizard_VersionPageName);
- addPage(versionSelectionPage);
+// versionSelectionPage = new SmooksVersionSelectionPage(Messages.SmooksConfigurationFileNewWizard_VersionPageName);
+// addPage(versionSelectionPage);
}
/**
@@ -71,7 +71,7 @@
public boolean performFinish() {
final IPath containerPath = containerSelectionPage.getContainerFullPath();
final String fileName = containerSelectionPage.getFileName();
- final String version = versionSelectionPage.getVersion();
+ final String version = SmooksConstants.VERSION_1_2;
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
@@ -193,7 +193,6 @@
+ " <params>\n"//$NON-NLS-1$
+ " <param name=\"stream.filter.type\">SAX</param>\n"//$NON-NLS-1$
+ " </params>\n"//$NON-NLS-1$
-// + " <graph:smooks-graphics-ext platformVersion = \"1.2\"/>\n"//$NON-NLS-1$
+ "</smooks-resource-list>"; //$NON-NLS-1$
}
return new ByteArrayInputStream(contents.getBytes());
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.smooks.graphical.actions;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.edit.command.AddCommand;
@@ -65,15 +62,16 @@
IWizard currentWizard = wizard.getWizard();
if (currentWizard instanceof FreemarkerCSVTemplateCreationWizard) {
- List<String> fields = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getFields();
- String fieldsString = "";
- for (Iterator<?> iterator = fields.iterator(); iterator.hasNext();) {
- String string = (String) iterator.next();
- fieldsString += string + ",";
- }
- if (fieldsString.length() > 0) {
- fieldsString = fieldsString.substring(0, fieldsString.length() - 1);
- }
+ String fieldsString = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getFieldsString();
+ // for (Iterator<?> iterator = fields.iterator();
+ // iterator.hasNext();) {
+ // String string = (String) iterator.next();
+ // fieldsString += string + ",";
+ // }
+ // if (fieldsString.length() > 0) {
+ // fieldsString = fieldsString.substring(0,
+ // fieldsString.length() - 1);
+ // }
String quote = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getQuote();
String seperator = ((FreemarkerCSVTemplateCreationWizard) currentWizard).getSeprator();
@@ -99,12 +97,16 @@
freemarker.getParam().add(speratorParam);
freemarker.getParam().add(quoteParam);
freemarker.getParam().add(fieldsParam);
-
-// SmooksModelUtils.addParam(freemarker.getTemplate(), messageTypeParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), quoteParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), speratorParam);
-// SmooksModelUtils.addParam(freemarker.getTemplate(), fieldsParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // messageTypeParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // quoteParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // speratorParam);
+ // SmooksModelUtils.addParam(freemarker.getTemplate(),
+ // fieldsParam);
+
Command addFreemarkerCommand = AddCommand.create(this.provider.getEditingDomain(),
resourceList,
SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -170,7 +170,7 @@
}
List<TreeNodeConnection> collectionConnections = csvRecordGraphModel.getTargetConnections();
if (collectionConnections.isEmpty()) {
- csvRecordGraphModel.addMessage("Must be linked with source node");
+ csvRecordGraphModel.addMessage("Must be linked with collection java class node");
csvRecordGraphModel.setSeverity(AbstractSmooksGraphicalModel.WARNING);
List<AbstractSmooksGraphicalModel> csvFields = csvRecordGraphModel.getChildren();
for (Iterator<?> iterator2 = csvFields.iterator(); iterator2.hasNext();) {
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -311,11 +311,7 @@
break;
}
}
-
Collection<?> deletedObjs = null;
- // if(command instanceof AddCommand){
- // deletedObjs = ((AddCommand)command).getCollection();
- // }
if (command instanceof DeleteCommand) {
deletedObjs = ((DeleteCommand) command).getCollection();
}
@@ -329,10 +325,6 @@
refreshInputModel = true;
break;
}
- // if (needToLayoutWhenAddModel(object2)) {
- // refreshInputModel = true;
- // break;
- // }
}
}
if (refreshInputModel)
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVCreationWizardPage.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -14,26 +14,16 @@
import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -46,7 +36,10 @@
private List<FieldText> fieldsList = new ArrayList<FieldText>();
private Text seperatorText;
private Text quoteText;
+ private Text fieldsText;
+
+
public FreemarkerCSVCreationWizardPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
@@ -56,7 +49,15 @@
this.setTitle(Messages.FreemarkerCSVCreationWizardPage_WizardTitle);
this.setDescription(Messages.FreemarkerCSVCreationWizardPage_WizardDes);
}
+
+ public Text getFieldsText() {
+ return fieldsText;
+ }
+ public void setFieldsText(Text fieldsText) {
+ this.fieldsText = fieldsText;
+ }
+
/**
* @return the fieldsList
*/
@@ -101,162 +102,176 @@
gd = new GridData(GridData.FILL_HORIZONTAL);
seperatorText.setLayoutData(gd);
seperatorText.setTextLimit(1);
-
+
Label quoteLabel = new Label(mainComposite, SWT.NONE);
quoteLabel.setText(Messages.FreemarkerCSVCreationWizardPage_QuoteCharLabel);
quoteText = new Text(mainComposite, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
quoteText.setLayoutData(gd);
quoteText.setTextLimit(1);
-
-
+ Label filedsLabel = new Label(mainComposite, SWT.NONE);
+ filedsLabel.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
+ fieldsText = new Text(mainComposite, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 200;
- gd.horizontalSpan = 2;
- Group fieldsComposite = new Group(mainComposite, SWT.NONE);
- fieldsComposite.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
- fieldsComposite.setLayoutData(gd);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- fieldsComposite.setLayout(gl);
+ fieldsText.setLayoutData(gd);
- gd = new GridData(GridData.FILL_BOTH);
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // gd.heightHint = 200;
+ // gd.horizontalSpan = 2;
+ // Group fieldsComposite = new Group(mainComposite, SWT.NONE);
+ // fieldsComposite.setText(Messages.FreemarkerCSVCreationWizardPage_FieldsGroupText);
+ // fieldsComposite.setLayoutData(gd);
+ // GridLayout gl = new GridLayout();
+ // gl.numColumns = 2;
+ // fieldsComposite.setLayout(gl);
+ //
+ // gd = new GridData(GridData.FILL_BOTH);
+ //
+ // String fields = null;
+ //
+ // final TableViewer fieldsViewer = new TableViewer(fieldsComposite,
+ // SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ // fieldsViewer.getControl().setLayoutData(gd);
+ // fieldsViewer.getTable().setLinesVisible(true);
+ // fieldsViewer.setContentProvider(new FieldsContentProvider());
+ // fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+ //
+ // CellEditor fieldCellEditor = new
+ // TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+ //
+ // fieldsViewer.getTable().setLinesVisible(true);
+ //
+ // fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
+ //
+ // fieldsViewer.setColumnProperties(new String[] { "field" }); //$NON-NLS-1$
+ //
+ // fieldsViewer.setCellModifier(new ICellModifier() {
+ //
+ // public void modify(Object element, String property, Object value) {
+ // Object el = null;
+ // if (element instanceof Item) {
+ // el = ((Item) element).getData();
+ // }
+ // if (el == null)
+ // return;
+ // if (el instanceof FieldText && value instanceof String) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // if (value.toString().equals(((FieldText) el).getText())) {
+ // return;
+ // }
+ // ((FieldText) el).setText(value.toString());
+ // fieldsViewer.refresh(el);
+ // updatePage();
+ // }
+ // }
+ // }
+ //
+ // public Object getValue(Object element, String property) {
+ // if (element instanceof FieldText) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // return ((FieldText) element).getText();
+ // }
+ // }
+ //
+ // return null;
+ // }
+ //
+ // public boolean canModify(Object element, String property) {
+ // if (element instanceof FieldText) {
+ // if (property.equals("field")) { //$NON-NLS-1$
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+ // });
+ // if (fields == null) {
+ // fields = ""; //$NON-NLS-1$
+ // }
+ // fillFieldsList(fields);
+ // fieldsViewer.setInput(fieldsList);
+ //
+ // Composite buttonComposite = new Composite(fieldsComposite, SWT.NONE);
+ // gd = new GridData(GridData.FILL_VERTICAL);
+ // gd.widthHint = 100;
+ // buttonComposite.setLayoutData(gd);
+ //
+ // GridLayout bgl = new GridLayout();
+ // buttonComposite.setLayout(bgl);
+ //
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ //
+ // final Button addButton = new Button(buttonComposite, SWT.NONE);
+ // addButton.setLayoutData(gd);
+ // addButton.setText(Messages.FreemarkerCSVCreationWizardPage_AddFieldButtonText);
+ //
+ // final Button removeButton = new Button(buttonComposite, SWT.NONE);
+ // removeButton.setLayoutData(gd);
+ // removeButton.setText(Messages.FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel);
+ //
+ // addButton.addSelectionListener(new SelectionListener() {
+ //
+ // public void widgetSelected(SelectionEvent e) {
+ // addButton.setEnabled(false);
+ // try {
+ // FieldText field = new FieldText("field"); //$NON-NLS-1$
+ // fieldsList.add(field);
+ // fieldsViewer.refresh();
+ // updatePage();
+ // } catch (Throwable t) {
+ //
+ // } finally {
+ // addButton.setEnabled(true);
+ // }
+ // }
+ //
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // // TODO Auto-generated method stub
+ //
+ // }
+ // });
+ //
+ // removeButton.addSelectionListener(new SelectionListener() {
+ //
+ // public void widgetSelected(SelectionEvent e) {
+ // IStructuredSelection s = (IStructuredSelection)
+ // fieldsViewer.getSelection();
+ // fieldsList.removeAll(s.toList());
+ // fieldsViewer.refresh();
+ // updatePage();
+ // }
+ //
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ //
+ // }
+ // });
- String fields = null;
+ this.setControl(mainComposite);
- final TableViewer fieldsViewer = new TableViewer(fieldsComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- fieldsViewer.getControl().setLayoutData(gd);
- fieldsViewer.getTable().setLinesVisible(true);
- fieldsViewer.setContentProvider(new FieldsContentProvider());
- fieldsViewer.setLabelProvider(new FieldsLabelProvider());
+ seperatorText.setText(","); //$NON-NLS-1$
+ quoteText.setText("\""); //$NON-NLS-1$
- CellEditor fieldCellEditor = new TextCellEditor(fieldsViewer.getTable(), SWT.BORDER);
+ seperatorText.addModifyListener(new ModifyListener() {
- fieldsViewer.getTable().setLinesVisible(true);
-
- fieldsViewer.setCellEditors(new CellEditor[] { fieldCellEditor });
-
- fieldsViewer.setColumnProperties(new String[] { "field" }); //$NON-NLS-1$
-
- fieldsViewer.setCellModifier(new ICellModifier() {
-
- public void modify(Object element, String property, Object value) {
- Object el = null;
- if (element instanceof Item) {
- el = ((Item) element).getData();
- }
- if (el == null)
- return;
- if (el instanceof FieldText && value instanceof String) {
- if (property.equals("field")) { //$NON-NLS-1$
- if (value.toString().equals(((FieldText) el).getText())) {
- return;
- }
- ((FieldText) el).setText(value.toString());
- fieldsViewer.refresh(el);
- updatePage();
- }
- }
+ public void modifyText(ModifyEvent e) {
+ updatePage();
}
-
- public Object getValue(Object element, String property) {
- if (element instanceof FieldText) {
- if (property.equals("field")) { //$NON-NLS-1$
- return ((FieldText) element).getText();
- }
- }
-
- return null;
- }
-
- public boolean canModify(Object element, String property) {
- if (element instanceof FieldText) {
- if (property.equals("field")) { //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
});
- if (fields == null) {
- fields = ""; //$NON-NLS-1$
- }
- fillFieldsList(fields);
- fieldsViewer.setInput(fieldsList);
+ quoteText.addModifyListener(new ModifyListener() {
- Composite buttonComposite = new Composite(fieldsComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.widthHint = 100;
- buttonComposite.setLayoutData(gd);
-
- GridLayout bgl = new GridLayout();
- buttonComposite.setLayout(bgl);
-
- gd = new GridData(GridData.FILL_HORIZONTAL);
-
- final Button addButton = new Button(buttonComposite, SWT.NONE);
- addButton.setLayoutData(gd);
- addButton.setText(Messages.FreemarkerCSVCreationWizardPage_AddFieldButtonText);
-
- final Button removeButton = new Button(buttonComposite, SWT.NONE);
- removeButton.setLayoutData(gd);
- removeButton.setText(Messages.FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel);
-
- addButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- addButton.setEnabled(false);
- try {
- FieldText field = new FieldText("field"); //$NON-NLS-1$
- fieldsList.add(field);
- fieldsViewer.refresh();
- updatePage();
- } catch (Throwable t) {
-
- } finally {
- addButton.setEnabled(true);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- removeButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection s = (IStructuredSelection) fieldsViewer.getSelection();
- fieldsList.removeAll(s.toList());
- fieldsViewer.refresh();
+ public void modifyText(ModifyEvent e) {
updatePage();
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
});
- this.setControl(mainComposite);
-
- seperatorText.setText(","); //$NON-NLS-1$
- quoteText.setText("\""); //$NON-NLS-1$
-
- seperatorText.addModifyListener(new ModifyListener() {
+ fieldsText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updatePage();
}
});
- quoteText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updatePage();
- }
- });
-
this.setPageComplete(false);
}
@@ -285,6 +300,7 @@
String error = null;
String seperator = seperatorText.getText();
String quote = quoteText.getText();
+ String fields = fieldsText.getText();
if (seperator == null || seperator.length() == 0) {
error = Messages.FreemarkerCSVCreationWizardPage_SeperatorEmptyErrorMessage;
}
@@ -298,9 +314,44 @@
if (quote != null && quote.length() > 1) {
error = "Quote must be only one character"; //$NON-NLS-1$
}
- if (fieldsList.isEmpty()) {
- error = Messages.FreemarkerCSVCreationWizardPage_FieldEmptyErrorMessage;
+ if (fields == null) {
+ error = "Fields can't be empty";
+ } else {
+ fields = fields.trim();
+ if ("".equals(fields)) { //$NON-NLS-1$
+ error = "Fields can't be empty";
+ } else {
+ char[] chars = fields.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ char c = chars[i];
+ if (c == ',') {
+ continue;
+ }
+ if (Character.isLetterOrDigit(c)) {
+
+ } else {
+ error = "The '" + c + "' is incorrect in the fields string";
+ break;
+ }
+ }
+
+ String[] fieldsArray = fields.split(",");
+ if(fieldsArray.length == 0){
+ error = "Fields can't be empty";
+ }
+ for (int i = 0; i < fieldsArray.length; i++) {
+ String f = fieldsArray[i];
+ if(f == null || "".equals(f.trim())){
+ error = "Fields can't be empty";
+ break;
+ }
+ }
+ }
}
+ // if (fieldsList.isEmpty()) {
+ // error =
+ // Messages.FreemarkerCSVCreationWizardPage_FieldEmptyErrorMessage;
+ // }
this.setErrorMessage(error);
this.setPageComplete(error == null);
}
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/FreemarkerCSVTemplateCreationWizard.java 2009-12-04 12:22:40 UTC (rev 19045)
@@ -11,11 +11,9 @@
package org.jboss.tools.smooks.graphical.wizard.freemarker;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.wizard.Wizard;
-import org.jboss.tools.smooks.graphical.wizard.freemarker.FreemarkerCSVCreationWizardPage.FieldText;
/**
* @author Dart
@@ -28,6 +26,7 @@
private String quote;
private List<String> fields = new ArrayList<String>();
+ private String fieldsString;
public FreemarkerCSVTemplateCreationWizard() {
super();
@@ -51,9 +50,9 @@
/**
* @return the fields
*/
- public List<String> getFields() {
- return fields;
- }
+// public List<String> getFields() {
+// return fields;
+// }
/*
* (non-Javadoc)
@@ -68,7 +67,13 @@
this.addPage(page);
super.addPages();
}
+
+
+ public String getFieldsString() {
+ return fieldsString;
+ }
+
/*
* (non-Javadoc)
*
@@ -79,11 +84,12 @@
if (page != null) {
seprator = page.getSeperatorText().getText();
quote = page.getQuoteText().getText();
- List<FieldText> fieldList = page.getFieldsList();
- for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();) {
- FieldText fieldText = (FieldText) iterator.next();
- fields.add(fieldText.getText());
- }
+ fieldsString = page.getFieldsText().getText();
+// List<FieldText> fieldList = page.getFieldsList();
+// for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();) {
+// FieldText fieldText = (FieldText) iterator.next();
+// fields.add(fieldText.getText());
+// }
return true;
}
return true;
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties 2009-12-04 10:55:06 UTC (rev 19044)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizard/freemarker/messages.properties 2009-12-04 12:22:40 UTC (rev 19045)
@@ -6,5 +6,5 @@
FreemarkerCSVCreationWizardPage_RemoveFieldButtonLabel=Remove
FreemarkerCSVCreationWizardPage_SeperatorCharLabel=Seperator Character :
FreemarkerCSVCreationWizardPage_SeperatorEmptyErrorMessage=Seperator can't be null
-FreemarkerCSVCreationWizardPage_WizardDes=Configurate CSV Template
+FreemarkerCSVCreationWizardPage_WizardDes=Configurate CSV Template. Use ',' to seperate the CSV field string.
FreemarkerCSVCreationWizardPage_WizardTitle=CSV Template Configuration
15 years, 1 month
JBoss Tools SVN: r19044 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources: jsf2test/JavaSource/demo and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-12-04 05:55:06 -0500 (Fri, 04 Dec 2009)
New Revision: 19044
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_de.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_GB.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5218, adding messages to jsf2test.
Copied: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_de.properties (from rev 19043, trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties)
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_de.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_de.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -0,0 +1,3 @@
+header=German Hello Demo Application
+prompt_message=German Name:
+hello_message=German Hello
Copied: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_GB.properties (from rev 19043, trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties)
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_GB.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_GB.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -0,0 +1,3 @@
+header=Great Britain Hello!
+prompt_message=Great Britain Name:
+hello_message=Great Britain Hello
Copied: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties (from rev 19043, trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties)
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -0,0 +1,3 @@
+header=US Hello Demo Application
+prompt_message=US Name:
+hello_message=US Hello
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties 2009-12-04 10:03:43 UTC (rev 19043)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -1,3 +0,0 @@
-header=German Hello Demo Application
-prompt_message=German Name:
-hello_message=German Hello
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties 2009-12-04 10:03:43 UTC (rev 19043)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -1,3 +0,0 @@
-header=Great Britain Hello!
-prompt_message=Great Britain Name:
-hello_message=Great Britain Hello
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties 2009-12-04 10:03:43 UTC (rev 19043)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties 2009-12-04 10:55:06 UTC (rev 19044)
@@ -1,3 +0,0 @@
-header=US Hello Demo Application
-prompt_message=US Name:
-hello_message=US Hello
15 years, 1 month
JBoss Tools SVN: r19043 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-12-04 05:03:43 -0500 (Fri, 04 Dec 2009)
New Revision: 19043
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5218, adding messages.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_de.properties 2009-12-04 10:03:43 UTC (rev 19043)
@@ -0,0 +1,3 @@
+header=German Hello Demo Application
+prompt_message=German Name:
+hello_message=German Hello
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_GB.properties 2009-12-04 10:03:43 UTC (rev 19043)
@@ -0,0 +1,3 @@
+header=Great Britain Hello!
+prompt_message=Great Britain Name:
+hello_message=Great Britain Hello
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/JavaSource/demo/Messages_en_US.properties 2009-12-04 10:03:43 UTC (rev 19043)
@@ -0,0 +1,3 @@
+header=US Hello Demo Application
+prompt_message=US Name:
+hello_message=US Hello
15 years, 1 month