[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: Action set, Editor input
|
Hi Krishna,
Thanks for your quick response.
Q1: Where am I wrong?
-> To check this problem, you may want to take a look at the log file.
There might be some exception which might be logged there. This I guess
may be because the application is not able to find some classes during
its runtime. I hope seeing the log should be helpful.
>> Thanks for the hint. Yes, the log file shows:
!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
And now? Now I know what can NOT be done. Don't have a clue what CAN be
done. The class is there. In this package. Spelling is correct. It
extends Action and implements IWorkbenchWindowActionDelegate (I read in
an other thread that this is necessary, isn't it?)
(And, if one of the appropriate developers comes by eventually: A note
like "See <path>/.log for details." displayed together with the message
would be helpful.)
Q2: Would it be better to add the actions via an editorContribution
(like in
http://www.eclipse.org/articles/Article-action-contribution/index.html)?
With the advantage of disabled menu items, unless an editor window is
opened? But, as extension to WHICH editor? There are three used in the
text editor example above: AbstractTextEditor, SimpleEditor, XMLEditor.
-> As you said the advantage of using editorContribustion is that you
will be able to see the menu and tool items only when they are accessed.
I am not sure if you can group editors for these items, (it would be
good though if it possible :)). I am also trying for a similar feature,
maybe your thread will be helpful in this regard :) .
>> I tested implementing editorContributions with the following results:
1.3) Yes. One has to define all actions for each and every editor -
SimpleEditor and XMLEditor in my case. That's odd, since in my case the
process is the same, no matter of the contents of the editor.
1.4) The menu and toolbar items are only shown, if an instance of the
appropriate editor is open. This leads to an empty menu and to an empty
toolbar unless an editor window is opened --> not very sexy. I'd rather
would like to have disabled ("grayed out") menu/toolbar items.
1.5) The result when selecting menu/toolbar item is the same: "The
chosen operation is not currently available."
2) When I add Sign and Verify via ApplicationActionBarAdvisor, the
proper classes are accessed, of course. The disadvantage is that this
seems only to be useful for menu items. When I add actions to the
toolbar there, labels are displayed, not icons. And the items are active
even if there's nothing to do (no editor has been opened).
-> I am not sure why this problem is arising. I have done this thing of
adding the actions in toolbar but haven't faced such problem. Have you
added the icon information for the actions in plugin.xml? Also, have you
added the export information for the icons folder in build.properties?
>> 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.
Q3: How do I get the contents of the currently active editor?
-> What information form the active editor do you require? If it is the
current editor input you can get it from getEditorInput().
>> Yes, i've read about getEditorInput(). But the question is how to
get the proper editor (the one which is currently active) first, to be
able to get its content via getEditorInput().
Q4: How do I open an empty editor and fill it with contents (to display,
and optionally save, changed data without harming the original file)?
-> I don't get your question. Save the file optionally without harming
the original file?
>> 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.
Geri