i need help regarding a thrown exception please [message #228766] |
Mon, 04 May 2009 07:36  |
Eclipse User |
|
|
|
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);
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.25562 seconds