Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Overriding Sapphire Actions(Overriding Sapphire Actions)
Overriding Sapphire Actions [message #711397] Sat, 06 August 2011 05:03 Go to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Hello,

I have a model like

Person{id,name,address}

I have defined an MyAddActionHandlerfor handling all my Model Creation actions referred http://www.eclipse.org/sapphire/releases/0.3/documentation/actions/index.html

I am trying to override the Sapphire.Add action that comes on my Model Context right click to call my MyAddActionHandler. But I see am not able to override it i always get the Sapphire.Add default handler being called.

I have defined the MyAddActionHandlerGlobally, here is the definition of it,
        <action-handler>
            <id>Portlet.Sapphire.Add.Override</id>
            <impl>MyAddActionHandler</impl>
            <condition>MyAddActionHandlerCondition</condition>
            <context>Sapphire.EditorPage.Outline</context>
            <action>Sapphire.Add</action>
            <context>Sapphire.EditorPage.Outline.Node</context>
        </action-handler>


Can you please let me know if I have missed anything ?

~Kamesh
Re: Overriding Sapphire Actions [message #711779 is a reply to message #711397] Sat, 06 August 2011 16:32 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
You should be seeing both the system-provided action handler and yours. If you are not seeing yours, then it isn't correctly specified. Looking at this snippet and your statement that this is registered globally, I would say that the problem is that your impl and condition classes aren't specified using fully-qualified names. Only sdef language has package import facility. You have to use fully-qualified class names in sapphire-extension.xml.

In order to suppress a system-provided action handler, you have to use an action handle filter. Note that filters can only be registered at local level in sdef.

- Konstantin
Re: Overriding Sapphire Actions [message #711803 is a reply to message #711779] Sat, 06 August 2011 17:10 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
yeah Konstantin, i tried using the Global action handlers using extension.xml and i see both system and my handler getting displayed. But i did try supressing it using the filters but i dont see the system handler being supressed.

Let me give a try and keep you posted on the same.



~Kamesh
Re: Overriding Sapphire Actions [message #711821 is a reply to message #711803] Sat, 06 August 2011 17:31 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
No luck Konstantin, am not able to suppress the System generated Actions using handler filters

Find below my code snippets:
sapphire-extension.xml
<?xml version="1.0" encoding="UTF-8"?>
<extension xmlns="http://www.eclipse.org/sapphire/xmlns/extension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <action-handler>
        <action>Sapphire.Add</action>
        <label>Add Person</label>           <impl>com.sk.sapphire.demo.action.AddPortletActionHandler</impl>
    </action-handler>
</extension>


PersonEditor.sdef
....
<editor-page>
          <action-handler-filter>
            <impl>AddPortletActionFilter</impl>
        </action-handler-filter>
</editor-page>
....



When i debugged my filter i was able to see only the following action ID's

Sapphire.Outline.CollapseAll
Sapphire.Outline.ExpandAll
Sapphire.Outline.Hide

For each and every child node. Since I dont see Sapphire.Add i am not able to supress it.

I even tried with setting the context for Filter and Global Action Handler as Sapphire.EditorPage.Outline.Node but still same result Sad

Anything that am missing
Re: Overriding Sapphire Actions [message #712037 is a reply to message #711821] Sun, 07 August 2011 00:09 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
You are putting the filter at the wrong level in sdef in order to see Sapphire.Add action. It should be in the context of a node as opposed to in the context of the editor page.

- Konstantin
Re: Overriding Sapphire Actions [message #712608 is a reply to message #712037] Sun, 07 August 2011 13:51 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
But then I can't put at the node because the Child Node is added from the Parent.

Consider the following structure

Parent
-- Child-1 (list property)
-- Child-2
-- Child-3

I have an editor and for child nodes actions I can define/put actions only at editor page right since the Child Nodes which are structured as follows

Quote:
Sections --> Content Outline Node --> Child Nodes --> Content Outline Node Factory


As per Sapphire it will create three System Add actions like Add Child-1, Add Child-2 and Add Child-3

What I am trying to do is i want to delegate the Add Child-1 Action to my Action Handler rather than default System Action Handler.

But I am not able to do that, when the editor is loaded i don't see any Action Handlers targeted at Sapphire.EditorPage.Outline.Node which I suppose are the contexts for Child-1, Child-2, Child-3 actions can be handled.

Please correct me if my understanding is wrong, if not please let me know how we can achieve this ?

Another Question is that why Sapphire UI is not supporting CONTROL+SPACE keybinding ?

[Updated on: Mon, 08 August 2011 11:54]

Report message to a moderator

Re: Overriding Sapphire Actions [message #713597 is a reply to message #712608] Mon, 08 August 2011 16:23 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The filter needs to be in the context of whichever node has the action. In this case, it's your "Parent" node that has the add action to create children. Makes sense?

> Another Question is that why Sapphire UI is not supporting CONTROL+SPACE keybindin

Do you mean content assist in a text field? That hasn't been implemented yet. Go ahead and open an enhancement request.

- Konstantin

[Updated on: Mon, 08 August 2011 16:24]

Report message to a moderator

Re: Overriding Sapphire Actions [message #714018 is a reply to message #713597] Tue, 09 August 2011 15:44 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
I understand that filter needs to be at the Parent, but in my scenario the parent itself root node of the XML document and we never add it in sdef as property right ? Without adding it as property I am left only option of adding the Action Filter @ Editor Page level which is not working for me :'(

Not sure am missing something or misunderstood your suggestions
Re: Overriding Sapphire Actions [message #714027 is a reply to message #714018] Tue, 09 August 2011 16:16 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
I think at this point, it would be easier if you included a trimmed copy of your sdef file.

- Konstantin
Re: Overriding Sapphire Actions [message #714030 is a reply to message #714027] Tue, 09 August 2011 16:24 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Not sure I can upload a trimmed copy, anyways I have uploaded my complete sdef which i have created for portlet.xml editing.
Re: Overriding Sapphire Actions [message #714032 is a reply to message #714030] Tue, 09 August 2011 16:25 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Ok. Now tell me which list property's add action you wish to override?
Re: Overriding Sapphire Actions [message #714033 is a reply to message #714032] Tue, 09 August 2011 16:27 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Portlets
Re: Overriding Sapphire Actions [message #714048 is a reply to message #714033] Tue, 09 August 2011 17:02 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The action filter should be placed directly inside <node> element whose label is "Portlet Application".
Re: Overriding Sapphire Actions [message #714079 is a reply to message #714048] Tue, 09 August 2011 18:42 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Thanks Kosntantin, it worked and a learning for me Smile

but I never knew that Action Filters could be added directly under the node too . Since sdef editor doesn't show Action, Handler, & Filters sections for Nodes Sad

I have couple of questions,

1. Ordering of actions that appear in context menu ?

2. Can you please let me know now where it could be added Action, Handler & Filter ?

~ Kamesh

[Updated on: Tue, 09 August 2011 19:03]

Report message to a moderator

Re: Overriding Sapphire Actions [message #714085 is a reply to message #714079] Tue, 09 August 2011 19:03 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
> Since sdef editor doesn't show Action, Handler, & Filters sections for Nodes Sad

Could you open a bug for this?

> Can you please let me know now where it could be added Action, Handler & Filter ?

You can have actions at the level of any UI part... page, node, section, property editor, etc. Every part determines how to expose these actions.

[Updated on: Tue, 09 August 2011 19:04]

Report message to a moderator

Re: Overriding Sapphire Actions [message #714087 is a reply to message #714085] Tue, 09 August 2011 19:08 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
here it is 354292

One more question
Is it possible to order actions that appear in context menu ? I mean change the default order in which they are listed ?
Re: Overriding Sapphire Actions [message #714090 is a reply to message #714087] Tue, 09 August 2011 19:15 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
> Is it possible to order actions that appear in context menu ? I mean change the default order
> in which they are listed ?

You can control the location of the action that you define. That is, the means for specifying location is part of action definition. See Location section at the very bottom. There is a group field and set of location hints that amount to (before action X, after action Y, etc.). Sapphire then uses that information to produce concrete ordering.

The only way to re-arrange system actions is to filter out all of their handlers (which will hide the actions) and then define your own action that look to the user like the system ones. Not something you generally want to do...

- Konstantin
Re: Overriding Sapphire Actions [message #714181 is a reply to message #714090] Wed, 10 August 2011 01:49 Go to previous message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
yeah using location i moved the actions, slowly am getting the grip on the framework. but still a lot to learn on this great framework Smile
Previous Topic:Custom Part Creation
Next Topic:reinitialization of the model
Goto Forum:
  


Current Time: Thu Mar 28 16:59:23 GMT 2024

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

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

Back to the top