@Override public IStatus validate(Object[] selection) { int selectedCount= 0; int duplicateCount= 0; if (selection != null && selection.length > 0) { HashSet<String> signatures= new HashSet<>(selection.length); for (int index= 0; index < selection.length; index++) { if (selection[index] instanceof DelegateEntry) { DelegateEntry delegateEntry= (DelegateEntry) selection[index]; if (!signatures.add(getSignature(delegateEntry.delegateMethod))) duplicateCount++; selectedCount++; } } } if (duplicateCount > 0) { return new StatusInfo(IStatus.ERROR, duplicateCount == 1 ? ActionMessages.AddDelegateMethodsAction_duplicate_methods_singular : Messages.format(ActionMessages.AddDelegateMethodsAction_duplicate_methods_plural, String.valueOf(duplicateCount))); } return new StatusInfo(IStatus.INFO, Messages.format(ActionMessages.AddDelegateMethodsAction_selectioninfo_more, new Object[] { String.valueOf(selectedCount), String.valueOf(fEntries) })); }
AddDelegateMethodsContentProvider provider= new AddDelegateMethodsContentProvider(type, fields); SourceActionDialog dialog= new AddDelegateMethodsDialog(getShell(), new AddDelegateMethodsLabelProvider(), provider, fEditor, type, false); dialog.setValidator(new AddDelegateMethodsActionStatusValidator(provider.getCount())); AddDelegateMethodsViewerComparator comparator= new AddDelegateMethodsViewerComparator(); dialog.setComparator(comparator);
dialog.setValidator(new AddDelegateMethodsActionStatusValidator(provider.getCount())); AddDelegateMethodsViewerComparator comparator= new AddDelegateMethodsViewerComparator(); dialog.setComparator(comparator);
dialog.setValidator(new AddDelegateMethodsActionStatusValidator(provider.getCount())); AddDelegateMethodsViewerComparator comparator= new AddDelegateMethodsViewerComparator(); dialog.setComparator(comparator);
@Override public IStatus validate(Object[] selection) { int selectedCount= 0; int duplicateCount= 0; if (selection != null && selection.length > 0) { HashSet<String> signatures= new HashSet<>(selection.length); for (int index= 0; index < selection.length; index++) { if (selection[index] instanceof DelegateEntry) { DelegateEntry delegateEntry= (DelegateEntry) selection[index]; if (!signatures.add(getSignature(delegateEntry.delegateMethod))) duplicateCount++; selectedCount++; } } } if (duplicateCount > 0) { return new StatusInfo(IStatus.ERROR, duplicateCount == 1 ? ActionMessages.AddDelegateMethodsAction_duplicate_methods_singular : Messages.format(ActionMessages.AddDelegateMethodsAction_duplicate_methods_plural, String.valueOf(duplicateCount))); } return new StatusInfo(IStatus.INFO, Messages.format(ActionMessages.AddDelegateMethodsAction_selectioninfo_more, new Object[] { String.valueOf(selectedCount), String.valueOf(fEntries) })); }