Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » i need help regarding a thrown exception please
i need help regarding a thrown exception please [message #228766] Mon, 04 May 2009 11:36 Go to next message
spyro  is currently offline spyro Friend
Messages: 18
Registered: July 2009
Junior Member
hello,
i have a problem with my GMF generated editor:
i added a command to change the color of my selected node from the context
menu. i wrote everything needed (registerd action, wrote the action, wrote
the command, editpolicies and all) but when i debug my command and i see
that when it comes to executing it, an exception is thrown

"java.lang.ClassCastException:
org.eclipse.gmf.runtime.notation.impl.NodeImpl cannot be cast to
XXX.diagram.edit.parts.RectangularKnotenEditPart"

in " org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt " class.

i tried all kinds of casts but everytime the same. do you have any idea
how can i go around this?
here is my command class:


import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt;
import org.eclipse.swt.graphics.Color;
import XXX.diagram.edit.parts.RectangularKnotenEditPart;

public class ColorCommand extends Command {
private RectangularKnotenEditPart model;
private Color oldColor;
private Color newColor;

@Override
public void execute() {

this.oldColor = model.getFigure().getForegroundColor();
this.model.getFigure().setForegroundColor(newColor);
model.refresh();
}
public void setModel(Object model) {
this.model = (RectangularKnotenEditPart) model;
}

public void setNewColor(Color newColor) {
this.newColor = newColor;
}

public void undo() {
this.model.getFigure().setForegroundColor(oldColor);
}
}
Re: i need help regarding a thrown exception please [message #228793 is a reply to message #228766] Mon, 04 May 2009 17:09 Go to previous message
spyro  is currently offline spyro Friend
Messages: 18
Registered: July 2009
Junior Member
just fixed it
Previous Topic:Don't want the generated diagram creation wizard
Next Topic:Set focus in properties view
Goto Forum:
  


Current Time: Wed Sep 25 01:37:31 GMT 2024

Powered by FUDForum. Page generated in 0.04320 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top