Skip to main content



      Home
Home » Modeling » Graphiti » No Stop sign when drop is not allowed
No Stop sign when drop is not allowed [message #683674] Tue, 14 June 2011 04:25 Go to next message
Eclipse UserFriend
When I drop something in an editor, I can use the canAdd() operation of the AddFeature to make sure the drop will not take place if the dropped element does not fit.
However, this only seems to be triggered when I actually do the drop. Until then the plus sign is displayed. I would have expected that the canAdd() was dynamically called, such that the Stop symbol would display, even before doing the actual drop.
Is there an option I can set to enable this behaviour ?

Jos
Re: No Stop sign when drop is not allowed [message #683712 is a reply to message #683674] Tue, 14 June 2011 05:11 Go to previous messageGo to next message
Eclipse UserFriend
Jos,

what you describe should be the default behavior, I was able to verify this
using the tutorial editor. Are sou sure that your AddFeature is correctly
asked and returns the right value? (It's a little nasty to debug while doing
drag&drop...)

There's no switch that would enable that.

Michael


"Jos Warmer" schrieb im Newsbeitrag news:it75ch$bo$1@news.eclipse.org...

When I drop something in an editor, I can use the canAdd() operation of the
AddFeature to make sure the drop will not take place if the dropped element
does not fit.
However, this only seems to be triggered when I actually do the drop. Until
then the plus sign is displayed. I would have expected that the canAdd() was
dynamically called, such that the Stop symbol would display, even before
doing the actual drop.
Is there an option I can set to enable this behaviour ?

Jos
Re: No Stop sign when drop is not allowed [message #683716 is a reply to message #683712] Tue, 14 June 2011 05:43 Go to previous messageGo to next message
Eclipse UserFriend
Michael,

I forgot to mention that I am still using 0.7, is this something that should work in 0.7 as well?

Jos
Re: No Stop sign when drop is not allowed [message #683725 is a reply to message #683674] Tue, 14 June 2011 06:03 Go to previous messageGo to next message
Eclipse UserFriend
Are you sure, your feature provider delivers the correct add feature?
In Graphiti's sketch example we have defined a special add feature which is used as a kind of a fallback: AddAnythingFeature. This one is delivered in our SketchFeatureProvider:
	@Override
	public IAddFeature getAddFeature(IAddContext context) {
		IAddFeature ret = super.getAddFeature(context);

		Object newObject = context.getNewObject();
		if (newObject instanceof Diagram) {
			ret = new AddDiagramFeature(this);
		} else if (!(context.getTargetContainer() instanceof Diagram) && !(newObject instanceof PictogramElement)) {
			// works only container shapes, because drop is only allowed on
			// container shapes
			ret = new AddLinkFeature(this);
		} else {
			return new AddAnythingFeature(this);
		}

		return ret;
	}
Re: No Stop sign when drop is not allowed [message #684184 is a reply to message #683716] Wed, 15 June 2011 03:28 Go to previous message
Eclipse UserFriend
Yes, that works in 0.7 as well.

Michael

"Jos Warmer" schrieb im Newsbeitrag news:it79u8$5ov$1@news.eclipse.org...

Michael,

I forgot to mention that I am still using 0.7, is this something that
should work in 0.7 as well?

Jos
Previous Topic:Collapse Feature Bug?
Next Topic:Strong "org.eclipse.ide" dependency
Goto Forum:
  


Current Time: Fri Jul 04 20:18:39 EDT 2025

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

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

Back to the top