Package org.locationtech.udig.ui

Examples of org.locationtech.udig.ui.WaitCondition


       
        handler.setTarget(destination);
        handler.setViewerLocation(ViewerDropLocation.BEFORE);
        handler.performDrop(data, null);
        final Object finalDest=destination;
        UDIGTestUtil.inDisplayThreadWait(4000, new WaitCondition(){

            public boolean isTrue() {
                return data.getZorder()==2 && ((Layer) finalDest).getZorder()==1;
            }
           
View Full Code Here


    @Ignore
    @Test
    public void testCUTPASTEFeatures() throws Exception {
        ApplicationGIS.openMap(map);
        UDIGTestUtil.inDisplayThreadWait(2000, new WaitCondition(){

            public boolean isTrue() {
                return ApplicationGIS.getActiveMap() != null && ApplicationGIS.getActiveMap()==map;
            }

        }, true);

        SimpleFeature[] features = UDIGTestUtil.createDefaultTestFeatures("new", 1); //$NON-NLS-1$
        IGeoResource resource = MapTests.createGeoResource(features, true);
        Layer layer = map.getLayerFactory().createLayer(resource);
        map.getLayersInternal().add(layer);
       
       
        IAction copyAction = ApplicationGIS.getToolManager().getCOPYAction(ApplicationGISInternal.getActiveEditor());
        IAction pasteAction = ApplicationGIS.getToolManager().getPASTEAction(ApplicationGISInternal.getActiveEditor());
       
        map.getEditManagerInternal().setSelectedLayer(firstLayer);

        firstLayer.setFilter( null ); // Filter.INCLUDE
       
        AdaptingFilter filter = AdaptingFilterFactory.createAdaptingFilter(firstLayer.getFilter(), firstLayer );
        StructuredSelection structuredSelection = new StructuredSelection(filter);
       
        ApplicationGISInternal.getActiveEditor().getEditorSite().getSelectionProvider().setSelection(structuredSelection) ;
        Event event = new Event();
        event.display=Display.getCurrent();
        copyAction.runWithEvent(event);

        ApplicationGISInternal.getActiveEditor().getEditorSite().getSelectionProvider().setSelection(new StructuredSelection(layer));
       
        pasteAction.runWithEvent(event);
       
        final FeatureSource<SimpleFeatureType, SimpleFeature> fs = layer.getResource(FeatureSource.class, new NullProgressMonitor());
       
        UDIGTestUtil.inDisplayThreadWait( 4000, new WaitCondition(){

            public boolean isTrue() {
                try {
                    return fs.getCount(Query.ALL)==11;
                } catch (IOException e) {
View Full Code Here

    handler.performDrop(data, null);
   
        final int[] expectedLayers=new int[1];
        expectedLayers[0]=1;

        WaitCondition c=new WaitCondition(){
      public boolean isTrue() {
        Map map = ApplicationGISInternal.getActiveMap();
        if( map==null )
          return false;
        List<ILayer> layers = map.getMapLayers();
View Full Code Here

        if( ApplicationGIS.getActiveMap()!=null ){
            baseLayers[0]=ApplicationGIS.getActiveMap().getMapLayers().size();
        }
       
    handler.performDrop(data, null);
        WaitCondition c=new WaitCondition(){
      public boolean isTrue() {
        Map map = ApplicationGISInternal.getActiveMap();
        if( map==null )
          return false;
        List<ILayer> layers = map.getMapLayers();
View Full Code Here

        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();
View Full Code Here

        final Map currentMap = ApplicationGISInternal.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();
View Full Code Here

        final Layer destination = map.getLayersInternal().get(1);

        action.init(null, null, ViewerDropLocation.ON, destination, sldURL);
        action.perform(new NullProgressMonitor());
        final String expectedName="Test Style"; //$NON-NLS-1$
        UDIGTestUtil.inDisplayThreadWait(3000, new WaitCondition(){

            public boolean isTrue() {
                return isTestStyle(destination, expectedName);
            }
           
View Full Code Here

        final Layer destination = map.getLayersInternal().get(2);

        action.init(null, null, ViewerDropLocation.ON, destination, sldFile);
        action.perform(new NullProgressMonitor());
        final String expectedName="Test Style"; //$NON-NLS-1$
        UDIGTestUtil.inDisplayThreadWait(3000, new WaitCondition(){

            public boolean isTrue() {
                return isTestStyle(destination, expectedName);
            }
           
View Full Code Here

    public void testDropOnMap() throws Exception {
        map.getEditManagerInternal().setSelectedLayer(map.getLayersInternal().get(3));
        action.init(null, null, ViewerDropLocation.ON, map, sldURL);
        action.perform(new NullProgressMonitor());
        final String expectedName="Test Style"; //$NON-NLS-1$
        UDIGTestUtil.inDisplayThreadWait(3000, new WaitCondition(){

            public boolean isTrue() {
                return isTestStyle(map.getEditManager().getSelectedLayer(), expectedName);
            }
           
View Full Code Here

    public void testDropOnMapIntegration() throws Exception {
        map.getEditManagerInternal().setSelectedLayer(map.getLayersInternal().get(3));
        handler.setTarget(map);
        handler.performDrop(sldFile, null);
        final String expectedName="Test Style"; //$NON-NLS-1$
        UDIGTestUtil.inDisplayThreadWait(3000, new WaitCondition(){

            public boolean isTrue() {
                return isTestStyle(map.getEditManager().getSelectedLayer(), expectedName);
            }
           
View Full Code Here

TOP

Related Classes of org.locationtech.udig.ui.WaitCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.