use of org.mybatis.generator.eclipse.ui.content.ConfigVerifyer in project generator by mybatis.
the class ConfigurationComposite method getViewerFilter.
@Override
protected ViewerFilter getViewerFilter() {
return new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IContainer) {
return true;
}
if (element instanceof IFile) {
IFile file = (IFile) element;
ConfigVerifyer cv = new ConfigVerifyer(file);
return cv.isConfigurationFile();
}
return false;
}
};
}
use of org.mybatis.generator.eclipse.ui.content.ConfigVerifyer in project generator by mybatis.
the class ConfigurationComposite method isValid.
public boolean isValid() {
try {
String fileName = txtFileName.getText();
String fullPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fileName);
File file = new File(fullPath);
if (file.exists()) {
ConfigVerifyer cv = new ConfigVerifyer(file);
if (cv.isConfigurationFile()) {
configurationTab.setErrorMessage(null);
return true;
} else {
configurationTab.setErrorMessage(Messages.CONFIGURATION_TAB_INVALID_MESSAGE);
return false;
}
} else {
configurationTab.setErrorMessage(Messages.FILE_PICKER_FILE_DOESNT_EXIST);
return false;
}
} catch (CoreException e) {
return false;
}
}
Aggregations