Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EPF » Re-using RichText and RichTextEditor
Re-using RichText and RichTextEditor [message #42902] Mon, 08 October 2007 16:34 Go to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
app. I'm going to ask a series of increasingly specific questions
realted to doing so; I've tried to do some research, but if there is a
RTFM answer, please provide a link or direction to the FM :-)

Are there any resources available (other than the EPF source code) to
help use the rich text editor in a non-EPF context?

Has anyone done any work towards integrating RichTextEditor with the
JFace Data Binding framework?

Is there any way to get FOCUS_OUT events from RichTextEditor? I've tried
hooking into the SWT.FocusOut event on the RichText but my Listener
never gets called. I've also tried attaching the Listener to
RichtText.getControl() without luck. The app/plugins I'm working on use
FocusOut events to trigger modification from Text widgets to the model,
so if I can't find a way to get RichText/RichtTextEditor to emit
FocusOut events I'm afraid I won't be able to use it - that would be
very unfortunate since the existing alternatives are not really robust
enough for production use.

Thanks in advance,
Eric
Re: Re-using RichText and RichTextEditor [message #43027 is a reply to message #42902] Mon, 08 October 2007 16:55 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
> app. I'm going to ask a series of increasingly specific questions
> realted to doing so; I've tried to do some research, but if there is a
> RTFM answer, please provide a link or direction to the FM :-)
>
> Are there any resources available (other than the EPF source code) to
> help use the rich text editor in a non-EPF context?
>
> Has anyone done any work towards integrating RichTextEditor with the
> JFace Data Binding framework?
>
> Is there any way to get FOCUS_OUT events from RichTextEditor? I've tried
> hooking into the SWT.FocusOut event on the RichText but my Listener
> never gets called. I've also tried attaching the Listener to
> RichtText.getControl() without luck. The app/plugins I'm working on use
> FocusOut events to trigger modification from Text widgets to the model,
> so if I can't find a way to get RichText/RichtTextEditor to emit
> FocusOut events I'm afraid I won't be able to use it - that would be
> very unfortunate since the existing alternatives are not really robust
> enough for production use.
>
> Thanks in advance,
> Eric

Yes, me.

Can't help on the FOCUS_OUT or Data Binding thing. But...

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
Re: Re-using RichText and RichTextEditor [message #43052 is a reply to message #43027] Mon, 08 October 2007 17:59 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

Phillip Beauvoir wrote:
> Eric Rizzo wrote:
>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>> app. I'm going to ask a series of increasingly specific questions
>> realted to doing so; I've tried to do some research, but if there is a
>> RTFM answer, please provide a link or direction to the FM :-)
>>
>> Are there any resources available (other than the EPF source code) to
>> help use the rich text editor in a non-EPF context?
>>
>> Has anyone done any work towards integrating RichTextEditor with the
>> JFace Data Binding framework?
>>
>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>> tried hooking into the SWT.FocusOut event on the RichText but my
>> Listener never gets called. I've also tried attaching the Listener to
>> RichtText.getControl() without luck. The app/plugins I'm working on
>> use FocusOut events to trigger modification from Text widgets to the
>> model, so if I can't find a way to get RichText/RichtTextEditor to
>> emit FocusOut events I'm afraid I won't be able to use it - that would
>> be very unfortunate since the existing alternatives are not really
>> robust enough for production use.
>>
>> Thanks in advance,
>> Eric
>
> Yes, me.
>
> Can't help on the FOCUS_OUT or Data Binding thing. But...
>
> 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
[etc...]
> }

OK, thanks. That is pretty much the same thing I am doing.

Eric
Re: Re-using RichText and RichTextEditor [message #43075 is a reply to message #42902] Mon, 08 October 2007 18:03 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

A follow-up question:
When I use a RichTextEditor in my plugin, it seems to have somehow
hijacked the undo and redo actions (Ctrl+Z). I had a special
(EMF-generated) action bar contributor that handled undo/redo through
the EMF command stack, but now the RichTextEditor is being used if I try
Ctrl+Z anywhere in my editor.
I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
my own, which seems to be the minimum required to actually use
RichTextEditor.

Any ideas how/why undo/redo is being hijacked in this way?

Is it possible (simple) to build the RichTextEditor as a JAR to be
packaged with my plugin instead of deploying all those epf plugins?

Thanks in advance,
Eric


Eric Rizzo wrote:
> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
> app. I'm going to ask a series of increasingly specific questions
> realted to doing so; I've tried to do some research, but if there is a
> RTFM answer, please provide a link or direction to the FM :-)
>
> Are there any resources available (other than the EPF source code) to
> help use the rich text editor in a non-EPF context?
>
> Has anyone done any work towards integrating RichTextEditor with the
> JFace Data Binding framework?
>
> Is there any way to get FOCUS_OUT events from RichTextEditor? I've tried
> hooking into the SWT.FocusOut event on the RichText but my Listener
> never gets called. I've also tried attaching the Listener to
> RichtText.getControl() without luck. The app/plugins I'm working on use
> FocusOut events to trigger modification from Text widgets to the model,
> so if I can't find a way to get RichText/RichtTextEditor to emit
> FocusOut events I'm afraid I won't be able to use it - that would be
> very unfortunate since the existing alternatives are not really robust
> enough for production use.
>
> Thanks in advance,
> Eric
Re: Re-using RichText and RichTextEditor [message #43170 is a reply to message #43075] Tue, 09 October 2007 00:55 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> A follow-up question:
> When I use a RichTextEditor in my plugin, it seems to have somehow
> hijacked the undo and redo actions (Ctrl+Z). I had a special
> (EMF-generated) action bar contributor that handled undo/redo through
> the EMF command stack, but now the RichTextEditor is being used if I try
> Ctrl+Z anywhere in my editor.
> I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
> my own, which seems to be the minimum required to actually use
> RichTextEditor.
>
> Any ideas how/why undo/redo is being hijacked in this way?
>
> Is it possible (simple) to build the RichTextEditor as a JAR to be
> packaged with my plugin instead of deploying all those epf plugins?
>
> Thanks in advance,
> Eric
>
>
> Eric Rizzo wrote:
>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>> app. I'm going to ask a series of increasingly specific questions
>> realted to doing so; I've tried to do some research, but if there is a
>> RTFM answer, please provide a link or direction to the FM :-)
>>
>> Are there any resources available (other than the EPF source code) to
>> help use the rich text editor in a non-EPF context?
>>
>> Has anyone done any work towards integrating RichTextEditor with the
>> JFace Data Binding framework?
>>
>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>> tried hooking into the SWT.FocusOut event on the RichText but my
>> Listener never gets called. I've also tried attaching the Listener to
>> RichtText.getControl() without luck. The app/plugins I'm working on
>> use FocusOut events to trigger modification from Text widgets to the
>> model, so if I can't find a way to get RichText/RichtTextEditor to
>> emit FocusOut events I'm afraid I won't be able to use it - that would
>> be very unfortunate since the existing alternatives are not really
>> robust enough for production use.
>>
>> Thanks in advance,
>> Eric

That's why I took all the minimum classes needed and bundled them into
one plugin.

PB.
Re: Re-using RichText and RichTextEditor [message #43240 is a reply to message #43170] Tue, 09 October 2007 09:05 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

Phillip Beauvoir wrote:
> Eric Rizzo wrote:
>> A follow-up question:
>> When I use a RichTextEditor in my plugin, it seems to have somehow
>> hijacked the undo and redo actions (Ctrl+Z). I had a special
>> (EMF-generated) action bar contributor that handled undo/redo through
>> the EMF command stack, but now the RichTextEditor is being used if I
>> try Ctrl+Z anywhere in my editor.
>> I've got the epf.richtext, epf.ui, and epf.common plugins deployed
>> with my own, which seems to be the minimum required to actually use
>> RichTextEditor.
>>
>> Any ideas how/why undo/redo is being hijacked in this way?
>>
>> Is it possible (simple) to build the RichTextEditor as a JAR to be
>> packaged with my plugin instead of deploying all those epf plugins?
>>
>> Thanks in advance,
>> Eric
>>
>>
>> Eric Rizzo wrote:
>>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>>> app. I'm going to ask a series of increasingly specific questions
>>> realted to doing so; I've tried to do some research, but if there is
>>> a RTFM answer, please provide a link or direction to the FM :-)
>>>
>>> Are there any resources available (other than the EPF source code) to
>>> help use the rich text editor in a non-EPF context?
>>>
>>> Has anyone done any work towards integrating RichTextEditor with the
>>> JFace Data Binding framework?
>>>
>>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>>> tried hooking into the SWT.FocusOut event on the RichText but my
>>> Listener never gets called. I've also tried attaching the Listener to
>>> RichtText.getControl() without luck. The app/plugins I'm working on
>>> use FocusOut events to trigger modification from Text widgets to the
>>> model, so if I can't find a way to get RichText/RichtTextEditor to
>>> emit FocusOut events I'm afraid I won't be able to use it - that
>>> would be very unfortunate since the existing alternatives are not
>>> really robust enough for production use.
>>>
>>> Thanks in advance,
>>> Eric
>
> That's why I took all the minimum classes needed and bundled them into
> one plugin.

I tried your plugin from CVS, but it has the same problem. I suspect
there is something that RichText is using from the
org.eclipse.ui.wokbench.texteditor package that is causing it, but I'm
still investigating.

Eric
Re: Re-using RichText and RichTextEditor [message #43271 is a reply to message #43075] Tue, 09 October 2007 11:22 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

Eric Rizzo wrote:
> A follow-up question:
> When I use a RichTextEditor in my plugin, it seems to have somehow
> hijacked the undo and redo actions (Ctrl+Z). I had a special
> (EMF-generated) action bar contributor that handled undo/redo through
> the EMF command stack, but now the RichTextEditor is being used if I try
> Ctrl+Z anywhere in my editor.
> I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
> my own, which seems to be the minimum required to actually use
> RichTextEditor.
>
> Any ideas how/why undo/redo is being hijacked in this way?

I must have been blind yesterday because this morning I quickly found
the method RichTextEditor.createUndoRedoActions() which I can override
to eliminate the unwanted actions.


> Is it possible (simple) to build the RichTextEditor as a JAR to be
> packaged with my plugin instead of deploying all those epf plugins?

Still looking for any advice on doing this, though...

Eric
Re: Re-using RichText and RichTextEditor [message #43377 is a reply to message #42902] Tue, 09 October 2007 15:47 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse6.rizzoweb.com

Another follow-up as I progress towards using RichTextEditor in non-EPF
plugins:

If I place a RichTextEditor in a JFace Dialog, there is an anomaly when
switching from the HTML tab to the Rich Text tab. If the cursor is in
the edit window when selecting the Rich Text tab, the dialog flashes
many times and eventually pops up an Internet Explorer error dialog that
says "Stack overflow at line: 0."
This happens regardless of the contents of the rich text or HTML edit
components.

I suspect some kind of incompatibility between the rte.js and placing
the editor in a modal dialog, but am not sure how to proceed.

Any help appreciated,
Eric
Re: Re-using RichText and RichTextEditor [message #43406 is a reply to message #43377] Tue, 09 October 2007 17:00 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> Another follow-up as I progress towards using RichTextEditor in non-EPF
> plugins:
>
> If I place a RichTextEditor in a JFace Dialog, there is an anomaly when
> switching from the HTML tab to the Rich Text tab. If the cursor is in
> the edit window when selecting the Rich Text tab, the dialog flashes
> many times and eventually pops up an Internet Explorer error dialog that
> says "Stack overflow at line: 0."
> This happens regardless of the contents of the rich text or HTML edit
> components.
>
> I suspect some kind of incompatibility between the rte.js and placing
> the editor in a modal dialog, but am not sure how to proceed.
>
> Any help appreciated,
> Eric

I found the same problem. Not sure either!

PB.
Re: Re-using RichText and RichTextEditor [message #43437 is a reply to message #43271] Tue, 09 October 2007 17:01 Go to previous messageGo to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:

>> Is it possible (simple) to build the RichTextEditor as a JAR to be
>> packaged with my plugin instead of deploying all those epf plugins?
>
> Still looking for any advice on doing this, though...
>
> Eric

Like I said, I have down exactly that but in one plugin which is
superior to one jar.

PB
Re: Re-using RichText and RichTextEditor [message #48358 is a reply to message #43406] Tue, 26 February 2008 05:25 Go to previous messageGo to next message
Robert Barthold is currently offline Robert Barthold
Messages: 9
Registered: July 2009
Junior Member
Hello Phillip,

i had the same problem. I solved it by commenting setFocus() in the ActivateListener.
This listener is located in RichText.java in the method addListeners(). It's
the second listener for the editorControl:

....
protected void addListeners()
{
this.editorControl = getControlSite( this.editor );
if ( this.editorControl != null )
{
if ( this.debug )
{
printDebugMessage( "init", "editorControl=" + this.editorControl.getClass().getName()
); //$NON-NLS-1$ //$NON-NLS-2$
}

this.editorControl.addListener( SWT.Activate, new Listener()
{
public void handleEvent( final Event event )
{
if ( RichText.this.debug )
{
printDebugMessage( "activateListener" ); //$NON-NLS-1$
}
// setFocus causes the RichText in the dialog to flicker.
// The reason for it was that it got and lost focus the whole time.
// commented the line -> fixed!
// setFocus();
notifyListeners( SWT.Activate, event );
}
} );
.....

Hope that helps.
Robert



> Eric Rizzo wrote:
>
>> Another follow-up as I progress towards using RichTextEditor in
>> non-EPF plugins:
>>
>> If I place a RichTextEditor in a JFace Dialog, there is an anomaly
>> when
>> switching from the HTML tab to the Rich Text tab. If the cursor is in
>> the edit window when selecting the Rich Text tab, the dialog flashes
>> many times and eventually pops up an Internet Explorer error dialog
>> that
>> says "Stack overflow at line: 0."
>> This happens regardless of the contents of the rich text or HTML edit
>> components.
>> I suspect some kind of incompatibility between the rte.js and placing
>> the editor in a modal dialog, but am not sure how to proceed.
>>
>> Any help appreciated,
>> Eric
> I found the same problem. Not sure either!
>
> PB.
>
Re: Re-using RichText and RichTextEditor [message #49815 is a reply to message #48358] Fri, 25 April 2008 08:35 Go to previous message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

Note that this bug has been fixed. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205927
and the related bug to make the RichText component available as a
stand-alone feature: https://bugs.eclipse.org/bugs/show_bug.cgi?id=209373

Eric


Robs wrote:
> Hello Phillip,
>
> i had the same problem. I solved it by commenting setFocus() in the
> ActivateListener. This listener is located in RichText.java in the
> method addListeners(). It's the second listener for the editorControl:
>
> ...
> protected void addListeners()
> {
> this.editorControl = getControlSite( this.editor );
> if ( this.editorControl != null )
> {
> if ( this.debug )
> {
> printDebugMessage( "init", "editorControl=" +
> this.editorControl.getClass().getName() ); //$NON-NLS-1$ //$NON-NLS-2$
> }
>
> this.editorControl.addListener( SWT.Activate, new Listener()
> {
> public void handleEvent( final Event event )
> {
> if ( RichText.this.debug )
> {
> printDebugMessage( "activateListener" ); //$NON-NLS-1$
> }
> // setFocus causes the RichText in the dialog to flicker.
> // The reason for it was that it got and lost focus the whole
> time.
> // commented the line -> fixed!
> // setFocus();
> notifyListeners( SWT.Activate, event );
> }
> } );
> ....
>
> Hope that helps.
> Robert
>
>
>
>> Eric Rizzo wrote:
>>
>>> Another follow-up as I progress towards using RichTextEditor in
>>> non-EPF plugins:
>>>
>>> If I place a RichTextEditor in a JFace Dialog, there is an anomaly
>>> when
>>> switching from the HTML tab to the Rich Text tab. If the cursor is in
>>> the edit window when selecting the Rich Text tab, the dialog flashes
>>> many times and eventually pops up an Internet Explorer error dialog
>>> that
>>> says "Stack overflow at line: 0."
>>> This happens regardless of the contents of the rich text or HTML edit
>>> components.
>>> I suspect some kind of incompatibility between the rte.js and placing
>>> the editor in a modal dialog, but am not sure how to proceed.
>>>
>>> Any help appreciated,
>>> Eric
>> I found the same problem. Not sure either!
>>
>> PB.
>>
>
>
>
Re: Re-using RichText and RichTextEditor [message #584402 is a reply to message #42902] Mon, 08 October 2007 16:55 Go to previous message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
> app. I'm going to ask a series of increasingly specific questions
> realted to doing so; I've tried to do some research, but if there is a
> RTFM answer, please provide a link or direction to the FM :-)
>
> Are there any resources available (other than the EPF source code) to
> help use the rich text editor in a non-EPF context?
>
> Has anyone done any work towards integrating RichTextEditor with the
> JFace Data Binding framework?
>
> Is there any way to get FOCUS_OUT events from RichTextEditor? I've tried
> hooking into the SWT.FocusOut event on the RichText but my Listener
> never gets called. I've also tried attaching the Listener to
> RichtText.getControl() without luck. The app/plugins I'm working on use
> FocusOut events to trigger modification from Text widgets to the model,
> so if I can't find a way to get RichText/RichtTextEditor to emit
> FocusOut events I'm afraid I won't be able to use it - that would be
> very unfortunate since the existing alternatives are not really robust
> enough for production use.
>
> Thanks in advance,
> Eric

Yes, me.

Can't help on the FOCUS_OUT or Data Binding thing. But...

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
Re: Re-using RichText and RichTextEditor [message #584418 is a reply to message #43027] Mon, 08 October 2007 17:59 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
Phillip Beauvoir wrote:
> Eric Rizzo wrote:
>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>> app. I'm going to ask a series of increasingly specific questions
>> realted to doing so; I've tried to do some research, but if there is a
>> RTFM answer, please provide a link or direction to the FM :-)
>>
>> Are there any resources available (other than the EPF source code) to
>> help use the rich text editor in a non-EPF context?
>>
>> Has anyone done any work towards integrating RichTextEditor with the
>> JFace Data Binding framework?
>>
>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>> tried hooking into the SWT.FocusOut event on the RichText but my
>> Listener never gets called. I've also tried attaching the Listener to
>> RichtText.getControl() without luck. The app/plugins I'm working on
>> use FocusOut events to trigger modification from Text widgets to the
>> model, so if I can't find a way to get RichText/RichtTextEditor to
>> emit FocusOut events I'm afraid I won't be able to use it - that would
>> be very unfortunate since the existing alternatives are not really
>> robust enough for production use.
>>
>> Thanks in advance,
>> Eric
>
> Yes, me.
>
> Can't help on the FOCUS_OUT or Data Binding thing. But...
>
> 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
[etc...]
> }

OK, thanks. That is pretty much the same thing I am doing.

Eric
Re: Re-using RichText and RichTextEditor [message #584437 is a reply to message #42902] Mon, 08 October 2007 18:03 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
A follow-up question:
When I use a RichTextEditor in my plugin, it seems to have somehow
hijacked the undo and redo actions (Ctrl+Z). I had a special
(EMF-generated) action bar contributor that handled undo/redo through
the EMF command stack, but now the RichTextEditor is being used if I try
Ctrl+Z anywhere in my editor.
I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
my own, which seems to be the minimum required to actually use
RichTextEditor.

Any ideas how/why undo/redo is being hijacked in this way?

Is it possible (simple) to build the RichTextEditor as a JAR to be
packaged with my plugin instead of deploying all those epf plugins?

Thanks in advance,
Eric


Eric Rizzo wrote:
> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
> app. I'm going to ask a series of increasingly specific questions
> realted to doing so; I've tried to do some research, but if there is a
> RTFM answer, please provide a link or direction to the FM :-)
>
> Are there any resources available (other than the EPF source code) to
> help use the rich text editor in a non-EPF context?
>
> Has anyone done any work towards integrating RichTextEditor with the
> JFace Data Binding framework?
>
> Is there any way to get FOCUS_OUT events from RichTextEditor? I've tried
> hooking into the SWT.FocusOut event on the RichText but my Listener
> never gets called. I've also tried attaching the Listener to
> RichtText.getControl() without luck. The app/plugins I'm working on use
> FocusOut events to trigger modification from Text widgets to the model,
> so if I can't find a way to get RichText/RichtTextEditor to emit
> FocusOut events I'm afraid I won't be able to use it - that would be
> very unfortunate since the existing alternatives are not really robust
> enough for production use.
>
> Thanks in advance,
> Eric
Re: Re-using RichText and RichTextEditor [message #584482 is a reply to message #43075] Tue, 09 October 2007 00:55 Go to previous message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> A follow-up question:
> When I use a RichTextEditor in my plugin, it seems to have somehow
> hijacked the undo and redo actions (Ctrl+Z). I had a special
> (EMF-generated) action bar contributor that handled undo/redo through
> the EMF command stack, but now the RichTextEditor is being used if I try
> Ctrl+Z anywhere in my editor.
> I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
> my own, which seems to be the minimum required to actually use
> RichTextEditor.
>
> Any ideas how/why undo/redo is being hijacked in this way?
>
> Is it possible (simple) to build the RichTextEditor as a JAR to be
> packaged with my plugin instead of deploying all those epf plugins?
>
> Thanks in advance,
> Eric
>
>
> Eric Rizzo wrote:
>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>> app. I'm going to ask a series of increasingly specific questions
>> realted to doing so; I've tried to do some research, but if there is a
>> RTFM answer, please provide a link or direction to the FM :-)
>>
>> Are there any resources available (other than the EPF source code) to
>> help use the rich text editor in a non-EPF context?
>>
>> Has anyone done any work towards integrating RichTextEditor with the
>> JFace Data Binding framework?
>>
>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>> tried hooking into the SWT.FocusOut event on the RichText but my
>> Listener never gets called. I've also tried attaching the Listener to
>> RichtText.getControl() without luck. The app/plugins I'm working on
>> use FocusOut events to trigger modification from Text widgets to the
>> model, so if I can't find a way to get RichText/RichtTextEditor to
>> emit FocusOut events I'm afraid I won't be able to use it - that would
>> be very unfortunate since the existing alternatives are not really
>> robust enough for production use.
>>
>> Thanks in advance,
>> Eric

That's why I took all the minimum classes needed and bundled them into
one plugin.

PB.
Re: Re-using RichText and RichTextEditor [message #584508 is a reply to message #43170] Tue, 09 October 2007 09:05 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
Phillip Beauvoir wrote:
> Eric Rizzo wrote:
>> A follow-up question:
>> When I use a RichTextEditor in my plugin, it seems to have somehow
>> hijacked the undo and redo actions (Ctrl+Z). I had a special
>> (EMF-generated) action bar contributor that handled undo/redo through
>> the EMF command stack, but now the RichTextEditor is being used if I
>> try Ctrl+Z anywhere in my editor.
>> I've got the epf.richtext, epf.ui, and epf.common plugins deployed
>> with my own, which seems to be the minimum required to actually use
>> RichTextEditor.
>>
>> Any ideas how/why undo/redo is being hijacked in this way?
>>
>> Is it possible (simple) to build the RichTextEditor as a JAR to be
>> packaged with my plugin instead of deploying all those epf plugins?
>>
>> Thanks in advance,
>> Eric
>>
>>
>> Eric Rizzo wrote:
>>> I'm trying to use EPF's RichtText/RichTextEditor in a plugin and RCP
>>> app. I'm going to ask a series of increasingly specific questions
>>> realted to doing so; I've tried to do some research, but if there is
>>> a RTFM answer, please provide a link or direction to the FM :-)
>>>
>>> Are there any resources available (other than the EPF source code) to
>>> help use the rich text editor in a non-EPF context?
>>>
>>> Has anyone done any work towards integrating RichTextEditor with the
>>> JFace Data Binding framework?
>>>
>>> Is there any way to get FOCUS_OUT events from RichTextEditor? I've
>>> tried hooking into the SWT.FocusOut event on the RichText but my
>>> Listener never gets called. I've also tried attaching the Listener to
>>> RichtText.getControl() without luck. The app/plugins I'm working on
>>> use FocusOut events to trigger modification from Text widgets to the
>>> model, so if I can't find a way to get RichText/RichtTextEditor to
>>> emit FocusOut events I'm afraid I won't be able to use it - that
>>> would be very unfortunate since the existing alternatives are not
>>> really robust enough for production use.
>>>
>>> Thanks in advance,
>>> Eric
>
> That's why I took all the minimum classes needed and bundled them into
> one plugin.

I tried your plugin from CVS, but it has the same problem. I suspect
there is something that RichText is using from the
org.eclipse.ui.wokbench.texteditor package that is causing it, but I'm
still investigating.

Eric
Re: Re-using RichText and RichTextEditor [message #584525 is a reply to message #43075] Tue, 09 October 2007 11:22 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> A follow-up question:
> When I use a RichTextEditor in my plugin, it seems to have somehow
> hijacked the undo and redo actions (Ctrl+Z). I had a special
> (EMF-generated) action bar contributor that handled undo/redo through
> the EMF command stack, but now the RichTextEditor is being used if I try
> Ctrl+Z anywhere in my editor.
> I've got the epf.richtext, epf.ui, and epf.common plugins deployed with
> my own, which seems to be the minimum required to actually use
> RichTextEditor.
>
> Any ideas how/why undo/redo is being hijacked in this way?

I must have been blind yesterday because this morning I quickly found
the method RichTextEditor.createUndoRedoActions() which I can override
to eliminate the unwanted actions.


> Is it possible (simple) to build the RichTextEditor as a JAR to be
> packaged with my plugin instead of deploying all those epf plugins?

Still looking for any advice on doing this, though...

Eric
Re: Re-using RichText and RichTextEditor [message #584577 is a reply to message #42902] Tue, 09 October 2007 15:47 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
Another follow-up as I progress towards using RichTextEditor in non-EPF
plugins:

If I place a RichTextEditor in a JFace Dialog, there is an anomaly when
switching from the HTML tab to the Rich Text tab. If the cursor is in
the edit window when selecting the Rich Text tab, the dialog flashes
many times and eventually pops up an Internet Explorer error dialog that
says "Stack overflow at line: 0."
This happens regardless of the contents of the rich text or HTML edit
components.

I suspect some kind of incompatibility between the rte.js and placing
the editor in a modal dialog, but am not sure how to proceed.

Any help appreciated,
Eric
Re: Re-using RichText and RichTextEditor [message #584589 is a reply to message #43377] Tue, 09 October 2007 17:00 Go to previous message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> Another follow-up as I progress towards using RichTextEditor in non-EPF
> plugins:
>
> If I place a RichTextEditor in a JFace Dialog, there is an anomaly when
> switching from the HTML tab to the Rich Text tab. If the cursor is in
> the edit window when selecting the Rich Text tab, the dialog flashes
> many times and eventually pops up an Internet Explorer error dialog that
> says "Stack overflow at line: 0."
> This happens regardless of the contents of the rich text or HTML edit
> components.
>
> I suspect some kind of incompatibility between the rte.js and placing
> the editor in a modal dialog, but am not sure how to proceed.
>
> Any help appreciated,
> Eric

I found the same problem. Not sure either!

PB.
Re: Re-using RichText and RichTextEditor [message #584598 is a reply to message #43271] Tue, 09 October 2007 17:01 Go to previous message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Eric Rizzo wrote:

>> Is it possible (simple) to build the RichTextEditor as a JAR to be
>> packaged with my plugin instead of deploying all those epf plugins?
>
> Still looking for any advice on doing this, though...
>
> Eric

Like I said, I have down exactly that but in one plugin which is
superior to one jar.

PB
Re: Re-using RichText and RichTextEditor [message #588532 is a reply to message #43406] Tue, 26 February 2008 05:25 Go to previous message
Robert Barthold is currently offline Robert Barthold
Messages: 9
Registered: July 2009
Junior Member
Hello Phillip,

i had the same problem. I solved it by commenting setFocus() in the ActivateListener.
This listener is located in RichText.java in the method addListeners(). It's
the second listener for the editorControl:

....
protected void addListeners()
{
this.editorControl = getControlSite( this.editor );
if ( this.editorControl != null )
{
if ( this.debug )
{
printDebugMessage( "init", "editorControl=" + this.editorControl.getClass().getName()
); //$NON-NLS-1$ //$NON-NLS-2$
}

this.editorControl.addListener( SWT.Activate, new Listener()
{
public void handleEvent( final Event event )
{
if ( RichText.this.debug )
{
printDebugMessage( "activateListener" ); //$NON-NLS-1$
}
// setFocus causes the RichText in the dialog to flicker.
// The reason for it was that it got and lost focus the whole time.
// commented the line -> fixed!
// setFocus();
notifyListeners( SWT.Activate, event );
}
} );
.....

Hope that helps.
Robert



> Eric Rizzo wrote:
>
>> Another follow-up as I progress towards using RichTextEditor in
>> non-EPF plugins:
>>
>> If I place a RichTextEditor in a JFace Dialog, there is an anomaly
>> when
>> switching from the HTML tab to the Rich Text tab. If the cursor is in
>> the edit window when selecting the Rich Text tab, the dialog flashes
>> many times and eventually pops up an Internet Explorer error dialog
>> that
>> says "Stack overflow at line: 0."
>> This happens regardless of the contents of the rich text or HTML edit
>> components.
>> I suspect some kind of incompatibility between the rte.js and placing
>> the editor in a modal dialog, but am not sure how to proceed.
>>
>> Any help appreciated,
>> Eric
> I found the same problem. Not sure either!
>
> PB.
>
Re: Re-using RichText and RichTextEditor [message #589009 is a reply to message #48358] Fri, 25 April 2008 08:35 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2108
Registered: July 2009
Senior Member
Note that this bug has been fixed. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205927
and the related bug to make the RichText component available as a
stand-alone feature: https://bugs.eclipse.org/bugs/show_bug.cgi?id=209373

Eric


Robs wrote:
> Hello Phillip,
>
> i had the same problem. I solved it by commenting setFocus() in the
> ActivateListener. This listener is located in RichText.java in the
> method addListeners(). It's the second listener for the editorControl:
>
> ...
> protected void addListeners()
> {
> this.editorControl = getControlSite( this.editor );
> if ( this.editorControl != null )
> {
> if ( this.debug )
> {
> printDebugMessage( "init", "editorControl=" +
> this.editorControl.getClass().getName() ); //$NON-NLS-1$ //$NON-NLS-2$
> }
>
> this.editorControl.addListener( SWT.Activate, new Listener()
> {
> public void handleEvent( final Event event )
> {
> if ( RichText.this.debug )
> {
> printDebugMessage( "activateListener" ); //$NON-NLS-1$
> }
> // setFocus causes the RichText in the dialog to flicker.
> // The reason for it was that it got and lost focus the whole
> time.
> // commented the line -> fixed!
> // setFocus();
> notifyListeners( SWT.Activate, event );
> }
> } );
> ....
>
> Hope that helps.
> Robert
>
>
>
>> Eric Rizzo wrote:
>>
>>> Another follow-up as I progress towards using RichTextEditor in
>>> non-EPF plugins:
>>>
>>> If I place a RichTextEditor in a JFace Dialog, there is an anomaly
>>> when
>>> switching from the HTML tab to the Rich Text tab. If the cursor is in
>>> the edit window when selecting the Rich Text tab, the dialog flashes
>>> many times and eventually pops up an Internet Explorer error dialog
>>> that
>>> says "Stack overflow at line: 0."
>>> This happens regardless of the contents of the rich text or HTML edit
>>> components.
>>> I suspect some kind of incompatibility between the rte.js and placing
>>> the editor in a modal dialog, but am not sure how to proceed.
>>>
>>> Any help appreciated,
>>> Eric
>> I found the same problem. Not sure either!
>>
>> PB.
>>
>
>
>
Previous Topic:Getting RoleSets from XMI files
Next Topic:EPF Update Site
Goto Forum:
  


Current Time: Sun Apr 20 23:02:47 EDT 2014

Powered by FUDForum. Page generated in 0.02788 seconds