JBoss Tools SVN: r13833 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template: selectitem and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-02-26 09:37:34 -0500 (Thu, 26 Feb 2009)
New Revision: 13833
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3860
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2009-02-26 14:18:56 UTC (rev 13832)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2009-02-26 14:37:34 UTC (rev 13833)
@@ -150,7 +150,7 @@
creationData.setElementData(elementData);
}
- @Deprecated
+// @Deprecated
// protected String prepareAttrValue(VpePageContext pageContext,
// Element parent, Attr attr) {
//
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java 2009-02-26 14:18:56 UTC (rev 13832)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java 2009-02-26 14:37:34 UTC (rev 13833)
@@ -58,7 +58,6 @@
nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
// create span element
nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
- nsIDOMElement labelSpan = visualDocument.createElement(HTML.TAG_SPAN);
VpeCreationData creationData = new VpeCreationData(span);
@@ -78,11 +77,10 @@
label.setAttribute(HTML.ATTR_CLASS, enabledClass);
}
- label.appendChild(labelSpan);
span.appendChild(input);
span.appendChild(label);
- processOutputAttribute(pageContext, visualDocument, element, labelSpan,
+ processOutputAttribute(pageContext, visualDocument, element, label,
creationData);
return creationData;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java 2009-02-26 14:18:56 UTC (rev 13832)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java 2009-02-26 14:37:34 UTC (rev 13833)
@@ -10,23 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template.selectitem;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.AttributeData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author dmaliarevich
@@ -78,77 +70,6 @@
return creationData;
}
- protected void processOutputAttribute(VpePageContext pageContext,
- nsIDOMDocument visualDocument, Element sourceElement,
- nsIDOMElement targetVisualElement, VpeCreationData creationData) {
-
- VpeElementProxyData elementData = new VpeElementProxyData();
-
- Attr outputAttr = getOutputAttributeNode(sourceElement);
-
- if (outputAttr != null) {
-
- // prepare value
- String newValue = outputAttr.getValue();
-
- // if escape then contents of value (or other attribute) is only
- // text
- if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
- || Constants.TRUE.equalsIgnoreCase(sourceElement
- .getAttribute(JSF.ATTR_ESCAPE))) {
-
- String value = outputAttr.getNodeValue();
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(newValue);
-
- text = visualDocument.createTextNode(newValue);
- // add attribute for ability of editing
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, isEditable));
-
- targetVisualElement.appendChild(text);
-
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
- targetVisualElement);
-
- // get atribute's offset
- int offset = ((IDOMAttr) outputAttr)
- .getValueRegionStartOffset();
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(
- elementData, newValue, offset + 1);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- // add info to creation data
- targetVisualInfo.addSourceChild(child);
- }
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, false));
-
- creationData.addChildrenInfo(targetVisualInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
- }
-
/**
* Checks is attribute presents.
*
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java 2009-02-26 14:18:56 UTC (rev 13832)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java 2009-02-26 14:37:34 UTC (rev 13833)
@@ -10,9 +10,23 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template.selectitem;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.vpe.jsf.template.AbstractOutputJsfTemplate;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.AttributeData;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* This class is the base class for all templates of
@@ -38,4 +52,75 @@
public final Attr getOutputAttributeNode(Element element) {
return selectItemType.getOutputAttributeNode(element);
}
+
+ protected void processOutputAttribute(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, Element sourceElement,
+ nsIDOMElement targetVisualElement, VpeCreationData creationData) {
+
+ VpeElementProxyData elementData = new VpeElementProxyData();
+
+ Attr outputAttr = getOutputAttributeNode(sourceElement);
+
+ if (outputAttr != null) {
+
+ // prepare value
+ String newValue = outputAttr.getValue();
+
+ // if escape then contents of value (or other attribute) is only
+ // text
+ if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
+ || Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(JSF.ATTR_ESCAPE))) {
+
+ String value = outputAttr.getNodeValue();
+
+ nsIDOMText text;
+ // if bundleValue differ from value then will be represent
+ // bundleValue, but text will be not edit
+ boolean isEditable = value.equals(newValue);
+
+ text = visualDocument.createTextNode(newValue);
+ // add attribute for ability of editing
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, isEditable));
+
+ targetVisualElement.appendChild(text);
+
+ }
+ // then text can be html code
+ else {
+
+ // create info
+ VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
+ targetVisualElement);
+
+ // get atribute's offset
+ int offset = ((IDOMAttr) outputAttr)
+ .getValueRegionStartOffset();
+
+ // reparse attribute's value
+ NodeList list = NodeProxyUtil.reparseAttributeValue(
+ elementData, newValue, offset + 1);
+
+ // add children to info
+ for (int i = 0; i < list.getLength(); i++) {
+
+ Node child = list.item(i);
+
+ // add info to creation data
+ targetVisualInfo.addSourceChild(child);
+ }
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, false));
+
+ creationData.addChildrenInfo(targetVisualInfo);
+
+ }
+
+ }
+
+ creationData.setElementData(elementData);
+ }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java 2009-02-26 14:18:56 UTC (rev 13832)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java 2009-02-26 14:37:34 UTC (rev 13833)
@@ -3,6 +3,10 @@
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.w3c.dom.NodeList;
+/**
+ * TODO check if this class is necessary
+ *
+ */
public class VpeElementProxyData extends VpeElementData {
// private IStructuredModel model;
15 years, 10 months
JBoss Tools SVN: r13832 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-02-26 09:18:56 -0500 (Thu, 26 Feb 2009)
New Revision: 13832
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3878 - Fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-02-26 13:37:46 UTC (rev 13831)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2009-02-26 14:18:56 UTC (rev 13832)
@@ -720,9 +720,11 @@
for (ISeamComponentMethod method : methods) {
IMethod javaMethod = (IMethod)method.getSourceMember();
String methodName = javaMethod.getElementName();
- ISeamTextSourceReference methodNameLocation = getNameLocation(method);
- addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, preferenceKey, new String[]{methodName}, methodNameLocation, method.getResource());
- validationContext.addUnnamedCoreResource(declaration.getSourcePath());
+ if(declaration.getSourcePath().equals(javaMethod.getPath())) {
+ ISeamTextSourceReference methodNameLocation = getNameLocation(method);
+ addError(sufixMessageId + NONCOMPONENTS_METHOD_SUFIX_MESSAGE_ID, preferenceKey, new String[]{methodName}, methodNameLocation, method.getResource());
+ validationContext.addUnnamedCoreResource(declaration.getSourcePath());
+ }
}
} else {
validationContext.removeUnnamedCoreResource(declaration.getSourcePath());
15 years, 10 months
JBoss Tools SVN: r13831 - trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-02-26 08:37:46 -0500 (Thu, 26 Feb 2009)
New Revision: 13831
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
Log:
refreshVisuals when the label is moved
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-02-26 12:52:39 UTC (rev 13830)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-02-26 13:37:46 UTC (rev 13831)
@@ -106,7 +106,7 @@
}
public void modelChanged(ModelEvent event) {
- if (event.getChange() == Wrapper.CHANGE_PROPERTY) {
+ if (event.getChange() == Wrapper.CHANGE_PROPERTY || event.getChange() == Wrapper.CHANGE_VISUAL) {
refreshVisuals();
}
}
15 years, 10 months
JBoss Tools SVN: r13830 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-02-26 07:52:39 -0500 (Thu, 26 Feb 2009)
New Revision: 13830
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
close stream in finally and add npe check
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26 12:38:15 UTC (rev 13829)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26 12:52:39 UTC (rev 13830)
@@ -394,7 +394,7 @@
}
finally {
try {
- stream.close();
+ if (stream!=null) stream.close();
}
catch (IOException ioe) {
//log.warn( "could not close input stream for: " + resourceName, ioe );
@@ -417,21 +417,19 @@
InputStream is = null;
try {
is = ConfigHelper.getResourceAsStream(resource);
- } catch(HibernateException e) {
+ }
+ catch (HibernateException e) {
// just ignore
}
- boolean res = false;
- if (is != null )
- {
- res = true;
+ finally {
try {
- is.close();
+ if (is != null) is.close();
}
catch (IOException e) {
// ignore
}
}
- return res;
+ return (is != null);
}
/**
15 years, 10 months
JBoss Tools SVN: r13829 - trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-02-26 07:38:15 -0500 (Thu, 26 Feb 2009)
New Revision: 13829
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools/hibernate-tools.jar
Log:
JBIDE-3712 various fixes to make hbm.xml more complete
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools/hibernate-tools.jar
===================================================================
(Binary files differ)
15 years, 10 months
JBoss Tools SVN: r13828 - trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-02-26 05:54:56 -0500 (Thu, 26 Feb 2009)
New Revision: 13828
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools/hibernate-tools.jar
Log:
JBIDE-3712 various fixes to make hbm.xml more complete
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/lib/tools/hibernate-tools.jar
===================================================================
(Binary files differ)
15 years, 10 months
JBoss Tools SVN: r13827 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-02-26 05:29:38 -0500 (Thu, 26 Feb 2009)
New Revision: 13827
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java
Log:
JBIDE-3840
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java 2009-02-26 09:56:07 UTC (rev 13826)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationSettingsTab.java 2009-02-26 10:29:38 UTC (rev 13827)
@@ -297,7 +297,7 @@
}
if(reverseEngineeringSettings.getText().trim().length()>0) {
- msg = checkFile(getReverseEngineeringSettingsFile(), HibernateConsoleMessages.CodeGenerationSettingsTab_reveng_xml_3);
+ msg = PathHelper.checkFile(reverseEngineeringSettings.getText(), HibernateConsoleMessages.CodeGenerationSettingsTab_reveng_xml_3, true);
if(msg!=null) {
updateStatus(msg);
return;
15 years, 10 months
JBoss Tools SVN: r13826 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-02-26 04:56:07 -0500 (Thu, 26 Feb 2009)
New Revision: 13826
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
close input stream
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26 09:50:39 UTC (rev 13825)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-02-26 09:56:07 UTC (rev 13826)
@@ -420,7 +420,18 @@
} catch(HibernateException e) {
// just ignore
}
- return( is != null );
+ boolean res = false;
+ if (is != null )
+ {
+ res = true;
+ try {
+ is.close();
+ }
+ catch (IOException e) {
+ // ignore
+ }
+ }
+ return res;
}
/**
15 years, 10 months
JBoss Tools SVN: r13825 - in workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui: editors and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-02-26 04:50:39 -0500 (Thu, 26 Feb 2009)
New Revision: 13825
Added:
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/Report.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/TestResult.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceContentProvider.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceLabelProvider.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceModel.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanViewer.java
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/ISmooksTestRunner.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/editors/SmooksTestMultiPageEditor.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/views/SmooksTestEditor.java
workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/xml2java/X2JTestRunner.java
Log:
Modified: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/ISmooksTestRunner.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/ISmooksTestRunner.java 2009-02-26 08:05:24 UTC (rev 13824)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/ISmooksTestRunner.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -3,6 +3,7 @@
import javax.xml.transform.Source;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
public interface ISmooksTestRunner {
public String getSmooksConfigFilePath();
@@ -11,5 +12,5 @@
public void init(IFile configFile , Source inputSource);
- public Object run() throws Exception ;
+ public TestResult run(IProgressMonitor monitor) throws Exception ;
}
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/Report.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/Report.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/Report.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.smooks.tools.testui;
+
+/**
+ * @author Dart
+ *
+ */
+public class Report {
+
+ private String filePath;
+
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/Report.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/TestResult.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/TestResult.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/TestResult.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,18 @@
+package org.smooks.tools.testui;
+
+public class TestResult {
+ private Report report = null;
+ private Object result;
+ public Report getReport() {
+ return report;
+ }
+ public void setReport(Report report) {
+ this.report = report;
+ }
+ public Object getResult() {
+ return result;
+ }
+ public void setResult(Object result) {
+ this.result = result;
+ }
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/TestResult.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/editors/SmooksTestMultiPageEditor.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/editors/SmooksTestMultiPageEditor.java 2009-02-26 08:05:24 UTC (rev 13824)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/editors/SmooksTestMultiPageEditor.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -14,15 +14,11 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
-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.Display;
import org.eclipse.swt.widgets.FontDialog;
@@ -52,13 +48,9 @@
/** The text editor used in page 0. */
private TextEditor editor;
- /** The font chosen in page 1. */
- private Font font;
-
- /** The text widget used in page 2. */
- private StyledText text;
-
private SmooksTestEditor testEditor;
+
+ private Browser reportBrowser;
/**
* Creates a multi-page editor example.
*/
@@ -81,45 +73,31 @@
throw new RuntimeException(e1);
}
}
+
/**
* Creates page 1 of the multi-page editor,
* which allows you to change the font used in page 2.
*/
void createPage1() {
-
Composite composite = new Composite(getContainer(), SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- layout.numColumns = 2;
-
- Button fontButton = new Button(composite, SWT.NONE);
- GridData gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- fontButton.setLayoutData(gd);
- fontButton.setText("Change Font...");
-
- fontButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
-
+ composite.setLayout(new FillLayout());
+ reportBrowser = new Browser(composite,SWT.NONE);
int index = addPage(composite);
- setPageText(index, "Properties");
+ setPageText(index, "Report");
}
/**
* Creates page 2 of the multi-page editor,
* which shows the sorted text.
*/
void createPage2() {
- Composite composite = new Composite(getContainer(), SWT.NONE);
- FillLayout layout = new FillLayout();
- composite.setLayout(layout);
- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
- text.setEditable(false);
-
- int index = addPage(composite);
- setPageText(index, "Preview");
+// Composite composite = new Composite(getContainer(), SWT.NONE);
+// FillLayout layout = new FillLayout();
+// composite.setLayout(layout);
+// text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
+// text.setEditable(false);
+//
+// int index = addPage(composite);
+// setPageText(index, "Preview");
}
/**
* Creates the pages of the multi-page editor.
@@ -127,7 +105,6 @@
protected void createPages() {
createPage0();
createPage1();
-// createPage2();
}
/**
* The <code>MultiPageEditorPart</code> implementation of this
@@ -183,8 +160,18 @@
*/
protected void pageChange(int newPageIndex) {
super.pageChange(newPageIndex);
- if (newPageIndex == 2) {
- sortWords();
+ String report = testEditor.getReportFilePath();
+ if(report != null){
+ if(report.equals(reportBrowser.getUrl())){
+ reportBrowser.refresh();
+ return;
+ }
+ reportBrowser.setUrl(report);
+ reportBrowser.setVisible(true);
+ reportBrowser.forward();
+ }else{
+ reportBrowser.setVisible(false);
+ reportBrowser.refresh();
}
}
/**
@@ -205,41 +192,4 @@
});
}
}
- /**
- * Sets the font related data to be applied to the text in page 2.
- */
- void setFont() {
- FontDialog fontDialog = new FontDialog(getSite().getShell());
- fontDialog.setFontList(text.getFont().getFontData());
- FontData fontData = fontDialog.open();
- if (fontData != null) {
- if (font != null)
- font.dispose();
- font = new Font(text.getDisplay(), fontData);
- text.setFont(font);
- }
- }
- /**
- * Sorts the words in page 0, and shows them in page 2.
- */
- void sortWords() {
-
- String editorText =
- editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
-
- StringTokenizer tokenizer =
- new StringTokenizer(editorText, " \t\n\r\f!@#\u0024%^&*()-_=+`~[]{};:'\",.<>/?|\\");
- ArrayList editorWords = new ArrayList();
- while (tokenizer.hasMoreTokens()) {
- editorWords.add(tokenizer.nextToken());
- }
-
- Collections.sort(editorWords, Collator.getInstance());
- StringWriter displayText = new StringWriter();
- for (int i = 0; i < editorWords.size(); i++) {
- displayText.write(((String) editorWords.get(i)));
- displayText.write(System.getProperty("line.separator"));
- }
- text.setText(displayText.toString());
- }
}
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceContentProvider.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceContentProvider.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceContentProvider.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,25 @@
+/**
+ *
+ */
+package org.smooks.tools.testui.java;
+
+import org.jboss.tools.smooks.javabean.model.BeanContentProvider;
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanInstanceContentProvider extends BeanContentProvider {
+
+ @Override
+ public boolean hasChildren(Object bean) {
+ boolean has = super.hasChildren(bean);
+ if(!has) return has;
+ if(bean instanceof JavaBeanInstanceModel){
+ Object value = ((JavaBeanInstanceModel)bean).getValue();
+ if(value == null) return false;
+ }
+ return true;
+ }
+
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceLabelProvider.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceLabelProvider.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceLabelProvider.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,40 @@
+/**
+ *
+ */
+package org.smooks.tools.testui.java;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.smooks.javabean.model.BeanlabelProvider;
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanInstanceLabelProvider extends BeanlabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return getImage(element);
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return getText(element);
+ case 1:
+ if(element instanceof JavaBeanInstanceModel){
+ Object value = ((JavaBeanInstanceModel)element).getValue();
+ if(value != null){
+ return value.toString();
+ }
+ }
+ }
+ return "";
+ }
+
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceModel.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceModel.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceModel.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,69 @@
+/**
+ *
+ */
+package org.smooks.tools.testui.java;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jboss.tools.smooks.javabean.model.JavaBeanModel;
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanInstanceModel extends JavaBeanModel {
+
+ private Object instanceModel = null;
+
+ public Object getValue(Object args) {
+ if(instanceModel == null){
+ return null;
+ }
+ Method readMethod = this.getPropertyDescriptor().getReadMethod();
+ if(readMethod != null){
+ try {
+ readMethod.invoke(instanceModel, args);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ public Object getValue(){
+ return getValue(null);
+ }
+
+
+ public Object getInstanceModel() {
+ return instanceModel;
+ }
+
+ public void setInstanceModel(Object instanceModel) {
+ this.instanceModel = instanceModel;
+ }
+
+ public JavaBeanInstanceModel(Object instance , String beanId){
+ this(instance.getClass());
+ this.setInstanceModel(instance);
+ String name = getName();
+ if(beanId != null){
+ name += " (" + beanId + ")";
+ setName(name);
+ }
+ }
+
+ public JavaBeanInstanceModel(Class beanClass, String name) {
+ super(beanClass, name);
+ }
+
+ public JavaBeanInstanceModel(Class beanClass) {
+ super(beanClass);
+ }
+
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanInstanceModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanViewer.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanViewer.java (rev 0)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanViewer.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package org.smooks.tools.testui.java;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanViewer extends Composite {
+ TreeViewer viewer;
+
+ public JavaBeanViewer(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+ viewer = createJavaBeanTreeViewer(this, style);
+ }
+
+ public void setInput(Object input){
+ viewer.setInput(input);
+ }
+
+ public void refresh(){
+ viewer.refresh();
+ }
+
+ public TreeViewer getViewer() {
+ return viewer;
+ }
+
+ protected TreeViewer createJavaBeanTreeViewer(Composite parent , int style){
+ TreeViewer viewer = new TreeViewer(parent,SWT.NONE|style);
+ viewer.setContentProvider(new JavaBeanInstanceContentProvider());
+ viewer.setLabelProvider(new JavaBeanInstanceLabelProvider());
+ TreeColumn column = new TreeColumn(viewer.getTree(),SWT.NONE);
+ column.setWidth(150);
+ TreeColumn valuecolumn = new TreeColumn(viewer.getTree(),SWT.NONE);
+ valuecolumn.setWidth(150);
+ viewer.getTree().setLinesVisible(true);
+ viewer.getTree().setHeaderVisible(true);
+ return viewer;
+ }
+
+}
Property changes on: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/java/JavaBeanViewer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/views/SmooksTestEditor.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/views/SmooksTestEditor.java 2009-02-26 08:05:24 UTC (rev 13824)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/views/SmooksTestEditor.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -16,10 +16,22 @@
import javax.xml.transform.stream.StreamSource;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.custom.StyledText;
+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.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
@@ -35,6 +47,10 @@
import org.jboss.tools.smooks.ui.editors.SmooksFileEditorInput;
import org.jboss.tools.smooks.ui.wizards.SmooksConfigFileNewWizard;
import org.jboss.tools.smooks.xml2java.analyzer.AbstractXMLModelAnalyzer;
+import org.smooks.tools.testui.Report;
+import org.smooks.tools.testui.SmooksTestUIActivator;
+import org.smooks.tools.testui.TestResult;
+import org.smooks.tools.testui.java.JavaBeanViewer;
import org.smooks.tools.testui.xml2java.X2JTestRunner;
/**
@@ -45,6 +61,9 @@
private GraphInformations graphInformations;
private String inputSource;
+
+ private String reportFilePath = null;
+ private JavaBeanViewer viewer;
/*
* (non-Javadoc)
@@ -168,14 +187,45 @@
public void createPartControl(Composite parent) {
GridLayout gl = new GridLayout();
parent.setLayout(gl);
- StyledText text = new StyledText(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ CTabFolder tabFolder = new CTabFolder(parent, SWT.NONE);
+ tabFolder.setLayoutData(gd);
+ CTabItem textItem = new CTabItem(tabFolder, SWT.NONE);
+ textItem.setText("Text Input");
+
+ CTabItem graphInputItem = new CTabItem(tabFolder, SWT.NONE);
+ graphInputItem.setText("Input");
+
+ final StyledText text = new StyledText(tabFolder, SWT.V_SCROLL);
if (inputSource != null) {
text.setText(inputSource);
}
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ inputSource = text.getText();
+ }
+ });
+ textItem.setControl(text);
+ tabFolder.setSelection(textItem);
+ Composite operationComposite = createOperationComposite(parent);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ operationComposite.setLayoutData(gd);
+
+ Composite resultComposite = new Composite(parent,SWT.NONE);
+ resultComposite.setBackground(new Color(null,0,0,0));
+ resultComposite.setLayout(new FillLayout());
+ viewer = new JavaBeanViewer(resultComposite,SWT.NONE);
+ gd = new GridData(GridData.FILL_BOTH);
+ resultComposite.setLayoutData(gd);
+ }
- Button button = new Button(parent, SWT.NONE);
+ private Composite createOperationComposite(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayout(new FillLayout());
+ Button button = new Button(c, SWT.NONE);
+ button.setText("RUN");
button.addSelectionListener(this);
-
+ return c;
}
/*
@@ -191,9 +241,9 @@
public void widgetDefaultSelected(SelectionEvent e) {
}
-
+static int a = 0;
public void widgetSelected(SelectionEvent e) {
- X2JTestRunner runner = new X2JTestRunner();
+ final X2JTestRunner runner = new X2JTestRunner();
Source source = null;
if (inputSource != null) {
ByteArrayInputStream stream = new ByteArrayInputStream(inputSource
@@ -203,12 +253,73 @@
if (source != null) {
runner.init(((IFileEditorInput) this.getEditorInput()).getFile(),
source);
+ Exception exception = null;
+ final TestResult[] tr = new TestResult[]{null};
try {
- runner.run();
- } catch (Exception e1) {
- e1.printStackTrace();
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(
+ getSite().getShell());
+ dialog.run(false, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ try {
+ reportFilePath = null;
+ tr[0] = runner.run(monitor);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ });
+ } catch (InvocationTargetException e2) {
+ exception = e2;
+ } catch (InterruptedException e2) {
+ exception = e2;
}
+ if (exception instanceof InterruptedException) {
+ MessageDialog.openInformation(getSite().getShell(),
+ "Test Canceled", "User cancel the test");
+ }
+ if (exception instanceof InvocationTargetException) {
+ InvocationTargetException ie = (InvocationTargetException) exception;
+ Throwable t = ie.getTargetException();
+ while (t instanceof InvocationTargetException) {
+ t = ((InvocationTargetException) t).getTargetException();
+ }
+ Status status = new Status(Status.ERROR,
+ SmooksTestUIActivator.PLUGIN_ID, 1, "Look at the details", t);
+ ErrorDialog.openError(getSite().getShell(), "Error Dialog",
+ "Some errores occured during running the test case.",
+ status);
+ }
+
+ TestResult testResult = tr[0];
+ if(testResult != null){
+ processTestResult(testResult);
+ }
}
}
+
+ private void processTestResult(TestResult testResult){
+ if(testResult == null) return;
+ Report re = testResult.getReport();
+ if(re !=null){
+ reportFilePath= re.getFilePath();
+ }
+ Object result = testResult.getResult();
+ if(result != null && viewer != null){
+ viewer.setInput(result);
+ viewer.refresh();
+ }
+ }
+ public String getReportFilePath() {
+ return reportFilePath;
+ }
+
+ public void setReportFilePath(String reportFilePath) {
+ this.reportFilePath = reportFilePath;
+ }
+
}
Modified: workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/xml2java/X2JTestRunner.java
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/xml2java/X2JTestRunner.java 2009-02-26 08:05:24 UTC (rev 13824)
+++ workspace/dart/plugins/org.jboss.tools.smooks.testui/src/org/smooks/tools/testui/xml2java/X2JTestRunner.java 2009-02-26 09:50:39 UTC (rev 13825)
@@ -3,6 +3,7 @@
*/
package org.smooks.tools.testui.xml2java;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -11,8 +12,11 @@
import javax.xml.transform.Source;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -20,6 +24,7 @@
import org.jboss.tools.smooks.graphical.Param;
import org.jboss.tools.smooks.graphical.Params;
import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
+import org.jboss.tools.smooks.javabean.model.JavaBeanList;
import org.jboss.tools.smooks.model.AbstractResourceConfig;
import org.jboss.tools.smooks.model.DocumentRoot;
import org.jboss.tools.smooks.model.ResourceConfigType;
@@ -35,6 +40,9 @@
import org.milyn.event.report.HtmlReportGenerator;
import org.milyn.payload.JavaResult;
import org.smooks.tools.testui.ISmooksTestRunner;
+import org.smooks.tools.testui.Report;
+import org.smooks.tools.testui.TestResult;
+import org.smooks.tools.testui.java.JavaBeanInstanceModel;
/**
* @author Dart
@@ -80,19 +88,27 @@
return path;
}
- public Object run() throws Exception {
+ public TestResult run(IProgressMonitor monitor) throws Exception {
ClassLoader oldClassLoader = Thread.currentThread()
.getContextClassLoader();
- List resultList = new ArrayList();
+ monitor.beginTask("Run", 3);
+ TestResult testResult = new TestResult();
+ JavaBeanList resultList = new JavaBeanList();
+ Report report = null;
try {
+ monitor.setTaskName("create java project");
IJavaProject javaProject = JavaCore.create(configFile.getProject());
+ monitor.worked(1);
+
List<String> beanIdList = getBeanIdList();
ProjectClassLoader classLoader = new ProjectClassLoader(javaProject);
Thread.currentThread().setContextClassLoader(classLoader);
if (configFile == null)
throw new Exception("Can't load Config File");
+ monitor.setTaskName("New Smooks engine instance...");
Smooks smooks = new Smooks(configFile.getLocation()
.toPortableString());
+ monitor.worked(1);
ExecutionContext executionContext = smooks.createExecutionContext();
// Transform the source Order to the target LineOrder via a
@@ -105,20 +121,39 @@
// StreamSource streamSource = new StreamSource(ss);
JavaResult result = new JavaResult();
// Configure the execution context to generate a report...
+
+ IContainer container = configFile.getParent();
+ monitor.subTask("Creating Report File");
+ IFile reportFile = container.getFile(new Path(configFile.getName() + "report.html"));
+ if(!reportFile.exists()){
+ reportFile.create(new ByteArrayInputStream("".getBytes()), true, monitor);
+ }else{
+
+ }
executionContext.setEventListener(new HtmlReportGenerator(
- "target/report/report.html"));
+ reportFile.getLocation().toPortableString()));
+ monitor.subTask("");
+ monitor.setTaskName("Start to transform data...");
smooks.filter(inputSource, result, executionContext);
+ monitor.worked(1);
for (Iterator iterator = beanIdList.iterator(); iterator.hasNext();) {
String beanID = (String) iterator.next();
- System.out.println(result.getBean(beanID));
+ Object obj = result.getBean(beanID);
+ if(obj != null){
+ JavaBeanInstanceModel instanceModel = new JavaBeanInstanceModel(obj.getClass(),beanID);
+ resultList.addJavaBean(instanceModel);
+ }
}
+ report = new Report();
+ report.setFilePath(reportFile.getLocation().toPortableString());
+ testResult.setReport(report);
+ testResult.setResult(resultList);
} catch (Exception e) {
throw e;
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
- // LineOrder lineOrder = (LineOrder) result.getBean("LineOrder");
- return null;
+ return testResult;
}
private List<String> getBeanIdList() throws IOException, CoreException {
15 years, 10 months
JBoss Tools SVN: r13824 - trunk/jbpm/tests/org.jboss.tools.jbpm.convert.test.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-02-26 03:05:24 -0500 (Thu, 26 Feb 2009)
New Revision: 13824
Modified:
trunk/jbpm/tests/org.jboss.tools.jbpm.convert.test/
Log:
svn bin ignore
Property changes on: trunk/jbpm/tests/org.jboss.tools.jbpm.convert.test
___________________________________________________________________
Name: svn:ignore
+ bin
15 years, 10 months