Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Re-enabling Direct Editing Mode
Re-enabling Direct Editing Mode [message #849950] Thu, 19 April 2012 15:55 Go to next message
Craig Petre is currently offline Craig PetreFriend
Messages: 32
Registered: April 2011
Member
Hey, so I followed the tutorial for adding a DirectEditingFeature and it works fine. I add the pictogram element which can be direct edited and I'm able to edit the name, etc. I was wondering if there is an easy way to re-enable direct editing at some point after creation (like if the user double clicks on text, I'd like to enable direct editing again). I noticed there is a function in IFeatureProviderWithPatterns called "activateDirectEditingForPatterns". So what I did was create a ICustomFeature which calls, in its execute method, that function and I return the custom feature from the ToolBehaviorProvider "getDoubleClickFeature". So all of that works fine, I double click on the pictogram element I want to re-enable direct editing on and "activateDirectEditingForPatterns" is called and everything seems to be working as designed with one small problem, I need to move the pictogram element after calling "activateDirectEditingForPatterns" before the editable text box will show up and allow me to edit.. which I can of course get around by overriding the function and moving the PE after direct editing mode is enabled.. but that is definitely a hack.

Does the procedure described above sound like how one would go about doing this? Or am I missing some simpler method? Seems like "activateDirectEditingForPatterns" shouldn't require me to move or otherwise update the PE in order to get direct editing turned on right?

Thanks,
Craig

[Updated on: Thu, 19 April 2012 17:44]

Report message to a moderator

Re: Re-enabling Direct Editing Mode [message #850837 is a reply to message #849950] Fri, 20 April 2012 11:24 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Using that pattern-related method seems a bit odd when you have a plain
custom feature to enable that. I would suggest to use the direct editing
info stored at the feature provider to provide what should be edited (as
done in the add feature in the tutorial) and then triggering an editor
refresh (needed to activate direct editing mode for the editor). Something
like that in the custom feature will do:

IDirectEditingInfo directEditingInfo =
getFeatureProvider().getDirectEditingInfo();
directEditingInfo.setMainPictogramElement(pe);
directEditingInfo.setPictogramElement(textPE);
directEditingInfo.setGraphicsAlgorithm(textGA);
directEditingInfo.setActive(true);

getFeatureProvider().getDiagramTypeProvider().getDiagramEditor().refresh();

Michael
Re: Re-enabling Direct Editing Mode [message #851115 is a reply to message #850837] Fri, 20 April 2012 17:01 Go to previous message
Craig Petre is currently offline Craig PetreFriend
Messages: 32
Registered: April 2011
Member
Thanks Michael that works much better.
Previous Topic:Possible to add a source tab?
Next Topic:Layering of figures
Goto Forum:
  


Current Time: Fri May 10 01:15:29 GMT 2024

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

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

Back to the top