Skip to main content



      Home
Home » Newcomers » Newcomers » ObjectContribution vs viewContribution
ObjectContribution vs viewContribution [message #164601] Tue, 08 August 2006 12:27 Go to next message
Eclipse UserFriend
Hi

I created a view that holds a treeViewer and added a context menu with an
Action to it. The Action works fine when I invoke it from the view. The
constructor of the Action has some parameters inclusive of the treeViewer.

Now, I want to be able to invoke the Action from the Java Editor so I
added the necessary info to the plugin.xml and the menuItem along with
accelerator keys appear.

However, when I select the Action from the Java Editor's context menu, I'm
getting a java.lang.InstantiationException . I thought that it might be
related to the fact that my constructor has parameters so I added a
default constructor but now my context menu Item is disabled. How do I
deal with this?


Thanks
Is it possible to have an editor action that targets another view? [message #164609 is a reply to message #164601] Tue, 08 August 2006 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi

This info is related to mail immediately preceeding:

I want to add a context menuItem to the Java Editor. The context menuItem
is only interested in the selected text in the editor *but* the actual
processing is targeted at another view, i.e. the action takes the selected
text, passes it to the view for the view to work on. Is this possible?

My goal is to free the user up of some steps, instead of having to select
the text in the editor, go over to the view and select the menu option.
The user just does everything from the selection point.
Re: Add a listener to the context menu? [message #164641 is a reply to message #164609] Tue, 08 August 2006 14:22 Go to previous messageGo to next message
Eclipse UserFriend
Is it possible to add a listener to a context menuItem that's been added
to the Java Editor through plugin.xml?

That would solve my problem, I think(?) then when my treeViewer hears the
context menuItemClick it just calls its action.run()?

Thanks
Workaround: need to know if its a sound way to proceed [message #164649 is a reply to message #164641] Tue, 08 August 2006 15:22 Go to previous message
Eclipse UserFriend
Hi
v3.2

Background:
Trying to invoke an action from the Java Editor context menu, but the
action actually performs operations on the treeViewer in another view and
has some input parameters. (The treeViewer is interested in knowing the
selected text in the Java Editor). Previously, when I tried to call the
action directly I was getting a java.lang.InstantiationError

Workaround:
I created an intermediate action that looks for the treeViewer view, if it
finds it, it calls the treeViewer.actionInstance.run(IAction) method. Is
this sound? I thought a better way might be if I were able to listen for
the click of the context menu in the treeViewer but I dont know how to do
that or if it can be done with an action setup from the plugin.xml. (or if
there's a better way)
Previous Topic:Problems creating a Chatserver -Plugin
Next Topic:Generate Report Programatically using Design API & flat file as data source
Goto Forum:
  


Current Time: Sun May 11 18:01:34 EDT 2025

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

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

Back to the top