in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/ui/preferences/IvyDEProjectPreferences.java [67:162]
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
final IProject project = IvyPlugin.adapt(getElement(), IProject.class);
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 0));
label.setText("Retrieve list:");
table = new TableViewer(composite);
table.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
table.setContentProvider(ArrayContentProvider.getInstance());
table.setLabelProvider(new RetrieveTableLabelProvider());
table.getTable().setHeaderVisible(true);
TableColumn col1 = new TableColumn(table.getTable(), SWT.NONE);
col1.setText("Name");
// CheckStyle:MagicNumber| OFF
col1.setWidth(100);
TableColumn col2 = new TableColumn(table.getTable(), SWT.NONE);
col2.setText("Pattern");
col2.setWidth(200);
TableColumn col3 = new TableColumn(table.getTable(), SWT.NONE);
col3.setText("Confs");
col3.setWidth(50);
TableColumn col4 = new TableColumn(table.getTable(), SWT.NONE);
col4.setText("Types");
col4.setWidth(50);
// CheckStyle:MagicNumber| ON
table.setColumnProperties(new String[] {"Name", "Pattern", "Confs", "Types"});
Composite buttons = new Composite(composite, SWT.NONE);
buttons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
buttons.setLayout(new GridLayout(1, false));
Button newButton = new Button(buttons, SWT.PUSH);
newButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
newButton.setText("New...");
newButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
public void widgetSelected(SelectionEvent e) {
StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
EditStandaloneRetrieveDialog editDialog = new EditStandaloneRetrieveDialog(
getShell(), project, setup);
if (editDialog.open() == Window.OK) {
List<Object> list = (List<Object>) table.getInput();
list.add(editDialog.getStandaloneRetrieveSetup());
table.refresh();
}
}
});
Button editButton = new Button(buttons, SWT.PUSH);
editButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
editButton.setText("Edit...");
editButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openEdit((IStructuredSelection) table.getSelection(), project);
}
});
final Button removeButton = new Button(buttons, SWT.PUSH);
removeButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
removeButton.setText("Remove");
removeButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
public void widgetSelected(SelectionEvent e) {
List<Object> list = (List<Object>) table.getInput();
list.removeAll(((IStructuredSelection) table.getSelection()).toList());
table.refresh();
}
});
removeButton.setEnabled(false);
table.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
removeButton.setEnabled(!event.getSelection().isEmpty());
}
});
table.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
openEdit((IStructuredSelection) event.getSelection(), project);
}
});
List<StandaloneRetrieveSetup> retrieveSetups;
try {
retrieveSetups = retrieveSetupManager.getSetup(project);
} catch (IOException e) {
throw new RuntimeException(e);
}
table.setInput(retrieveSetups);
return composite;
}