Skip to content
Draft
Show file tree
Hide file tree
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 @@ -98,11 +98,10 @@ public class FiltersConfigurationDialog extends TrayDialog {
private ScrolledForm form;

private Collection<FilterConfigurationArea> configAreas;
private Label limitsLabel;

private Object[] previouslyChecked = new Object[0];
private Group configComposite;
private Composite compositeLimits;
private Composite allConfigArea;

/**
* Create a new instance of the receiver on builder.
Expand Down Expand Up @@ -201,6 +200,8 @@ private void updateRadioButtonsFromTable() {
boolean showAll = isShowAll();
allButton.setSelection(showAll);
updateConfigComposite(!showAll);
setEnabled(!showAll, configComposite);
setEnabled(!showAll, allConfigArea);
}

private void updateConfigComposite(boolean enabled) {
Expand All @@ -212,7 +213,6 @@ private void updateConfigComposite(boolean enabled) {
/** Update the enablement of limitText */
private void updateLimitTextEnablement() {
boolean useLimits = limitButton.getSelection();
limitsLabel.setEnabled(useLimits);
limitText.setEnabled(useLimits);
}

Expand All @@ -221,6 +221,10 @@ private void updateShowAll(boolean showAll) {
updateConfigComposite(!showAll);
updateLimitTextEnablement();

// Disable the configurations group and limit area when showing all items
setEnabled(!showAll, configComposite);
setEnabled(!showAll, allConfigArea);

if (showAll) {
previouslyChecked = configsTable.getCheckedElements();
configsTable.setAllChecked(false);
Expand All @@ -243,39 +247,29 @@ private boolean isShowAll() {
* Create the area of the dialog that apply's to all configurations.
*/
private void createAllConfigArea(Composite parent) {
compositeLimits = new Composite(parent, SWT.NONE);
GridLayout glCompositeLimits = new GridLayout(3, false);
compositeLimits.setLayout(glCompositeLimits);
allConfigArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
layout.marginHeight = 0;
allConfigArea.setLayout(layout);
allConfigArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

limitButton = new Button(compositeLimits, SWT.CHECK);
limitButton.setText(MarkerMessages.MarkerPreferences_MarkerLimits);
limitButton = new Button(allConfigArea, SWT.CHECK);
limitButton.setText(MarkerMessages.filtersDialog_limitItemsPerGroup);
limitButton.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {
updateLimitTextEnablement();
}
});

GridData limitData = new GridData();
limitData.verticalIndent = 5;
limitButton.setLayoutData(limitData);

Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
GridData compositeData = new GridData(GridData.FILL_HORIZONTAL);
compositeData.horizontalIndent = 20;
composite.setLayoutData(compositeData);

limitsLabel = new Label(composite, SWT.NONE);
limitsLabel.setText(MarkerMessages.MarkerPreferences_VisibleItems);

limitText = new Text(composite, SWT.BORDER);
limitText = new Text(allConfigArea, SWT.BORDER);
GridData textData = new GridData();
textData.widthHint = convertWidthInCharsToPixels(10);
textData.verticalIndent = 5;
limitText.setLayoutData(textData);
limitText.addVerifyListener(e -> {
if (e.character != 0 && e.keyCode != SWT.BS
Expand All @@ -300,7 +294,7 @@ public void widgetSelected(SelectionEvent e) {
}
});

Composite defaultButtonComposite = new Composite(composite, SWT.NONE);
Composite defaultButtonComposite = new Composite(allConfigArea, SWT.NONE);
GridLayout defaultButtonLayout = new GridLayout(1, false);
defaultButtonComposite.setLayout(defaultButtonLayout);
GridData defaultButtonCompositeData = new GridData(SWT.END, SWT.END, true, false);
Expand Down Expand Up @@ -402,10 +396,16 @@ private void createConfigDesc(Composite parent) {

configAreas = generator.createFilterConfigurationFields();

// Scope and severity/description are always expanded (most used)
createFieldArea(toolkit, form, scopeArea, true);
Iterator<FilterConfigurationArea> areas = configAreas.iterator();
boolean isFirst = true;
while (areas.hasNext()) {
createFieldArea(toolkit, form, areas.next(), true);
FilterConfigurationArea area = areas.next();
// First config area (severity/description) is always expanded,
// subsequent areas (types) start collapsed to reduce clutter
createFieldArea(toolkit, form, area, isFirst);
isFirst = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ public boolean selectByFilters(MarkerEntry entry) {

public boolean selectByScope(MarkerEntry entry, IResource[] resources) {
int scopeVal = getScope();
// When no resources are selected and scope depends on selection,
// fall back to showing all markers to avoid confusing empty results
if (resources.length == 0 && scopeVal != ON_ANY && scopeVal != ON_WORKING_SET) {
return true;
}
switch (scopeVal) {
case MarkerFieldFilterGroup.ON_ANY: {
return true;
Expand Down
Loading
Loading