Skip to main content



      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 04:03 Go to next message
Eclipse UserFriend
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 11:06 Go to previous message
Eclipse UserFriend
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: Thu Jul 03 20:06:48 EDT 2025

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

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

Back to the top