use of org.eclipse.jdt.core.dom.ParameterizedType in project bndtools by bndtools.
the class NewTypeWizardPage method superClassChanged.
/**
* Hook method that gets called when the superclass name has changed. The method validates the superclass name and
* returns the status of the validation.
* <p>
* Subclasses may extend this method to perform their own validation.
* </p>
*
* @return the status of the validation
*/
protected IStatus superClassChanged() {
StatusInfo status = new StatusInfo();
IPackageFragmentRoot root = getPackageFragmentRoot();
fSuperClassDialogField.enableButton(root != null);
fSuperClassStubTypeContext = null;
String sclassName = getSuperClass();
if (sclassName.length() == 0) {
// accept the empty field (stands for java.lang.Object)
return status;
}
if (root != null) {
Type type = TypeContextChecker.parseSuperClass(sclassName);
if (type == null) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperClassName);
return status;
}
if (type instanceof ParameterizedType && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_SuperClassNotParameterized);
return status;
}
} else {
//$NON-NLS-1$
status.setError("");
}
return status;
}
use of org.eclipse.jdt.core.dom.ParameterizedType in project bndtools by bndtools.
the class NewTypeWizardPage method superInterfacesChanged.
/**
* Hook method that gets called when the list of super interface has changed. The method validates the super
* interfaces and returns the status of the validation.
* <p>
* Subclasses may extend this method to perform their own validation.
* </p>
*
* @return the status of the validation
*/
protected IStatus superInterfacesChanged() {
StatusInfo status = new StatusInfo();
IPackageFragmentRoot root = getPackageFragmentRoot();
fSuperInterfacesDialogField.enableButton(0, root != null);
if (root != null) {
List<InterfaceWrapper> elements = fSuperInterfacesDialogField.getElements();
int nElements = elements.size();
for (int i = 0; i < nElements; i++) {
String intfname = elements.get(i).interfaceName;
Type type = TypeContextChecker.parseSuperInterface(intfname);
if (type == null) {
status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperInterfaceName, BasicElementLabels.getJavaElementName(intfname)));
return status;
}
if (type instanceof ParameterizedType && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_SuperInterfaceNotParameterized, BasicElementLabels.getJavaElementName(intfname)));
return status;
}
}
}
return status;
}
Aggregations