result.setLayout(layout);
//Jar row
Label l = new Label(result, SWT.NONE);
l.setText(Messages.getString("identify.jar")); //$NON-NLS-1$
l.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
final ListViewer jarsList = new ListViewer(result);
jarsList.setContentProvider(new StructuredContentProviderAdapter() {
public Object[] getElements(Object inputElement) {
return getJarFiles().toArray();
};
});
jarsList.setInput(getJarFiles());
jarsList.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 2));
Button browse = new Button(result, SWT.PUSH);
browse.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
browse.setText(Messages.getString("identify.addjar.button")); //$NON-NLS-1$
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String[] files = DialogUtil.openJarsFileBrowser();
if(files != null) {
for (int i = 0; i < files.length; i++) {
String file = files[i];
verifyOnWOJ(file);
((AddModuleWizard) getWizard()).addJarFile(file);
}
jarsList.setInput(getJarFiles());
}
}
});
//spacer
new Composite(result, SWT.NONE);
//remove jar button
final Button removeJar = new Button(result, SWT.PUSH);
removeJar.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
removeJar.setText(Messages.getString("identify.removejar.button")); //$NON-NLS-1$
removeJar.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Iterator it = ((StructuredSelection)jarsList.getSelection()).iterator();
while (it.hasNext()) {
String path = (String) it.next();
existOnWoj.remove(path);
((AddModuleWizard) getWizard()).removeJarFile(path);
}
refreshInfo();
jarsList.setInput(getJarFiles());
}
});
removeJar.setEnabled(false);
jarsList.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
removeJar.setEnabled(!jarsList.getSelection().isEmpty());
}
});
_detectLabel = new Label(result, SWT.NONE);
_detectLabel.setText(Messages.getString("identify.help.label")); //$NON-NLS-1$
_detectLabel.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 3, 1));