List<IBasicFile> filesList;
String path = location.getText().toLowerCase().replaceFirst( "/", "" );
if ( path.startsWith( CdeEnvironment.getSystemDir() + "/" ) ) {
filesList = CdeEnvironment.getPluginSystemReader().listFiles( location.getText(),
new GenericBasicFileFilter( COMPONENT_FILENAME, DEFINITION_FILE_EXT ), IReadAccess.DEPTH_ALL, false,
true );
} else {
filesList = CdeEnvironment.getUserContentAccess().listFiles( location.getText(),
new GenericBasicFileFilter( COMPONENT_FILENAME, DEFINITION_FILE_EXT ), IReadAccess.DEPTH_ALL, false,
true );
}
if ( filesList != null ) {
widgetsLists.add( filesList );
}
locations = locations + location.getText() + ", ";
} catch ( Exception e ) {
logger.fatal( "Couldn't load widgets from: " + location.getText(), e );
}
}
logger.info( String.format( "Loading WIDGET components from: %s", locations ) );
List<String> files = new ArrayList<String>();
if ( widgetsLists.size() > 0 ) {
for ( List<IBasicFile> filesList : widgetsLists ) {
for ( IBasicFile file : filesList ) {
if ( !files.contains( file.getName() ) ) {
files.add( file.getName() );
fixWidgetMeta( file );
this.readComponentsFile( model, factory, file, DEF_WIDGET_STUB_TYPE,
new RepositoryPathOrigin(
FilenameUtils.getPath( file.getPath() ) ) );
} else {
logger.debug( "Duplicate widget, ignoring " + file.getPath() );
}
}
}
}
return;
}
logger.info( String.format( "Loading WIDGET components from: %s", WIDGETS_DIR ) );
List<IBasicFile> filesList = CdeEnvironment.getPluginRepositoryReader( WIDGETS_DIR ).listFiles( null,
new GenericBasicFileFilter( COMPONENT_FILENAME, DEFINITION_FILE_EXT ), IReadAccess.DEPTH_ALL, false, true );
PathOrigin widgetsOrigin = new PluginRepositoryOrigin( CdeEngine.getEnv().getPluginRepositoryDir(), WIDGETS_DIR );
if ( filesList != null ) {
logger.debug( String.format( "%s widget components found", filesList.size() ) );
IBasicFile[] filesArray = filesList.toArray( new IBasicFile[] { } );