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
Member
Hello!

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()
				.getCurrentToolBehaviorProvider();
		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 org.eclipse.graphiti.mm.pictograms.Shape))
			return false;
		org.eclipse.graphiti.mm.pictograms.Shape s = (org.eclipse.graphiti.mm.pictograms.Shape) 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);
			graphics.setBackgroundColor(hoverColorSwt);
			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: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
John,

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.

Michael
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: Tue Mar 19 05:49:56 GMT 2024

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

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

Back to the top