Examples of JGrassService


Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

         * @return Object[]
         */
        public Object[] getChildren( Object arg0 ) {

            if (arg0 instanceof JGrassService) {
                JGrassService map = (JGrassService) arg0;
                List<IResolve> layers = null;
                try {
                    layers = map.members(null);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (layers == null)
                    return null;
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

            }
            /*
             * test code to make the catalog understand that the map should be added
             */
            final ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            final JGrassService originalJGrassService = catalog.getById(JGrassService.class, id, monitor);

            /*
             * create the same service
             */
            if (originalJGrassService == null)
                return;
            final URL ID = originalJGrassService.getIdentifier();
            Map<String, Serializable> connectionParams = originalJGrassService.getConnectionParams();
            IServiceFactory locator = CatalogPlugin.getDefault().getServiceFactory();
            final List<IService> rereadService = locator.acquire(ID, connectionParams);

            /*
             * replace the service
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

            ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
            mapset = localCatalog.getById(JGrassMapsetGeoResource.class, mapsetId, ProgressManager.instance().get());
            if (mapset == null) {
                // try with the service
                // URL locationId = JGrassService.createId(locationPath);
                JGrassService locationService = localCatalog.getById(JGrassService.class, locationId, ProgressManager.instance()
                        .get());
                mapset = locationService.getMapsetGeoresourceByName(mapsetName);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
            String message = "An error occurred while adding the map to the catalog";
            ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

    public synchronized static JGrassMapsetGeoResource addMapsetToCatalog( String locationPath, String mapsetName ) {
        // URL locationId = JGrassService.createId(locationPath);
        File locationFile = new File(locationPath);
        try {
            ID locationId = new ID(locationFile.toURI().toURL());
            JGrassService location = CatalogPlugin.getDefault().getLocalCatalog()
                    .getById(JGrassService.class, locationId, ProgressManager.instance().get());
            return location.addMapset(mapsetName);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            String message = "An error occurred while adding the mapset to the catalog";
            ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
            return null;
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

    public synchronized static void removeMapsetFromCatalog( String locationPath, String mapsetName ) {
        // URL locationId = JGrassService.createId(locationPath);
        try {
            File locationFile = new File(locationPath);
            ID locationId = new ID(locationFile.toURI().toURL());
            JGrassService location = CatalogPlugin.getDefault().getLocalCatalog()
                    .getById(JGrassService.class, locationId, ProgressManager.instance().get());
            location.removeMapset(mapsetName);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            String message = "An error occurred while removing the mapset to the catalog";
            ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
        }
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

                        if (!Program.launch(mapsetPath)) {
                            paths.add(mapsetPath);
                        }
                        paths.add(mapsetPath);
                    } else if (object instanceof JGrassService) {
                        JGrassService locationService = (JGrassService) object;
                        String locationPath = locationService.getFile().getAbsolutePath();
                        if (!Program.launch(locationPath)) {
                            paths.add(locationPath);
                        }
                        paths.add(locationPath);
                    }
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassService

        Display.getDefault().syncExec(new Runnable(){
            public void run() {

                Object firstElement = selection.getFirstElement();
                if (firstElement instanceof JGrassService) {
                    final JGrassService jgrassService = (JGrassService) firstElement;
                    URL identifier = jgrassService.getIdentifier();
                    String locationPath = URLUtils.urlToFile(identifier).getAbsolutePath();
                    InputDialog iDialog = new InputDialog(Display.getDefault().getActiveShell(), "New mapset name",
                            "Please enter the name for the new mapset to create.", "newmapset", null);
                    iDialog.open();
                    String mapsetName = iDialog.getValue();
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.