|
Re: [QVTo] UML Stereotypes application not set when launching transformation from Java [message #723487 is a reply to message #723094] |
Thu, 08 September 2011 16:33 |
--alex-- Messages: 26 Registered: October 2009 |
Junior Member |
|
|
Since I didn't find any way to resolve my problem (perhaps it is due to the ResourceSet) I solved by:
- creating a new launch configuration dynamically in Java and
- launching it DIRECTLY, i.e. not with a launch delegate (I need it to run in the same thread)
The code which solves my problem is the following:
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType c = manager.getLaunchConfigurationType(QvtLaunchConfigurationDelegate.LAUNCH_CONFIGURATION_TYPE_ID);
ILaunchConfigurationWorkingCopy instance = c.newInstance(null, NAME);
instance.setAttribute(IQvtLaunchConstants.CLEAR_CONTENTS+"1", true);
instance.setAttribute(IQvtLaunchConstants.CLEAR_CONTENTS+"2", true);
instance.setAttribute(IQvtLaunchConstants.CONFIGURATION_PROPERTIES, new HashMap());
instance.setAttribute(IQvtLaunchConstants.ELEM_COUNT, 2);
instance.setAttribute(IQvtLaunchConstants.FEATURE_NAME+"1", "");
instance.setAttribute(IQvtLaunchConstants.FEATURE_NAME+"2", "" );
instance.setAttribute(IQvtLaunchConstants.MODULE, transfURIString);
instance.setAttribute(IQvtLaunchConstants.TARGET_MODEL+"1", modelURIString);
instance.setAttribute(IQvtLaunchConstants.TARGET_MODEL+"2", marteURIString);
instance.setAttribute(IQvtLaunchConstants.TARGET_TYPE+"1", "NEW_MODEL");
instance.setAttribute(IQvtLaunchConstants.TARGET_TYPE+"2", "NEW_MODEL");
instance.setAttribute(IQvtLaunchConstants.TRACE_FILE, traceURIString);
instance.setAttribute(IQvtLaunchConstants.USE_TRACE_FILE, true);
QvtTransformation qvtTransformation = new QvtInterpretedTransformation(QvtLaunchConfigurationDelegateBase.getQvtModule(instance));
IStatus status = QvtLaunchConfigurationDelegateBase.validate(qvtTransformation, instance);
if(status.getSeverity() > IStatus.WARNING)
throw new CoreException(status);
StreamsProxy streamsProxy = new StreamsProxy();
EvaluationMonitor execMonitor = createMonitor();
Context context = QvtLaunchUtil.createContext(instance);
context.setLog(new WriterLog(streamsProxy.getOutputWriter()));
context.setMonitor(execMonitor);
QvtLaunchConfigurationDelegateBase.doLaunch(qvtTransformation, instance, context);
qvtTransformation.cleanup();
p.s. I created a monster but I don't have the time to tidy up the code
|
|
|
Powered by
FUDForum. Page generated in 0.02873 seconds