Examples of UDIGDropHandler


Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

        monitor.worked(1);
        Viewer viewer = LayersView.getViewer();
        if (viewer == null)
            ProjectUIPlugin.trace(getClass(), "Layers View is not available", (Exception) null); //$NON-NLS-1$

        UDIGDropHandler dropHandler = new UDIGDropHandler();
        dropHandler.setTarget(new EditorPart(){

            @Override
            public void doSave( IProgressMonitor monitor ) {
            }

            @Override
            public void doSaveAs() {
            }

            @Override
            public void init( IEditorSite site, IEditorInput input ) throws PartInitException {
            }

            @Override
            public boolean isDirty() {
                return false;
            }

            @Override
            public boolean isSaveAsAllowed() {
                return false;
            }

            @Override
            public void createPartControl( Composite parent ) {
            }

            @Override
            public void setFocus() {
            }

        });

        closeIntro();

        for( URL url : urls ) {
            monitor.worked(1);
            monitor.setTaskName(Messages.StartupOpenMaps_processingTask + ": " + url); //$NON-NLS-1$
            if (monitor.isCanceled())
                break;
            ProcessingURLSListener listener = new ProcessingURLSListener(this);
            try {
                dropHandler.addListener(listener);
                dropHandler.performDrop(url, null);
                while( !listener.processed && !monitor.isCanceled() ) {
                    synchronized (this) {
                        try {
                            wait(500);
                        } catch (InterruptedException e) {
                            return;
                        }
                    }
                }
            } finally {
                dropHandler.removeListener(listener);
            }
        }
    }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

                            || url.toLowerCase().indexOf("jdbc:postgis://") != -1 //$NON-NLS-1$
                            || url.toLowerCase().indexOf("postgis:jdbc://") != -1 //$NON-NLS-1$
                            || recognizedFile(url)) {
                        event.doit=false;

                        UDIGDropHandler dropHandler = new UDIGDropHandler();
                        MapEditorPart editor = ApplicationGISInternal.getActiveEditor();
                        dropHandler.setTarget(editor);
                        dropHandler.performDrop(url, null);
                    }
                }
                private boolean recognizedFile( String url ) {
                    if (url.toLowerCase().indexOf("file://") != -1 ){ //$NON-NLS-1$
                        return new FileConnectionFactory().canProcess(url);
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

   * @param destination the destination that determines what actions will take
   * place when a drop event occurs.
   * @return
   */
  public static DropTargetDescriptor addDropSupport(Control control, IDropTargetProvider destination) {
    return addDropSupport(control, destination, new UDIGDropHandler());
  }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

     * Public because it might need to be called by another application using uDig as a plugin.
     * @param configurer The IWorkbenchWindowConfigurer for the workbench
     * @param the dropHandler strategy for processing the drop using the DropAction extension point
     */
    public static void registerUDigDND( IWorkbenchWindowConfigurer configurer ) {
      registerUDigDND(configurer, new UDIGDropHandler());
    }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

     *
     * @return  a drop listener that will send the drop event to the
     * currently active editor.
     */
    public static UDIGControlDropListener getEditorDropListener() {
    return getEditorDropListener(new UDIGDropHandler());
    }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

        assertEquals( 2, destination.getZorder());
    }

    @Test
    public void testIntegrationTest() throws Exception {
        UDIGDropHandler handler = new UDIGDropHandler();
        final Layer data = map.getLayersInternal().get(0);
        Object destination = map.getLayersInternal().get(2);
       
        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

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

      assertLayerType(layer,typeNames, ShapefileDataStore.class);
    }
       

        MapEditorPart activeEditor = ApplicationGISInternal.getActiveEditor();
        UDIGDropHandler dropHandler = activeEditor.getDropHandler();
        dropHandler.setTarget(activeEditor);
        dropHandler.setViewerLocation(ViewerDropLocation.NONE);
        dropHandler.performDrop(data, null);

        expectedLayers[0]=2;
       
        UDIGTestUtil.inDisplayThreadWait(4000,c, true);
   
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

        ApplicationGIS.addLayersToMap(map, Arrays.asList(resources),0,null, true);
        action = new SLDDropAction();

        sldURL = FileLocator.toFileURL(TestsUIPlugin.getDefault().getBundle().getEntry("/test-data/teststyle.sld")); //$NON-NLS-1$
        sldFile = new File( sldURL.getFile() );
        handler=new UDIGDropHandler();
        assertTrue(sldFile.exists());
    }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

        reset();
    }
   
    @Before
    public void setUp() throws Exception {
        handler=new UDIGDropHandler();
        handler.addListener(listener);
        handler.setTarget(dropDestination);
    }
View Full Code Here

Examples of org.locationtech.udig.internal.ui.UDIGDropHandler

            Object selection = firstSelectedElement();

            if (contents != null) {
                MapEditorPart activeEditor = ApplicationGISInternal.getActiveEditor();
                final Map finalMap;
                final UDIGDropHandler finalDropHandler;
                if( selection instanceof Map){
                    finalMap = (Map)selection;
                    finalDropHandler = new UDIGDropHandler();
                    activeEditor=null;
                } else if( activeEditor==null ){
                    CreateMapCommand command = new CreateMapCommand(null,Collections.<IGeoResource>emptyList(), null);
                    try {
                        command.run(new NullProgressMonitor());
                    } catch (Exception e) {
                        throw (RuntimeException) new RuntimeException( ).initCause( e );
                    }
                    finalMap = (Map) command.getCreatedMap();
                    finalDropHandler = new UDIGDropHandler();
                } else {
                    finalDropHandler = activeEditor.getDropHandler();
                    finalMap = activeEditor.getMap();
                }
               
                final MapEditorPart finalActiveEditor = activeEditor;
                ILayer selectedLayer = finalMap.getEditManager().getSelectedLayer();
                if( selectedLayer==null ){
                    finalDropHandler.setTarget(finalMap);
                }else{
                    finalDropHandler.setTarget(selectedLayer);
                }
                finalDropHandler.addListener(new IDropHandlerListener(){

                    public void done( IDropAction action, Throwable error ) {

                        if( finalActiveEditor==null && finalMap.getMapLayers().size()==0 ){
                            finalMap.getProjectInternal().getElementsInternal().remove(finalMap);
                        }
                       
                        finalDropHandler.removeListener(this);
                    }

                    public void noAction( Object data ) {
                        if( finalActiveEditor==null && finalMap.getMapLayers().size()==0 ){
                            finalMap.getProjectInternal().getElementsInternal().remove(finalMap);
                        }
                        finalDropHandler.removeListener(this);
                    }

                    public void starting( IDropAction action ) {
                    }
                   
                });
                finalDropHandler.setViewerLocation(ViewerDropLocation.ON);
                finalDropHandler.performDrop(contents, null);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.