protected void createDialogHeader(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(3, false));
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Hyperlink hl1 = new Hyperlink(composite, SWT.NONE);
hl1.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
hl1.setText(Messages.getString("help"));
hl1.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
try {
String lang = Locale.getDefault().getLanguage();
InputStream is = FormulaCellEditorProvider.class.getResourceAsStream("FormulaHelp_" + lang);
if (is == null) {
is = FormulaCellEditorProvider.class.getResourceAsStream("FormulaHelp");
}
String help = IOUtils.readStream(is);
HelpDialog dialog = new HelpDialog(help);
dialog.open();
} catch (IOException ex) {
DesignerLogger.logError("Unable to find help file", ex);
}
}
});
hyperlinkGroup.add(hl1);
Hyperlink hl2 = new Hyperlink(composite, SWT.NONE);
hl2.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hl2.setText(Messages.getString("button.insert_function"));
hl2.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
ChooseFunctionDialog dialog = new ChooseFunctionDialog();
String function = dialog.openDialog();
if (function != null) {
styledText.insert(function);
styledText.setFocus();
styledText.setCaretOffset(styledText.getCaretOffset() + function.length());
}
}
});
hyperlinkGroup.add(hl2);
Hyperlink hl3 = new Hyperlink(composite, SWT.NONE);
hl3.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hl3.setText(Messages.getString("button.insert_variable"));
hl3.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
ChooseVariableDialog dialog = new ChooseVariableDialog(variableNames);
String variableName = dialog.openDialog();
if (variableName != null) {