public boolean canFlipToNextPage() {
return super.canFlipToNextPage() && getXmlFileUnderTest() != null;
}
private IFile chooseXmlFileToTestType() {
FilteredResourcesSelectionDialog dialog = new FilteredResourcesSelectionDialog(getShell(), false,
resourceContainer, IResource.FILE) {
/*
* (non-Javadoc)
* @see org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog#fillContentProvider(org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected void fillContentProvider(final AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
IProgressMonitor progressMonitor) throws CoreException {
AbstractContentProvider filteringContentProvider = new AbstractContentProvider() {
/*
* (non-Javadoc)
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.AbstractContentProvider#add(java.lang.Object, org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.ItemsFilter)
*/
@Override
public void add(Object item, ItemsFilter itemsFilter) {
if (itemsFilter.matchItem(item)) {
if (item instanceof IFile) {
IFile ifile = (IFile) item;
boolean matches = camelXmlMatcher.matches(ifile);
Activator.getLogger().debug("File " + ifile + " matches CamelXML: " + matches);
if (matches) {
contentProvider.add(item, itemsFilter);
}
}
}
}
};
super.fillContentProvider(filteringContentProvider, itemsFilter, progressMonitor);
}
};
dialog.setInitialPattern("*.xml", FilteredItemsSelectionDialog.FULL_SELECTION);
dialog.setTitle(WizardMessages.NewCamelTestWizardPageOne_class_to_test_dialog_title);
dialog.setMessage(WizardMessages.NewCamelTestWizardPageOne_class_to_test_dialog_message);
if (dialog.open() == Window.OK) {
Object[] resultArray = dialog.getResult();
if (resultArray != null && resultArray.length > 0) {
Object firstSelection = resultArray[0];
if (firstSelection instanceof IFile) {
return (IFile) firstSelection;
}