Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a delete peak/scan button. #629

Merged
merged 1 commit into from
Jun 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public class ExtendedPeakScanListUI extends Composite implements IExtendedPartUI
private Button buttonSave;
private Button buttonComparison;
private Button buttonMerge;
private Button buttonDelete;
private ScanIdentifierUI scanIdentifierUI;
private Button buttonTableEdit;
private AtomicReference<PeakScanListUI> tableViewer = new AtomicReference<>();
Expand Down Expand Up @@ -235,6 +236,7 @@ private void initialize() {
enableEdit(tableViewer, buttonTableEdit, IMAGE_EDIT_ENTRY, false);
buttonComparison.setEnabled(false);
buttonMerge.setEnabled(false);
buttonDelete.setEnabled(false);
scanIdentifierUI.setEnabled(false);
}

Expand All @@ -244,13 +246,14 @@ private void createToolbarMain(Composite parent) {
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalAlignment = SWT.END;
composite.setLayoutData(gridData);
composite.setLayout(new GridLayout(9, false));
composite.setLayout(new GridLayout(10, false));
//
buttonToolbarInfo = createButtonToggleToolbar(composite, Arrays.asList(toolbarInfoTop, toolbarInfoBottom), IMAGE_INFO, TOOLTIP_INFO);
buttonToolbarSearch = createButtonToggleToolbar(composite, toolbarSearch, IMAGE_SEARCH, TOOLTIP_SEARCH);
buttonTableEdit = createButtonToggleEditTable(composite, tableViewer, IMAGE_EDIT_ENTRY);
buttonComparison = createButtonComparison(composite);
buttonMerge = createButtonMerge(composite);
buttonDelete = createButtonDelete(composite);
scanIdentifierUI = createScanIdentifierUI(composite);
createButtonReset(composite);
buttonSave = createButtonSave(composite);
Expand Down Expand Up @@ -626,9 +629,11 @@ private void propagateSelection(Display display) {
IStructuredSelection selection = tableViewer.get().getStructuredSelection();
buttonComparison.setEnabled(false);
buttonMerge.setEnabled(false);
buttonDelete.setEnabled(false);
scanIdentifierUI.setEnabled(false); // setInput enables/disables the control.
//
if(!selection.isEmpty()) {
buttonDelete.setEnabled(true);
List list = selection.toList();
if(list.size() > 1) {
/*
Expand Down Expand Up @@ -789,6 +794,24 @@ public void widgetSelected(SelectionEvent e) {
return button;
}

private Button createButtonDelete(Composite parent) {

Button button = new Button(parent, SWT.PUSH);
button.setToolTipText("Delete the selected peaks.");
button.setText("");
button.setImage(ApplicationImageFactory.getInstance().getImage(IApplicationImage.IMAGE_DELETE, IApplicationImage.SIZE_16x16));
button.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {

deletePeaksOrIdentifications(parent.getDisplay());
}
});
//
return button;
}

private ScanIdentifierUI createScanIdentifierUI(Composite parent) {

ScanIdentifierUI scanIdentifierUI = new ScanIdentifierUI(parent, SWT.NONE);
Expand Down