fSearchButton = new Button(buttons, SWT.PUSH); fSearchButton.setFont(font); setButtonLayoutData(fSearchButton); fSearchButton.setText(CougaarPreferencesMessages.getString( "CougaarPreferencePage.&Search..._1")); fSearchButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event evt) { search(); } });
    protected Control createContents(Composite ancestor) {        Font font = ancestor.getFont();        initializeDialogUnits(ancestor);        noDefaultAndApplyButton();        Composite parent = new Composite(ancestor, SWT.NULL);        GridLayout layout = new GridLayout();        layout.numColumns = 2;        layout.marginHeight = 0;        layout.marginWidth = 0;        parent.setLayout(layout);        GridData data;        Label tableLabel = new Label(parent, SWT.NONE);        tableLabel.setText(CougaarPreferencesMessages.getString(                "CougaarPreferencePage.Installed_&Cougaars__1")); //$NON-NLS-1$        data = new GridData();        data.horizontalSpan = 2;        tableLabel.setLayoutData(data);        tableLabel.setFont(font);        Table table = new Table(parent,                SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);        data = new GridData(GridData.FILL_BOTH);        table.setLayoutData(data);        table.setFont(font);        table.setHeaderVisible(true);        table.setLinesVisible(true);        TableLayout tableLayout = new TableLayout();        table.setLayout(tableLayout);        TableColumn column2 = new TableColumn(table, SWT.NULL);        column2.setText(CougaarPreferencesMessages.getString(                "cougaarPreferencePage.cougaarName")); //$NON-NLS-1$        TableColumn column3 = new TableColumn(table, SWT.NULL);        column3.setText(CougaarPreferencesMessages.getString(                "cougaarPreferencePage.cougaarLocation")); //$NON-NLS-1$        fCougaarList = new CheckboxTableViewer(table);        fCougaarList.setSorter(new ViewerSorter() {                public int compare(Viewer viewer, Object e1, Object e2) {                    if ((e1 instanceof ICougaarInstall)                        && (e2 instanceof ICougaarInstall)) {                        ICougaarInstall left = (ICougaarInstall) e1;                        ICougaarInstall right = (ICougaarInstall) e2;                        String leftType = left.getId();                        String rightType = right.getId();                        int res = leftType.compareToIgnoreCase(rightType);                        if (res != 0) {                            return res;                        }                        return left.getId().compareToIgnoreCase(right.getId());                    }                    return super.compare(viewer, e1, e2);                }                public boolean isSorterProperty(Object element, String property) {                    return true;                }            });        fCougaarList.setLabelProvider(new CougaarLabelProvider());        fCougaarList.setContentProvider(new ListContentProvider(fCougaarList,                Collections.EMPTY_LIST));        fCougaarList.addSelectionChangedListener(new ISelectionChangedListener() {                public void selectionChanged(SelectionChangedEvent evt) {                    enableButtons();                }            });        fCougaarList.addDoubleClickListener(new IDoubleClickListener() {                public void doubleClick(DoubleClickEvent e) {                    editCougaar();                }            });        table.addKeyListener(new KeyAdapter() {                public void keyPressed(KeyEvent event) {                    if ((event.character == SWT.DEL) && (event.stateMask == 0)) {                        removeCougaarInstalls();                    }                }            });        Composite buttons = new Composite(parent, SWT.NULL);        buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));        layout = new GridLayout();        layout.marginHeight = 0;        layout.marginWidth = 0;        buttons.setLayout(layout);        fAddButton = new Button(buttons, SWT.PUSH);        setButtonLayoutData(fAddButton);        fAddButton.setFont(font);        fAddButton.setText(CougaarPreferencesMessages.getString(                "cougaarPreferencePage.add")); //$NON-NLS-1$        fAddButton.addListener(SWT.Selection,            new Listener() {                public void handleEvent(Event evt) {                    addCougaar();                }            });        fEditButton = new Button(buttons, SWT.PUSH);        setButtonLayoutData(fEditButton);        fEditButton.setFont(font);        fEditButton.setText(CougaarPreferencesMessages.getString(                "cougaarPreferencePage.edit")); //$NON-NLS-1$        fEditButton.addListener(SWT.Selection,            new Listener() {                public void handleEvent(Event evt) {                    editCougaar();                }            });        fRemoveButton = new Button(buttons, SWT.PUSH);        fRemoveButton.setFont(font);        setButtonLayoutData(fRemoveButton);        fRemoveButton.setText(CougaarPreferencesMessages.getString(                "cougaarPreferencePage.remove")); //$NON-NLS-1$        fRemoveButton.addListener(SWT.Selection,            new Listener() {                public void handleEvent(Event evt) {                    removeCougaarInstalls();                }            });        fSearchButton = new Button(buttons, SWT.PUSH);        fSearchButton.setFont(font);        setButtonLayoutData(fSearchButton);        fSearchButton.setText(CougaarPreferencesMessages.getString(                "CougaarPreferencePage.&Search..._1")); //$NON-NLS-1$        fSearchButton.addListener(SWT.Selection,            new Listener() {                public void handleEvent(Event evt) {                    search();                }            });        configureTableResizing(parent, buttons, table, column2, column3);        populateCougaarList();        enableButtons();        return parent;    }