Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ToolBar and Key Binding
ToolBar and Key Binding [message #443944] Mon, 04 October 2004 20:48 Go to next message
jmi is currently offline jmiFriend
Messages: 84
Registered: July 2009
Member
Hello,

I've defined a ViewForm with a ToolBar in the top left.

I've put org.eclipse.jface.action.Action running with:

public class TestAction extends Action implements ISelectionChangedListener,
IDoubleClickListener {
public TestAction(final Composite myComposite) {
super();
setText("Test Action");
setAccelerator(SWT.CTRL | 'C');
//setText("Test@Ctrl+C");// Le key binding ne fonctionne pas
setToolTipText("Run the test action...");
setEnabled(true);
setImageDescriptor(ImageDescriptor.createFromURL(Util
.newURL("file:icons/folder.gif")));
}

...
In myComposite, i have:

ToolBarManager tbManager = createToolBarManager(SWT.HORIZONTAL |
SWT.FLAT);
ToolBar tb = tbManager.createControl(vf);
vf.setTopLeft(tb);


protected ToolBarManager createToolBarManager(final int style) {
// Create the manager
ToolBarManager manager = new ToolBarManager(style);
ActionContributionItem actionItem = new
ActionContributionItem(_testAction);
//actionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT) ;
// Add an ActionContributionItem
manager.add(actionItem);
// Return the manager
return manager;
}

One button appears in the ToolBar and when you click on it, you have the
good result. So yyyeeeeessssssss everything is OK, my action is running.

Now, let's do CTRL+C ... and nothing happens!!!!!!

So, what's wrong????

There are Text widget in myComposite. Is the event consumed by a Widget???
Another thing, if i put some text in a Text widget, then i do CTRL+A [select
all], nothing is selected. So is it the rigth way?

Thanks

JMi
Re: ToolBar and Key Binding [message #444130 is a reply to message #443944] Thu, 07 October 2004 06:48 Go to previous message
jmi is currently offline jmiFriend
Messages: 84
Registered: July 2009
Member
Well, i've done it by adding the action in the main menu bar then with the
setComposite function, i modifiy the action of the panel (each panel
implements a custom interface IBaseAction with save, run, new...)... and
it runs.

JM Delsaux wrote:

> Hello,

> I've defined a ViewForm with a ToolBar in the top left.

> I've put org.eclipse.jface.action.Action running with:

> public class TestAction extends Action implements ISelectionChangedListener,
> IDoubleClickListener {
> public TestAction(final Composite myComposite) {
> super();
> setText("Test Action");
> setAccelerator(SWT.CTRL | 'C');
> //setText("Test@Ctrl+C");// Le key binding ne fonctionne pas
> setToolTipText("Run the test action...");
> setEnabled(true);
> setImageDescriptor(ImageDescriptor.createFromURL(Util
> .newURL("file:icons/folder.gif")));
> }

> ...
> In myComposite, i have:

> ToolBarManager tbManager = createToolBarManager(SWT.HORIZONTAL |
> SWT.FLAT);
> ToolBar tb = tbManager.createControl(vf);
> vf.setTopLeft(tb);


> protected ToolBarManager createToolBarManager(final int style) {
> // Create the manager
> ToolBarManager manager = new ToolBarManager(style);
> ActionContributionItem actionItem = new
> ActionContributionItem(_testAction);
> //actionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT) ;
> // Add an ActionContributionItem
> manager.add(actionItem);
> // Return the manager
> return manager;
> }

> One button appears in the ToolBar and when you click on it, you have the
> good result. So yyyeeeeessssssss everything is OK, my action is running.

> Now, let's do CTRL+C ... and nothing happens!!!!!!

> So, what's wrong????

> There are Text widget in myComposite. Is the event consumed by a Widget???
> Another thing, if i put some text in a Text widget, then i do CTRL+A [select
> all], nothing is selected. So is it the rigth way?

> Thanks

> JMi
Previous Topic:Sizing text widgets
Next Topic:eclipse gui using swt/jface
Goto Forum:
  


Current Time: Tue Oct 20 12:35:01 GMT 2020

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

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

Back to the top