Author: DartPeng
Date: 2008-08-29 05:08:39 -0400 (Fri, 29 Aug 2008)
New Revision: 9954
Added:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IValidatable.java
Removed:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalFactory.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalPackage.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/graphInfor.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/impl/
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/mappingType.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalAdapterFactory.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalSwitch.java
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.ecore
workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.genmodel
workspace/dart/plugins/org.jboss.tools.smooks.ui/plugin.xml
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IAnalyzer.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/Test.java
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
Log:
Delete old graphical model,
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-08-29
09:07:03 UTC (rev 9953)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-08-29
09:08:39 UTC (rev 9954)
@@ -19,7 +19,8 @@
org.jboss.tools.smooks.model,
org.eclipse.emf,
org.eclipse.emf.edit,
- org.jboss.tools.smooks.model.edit
+ org.jboss.tools.smooks.model.edit,
+ org.jboss.tools.smooks.graphicalInfo
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.ecore
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.ecore 2008-08-29
09:07:03 UTC (rev 9953)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.ecore 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,14 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
name="graphical"
+
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
name="org.jboss.tools.smooks.graphical"
nsURI="http://www.jboss.org/tools/smooks" nsPrefix="">
- <eClassifiers xsi:type="ecore:EClass" name="graphInfor">
- <eStructuralFeatures xsi:type="ecore:EReference"
name="mappingType" eType="#//mappingType"
+ <eClassifiers xsi:type="ecore:EClass"
name="GraphInformations">
+ <eStructuralFeatures xsi:type="ecore:EReference"
name="mappingType" eType="#//MappingDataType"
containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="params"
eType="#//Params"
+ containment="true"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="mappingType">
+ <eClassifiers xsi:type="ecore:EClass"
name="MappingDataType">
<eStructuralFeatures xsi:type="ecore:EAttribute"
name="targetTypeID" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute"
name="sourceTypeID" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Params">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="param"
upperBound="-1"
+ eType="#//Param" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Param">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
</ecore:EPackage>
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.genmodel
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.genmodel 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/graphical/graphical.genmodel 2008-08-29
09:08:39 UTC (rev 9954)
@@ -7,12 +7,20 @@
<foreignModel>graphical.ecore</foreignModel>
<genPackages prefix="Graphical"
basePackage="org.jboss.tools.smooks" disposableProviderFactory="true"
ecorePackage="graphical.ecore#/">
- <genClasses ecoreClass="graphical.ecore#//graphInfor">
- <genFeatures property="None" children="true"
createChild="true" ecoreFeature="ecore:EReference
graphical.ecore#//graphInfor/mappingType"/>
+ <genClasses ecoreClass="graphical.ecore#//GraphInformations">
+ <genFeatures property="None" children="true"
createChild="true" ecoreFeature="ecore:EReference
graphical.ecore#//GraphInformations/mappingType"/>
+ <genFeatures property="None" children="true"
createChild="true" ecoreFeature="ecore:EReference
graphical.ecore#//GraphInformations/params"/>
</genClasses>
- <genClasses ecoreClass="graphical.ecore#//mappingType">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//mappingType/targetTypeID"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//mappingType/sourceTypeID"/>
+ <genClasses ecoreClass="graphical.ecore#//MappingDataType">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//MappingDataType/targetTypeID"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//MappingDataType/sourceTypeID"/>
</genClasses>
+ <genClasses ecoreClass="graphical.ecore#//Params">
+ <genFeatures property="None" children="true"
createChild="true" ecoreFeature="ecore:EReference
graphical.ecore#//Params/param"/>
+ </genClasses>
+ <genClasses ecoreClass="graphical.ecore#//Param">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//Param/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute
graphical.ecore#//Param/value"/>
+ </genClasses>
</genPackages>
</genmodel:GenModel>
Modified: workspace/dart/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- workspace/dart/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-08-29 09:07:03 UTC
(rev 9953)
+++ workspace/dart/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-08-29 09:08:39 UTC
(rev 9954)
@@ -14,4 +14,12 @@
id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
</editor>
</extension>
+ <extension
+ point="org.eclipse.emf.ecore.generated_package">
+ <package
+ class="org.milyn.xsd.smooks.SmooksPackage"
+ genModel="graphical/graphical.genmodel"
+
uri="http://www.jboss.org/tools/smooks">
+ </package>
+ </extension>
</plugin>
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/AnalyzerFactory.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -93,7 +93,7 @@
return instance;
}
- public IAnalyzer getAnalyzer(String sourceDataTypeID,
+ public IAnalyzer getGraphModelAnalyzer(String sourceDataTypeID,
String targetDataTypeID) throws CoreException {
if (this.analyzerMap != null) {
AnalyzerMapper mapper = (AnalyzerMapper) this.analyzerMap
@@ -107,6 +107,16 @@
return null;
}
+ public IAnalyzer getSmooksModelAnalyzer(String datatypeID)
+ throws CoreException {
+ if (this.analyzerMap != null) {
+ AnalyzerMapper mapper = (AnalyzerMapper) this.analyzerMap
+ .get(datatypeID);
+ return (IAnalyzer) createAnalyzer(mapper);
+ }
+ return null;
+ }
+
protected Object createAnalyzer(AnalyzerMapper mapper) throws CoreException {
return mapper.getElement().createExecutableExtension(
SmooksExtensionPointConstants.EXTENTION_POINT_ATTRIBUTE_CLASS);
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IAnalyzer.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IAnalyzer.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IAnalyzer.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -10,6 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.analyzer;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.smooks.graphical.GraphInformations;
+import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
import org.milyn.xsd.smooks.SmooksResourceListType;
@@ -18,7 +24,13 @@
*
*/
public interface IAnalyzer {
- public SmooksResourceListType analyzeMappingGraphModel(
+ public void analyzeMappingGraphModel(
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException;
+
+ public List<LineConnectionModel> analyzeMappingSmooksModel(
+ SmooksResourceListType listType);
+
+ public Object buildSourceInputObjects(GraphInformations graphInfo,
+ SmooksResourceListType listType, IFile sourceFile) throws InvocationTargetException;
}
Added:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IValidatable.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IValidatable.java
(rev 0)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IValidatable.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.analyzer;
+
+/**
+ * @author root
+ *
+ */
+public interface IValidatable {
+ public void setWarning(Object warning);
+
+ public Object getWarning();
+
+ public void setError(Object error);
+
+ public Object getError();
+}
Property changes on:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IValidatable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/SmooksFileBuilder.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -26,22 +26,24 @@
IProgressMonitor monitor) throws SmooksAnalyzerException,
IOException, CoreException {
AnalyzerFactory factory = AnalyzerFactory.getInstance();
- IAnalyzer analyzer = factory.getAnalyzer(context.getSourceDataTypeID(),
+ IAnalyzer analyzer = factory.getGraphModelAnalyzer(context.getSourceDataTypeID(),
context.getTargetDataTypeID());
-
+
if (analyzer == null)
throw new SmooksAnalyzerException(
"can't find the Analyzer for sourceID : "
+ context.getSourceDataTypeID()
+ " and the targetID : "
+ context.getTargetDataTypeID());
-
- SmooksResourceListType listType = analyzer
- .analyzeMappingGraphModel(context);
-
+
+ SmooksResourceListType listType = SmooksFactory.eINSTANCE
+ .createSmooksResourceListType();
+ context.setSmooksResourceListModel(listType);
+ analyzer.analyzeMappingGraphModel(context);
+
// init the smooksresourcelist
- initSmooksParseStyle(context,listType);
-
+ initSmooksParseStyle(context, listType);
+
// serialize model to stream
Resource resource = new SmooksResourceFactoryImpl()
.createResource(null);
@@ -55,25 +57,30 @@
resource.save(outputStream, Collections.EMPTY_MAP);
return new ByteArrayInputStream(outputStream.toByteArray());
}
+
/**
*
- * <code> <resource-config selector="global-parameters">
- * <param name="stream.filter.type">SAX< /param>
- * </resource-config> </code>
- * @param context
+ * <code> <resource-config selector="global-parameters">
+ * <param name="stream.filter.type">SAX< /param>
+ * </resource-config> </code>
+ *
+ * @param context
* @param resourceList
*/
- protected void initSmooksParseStyle(SmooksConfigurationFileGenerateContext
context,SmooksResourceListType resourceList){
-// String type = context.getSmooksType();
-// if(type == null) return;
-// ResourceConfigType config = SmooksFactory.eINSTANCE.createResourceConfigType();
-// config.setSelector(SmooksConstants.GLOBAL_PARAMETERS);
-// ParamType param = SmooksFactory.eINSTANCE.createParamType();
-// param.setName(SmooksConstants.STREAM_FILTER_TYPE);
-// SmooksModelUtils.appendTextToSmooksType(param, SmooksConstants.SAX);
-//
-// config.getParam().add(param);
-
-// resourceList.getAbstractResourceConfig().add(0,config);
+ protected void initSmooksParseStyle(
+ SmooksConfigurationFileGenerateContext context,
+ SmooksResourceListType resourceList) {
+ // String type = context.getSmooksType();
+ // if(type == null) return;
+ // ResourceConfigType config =
+ // SmooksFactory.eINSTANCE.createResourceConfigType();
+ // config.setSelector(SmooksConstants.GLOBAL_PARAMETERS);
+ // ParamType param = SmooksFactory.eINSTANCE.createParamType();
+ // param.setName(SmooksConstants.STREAM_FILTER_TYPE);
+ // SmooksModelUtils.appendTextToSmooksType(param, SmooksConstants.SAX);
+ //
+ // config.getParam().add(param);
+
+ // resourceList.getAbstractResourceConfig().add(0,config);
}
}
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalFactory.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalFactory.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalFactory.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,55 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage
- * @generated
- */
-public interface GraphicalFactory extends EFactory {
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- GraphicalFactory eINSTANCE =
org.jboss.tools.smooks.graphical.impl.GraphicalFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>graph Infor</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>graph Infor</em>'.
- * @generated
- */
- graphInfor creategraphInfor();
-
- /**
- * Returns a new object of class '<em>mapping Type</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>mapping Type</em>'.
- * @generated
- */
- mappingType createmappingType();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- GraphicalPackage getGraphicalPackage();
-
-} //GraphicalFactory
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalPackage.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalPackage.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/GraphicalPackage.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,249 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.GraphicalFactory
- * @model kind="package"
- * @generated
- */
-public interface GraphicalPackage extends EPackage {
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "graphical";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "http://www.jboss.org/tools/smooks";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- GraphicalPackage eINSTANCE =
org.jboss.tools.smooks.graphical.impl.GraphicalPackageImpl.init();
-
- /**
- * The meta object id for the '{@link
org.jboss.tools.smooks.graphical.impl.graphInforImpl <em>graph
Infor</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.impl.graphInforImpl
- * @see org.jboss.tools.smooks.graphical.impl.GraphicalPackageImpl#getgraphInfor()
- * @generated
- */
- int GRAPH_INFOR = 0;
-
- /**
- * The feature id for the '<em><b>Mapping Type</b></em>'
containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int GRAPH_INFOR__MAPPING_TYPE = 0;
-
- /**
- * The number of structural features of the '<em>graph Infor</em>'
class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int GRAPH_INFOR_FEATURE_COUNT = 1;
-
- /**
- * The meta object id for the '{@link
org.jboss.tools.smooks.graphical.impl.mappingTypeImpl <em>mapping
Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.impl.mappingTypeImpl
- * @see org.jboss.tools.smooks.graphical.impl.GraphicalPackageImpl#getmappingType()
- * @generated
- */
- int MAPPING_TYPE = 1;
-
- /**
- * The feature id for the '<em><b>Target Type
ID</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int MAPPING_TYPE__TARGET_TYPE_ID = 0;
-
- /**
- * The feature id for the '<em><b>Source Type
ID</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int MAPPING_TYPE__SOURCE_TYPE_ID = 1;
-
- /**
- * The number of structural features of the '<em>mapping Type</em>'
class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int MAPPING_TYPE_FEATURE_COUNT = 2;
-
-
- /**
- * Returns the meta object for class '{@link
org.jboss.tools.smooks.graphical.graphInfor <em>graph Infor</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>graph Infor</em>'.
- * @see org.jboss.tools.smooks.graphical.graphInfor
- * @generated
- */
- EClass getgraphInfor();
-
- /**
- * Returns the meta object for the containment reference '{@link
org.jboss.tools.smooks.graphical.graphInfor#getMappingType <em>Mapping
Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Mapping
Type</em>'.
- * @see org.jboss.tools.smooks.graphical.graphInfor#getMappingType()
- * @see #getgraphInfor()
- * @generated
- */
- EReference getgraphInfor_MappingType();
-
- /**
- * Returns the meta object for class '{@link
org.jboss.tools.smooks.graphical.mappingType <em>mapping Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>mapping Type</em>'.
- * @see org.jboss.tools.smooks.graphical.mappingType
- * @generated
- */
- EClass getmappingType();
-
- /**
- * Returns the meta object for the attribute '{@link
org.jboss.tools.smooks.graphical.mappingType#getTargetTypeID <em>Target Type
ID</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Target Type
ID</em>'.
- * @see org.jboss.tools.smooks.graphical.mappingType#getTargetTypeID()
- * @see #getmappingType()
- * @generated
- */
- EAttribute getmappingType_TargetTypeID();
-
- /**
- * Returns the meta object for the attribute '{@link
org.jboss.tools.smooks.graphical.mappingType#getSourceTypeID <em>Source Type
ID</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Source Type
ID</em>'.
- * @see org.jboss.tools.smooks.graphical.mappingType#getSourceTypeID()
- * @see #getmappingType()
- * @generated
- */
- EAttribute getmappingType_SourceTypeID();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- GraphicalFactory getGraphicalFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link
org.jboss.tools.smooks.graphical.impl.graphInforImpl <em>graph
Infor</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.impl.graphInforImpl
- * @see org.jboss.tools.smooks.graphical.impl.GraphicalPackageImpl#getgraphInfor()
- * @generated
- */
- EClass GRAPH_INFOR = eINSTANCE.getgraphInfor();
-
- /**
- * The meta object literal for the '<em><b>Mapping
Type</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference GRAPH_INFOR__MAPPING_TYPE = eINSTANCE.getgraphInfor_MappingType();
-
- /**
- * The meta object literal for the '{@link
org.jboss.tools.smooks.graphical.impl.mappingTypeImpl <em>mapping
Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.impl.mappingTypeImpl
- * @see org.jboss.tools.smooks.graphical.impl.GraphicalPackageImpl#getmappingType()
- * @generated
- */
- EClass MAPPING_TYPE = eINSTANCE.getmappingType();
-
- /**
- * The meta object literal for the '<em><b>Target Type
ID</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute MAPPING_TYPE__TARGET_TYPE_ID = eINSTANCE.getmappingType_TargetTypeID();
-
- /**
- * The meta object literal for the '<em><b>Source Type
ID</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute MAPPING_TYPE__SOURCE_TYPE_ID = eINSTANCE.getmappingType_SourceTypeID();
-
- }
-
-} //GraphicalPackage
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/graphInfor.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/graphInfor.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/graphInfor.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,54 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>graph
Infor</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.jboss.tools.smooks.graphical.graphInfor#getMappingType
<em>Mapping Type</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage#getgraphInfor()
- * @model
- * @generated
- */
-public interface graphInfor extends EObject {
- /**
- * Returns the value of the '<em><b>Mapping
Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping Type</em>' containment
reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping Type</em>' containment
reference.
- * @see #setMappingType(mappingType)
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage#getgraphInfor_MappingType()
- * @model containment="true"
- * @generated
- */
- mappingType getMappingType();
-
- /**
- * Sets the value of the '{@link
org.jboss.tools.smooks.graphical.graphInfor#getMappingType <em>Mapping
Type</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapping Type</em>'
containment reference.
- * @see #getMappingType()
- * @generated
- */
- void setMappingType(mappingType value);
-
-} // graphInfor
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/mappingType.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/mappingType.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/mappingType.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,81 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>mapping
Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.jboss.tools.smooks.graphical.mappingType#getTargetTypeID
<em>Target Type ID</em>}</li>
- * <li>{@link org.jboss.tools.smooks.graphical.mappingType#getSourceTypeID
<em>Source Type ID</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage#getmappingType()
- * @model
- * @generated
- */
-public interface mappingType extends EObject {
- /**
- * Returns the value of the '<em><b>Target Type
ID</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Target Type ID</em>' attribute
isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Target Type ID</em>' attribute.
- * @see #setTargetTypeID(String)
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage#getmappingType_TargetTypeID()
- * @model
- * @generated
- */
- String getTargetTypeID();
-
- /**
- * Sets the value of the '{@link
org.jboss.tools.smooks.graphical.mappingType#getTargetTypeID <em>Target Type
ID</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Target Type ID</em>'
attribute.
- * @see #getTargetTypeID()
- * @generated
- */
- void setTargetTypeID(String value);
-
- /**
- * Returns the value of the '<em><b>Source Type
ID</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Source Type ID</em>' attribute
isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Source Type ID</em>' attribute.
- * @see #setSourceTypeID(String)
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage#getmappingType_SourceTypeID()
- * @model
- * @generated
- */
- String getSourceTypeID();
-
- /**
- * Sets the value of the '{@link
org.jboss.tools.smooks.graphical.mappingType#getSourceTypeID <em>Source Type
ID</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Source Type ID</em>'
attribute.
- * @see #getSourceTypeID()
- * @generated
- */
- void setSourceTypeID(String value);
-
-} // mappingType
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalAdapterFactory.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalAdapterFactory.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalAdapterFactory.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,142 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.jboss.tools.smooks.graphical.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the
model.
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage
- * @generated
- */
-public class GraphicalAdapterFactory extends AdapterFactoryImpl {
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static GraphicalPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public GraphicalAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = GraphicalPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the
model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected GraphicalSwitch<Adapter> modelSwitch =
- new GraphicalSwitch<Adapter>() {
- @Override
- public Adapter casegraphInfor(graphInfor object) {
- return creategraphInforAdapter();
- }
- @Override
- public Adapter casemappingType(mappingType object) {
- return createmappingTypeAdapter();
- }
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject)target);
- }
-
-
- /**
- * Creates a new adapter for an object of class '{@link
org.jboss.tools.smooks.graphical.graphInfor <em>graph Infor</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.jboss.tools.smooks.graphical.graphInfor
- * @generated
- */
- public Adapter creategraphInforAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link
org.jboss.tools.smooks.graphical.mappingType <em>mapping Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.jboss.tools.smooks.graphical.mappingType
- * @generated
- */
- public Adapter createmappingTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //GraphicalAdapterFactory
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -11,23 +11,26 @@
package org.jboss.tools.smooks.graphical.util;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collections;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
+import org.jboss.tools.smooks.graphical.GraphInformations;
import org.jboss.tools.smooks.graphical.GraphicalFactory;
-import org.jboss.tools.smooks.graphical.graphInfor;
-import org.jboss.tools.smooks.graphical.mappingType;
+import org.jboss.tools.smooks.graphical.MappingDataType;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
/**
@@ -35,9 +38,10 @@
* @Date Aug 25, 2008
*/
public class GraphicalInformationSaver {
- private IFile graphicalFile = null;
private IEditorInput input;
+ protected Resource graphicalFileResource;
+
/**
* Create the instance during init step
*
@@ -53,43 +57,65 @@
String gfileName = fileName + ".graph";
if (container != null) {
IFile gfile = container.getFile(new Path(gfileName));
- graphicalFile = gfile;
+ if(!gfile.exists()){
+ try {
+ gfile.create(new ByteArrayInputStream("".getBytes()), true, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ String path = rootPath.append(gfile.getFullPath()).toString();
+ graphicalFileResource = new XMLResourceFactoryImpl()
+ .createResource(URI.createFileURI(path));
}
}
}
}
+ public GraphInformations doLoad() throws IOException {
+ // throw new IOException("can't find the file");
+ if (graphicalFileResource != null) {
+ graphicalFileResource.load(Collections.EMPTY_MAP);
+ GraphInformations graph = (GraphInformations) graphicalFileResource
+ .getContents().get(0);
+ return graph;
+ }
+ return null;
+ }
+
public void doSave(IProgressMonitor monitor,
SmooksConfigurationFileGenerateContext context) throws IOException,
CoreException {
- if (graphicalFile == null)
- throw new IOException("can't find the file");
String sourceID = context.getSourceDataTypeID();
String targetID = context.getTargetDataTypeID();
+ GraphInformations graph = null;
+ if (graphicalFileResource != null) {
+ if (graphicalFileResource.getContents().isEmpty()) {
+ graph = GraphicalFactory.eINSTANCE.createGraphInformations();
+ graphicalFileResource.getContents().add(graph);
+ } else {
+ graph = (GraphInformations) graphicalFileResource.getContents()
+ .get(0);
+ }
+ if (graph != null) {
+ initMappingTypes(graph, sourceID, targetID);
+ }
+ graphicalFileResource.save(Collections.EMPTY_MAP);
+ }
- graphInfor infor = GraphicalFactory.eINSTANCE.creategraphInfor();
- initMappingTypes(infor, sourceID, targetID);
- XMLResource re = new XMLResourceImpl();
- re.getContents().add(infor);
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- re.save(outputStream, Collections.EMPTY_MAP);
+ }
- if (graphicalFile.exists()) {
- graphicalFile.setContents(new ByteArrayInputStream(outputStream
- .toByteArray()), IResource.FORCE, monitor);
- } else {
- graphicalFile.create(new ByteArrayInputStream(outputStream
- .toByteArray()), IResource.FORCE, monitor);
+ protected void initMappingTypes(GraphInformations infor, String sourceID,
+ String targetID) {
+ MappingDataType mapping = infor.getMappingType();
+ if (mapping == null) {
+ mapping = GraphicalFactory.eINSTANCE.createMappingDataType();
+ infor.setMappingType(mapping);
}
- }
- protected void initMappingTypes(graphInfor infor, String sourceID,
- String targetID) {
- mappingType mapping = GraphicalFactory.eINSTANCE.createmappingType();
mapping.setSourceTypeID(sourceID);
mapping.setTargetTypeID(targetID);
-
- infor.setMappingType(mapping);
}
}
Deleted:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalSwitch.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalSwitch.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalSwitch.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -1,151 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.jboss.tools.smooks.graphical.util;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-import org.jboss.tools.smooks.graphical.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.jboss.tools.smooks.graphical.GraphicalPackage
- * @generated
- */
-public class GraphicalSwitch<T> {
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static GraphicalPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public GraphicalSwitch() {
- if (modelPackage == null) {
- modelPackage = GraphicalPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code>
call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code>
call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code>
call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case GraphicalPackage.GRAPH_INFOR: {
- graphInfor graphInfor = (graphInfor)theEObject;
- T result = casegraphInfor(graphInfor);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case GraphicalPackage.MAPPING_TYPE: {
- mappingType mappingType = (mappingType)theEObject;
- T result = casemappingType(mappingType);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>graph
Infor</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>graph
Infor</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casegraphInfor(graphInfor object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of
'<em>mapping Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of
'<em>mapping Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casemappingType(mappingType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of
'<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case
anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of
'<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-
-} //GraphicalSwitch
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/Test.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/Test.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/Test.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -14,12 +14,15 @@
import java.util.Collections;
import org.eclipse.emf.ecore.EPackage.Registry;
-import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
+import org.jboss.tools.smooks.graphical.GraphInformations;
import org.jboss.tools.smooks.graphical.GraphicalFactory;
import org.jboss.tools.smooks.graphical.GraphicalPackage;
-import org.jboss.tools.smooks.graphical.graphInfor;
-import org.jboss.tools.smooks.graphical.mappingType;
+import org.jboss.tools.smooks.graphical.MappingDataType;
+import org.jboss.tools.smooks.graphical.Param;
+import org.jboss.tools.smooks.graphical.Params;
/**
* @author Dart Peng
@@ -27,22 +30,32 @@
*/
public class Test {
public static void main(String[] args) {
-
- Registry.INSTANCE.put(GraphicalPackage.eNS_URI, GraphicalPackage.eINSTANCE);
-
- graphInfor graph = GraphicalFactory.eINSTANCE.creategraphInfor();
- mappingType t = GraphicalFactory.eINSTANCE.createmappingType();
-
+
+ Registry.INSTANCE.put(GraphicalPackage.eNS_URI,
+ GraphicalPackage.eINSTANCE);
+
+ GraphInformations graph = GraphicalFactory.eINSTANCE
+ .createGraphInformations();
+ MappingDataType t = GraphicalFactory.eINSTANCE.createMappingDataType();
+
t.setSourceTypeID("adfada");
-
+
graph.setMappingType(t);
+
+ Params params = GraphicalFactory.eINSTANCE.createParams();
+ Param p = GraphicalFactory.eINSTANCE.createParam();
+ p.setName("classname");
+ p.setValue("dfafdafa");
+ params.getParam().add(p);
- XMLResource resource= new XMLResourceImpl();
+ graph.setParams(params);
+
+ Resource resource = new XMLResourceFactoryImpl().createResource(null);
resource.getContents().add(graph);
-
+
try {
- resource.save(System.out,Collections.EMPTY_MAP);
+ resource.save(System.out, Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Modified:
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
---
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-29
09:07:03 UTC (rev 9953)
+++
workspace/dart/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-08-29
09:08:39 UTC (rev 9954)
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.GraphicalViewer;
@@ -84,6 +85,7 @@
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
import org.jboss.tools.smooks.analyzer.SmooksFileBuilder;
import org.jboss.tools.smooks.graphical.GraphInformations;
+import org.jboss.tools.smooks.graphical.GraphicalPackage;
import org.jboss.tools.smooks.graphical.MappingDataType;
import org.jboss.tools.smooks.graphical.util.GraphicalInformationSaver;
import org.jboss.tools.smooks.ui.IStrucutredDataCreationWizard;
@@ -102,6 +104,7 @@
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
import org.jboss.tools.smooks.ui.wizards.TransformDataSelectionWizard;
import org.jboss.tools.smooks.utils.UIUtils;
+import org.milyn.xsd.smooks.DocumentRoot;
import org.milyn.xsd.smooks.SmooksResourceListType;
import org.milyn.xsd.smooks.util.SmooksConstants;
import org.milyn.xsd.smooks.util.SmooksResourceFactoryImpl;
@@ -585,22 +588,25 @@
*/
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
+ Registry.INSTANCE.put(GraphicalPackage.eNS_URI,
+ GraphicalPackage.eINSTANCE);
graphicalInformationSaver = new GraphicalInformationSaver(input);
try {
GraphInformations graph = graphicalInformationSaver.doLoad();
initFormEditorWithGraphInfo(graph);
- String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(
- ((IFileEditorInput) input).getFile().getFullPath()).toString();
+ String path = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation().append(
+ ((IFileEditorInput) input).getFile().getFullPath())
+ .toString();
Resource resource = new SmooksResourceFactoryImpl()
.createResource(URI.createFileURI(path));
resource.load(Collections.EMPTY_MAP);
- IAnalyzer analyzer = AnalyzerFactory.getInstance().getAnalyzer(
- sourceDataTypeID, targetDataTypeID);
-
-
- Object obj = analyzer.buildSourceInputObjects(graph,
- (SmooksResourceListType) resource.getContents().get(0),
+ IAnalyzer sourceModelAnalyzer =
AnalyzerFactory.getInstance().getSmooksModelAnalyzer(sourceDataTypeID);
+
+ SmooksResourceListType listType = ((DocumentRoot) resource
+ .getContents().get(0)).getSmooksResourceList();
+ Object obj = sourceModelAnalyzer.buildSourceInputObjects(graph, listType,
((IFileEditorInput) input).getFile());
} catch (IOException e) {
e.printStackTrace();