public void getCoreComponents() {
}
public void initUIComponents() {
SWTSkin skin = null;
try {
skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
}catch(Throwable t) { }
final Shell shell1=new Shell(SWTThread.getDisplay(),SWT.ON_TOP);
shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setSize(400, 330);
Utils.centreWindow(shell);
shell.setImage(SWTImageRepository.getImage("updater.png"));
shell.setText(_._("updaterwindow.title"));
shell.setLayout(new GridLayout(1,false));
Label label;
GridData grid_data;
GridLayout layout;
Composite window_content = new Composite(shell,SWT.NONE);
layout = new GridLayout(2,false);
layout.marginLeft = 50;
layout.marginBottom = 0;
window_content.setLayout(layout);
window_content.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(window_content,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(JMConstants.JMULE_NAME + " " + _._("updaterwindow.label.jmule_version") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
user_version = new Label(window_content,SWT.NONE);
FontData data = skin.getDefaultFont().getFontData()[0];
Font font = new Font(SWTThread.getDisplay(),data.getName(),data.getHeight(),SWT.BOLD );
user_version.setFont(font);
user_version.setText(JMConstants.CURRENT_JMULE_VERSION);
user_version.setForeground(green_color);
label = new Label(window_content,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setText(_._("updaterwindow.label.available_version") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
available_version = new Label(window_content,SWT.NONE);
available_version.setFont(font);
available_version.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
available_version.setForeground(green_color);
label = new Label(window_content,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("updaterwindow.label.last_update") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
last_update = new Label(window_content,SWT.NONE);
last_update.setFont(skin.getDefaultFont());
last_update.setForeground(skin.getDefaultColor());
last_update.setForeground(skin.getDefaultColor());
last_update.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
download_link = new CLabel(shell,SWT.NONE);
grid_data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
grid_data.horizontalSpan = 2;
download_link.setLayoutData(grid_data);
download_link.setText(_._("updaterwindow.label.download_link"));
download_link.setData(JMConstants.JMULE_DOWNLOAD_PAGE);
download_link.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
download_link.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
download_link.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent arg0) {
String path = (String) ((CLabel) arg0.widget).getData();
if (!Utils.launchProgram(path))
Utils.showWarningMessage(shell, _._("updaterwindow.error_open_url.title")
, Localizer._("updaterwindow.error_open_url",path));
}
public void mouseDown(MouseEvent arg0) {
String path = (String) ((CLabel) arg0.widget).getData();
if (!Utils.launchProgram(path))
Utils.showWarningMessage(shell, _._("updaterwindow.error_open_url.title")
, Localizer._("updaterwindow.error_open_url",path));
}
});
download_link.setVisible(false);
Group changelog_group = new Group(shell,SWT.NONE);
changelog_group.setLayout(new FillLayout());
changelog_group.setLayoutData(new GridData(GridData.FILL_BOTH));
changelog_group.setText(_._("updaterwindow.group.changelog"));
changelog_text = new StyledText(changelog_group,SWT.H_SCROLL | SWT.V_SCROLL);
changelog_text.setEditable(false);
Font font_changelog = new Font(SWTThread.getDisplay(),"Courier",10,SWT.NONE );
changelog_text.setFont(font_changelog);
Composite button_bar = new Composite(shell,SWT.NONE);
button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout = new GridLayout(3,false);
button_bar.setLayout(layout);
final Button button_startup_check = new Button(button_bar,SWT.CHECK);
grid_data = new GridData();
grid_data.horizontalSpan = 2;
grid_data.horizontalAlignment = GridData.BEGINNING;
button_startup_check.setLayoutData(grid_data);
button_startup_check.setText(_._("updaterwindow.check.startup_check"));
button_startup_check.setSelection(SWTPreferences.getInstance().updateCheckAtStartup());
Button button_ok = new Button(button_bar,SWT.NONE);
button_ok.setFont(skin.getButtonFont());
button_ok.setText(_._("updaterwindow.button.ok"));
button_ok.setImage(SWTImageRepository.getImage("ok.png"));
grid_data = new GridData();
grid_data.horizontalAlignment = GridData.END;
grid_data.widthHint = 60;