[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Action set, Editor input
|
I have to create an app to open a (text, html, xml) file and to process
its contents. So far, i managed to open such files in an editor (with
syntax coloring; code folding and line numberung would be nice, but it's
not essential).
This was very helpful to achieve this:
http://www.eclipse.org/eclipse/platform-text/development/rcp/examples/index.html
However, now I'm stuck at the following issues:
1) I defined three action in an action set in plugin.xml: OpenFile,
Sign, Verify.
1.1) OpenFile, which I took from the example mentioned above, works as
intended: Selecting File --> Menu or the appropriate toolbar button
accesses the proper class OpenFileAction which loads a file into an
appropriate editor.
1.2) Sign and Verify are displayed in the appropriate menu and in the
main tool bar. But, when I select either of them an Information msgbox
appears with the following text: "This operation is not available at the
moment."
Q1: Where am I wrong?
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.
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).
Q3: How do I get the contents of the currently active editor?
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)?
Geri