Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » ActionProvider not getting called
ActionProvider not getting called [message #233265] Wed, 10 June 2009 11:05 Go to next message
sowmya Mising name is currently offline sowmya Mising nameFriend
Messages: 51
Registered: July 2009
Member
Hi
Refering to the gmf mindmap example the
org.eclipse.gmf.examples.mindmap.diagram.navigator.MindmapNa vigatorActionProvider
class is not being called when the diagram file is opened.

This has been specified as the <actionProvider> with extension
point="org.eclipse.ui.navigator.navigatorContent" . And it has been binded
with package explorer in viewcontentBinding and viewerActionBinding with
extension point ="org.eclipse.ui.navigator.viewer".

I need to add some code into this action provider .
Could anybody please tell me how to get the control to this class.
Re: ActionProvider not getting called [message #233274 is a reply to message #233265] Wed, 10 June 2009 12:45 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sowmya,

This class is responsible for providing domain model structure below domain
model file node in generic ProjectExplorer view.
You can open this view and try to explore domain model file strucutre there
- then this class will be called.

-----------------
Alex Shatalin
Re: ActionProvider not getting called [message #233290 is a reply to message #233274] Wed, 10 June 2009 13:19 Go to previous messageGo to next message
sowmya Mising name is currently offline sowmya Mising nameFriend
Messages: 51
Registered: July 2009
Member
Can i not use this provider to provide my own copy action when i right
click on diagram file and select copy in package explorer. How would i
invoke this provider when i select diagram file in the package explorer.
The trigger point has the condition for IResource= file and check
extension mmd. I tried changing the extension to ecore_diagram but it does
not seem to work. Do i need to add anythin more in the trigger point
Re: ActionProvider not getting called [message #233314 is a reply to message #233290] Wed, 10 June 2009 15:38 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sowmya,

> Can i not use this provider to provide my own copy action when i right
Sorry - i mized content and action providers.. I think you can register your
own action provider to provide additional actions to the navigator popup
menu.

> click on diagram file and select copy in package explorer. How would i
> invoke this provider when i select diagram file in the package
You can right-click onto the diagram node (one below the diagram file) to
see this action in a popup menu.


-----------------
Alex Shatalin
Re: ActionProvider not getting called [message #233385 is a reply to message #233314] Thu, 11 June 2009 06:21 Go to previous messageGo to next message
sowmya Mising name is currently offline sowmya Mising nameFriend
Messages: 51
Registered: July 2009
Member
By clicking on the diagram node in hierarchy in project explorer.. Action
provider is getting invoked. But when i right click on the diagram
file(not the node) -default.mmd itself at top level without collapsing
the hierarchy,again actionprovider is not called.

I have modified the trigger point and possible children values as
below.(not sure if it is correct ) But still this action provider is not
used. Will i have to use a different action provider for files.?

<triggerPoints>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="mmd"/>
</and>
</triggerPoints>
<possibleChildren>
<instanceof value="org.eclipse.gmf.runtime.notation.Diagram"/>
</possibleChildren>
Re: ActionProvider not getting called [message #233406 is a reply to message #233385] Thu, 11 June 2009 10:49 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sowmya,

Looks like you have to create separate actionProvider declaration - see eclipse
documentation for org.eclipse.ui.navigator.navigatorContent extension-point.

-----------------
Alex Shatalin
Re: ActionProvider not getting called [message #233485 is a reply to message #233406] Thu, 11 June 2009 13:37 Go to previous messageGo to next message
sowmya Mising name is currently offline sowmya Mising nameFriend
Messages: 51
Registered: July 2009
Member
I have created an action provider and used navigator content.But the
action provider is invoked as soon as i just click on the file. I want it
to happen when i right click and select copy as i want to override copy
action.

My requirement is that when i select and copy diagram file and paste it.
the corresponding model file should have automatically got copied and
pasted along with diagram file. For this i am trying to override the copy
action on a diagram file .
Could you please help as to how could i achieve this.
It would be of great help if u you could suggest some alrady available
plugin or example where i can perform this.
Re: ActionProvider not getting called [message #233492 is a reply to message #233485] Thu, 11 June 2009 14:01 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sowmya,

See ActionGroup.fillContextMenu(IMenuManager menu) - you have to implement
this method in your ActionProvider to add corresponding action to the popup
menu.

/**
* Adds the applicable actions to a context menu,
* based on the state of the <code>ActionContext</code>.
* <p>
* The default implementation does nothing.
* Subclasses may override or extend this method.
* </p>
*
* @param menu the context menu manager
*/
public void fillContextMenu(IMenuManager menu) {
// do nothing
}

-----------------
Alex Shatalin
Re: ActionProvider not getting called [message #233533 is a reply to message #233492] Thu, 11 June 2009 20:56 Go to previous messageGo to next message
sowmya Mising name is currently offline sowmya Mising nameFriend
Messages: 51
Registered: July 2009
Member
I have implemented the fillContextMenu() for copy action in my
actionProvider. I want my copy action to be executed only when i copy a
diagram file in "package explorer" view.


This is how i have added in my plugin.xml. But it does not invoke when i
choose copy.Is there anything wrong with this ?



<navigatorContent
activeByDefault="true"
contentProvider="com.example.myFolder.MyJavaContentProvider "
icon="$nl$/icons/full/eview16/jperspective.gif"
id="com.example.myFolder.javaContent"
labelProvider="com.example.myFolder.MyJavaLabelProvider"
name="%commonNavigatorContentName"
priority="high">
<triggerPoints>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="gmap_diagram"/>
</and>
<instanceof
value=" org.eclipse.example.mindmap.diagram.navigator.MindMapAbstrac tNavigatorItem "/>
</or>
</triggerPoints>
<possibleChildren>
<or>
<instanceof
value=" org.eclipse.example.mindmap.diagram.navigator.MindMapAbstrac tNavigatorItem "/>
</or>
</possibleChildren>
<commonSorter
id="com.example.myFolder.navigatorSorter"

class=" org.eclipse.example.mindmap.diagram.navigator.MindMapNavigat orSorter ">
<parentExpression>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.core.resources.extension"
value="gmap_diagram"/>
</and>
<instanceof
value=" org.eclipse.example.mindmap.diagram.navigator.MindMapAbstrac tNavigatorItem "/>
</or>
</parentExpression>
</commonSorter>

<actionProvider

class=" org.eclipse.jdt.internal.ui.navigator.JavaNavigatorRefactorA ctionProvider "
id="org.eclipse.jdt.ui.navigator.actions.RefactorActions"
overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions ">
<enablement>
<or>
<and>
<instanceof value="org.eclipse.core.resources.IFile" />
<test property="org.eclipse.core.resources.extension"
value="gmap_diagram"/>
</and>
<instanceof
value=" org.eclipse.example.mindmap.diagram.navigator.MindMapAbstrac tNavigatorItem "/>
</or>
</enablement>
</actionProvider>
Re: ActionProvider not getting called [message #233558 is a reply to message #233533] Fri, 12 June 2009 09:08 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello sowmya,

> I have implemented the fillContextMenu() for copy action in my
> actionProvider. I want my copy action to be executed only when i copy
Was this method called? Do you see this action in a popup menu?
Hint: If you do not need a content provider (this provider was created for
you by Eclipse) then you can only:
- declare new actionProvider using org.eclipse.ui.navigator.navigatorContent
extension-point
- bind this action provider to an existing navigator view (Project Explorer)
by viewerActionBinding inside org.eclipse.ui.navigator.viewer extension-point.

In general, I'm not an author of Eclipse CommonNavigator framework ( http://wiki.eclipse.org/index.php/Common_Navigator_Framework),
so if you read documentation for this framework and still have questions
concerning contributing new actions into this framework probably it make
sense to ask these questions in corresponding newsgroup to let competent
people answer it.

-----------------
Alex Shatalin
Previous Topic:hyphenation in labels
Next Topic:Highlight selected objects
Goto Forum:
  


Current Time: Thu Apr 18 11:54:13 GMT 2024

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

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

Back to the top