wizard.setTitle(MessageText.getString("installPluginsWizard.list.title"));
wizard.setErrorMessage("");
Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);
Composite panel = new Composite(rootPanel, SWT.NULL);
GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
panel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 1;
panel.setLayout(layout);
final Label lblStatus = new Label(panel,SWT.NULL);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
lblStatus.setLayoutData(data);
Messages.setLanguageText(lblStatus,"installPluginsWizard.list.loading");
pluginList = new Table(panel,SWT.BORDER | SWT.V_SCROLL | SWT.CHECK | SWT.FULL_SELECTION | SWT.SINGLE);
pluginList.setHeaderVisible(true);
data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = 120;
pluginList.setLayoutData(data);
TableColumn tcName = new TableColumn(pluginList,SWT.LEFT);
Messages.setLanguageText(tcName,"installPluginsWizard.list.name");
tcName.setWidth(200);
TableColumn tcVersion = new TableColumn(pluginList,SWT.LEFT);
Messages.setLanguageText(tcVersion,"installPluginsWizard.list.version");
tcVersion.setWidth(150);
Label lblDescription = new Label(panel,SWT.NULL);
Messages.setLanguageText(lblDescription,"installPluginsWizard.list.description");
link_area = new LinkArea( panel );
data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = 100;
link_area.getComponent().setLayoutData(data);
AEThread listLoader = new AEThread("Plugin List Loader") {
public void runSupport() {
final StandardPlugin plugins[];
try {
plugins = ((InstallPluginWizard)wizard).getStandardPlugins();
Arrays.sort(
plugins,
new Comparator()
{
public int
compare(
Object o1,
Object o2)
{
return(((StandardPlugin)o1).getName().compareToIgnoreCase(((StandardPlugin)o2).getName()));
}
});
} catch(final Exception e) {
Debug.printStackTrace(e);
wizard.getDisplay().asyncExec(new AERunnable() {
public void runSupport() {
link_area.addLine( Debug.getNestedExceptionMessage(e));
}
});
return;
}
wizard.getDisplay().asyncExec(new AERunnable() {
public void runSupport() {
lblStatus.setText( ((InstallPluginWizard)wizard).getListTitleText());
List selected_plugins = ((InstallPluginWizard)wizard).getPluginList();
for(int i = 0 ; i < plugins.length ; i++) {
StandardPlugin plugin = plugins[i];
if(plugin.getAlreadyInstalledPlugin() == null) {
if(pluginList == null || pluginList.isDisposed())
return;
TableItem item = new TableItem(pluginList,SWT.NULL);
item.setData(plugin);
item.setText(0,plugin.getName());
boolean selected = false;
for (int j=0;j<selected_plugins.size();j++){
if (((StandardPlugin)selected_plugins.get(j)).getId() == plugin.getId()){
selected = true;
}
}
item.setChecked( selected );
item.setText(1,plugin.getVersion());
}
}
// if there's only one entry then we might as well pull it in (this is really to
// support explicit install directions in the wizard as opposed to selection from
// the SF list )
if ( plugins.length == 1 && pluginList.getItemCount() > 0 ){
pluginList.select(0);
loadPluginDetails( pluginList.getItem(0));
}
}
});
}
};
listLoader.setDaemon(true);
listLoader.start();
pluginList.addListener(SWT.Selection,new Listener() {
public void handleEvent(Event e) {
if(pluginList.getSelectionCount() > 0) {
loadPluginDetails( pluginList.getSelection()[0]);
}
updateList();
}
});