[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Action set, Editor input

Hi Geri,

It was getting a lot messy in the previous mails and real confusing. So let me start of with a clean mail.

Q1:!MESSAGE Could not create action delegate for id: myPackage.myAction
!MESSAGE The Plug-in myPackage.myPlugin could not create an instance of class myPackage.myActionClass
java.lang.InstantiationException: myPackage.myAction


You seem to have done everything right. May be you can try creating it from extension points using action sets. It is not really necessary though, I feel.

The following link may be useful:

http://wiki.eclipse.org/index.php/FAQ_Why_do_I_get_a_'plug-in_was_unable_to_load_class'_error_when_I_activate_a_menu_or_toolbar_action%3F

Q2:You don't need actions/-sets in plugin.xml if you add them in ApplicationActionBarAdvisor, do you? Anyway, had a wrong file name at setImageDescriptor(Activator.getImageDescriptor("/icons/sign.gif")); in the action class' constructor.

Once again to the problem of having to define the actions in every editor, the best way I feel is write all the actions in one of the packages and use these action classes in the required editor.

As for menu and toolbar not looking 'sexy' you can may be once again use the action classes in the ApplicationActionBarAdvisor. On opening each of the editors get an handle to the actions and enable and disable them as required. This would mean giving the action objects in ApplicationActionBarAdvisor proper access (public/protected).

For "The chosen operation is not currently available." message is concerned. This appears when the associated action class fails to get instantiated. I feel if you are able to resolve the previous problem this will be resolved.


Yes you don't need them in plugin.xml. But it is more clearer and less error prone if you do it this way. Personally it is just a way I prefer doing it. It gives a better feel :).


Q3:How do I get the contents of the currently active editor?

UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();

Q4:
I would like to open a file. Process it somehow. Put the results of this process into a new editor. Optionally save the contents of this new editor to a new file. Thus, the contents if the original file do not change.


I hope the file you will be processing is from the open active editor. In that case you can get a link to the file using the code I gave you in Q3.
From there may be you can process the info as you require and create a new
file putting the processed data into it. You can create this file on the file system as a temp or a permanent file as you require. Then you can open a new editor taking this new file as the input to the editor, showing the processed data in the new editor.

I hope I have understood your problem right?

Hope these things were of some use :)

Regards,
krishan