@Override protected Control createContents(Composite parent) { keyTable = new Table(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK); CommonFuncUtilities.drawTableWithCheck(parent, keyTable, LinkSortKey.keysForOWLPro, keySetPro); CommonFuncUtilities.copyHashMapToHashMap(keySetPro, beforeAction); Composite bottomComp = new Composite(parent, SWT.NONE); bottomComp.setLayout(new GridLayout(4, true)); bottomComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); selectAll = new Button(bottomComp, SWT.NONE); selectAll.setText("Select All"); selectAll.setEnabled(true); selectAll.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { beforeAction.clear(); for (TableItem item : keyTable.getItems()) { item.setChecked(true); String key = item.getText(1).toString(); String des = LinkSortKey.keysForOWLPro.get(key); beforeAction.put(key, des); } } }); deselectAll = new Button(bottomComp, SWT.NONE); deselectAll.setText("Deselect All"); deselectAll.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (TableItem item : keyTable.getItems()) { item.setChecked(false); } beforeAction.clear(); } }); return parent; }
@Override protected void performApply() { beforeAction.clear(); for (TableItem item : keyTable.getItems()) { if (item.getChecked()) { String key = item.getText(1); String des = item.getText(2); beforeAction.put(key, des); } } keySetPro = beforeAction; CommonFuncUtilities.refreshPrefsContent( new Object[] {keySetClass, keySetInd, keySetPro}, new String[] {"OWLClass_", "OWLIndividual_", "OWLProperty_"}, keySetOWL); }