Skip to main content



      Home
Home » Archived » Sapphire » How to programmatically call "Sapphire.Add" or "Sapphire.Browse"
How to programmatically call "Sapphire.Add" or "Sapphire.Browse" [message #1074018] Thu, 25 July 2013 20:05 Go to next message
Eclipse UserFriend
I'm trying to modify the ListProperty "Sapphire.Add" action to immediately call the "Sapphire.Browse" action. So far I have filtered out the "Sapphire.Add" event and replaced with my own custom ActionHandler. I would like to now call "Sapphire.Add" and Sapphire.Browse in my action handler. Is this possible?

Also let me know if this is the wrong approach. Thanks.

[Updated on: Thu, 25 July 2013 20:06] by Moderator

Re: How to programmatically call "Sapphire.Add" or "Sapphire.Browse" [message #1074389 is a reply to message #1074018] Fri, 26 July 2013 12:28 Go to previous messageGo to next message
Eclipse UserFriend
You will not be able to call "Sapphire.Add" from your action handler since you've filtered it out, so it "doesn't exist" in your context, but its implementation is quite simple. You just need to call insert on the list.

PropertyEditorPart listPropertyEditorPart = (PropertyEditorPart) getPart();
ElementList<?> list = (ElementList<?>) listPropertyEditorPart.property();
Element entry = list.insert();


Next, you need to locate the part corresponding to the table cell where you want to browse.

PropertyEditorPart cellPropertyEditorPart = listPropertyEditorPart.getChildPropertyEditor( entry, ListEntry.PROP_SOMETHING );


Then call browse.

cellPropertyEditorPart.getActions().getAction( "Sapphire.Browse" ).getFirstActiveHandler().execute( context );

Re: How to programmatically call "Sapphire.Add" or "Sapphire.Browse" [message #1074712 is a reply to message #1074389] Sat, 27 July 2013 10:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks but I'm running into an issue.

listPropertyEditorPart.getProperty() is returning the ListProperty but I can't figure out how to call insert.

what is ElementList<?> in your example?

[Updated on: Sat, 27 July 2013 10:40] by Moderator

Re: How to programmatically call "Sapphire.Add" or "Sapphire.Browse" [message #1075559 is a reply to message #1074712] Mon, 29 July 2013 12:27 Go to previous messageGo to next message
Eclipse UserFriend
The snippets in my prior post are based on Sapphire 0.7 API. Here is a translated version of the first snippet for 0.6.x API. The other two snippets should be the same.

PropertyEditorPart listPropertyEditorPart = (PropertyEditorPart) getPart();
ModelElementList<?> list = (ModelElementList<?>) listPropertyEditorPart.getLocalModelElement().read( listPropertyEditorPart.getProperty() );
IModelElement entry = list.insert();
Re: How to programmatically call "Sapphire.Add" or "Sapphire.Browse" [message #1075744 is a reply to message #1075559] Mon, 29 July 2013 21:28 Go to previous message
Eclipse UserFriend
Thank you. That's working for me.
Previous Topic:Pass values to custom validation service
Next Topic:Trigger ValueImageService programmatically
Goto Forum:
  


Current Time: Sun Aug 31 10:21:44 EDT 2025

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

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

Back to the top