*
* @param filter the new filter to use
*/
protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_ClassifierEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst = new Instances(m_Instances, 0);
else
tempInst = new Instances(m_Instances);
tempInst.setClassIndex(m_ClassCombo.getSelectedIndex());
try {
filterClass = Capabilities.forInstances(tempInst);
}
catch (Exception e) {
filterClass = new Capabilities(null);
}
// set new filter
m_ClassifierEditor.setCapabilitiesFilter(filterClass);
// Check capabilities
m_StartBut.setEnabled(true);
Capabilities currentFilter = m_ClassifierEditor.getCapabilitiesFilter();
Classifier classifier = (Classifier) m_ClassifierEditor.getValue();
Capabilities currentSchemeCapabilities = null;
if (classifier != null && currentFilter != null &&
(classifier instanceof CapabilitiesHandler)) {
currentSchemeCapabilities = ((CapabilitiesHandler)classifier).getCapabilities();
if (!currentSchemeCapabilities.supportsMaybe(currentFilter) &&
!currentSchemeCapabilities.supports(currentFilter)) {
m_StartBut.setEnabled(false);
}
}
}