Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Trouble with global action handlers in FormEditor
Trouble with global action handlers in FormEditor [message #444810] Tue, 21 February 2006 09:53 Go to next message
Eclipse UserFriend
Hi everyone,

I have an editorpart which is subclass of FormEditor. It initially consists
of one overview page (IFormPage) which contains some simple widgets like
Text, Combo, Hyperlink etc. There are also some other pages that are being
added/removed dynamically. These dynamically added pages are subclasses of
AbstractTextEditor class and implement the IFormPage interface.

Now, when I first open this FormEditor, I can cut/copy/paste text using
shortcut keys (ctrl+x etc.) in the overview page's Text widgets. Later when
I open (addPage) a text editor page, I can use these shortcuts in the text
editor too. But the problems starts, when I switch back to the overview
page:
a) The shortcuts like ctrl+x, ctrl+v etc. are still handled by the text
editor page, although it is no longer active.
b) Although I close the text editor page, the shortcuts still doesn't
work for the text widgets in the overview page.

I know that I miss something and I have been debugging and searching the
newsgroups etc. but I still couldn't find any solution. Here are some
relevant methods from my text editor based page.

public class TextAttEditor extends AbstractTextEditor implements IFormPage{
private String[] scopes;

public TextAttEditor(...) {
scopes = editor.getSite().getKeyBindingService().getScopes();
setKeyBindingScopes(new String[] {
"org.eclipse.ui.textEditorScope",
"com.rochade.metability.ui.app.textAttEditingScope" }); //$NON-NLS-1$
//$NON-NLS-2$

initialize(editor);
}

public void initialize(FormEditor editor) {
try {
init(editor.getEditorSite(), editor.getEditorInput());
} catch (PartInitException e) {
AppPlugin.getInstance().log(MtbErrorManager.ERROR, e);
}
}

public void setActive(boolean active) {
if (active) {
IActionBars actionBar = getEditorSite().getActionBars();
actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(),
getAction(ITextEditorActionConstants.UNDO));
actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(),
getAction(ITextEditorActionConstants.REDO));
actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(),
getAction(ITextEditorActionConstants.COPY));
actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(),
getAction(ITextEditorActionConstants.CUT));
actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId() ,
getAction(ITextEditorActionConstants.PASTE));
actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId( ),
getAction(ITextEditorActionConstants.DELETE));
actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(),
getAction(ITextEditorActionConstants.FIND));

actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.ge tId(),
getAction(ITextEditorActionConstants.SELECT_ALL));
actionBar.updateActionBars();
}else{
IActionBars actionBar = editor.getEditorSite().getActionBars();
actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(),
null);
actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(),
null);
actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(),
null);
actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(),
null);
actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId() ,
null);
actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId( ),
null);
actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(),
null);

actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.ge tId(), null);
actionBar.updateActionBars();
editor.getSite().getKeyBindingService().setScopes(scopes);
}
}
}


Thanks in advance,

Yetkin
Re: Trouble with global action handlers in FormEditor [message #444845 is a reply to message #444810] Wed, 22 February 2006 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Yetkin Oezkucur wrote:
> Hi everyone,
>
> I have an editorpart which is subclass of FormEditor. It initially consists
> of one overview page (IFormPage) which contains some simple widgets like
> Text, Combo, Hyperlink etc. There are also some other pages that are being
> added/removed dynamically. These dynamically added pages are subclasses of
> AbstractTextEditor class and implement the IFormPage interface.
>
> Now, when I first open this FormEditor, I can cut/copy/paste text using
> shortcut keys (ctrl+x etc.) in the overview page's Text widgets. Later when
> I open (addPage) a text editor page, I can use these shortcuts in the text
> editor too. But the problems starts, when I switch back to the overview
> page:
> a) The shortcuts like ctrl+x, ctrl+v etc. are still handled by the text
> editor page, although it is no longer active.
> b) Although I close the text editor page, the shortcuts still doesn't
> work for the text widgets in the overview page.

Yetkin,

If this is happening, open a bug report against Eclipse Platform/UI in
bugzilla https://bugs.eclipse.org/bugs/

Please include your platform information, eclipse version, your usecase,
and if possible a simple example of your FormEditor that shows the problem.

Later,
PW
Re: Trouble with global action handlers in FormEditor [message #444877 is a reply to message #444845] Wed, 22 February 2006 11:34 Go to previous message
Eclipse UserFriend
Hi Paul,

Thank you for your response. I've created the bug #128995

Yetkin

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:dthq3b$1pu$1@utils.eclipse.org...
> Yetkin Oezkucur wrote:
> > Hi everyone,
> >
> > I have an editorpart which is subclass of FormEditor. It initially
consists
> > of one overview page (IFormPage) which contains some simple widgets like
> > Text, Combo, Hyperlink etc. There are also some other pages that are
being
> > added/removed dynamically. These dynamically added pages are subclasses
of
> > AbstractTextEditor class and implement the IFormPage interface.
> >
> > Now, when I first open this FormEditor, I can cut/copy/paste text using
> > shortcut keys (ctrl+x etc.) in the overview page's Text widgets. Later
when
> > I open (addPage) a text editor page, I can use these shortcuts in the
text
> > editor too. But the problems starts, when I switch back to the overview
> > page:
> > a) The shortcuts like ctrl+x, ctrl+v etc. are still handled by the
text
> > editor page, although it is no longer active.
> > b) Although I close the text editor page, the shortcuts still
doesn't
> > work for the text widgets in the overview page.
>
> Yetkin,
>
> If this is happening, open a bug report against Eclipse Platform/UI in
> bugzilla https://bugs.eclipse.org/bugs/
>
> Please include your platform information, eclipse version, your usecase,
> and if possible a simple example of your FormEditor that shows the
problem.
>
> Later,
> PW
Previous Topic:RCP product
Next Topic:ClassNotFound when running product/application outside IDE
Goto Forum:
  


Current Time: Mon Jul 07 08:28:54 EDT 2025

Powered by FUDForum. Page generated in 0.07537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top