Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problem with help invocation if SWT_AWT is used
Problem with help invocation if SWT_AWT is used [message #519658] Tue, 09 March 2010 05:44
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
I'm trying to solve the following problem:

I have a simple RCP-View, which uses a Swing
table widget (JTable) embedded in an SWT composite
via the well-known SWT_AWT technique as shown
below.

The RCP application where this view is part of
uses the Eclipse help system (i.e. via the
existing org.eclipse.help.appserver and
org.eclipse.help.webapp dependencies) and it
the help mechanism is properly invoked, if
use_awt == false and F1 is pressed. If I activate
the Swing-component via use_awt == true, no help
search is done on pressing F1. My assumption
is, that the Swing controls "steal" the focus and
which again prevents a successful help search.

My question is: What is the proper way of enabling
the Eclipse help in the presence of Swing components?

Thanks,

Daniel Krügler

public class View extends ViewPart {

private Composite composite;

private boolean use_awt = true;

public void createPartControl(Composite parent) {
Composite main = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
main.setLayout(layout);

if (use_awt) {
composite = new Composite(main, SWT.EMBEDDED);
Frame frame = SWT_AWT.new_Frame(composite);
JScrollPane scroll = new JScrollPane(createTable());
JPanel panel = new JPanel(new BorderLayout());
panel.add(scroll, BorderLayout.CENTER);
frame.add(panel, BorderLayout.CENTER);
frame.setVisible(true);
} else {
composite = new Composite(main, SWT.NONE);
}

PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
"de.kruegler.daniel.testawthelp.help_1_ctx");
}

public void setFocus() {
composite.setFocus();
}

private JTable createTable() {
String[][] rows = { { "One" }, { "Two" }, { "Three" } };
String headers[] = { "Items" };
DefaultTableModel model = new DefaultTableModel(rows, headers);
final JTable table = new JTable(model);
return table;
}

}
Previous Topic:Problem with Splash Browser
Next Topic:Where is the "windows" menu?
Goto Forum:
  


Current Time: Mon Jul 28 04:22:04 EDT 2014

Powered by FUDForum. Page generated in 0.01830 seconds