Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:25 Go to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
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 09:11 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 09:43 Go to previous messageGo to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
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 10:03 Go to previous messageGo to next message
Christian Brand is currently offline Christian BrandFriend
Messages: 36
Registered: July 2009
Location: Walldorf/Germany
Member
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;
	}


Christian Brand
SAP AG - Walldorf - Germany
Re: No Stop sign when drop is not allowed [message #684184 is a reply to message #683716] Wed, 15 June 2011 07:28 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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: Thu Apr 25 16:50:28 GMT 2024

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

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

Back to the top