if( javaTypeNameValue.malformed() )
{
return null;
}
final JavaTypeName javaTypeName = (JavaTypeName) javaTypeNameValue.content();
if( javaTypeName.pkg() == null )
{
if( ! MessageDialog.openConfirm( shell, discourageDialogTitle.text(), discourageDefaultPackage.text() ) )
{
return null;
}
}
if( ! Character.isUpperCase( javaTypeName.simple().charAt( 0 ) ) )
{
if( ! MessageDialog.openConfirm( shell, discourageDialogTitle.text(), discourageLowerCase.text() ) )
{
return null;
}
}
final JavaTypeConstraintService javaTypeConstraintService = javaTypeNameValue.service( JavaTypeConstraintService.class );
final IJavaProject jproj = javaTypeNameValue.element().adapt( IJavaProject.class );
JavaTypeName expectedBaseClassTemp = null;
final List<JavaTypeName> expectedInterfaces = new ArrayList<JavaTypeName>();
if( javaTypeConstraintService != null )
{
final JavaTypeConstraintBehavior behavior = javaTypeConstraintService.behavior();
final Collection<String> types = javaTypeConstraintService.types();
final Iterator<String> iterator = types.iterator();
for( int i = 0, n = ( behavior == JavaTypeConstraintBehavior.ALL ? types.size() : min( 1, types.size() ) ); i < n; i++ )
{
final String typeName = iterator.next();
try
{
final IType type = jproj.findType( typeName.replace( '$', '.' ) );
if( type != null && type.exists() )
{
if( type.isClass() )
{
expectedBaseClassTemp = new JavaTypeName( typeName );
}
else if( type.isInterface() )
{
expectedInterfaces.add( new JavaTypeName( typeName ) );
}
}
}
catch( Exception e )
{
Sapphire.service( LoggingService.class ).log( e );
}
}
}
final JavaTypeName expectedBaseClass = expectedBaseClassTemp;
final IRunnableWithProgress op = new IRunnableWithProgress()
{
public void run( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
{