N
napo
Hi all,
I'm developing an Eclipse (3.3) RCP application and I have a problem.
I created some custom actions like this:
public class InsertTableRecordAction extends Action
implements ISelectionListener, IWorkbenchAction {
private final IWorkbenchWindow window;
private IStructuredSelection selection;
public InsertTableRecordAction(IWorkbenchWindow window) {
this.window = window;
setId("InsertTableRecordAction");
...
window.getSelectionService().addSelectionListener(this);
}
public void selectionChanged(IWorkbenchPart part, ISelection incoming) {
selection = (some kind of cast) incoming;
setEnabled(depends on selection type);
}
}
In the ActionBarAdvisor file I created the actions and filled all the menu
and tool bar. And it works fine.
Now, I created an EditorPart with some SWT widgets in it. Some of these
widgets are normal Button.
I want to link my custom action to these buttons, so they run the action
code and they enables concerning the action logic.
How can I associate an action to a button?
Thanks
Marco
I'm developing an Eclipse (3.3) RCP application and I have a problem.
I created some custom actions like this:
public class InsertTableRecordAction extends Action
implements ISelectionListener, IWorkbenchAction {
private final IWorkbenchWindow window;
private IStructuredSelection selection;
public InsertTableRecordAction(IWorkbenchWindow window) {
this.window = window;
setId("InsertTableRecordAction");
...
window.getSelectionService().addSelectionListener(this);
}
public void selectionChanged(IWorkbenchPart part, ISelection incoming) {
selection = (some kind of cast) incoming;
setEnabled(depends on selection type);
}
}
In the ActionBarAdvisor file I created the actions and filled all the menu
and tool bar. And it works fine.
Now, I created an EditorPart with some SWT widgets in it. Some of these
widgets are normal Button.
I want to link my custom action to these buttons, so they run the action
code and they enables concerning the action logic.
How can I associate an action to a button?
Thanks
Marco