Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » SelectionInfo in ToolBehaviorProvider is null(Null Pointer Exception when moving shapes)
SelectionInfo in ToolBehaviorProvider is null [message #1503216] Mon, 08 December 2014 09:03 Go to next message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013

I have a problem with moving graphical elements in my editor.
In some cases, a null pointer exception is thrown in the method adaptBackgroundToHover in class GFAbstractShape.

private boolean adaptBackgroundToHover(Graphics graphics) {
	if (getVisualState().getHoverFeedback() == IVisualState.HOVER_ON) {
		IToolBehaviorProvider tbp = getConfigurationProvider().getDiagramTypeProvider()
		IFigure parent = getParent();
		boolean parentSelected = false;
		if (parent instanceof GFAbstractShape) {
			GFAbstractShape gfa = (GFAbstractShape) parent;
			IVisualState visualState = gfa.getVisualState();
			parentSelected = visualState.getSelectionFeedback() == IVisualState.SELECTION_PRIMARY;
		PictogramElement pe = getPictogramElementDelegate().getPictogramElement();
		if (!(pe instanceof
			return false; s = ( pe;
		ISelectionInfo selectionInfo = tbp.getSelectionInfoForShape(s);
		IColorConstant hoverColor = null;
		hoverColor = selectionInfo.getHoverColor();
		if (parentSelected)
			hoverColor = selectionInfo.getHoverColorParentSelected();
		if (hoverColor != null) {
			Color hoverColorSwt = DataTypeTransformation.toSwtColor(getConfigurationProvider()
					.getResourceRegistry(), hoverColor);
			return true;
	return false;

The problem is, that selectInfo and hoverColor are null. The problem concerns moving of simple graphical elements, such as rectangle, ellipse, etc.

What could cause this problem? Can someone help?
Re: SelectionInfo in ToolBehaviorProvider is null [message #1503599 is a reply to message #1503216] Mon, 08 December 2014 16:06 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1898
Registered: July 2009
Location: Walldorf, Germany
Senior Member

I gues you refer to selectionInfo with selctInfo? That is retrieved from you
tool behavior provider; have you overridden getSelectionInfoForShape or
other getSelectionInfo methods there? In case yes, these methods must not
return null.

Previous Topic:How to add a search bar on top of IPaletteCompartmentEntries
Next Topic:Create automatic decoration between two pictogram elements
Goto Forum:

Current Time: Thu Sep 20 01:41:01 GMT 2018

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

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

Back to the top