FileLocator.toFileURL(CatalogTestsUIPlugin.getDefault().getBundle().getEntry("data/lakes.shp")) //$NON-NLS-1$
};
Object data = urls;
int base = 0;
final IMap currentMap = ApplicationGIS.getActiveMap();
ApplicationGIS.createAndOpenMap(Collections.<IGeoResource>emptyList());
UDIGTestUtil.inDisplayThreadWait(4000, new WaitCondition(){
public boolean isTrue() {
IMap map = ApplicationGIS.getActiveMap();
if( map==null || currentMap==map )
return false;
return true;
}
}, true);
Map activeMap = ApplicationGISInternal.getActiveMap();
final int[] numberLayerAdds=new int[1];
numberLayerAdds[0]=0;
activeMap.addMapCompositionListener(new IMapCompositionListener(){
public void changed( MapCompositionEvent event ) {
numberLayerAdds[0]++;
}
});
IMap map = ApplicationGIS.getActiveMap();
if (map != null) {
List<ILayer> layers = map.getMapLayers();
base = layers.size();
}
final int[] numberActionsRan=new int[1];
numberActionsRan[0]=0;
handler.setTarget(map);
handler.addListener(new IDropHandlerListener(){
public void done( IDropAction action, Throwable error ) {
numberActionsRan[0]++;
}
public void noAction( Object data ) {
}
public void starting( IDropAction action ) {
}
});
handler.performDrop(data, null);
final int base2=base;
WaitCondition c=new WaitCondition(){
public boolean isTrue() {
Map map = ApplicationGISInternal.getActiveMap();
if( map==null )
return false;
List<ILayer> layers = map.getMapLayers();
if (layers.size()<base2 + 2 || numberActionsRan[0]<1 || numberLayerAdds[0]<1 )
return false;
return true;
}
};
UDIGTestUtil.inDisplayThreadWait(8000,c, false);
// UDIGTestUtil.inDisplayThreadWait(800000,c, false);
map = ApplicationGIS.getActiveMap();
assertNotNull(map);
List<ILayer> layers = map.getMapLayers();
assertEquals(layers.size(),base+2);
assertEquals(1, numberLayerAdds[0]);
assertEquals(1, numberActionsRan[0]);