use of org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor in project jbosstools-hibernate by jbosstools.
the class ConsoleConfigurationPropertySource method createProjectDescriptor.
private IPropertyDescriptor createProjectDescriptor() {
ComboBoxPropertyDescriptor projectDescriptor = new ComboBoxPropertyDescriptor(// $NON-NLS-1$
"project", HibernateConsoleMessages.ConsoleConfigurationPropertySource_project, getSortedProjectNames());
projectDescriptor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
if (value instanceof Integer) {
if (((Integer) value).intValue() < 0) {
try {
ILaunchConfiguration lc = HibernateConsolePlugin.getDefault().findLaunchConfig(cfg.getName());
if (lc != null) {
String projectName = lc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null);
if (projectName != null) {
return NLS.bind(HibernateConsoleMessages.ConsoleConfigurationMainTab_the_java_project_does_not_exist, projectName);
}
} else {
// $NON-NLS-1$//$NON-NLS-2$
HibernateConsolePlugin.getDefault().log("Can't find Console Configuration \"" + cfg.getName() + "\"");
}
} catch (CoreException e) {
HibernateConsolePlugin.getDefault().log(e);
}
}
}
return null;
}
});
return projectDescriptor;
}
Aggregations