Loading plugins/org.etsi.mts.tdl.helper/src/org/etsi/mts/tdl/helper/TDLHelper.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ import org.eclipse.ocl.pivot.internal.delegate.OCLInvocationDelegateFactory; import org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegateFactory; import org.eclipse.ocl.pivot.internal.delegate.OCLValidationDelegateFactory; import org.eclipse.ocl.xtext.essentialocl.EssentialOCLStandaloneSetup; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.resource.SaveOptions; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.serializer.impl.Serializer; import org.etsi.mts.tdl.TDLan2StandaloneSetup; import org.etsi.mts.tdl.TDLtxStandaloneSetup; import org.etsi.mts.tdl.TDLtxiStandaloneSetup; Loading Loading @@ -126,6 +129,22 @@ public class TDLHelper { } /** * Get textual representation of resource contents. * @param resource A resource to be represented. * @throws Exception */ public static String getText(Resource resource) throws Exception { // if (resource instanceof XtextResource) { // return NodeModelUtils.getNode(resource.getContents().get(0)).getText(); // } else { //TODO: this needs to be more robust for the desired format Serializer serializer = injector.getInstance(Serializer.class); return serializer.serialize(resource.getContents().get(0)); // } } /** * Setup and return an XtextResourceSet with TDLan2 file support. * @return A new XtextResourceSet. Loading Loading
plugins/org.etsi.mts.tdl.helper/src/org/etsi/mts/tdl/helper/TDLHelper.java +19 −0 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ import org.eclipse.ocl.pivot.internal.delegate.OCLInvocationDelegateFactory; import org.eclipse.ocl.pivot.internal.delegate.OCLSettingDelegateFactory; import org.eclipse.ocl.pivot.internal.delegate.OCLValidationDelegateFactory; import org.eclipse.ocl.xtext.essentialocl.EssentialOCLStandaloneSetup; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.resource.SaveOptions; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.serializer.impl.Serializer; import org.etsi.mts.tdl.TDLan2StandaloneSetup; import org.etsi.mts.tdl.TDLtxStandaloneSetup; import org.etsi.mts.tdl.TDLtxiStandaloneSetup; Loading Loading @@ -126,6 +129,22 @@ public class TDLHelper { } /** * Get textual representation of resource contents. * @param resource A resource to be represented. * @throws Exception */ public static String getText(Resource resource) throws Exception { // if (resource instanceof XtextResource) { // return NodeModelUtils.getNode(resource.getContents().get(0)).getText(); // } else { //TODO: this needs to be more robust for the desired format Serializer serializer = injector.getInstance(Serializer.class); return serializer.serialize(resource.getContents().get(0)); // } } /** * Setup and return an XtextResourceSet with TDLan2 file support. * @return A new XtextResourceSet. Loading