Eric Rizzo wrote:
Phillip Beauvoir wrote:
I've extrapolated the following bundles that are needed for the RTE
(version 1.2) to work in a RCP application:
org.eclipse.epf.common
org.eclipse.epf.richtext
org.eclipse.epf.ui
I have a RichTextEditor class instantiated in an Editor View together
with a populated RichTextToolBar. This all works fine on Windows XP
and Ubuntu 7 (apart from a bug I noticed on the Toolbar layout).
Can you share the details of how you implemented RichTextEditor in a
non-EPF application? I'm in the process of doing so and would like to
hear any lessons that were learned by someone who has already been
down this path.
Thanks,
Eric
Hi, yes:
For a start it only works on Windows and Linux, the Mac is going to need
some Safari-specific voodoo added to the rte.js and rendering files in
the rte folder.
The plug-in I put together is here in CVS:
Host: tencompetence.cvs.sourceforge.net
Path: /cvsroot/tencompetence
Module: rte/org.eclipse.epf.richtext
I then instantiate a RTE control thus:
class RTE
extends RichTextEditor
{
public RTE(Composite parent, int style, IEditorSite editorSite,
String basePath) {
super(parent, style, editorSite, basePath);
}
public RTE(Composite parent, int style, IEditorSite editorSite) {
super(parent, style, editorSite);
}
@Override
public void fillToolBar(IRichTextToolBar toolBar) {
toolBar.addAction(new FontStyleAction(this));
toolBar.addAction(new FontNameAction(this));
toolBar.addAction(new FontSizeAction(this));
toolBar.addSeparator();
toolBar.addAction(new CutAction(this));
toolBar.addAction(new CopyAction(this));
toolBar.addAction(new PasteAction(this));
toolBar.addSeparator();
toolBar.addAction(new ClearContentAction(this));
toolBar.addSeparator();
toolBar.addAction(new BoldAction(this));
toolBar.addAction(new ItalicAction(this));
toolBar.addAction(new UnderlineAction(this));
toolBar.addSeparator();
toolBar.addAction(new SubscriptAction(this));
toolBar.addAction(new SuperscriptAction(this));
toolBar.addSeparator();
toolBar.addAction(new TidyActionGroup(this));
toolBar.addSeparator();
toolBar.addAction(new AddOrderedListAction(this));
toolBar.addAction(new AddUnorderedListAction(this));
toolBar.addSeparator();
toolBar.addAction(new OutdentAction(this));
toolBar.addAction(new IndentAction(this));
toolBar.addSeparator();
toolBar.addAction(new FindReplaceAction(this) {
@Override
public void execute(IRichText richText) {
richText.getFindReplaceAction().execute(richText);
}
});
toolBar.addSeparator();
toolBar.addAction(new AddLinkAction(this));
toolBar.addAction(new AddImageAction(this));
toolBar.addAction(new AddTableAction(this));
}
}
And then add it to an EditorPart.
PB