Problem by cast from AnyTypeImpl to ModelImpl [message #557414] |
Tue, 07 September 2010 06:57  |
Eclipse User |
|
|
|
Hallo,
i am facing a problem after migration of my oaw 4 project to oaw 5 project.
the class SimpleJavaModificationComponent doesn't exist anymore in oaw 5. so i found the thread in http://www.openarchitectureware.org/forum/viewtopic.php?show topic=14146&lastpost=true#15202 and try to created SimpleJavaModificationComponent .
unfortunately i got the cast-exception:
1. my SimpleJavaModificationComponent:
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
public abstract class SimpleJavaModificationComponent extends
WorkflowComponentWithModelSlot {
private Object modelObject;
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
Issues issues) {
String strName = getModelSlot();
modelObject = ctx.get(strName);
if (modelObject == null) {
issues.addWarning(this, "content of modelSlot " + getModelSlot()
+ " is null.");
}
doModification(ctx, monitor, issues, modelObject);
}
protected abstract void doModification(WorkflowContext ctx,
ProgressMonitor monitor, Issues issues, Object model);
}
2. my ModelTransformer Class
public class ModelTransformer extends SimpleJavaModificationComponent {
protected void doModification(WorkflowContext ctx, ProgressMonitor monitor,
Issues issues, Object model) {
ModelImpl dm = (ModelImpl) model;// <---caused an exception!!!
}
}
during debug i found out the Object model ist type of AnyTypeImpl. my question is how can i cast the AnyTypeImpl to ModelImpl?
thanks very much for your help.
|
|
|
|
|
|
|
|
|
|
Re: Problem by cast from AnyTypeImpl to ModelImpl [message #557489 is a reply to message #557414] |
Tue, 07 September 2010 12:45   |
Eclipse User |
|
|
|
Hi Ming
AnyType is the basic XMI element that Xtext uses until it can resolve a
proxy, so a CCE on an AnyType justvtells that a proxy resoluation failed
so your models/namespaces are incompatible or unresolvable.
If you search all ResourceSet.resources.errors you may find that
something is trying to tell you something; Xtext fails to explicitly
diagnose deep proxy resolution failures.
Regards
Ed Willink
On 07/09/2010 11:57, Ming Lu wrote:
> Hallo,
>
> i am facing a problem after migration of my oaw 4 project to oaw 5 project.
>
> the class SimpleJavaModificationComponent doesn't exist anymore in oaw
> 5. so i found the thread in
> http://www.openarchitectureware.org/forum/viewtopic.php?show topic=14146&lastpost=true#15202
> and try to created SimpleJavaModificationComponent .
>
> unfortunately i got the cast-exception:
>
> 1. my SimpleJavaModificationComponent:
>
> import org.eclipse.emf.mwe.core.WorkflowContext;
> import org.eclipse.emf.mwe.core.issues.Issues;
> import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot;
> import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
>
> public abstract class SimpleJavaModificationComponent extends
> WorkflowComponentWithModelSlot {
>
> private Object modelObject;
>
> @Override
> protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
> Issues issues) {
>
> String strName = getModelSlot();
> modelObject = ctx.get(strName);
>
> if (modelObject == null) {
> issues.addWarning(this, "content of modelSlot " + getModelSlot()
> + " is null.");
> }
>
> doModification(ctx, monitor, issues, modelObject);
> }
>
> protected abstract void doModification(WorkflowContext ctx,
> ProgressMonitor monitor, Issues issues, Object model);
>
> }
>
>
> 2. my ModelTransformer Class
>
> public class ModelTransformer extends SimpleJavaModificationComponent {
>
> protected void doModification(WorkflowContext ctx, ProgressMonitor monitor,
> Issues issues, Object model) {
>
> ModelImpl dm = (ModelImpl) model;// <---caused an exception!!!
> }
> }
>
>
> during debug i found out the Object model ist type of AnyTypeImpl. my
> question is how can i cast the AnyTypeImpl to ModelImpl?
> thanks very much for your help.
|
|
|
Re: Problem by cast from AnyTypeImpl to ModelImpl [message #557490 is a reply to message #557489] |
Tue, 07 September 2010 13:06   |
Eclipse User |
|
|
|
Hi Ming
Sorry wrong newsgroup. Nothing explicitly to do with Xtext, but the
proxy issue may still be relevant.
Regards
Ed Willink
>
> AnyType is the basic XMI element that Xtext uses until it can resolve a
> proxy, so a CCE on an AnyType justvtells that a proxy resoluation failed
> so your models/namespaces are incompatible or unresolvable.
>
> If you search all ResourceSet.resources.errors you may find that
> something is trying to tell you something; Xtext fails to explicitly
> diagnose deep proxy resolution failures.
>
> Regards
>
> Ed Willink
>
>
> On 07/09/2010 11:57, Ming Lu wrote:
>> Hallo,
>>
>> i am facing a problem after migration of my oaw 4 project to oaw 5
>> project.
>>
>> the class SimpleJavaModificationComponent doesn't exist anymore in oaw
>> 5. so i found the thread in
>> http://www.openarchitectureware.org/forum/viewtopic.php?show topic=14146&lastpost=true#15202
>>
>> and try to created SimpleJavaModificationComponent .
>>
>> unfortunately i got the cast-exception:
>>
>> 1. my SimpleJavaModificationComponent:
>>
>> import org.eclipse.emf.mwe.core.WorkflowContext;
>> import org.eclipse.emf.mwe.core.issues.Issues;
>> import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot;
>> import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
>>
>> public abstract class SimpleJavaModificationComponent extends
>> WorkflowComponentWithModelSlot {
>>
>> private Object modelObject;
>>
>> @Override
>> protected void invokeInternal(WorkflowContext ctx, ProgressMonitor
>> monitor,
>> Issues issues) {
>>
>> String strName = getModelSlot();
>> modelObject = ctx.get(strName);
>>
>> if (modelObject == null) {
>> issues.addWarning(this, "content of modelSlot " + getModelSlot()
>> + " is null.");
>> }
>>
>> doModification(ctx, monitor, issues, modelObject);
>> }
>>
>> protected abstract void doModification(WorkflowContext ctx,
>> ProgressMonitor monitor, Issues issues, Object model);
>>
>> }
>>
>>
>> 2. my ModelTransformer Class
>>
>> public class ModelTransformer extends SimpleJavaModificationComponent {
>>
>> protected void doModification(WorkflowContext ctx, ProgressMonitor
>> monitor,
>> Issues issues, Object model) {
>>
>> ModelImpl dm = (ModelImpl) model;// <---caused an exception!!!
>> }
>> }
>>
>>
>> during debug i found out the Object model ist type of AnyTypeImpl. my
>> question is how can i cast the AnyTypeImpl to ModelImpl?
>> thanks very much for your help.
>
|
|
|
|
|
|
|
|
Re: Problem by cast from AnyTypeImpl to ModelImpl [message #558188 is a reply to message #557973] |
Fri, 10 September 2010 09:16  |
Eclipse User |
|
|
|
Hi, Christian, Karsten, Edward
thanks a lot for your kindly helps!
i resolved the problem with the new component4oaw. it was the problem of uml 2 compilable from the c4oaw 1.6.1. with c4oaw 2.0 rc3 is my project runnable.
thanks again for your helps!
best regards and nice weekend!
~Ming
|
|
|
Powered by
FUDForum. Page generated in 0.52193 seconds