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

Feature: Toggle 'Use' tickbox, activate all samples #2075

Merged
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 @@ -29,8 +29,11 @@
import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImage;
import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImageProvider;
import org.eclipse.chemclipse.support.events.IChemClipseEvents;
import org.eclipse.chemclipse.support.ui.menu.ITableMenuEntry;
import org.eclipse.chemclipse.support.ui.provider.AbstractLabelProvider;
import org.eclipse.chemclipse.support.ui.swt.EnhancedComboViewer;
import org.eclipse.chemclipse.support.ui.swt.ExtendedTableViewer;
import org.eclipse.chemclipse.support.ui.swt.ITableSettings;
import org.eclipse.chemclipse.support.updates.IUpdateListener;
import org.eclipse.chemclipse.swt.ui.components.ISearchListener;
import org.eclipse.chemclipse.swt.ui.components.SearchSupportUI;
Expand Down Expand Up @@ -61,6 +64,7 @@
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizard;
Expand Down Expand Up @@ -601,6 +605,58 @@ public void update() {
});
//
sampleListControl.set(sampleListUI);
ITableSettings tableSettings = sampleListUI.getTableSettings();
tableSettings.addMenuEntry(new ITableMenuEntry() {

@Override
public String getCategory() {

return "";
}

@Override
public String getName() {

return "Toggle 'Use'";
}

@Override
public void execute(ExtendedTableViewer extendedTableViewer) {

IStructuredSelection selection = sampleListUI.getStructuredSelection();
@SuppressWarnings("unchecked")
List<Sample> samples = (List<Sample>)selection.toList();
for(Sample sample : samples) {
sample.setSelected(!sample.isSelected());
}
sampleListUI.updateContent();
}
});
tableSettings.addMenuEntry(new ITableMenuEntry() {

@Override
public String getCategory() {

return "";
}

@Override
public String getName() {

return "Use All Sample";
}

@Override
public void execute(ExtendedTableViewer extendedTableViewer) {

@SuppressWarnings("unchecked")
List<Sample> samples = (List<Sample>)sampleListUI.getInput();
for(Sample sample : samples) {
sample.setSelected(true);
}
sampleListUI.updateContent();
}
});
}

private void handleRowSelection(List<Object> selectedElements) {
Expand Down