diff --git a/docs/devel/en/contents.rst b/docs/devel/en/contents.rst index 6eb3efccbc..0c9237b83b 100644 --- a/docs/devel/en/contents.rst +++ b/docs/devel/en/contents.rst @@ -5,12 +5,10 @@ Contents * :doc:`getting_started` - * :doc:`custom_application_tutorial` * :doc:`disk_to_screen_tutorials` - * :doc:`csv_renderer_tutorial` * :doc:`csvservice_tutorial` @@ -19,10 +17,8 @@ Contents * :doc:`testing_tutorial` - * :doc:`examples` - * :doc:`code_examples` * :doc:`creating_new_perspective_example` @@ -39,41 +35,32 @@ Contents * :doc:`view_extension_point_example` - * :doc:`featuresourceop_example` * :doc:`gis_application_tutorials` - * :doc:`feature_editor_tutorial` * :doc:`map_decorator_tutorial` - * :doc:`gis_platform_tutorials` - * :doc:`iadaptable_and_operations_tutorial` * :doc:`shapefile_export_tutorial` - * :doc:`other_tutorials` - * :doc:`coverage_tool` * :doc:`tracking_animation` - * :doc:`rcp_tutorials` - * :doc:`preferred_zoom_level_application` * :doc:`tool_view_application` - * :doc:`SDKQuickstart/SDKQuickstart` * :doc:`CustomApplication/CustomApplication` @@ -87,10 +74,8 @@ Contents * :doc:`programmer_guide` - * :doc:`guidelines_and_rules` - * :doc:`coding_conventions` * :doc:`eclipse_house_rules` @@ -101,13 +86,10 @@ Contents * :doc:`user_interface_guidelines` - * :doc:`platform_architecture` - * :doc:`key_components` - * :doc:`drag_and_drop_design` * :doc:`issues_framework_design` @@ -116,7 +98,6 @@ Contents * :doc:`shutdown_tasks` - * :doc:`welcome_to_the_programmer's_guide` * :doc:`why_a_platform` @@ -124,7 +105,6 @@ Contents * :doc:`reference` - * :doc:`adding_new_format` * :doc:`api_rules_of_engagement` @@ -227,7 +207,6 @@ Contents * :doc:`working_with_gis_application` - * :doc:`commands` * :doc:`composite_commands` @@ -265,7 +244,6 @@ Contents * :doc:`working_with_the_gis_platform` - * :doc:`catalog` * :doc:`catalog_notifications` @@ -283,8 +261,3 @@ Contents * :doc:`service_and_georesource_interceptors` * :doc:`utility_classes` - - * :doc:`workbench_services` - - - diff --git a/docs/devel/en/images/workbench_services/BoundaryService.PNG b/docs/devel/en/images/workbench_services/BoundaryService.PNG deleted file mode 100644 index 41537fad33..0000000000 Binary files a/docs/devel/en/images/workbench_services/BoundaryService.PNG and /dev/null differ diff --git a/docs/devel/en/utility_classes.rst b/docs/devel/en/utility_classes.rst index 993e9377fd..5ac6320e81 100644 --- a/docs/devel/en/utility_classes.rst +++ b/docs/devel/en/utility_classes.rst @@ -93,30 +93,6 @@ complete. The above code example uses a final array to "hold" the value between the runnable and your code; you could also do this using a Class field. -Accessing the Boundary Service -'''''''''''''''''''''''''''''' - -The Boundary Service provides access to the boundary that the user has selected via the Boundary -View. This boundary is then be used to restrict functionality such as zoom to extent and catalog -search results. - -:: - - IBoundaryService service = PlatformGIS.getBoundaryService(); - -This service then provides methods to return the extent or an actual geometry of the current -boundary. - -:: - - ReferencedEnvelope extent = service.getExtent(); - -or - -:: - - Geometry boundingGeom = service.getGeometry(); - org.locationtech.udig.core ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/devel/en/workbench_services.rst b/docs/devel/en/workbench_services.rst deleted file mode 100644 index a21dc6177d..0000000000 --- a/docs/devel/en/workbench_services.rst +++ /dev/null @@ -1,50 +0,0 @@ -Workbench Services -~~~~~~~~~~~~~~~~~~ - -Boundary Service -^^^^^^^^^^^^^^^^ - -|image0| -   - -Adding a new BoundaryStrategy -''''''''''''''''''''''''''''' - -Additional Boundary Strategies are added by the boundary extension point. - -Details: - -- Add a boundary extension (org.locationtech.udig.ui.boundary) -- Add a new boundary to the extension -- Create a strategy class which extends the abstract IBoundaryStrategy class - -Note: If a strategy has not defined a boundary it should return a null geometry and extent. Tools -and views listening to the boundary service will by default treat a null geometry or extent as a -world extent (see BoundaryStrategyAll) - -Adding a page (optional) -'''''''''''''''''''''''' - -to be completed - -Getting the current Boundary -'''''''''''''''''''''''''''' - -Access to the current Boundary is available through the workbench BoundaryService as follows: - -:: - - IBoundaryService service = PlatformGIS.getBoundaryService(); - ReferencedEnvelope extent = service.getExtent(); - -or - -:: - - IBoundaryService service = PlatformGIS.getBoundaryService(); - Geometry boundingGeom = service.getGeometry(); - -Example use of the BoundaryService can be found in BoundaryStrategyScreen and -BoundaryStrategyMapCrs. - -.. |image0| image:: /images/workbench_services/BoundaryService.PNG diff --git a/docs/devel/en/working_with_the_gis_platform.rst b/docs/devel/en/working_with_the_gis_platform.rst index 652180dc4f..878c59036d 100644 --- a/docs/devel/en/working_with_the_gis_platform.rst +++ b/docs/devel/en/working_with_the_gis_platform.rst @@ -15,5 +15,3 @@ Using the local catalog as a repository to manage your spatial data utility_classes connect_to_a_service_on_startup service_and_georesource_interceptors - workbench_services - diff --git a/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/PlatformGIS.java b/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/PlatformGIS.java deleted file mode 100644 index bce7373d9f..0000000000 --- a/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/PlatformGIS.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * uDig - User Friendly Desktop Internet GIS client - * http://udig.refractions.net - * (C) 2004, Refractions Research Inc. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * (http://www.eclipse.org/legal/epl-v10.html), and the Refractions BSD - * License v1.0 (http://udig.refractions.net/files/bsd3-v10.html). - * - */ -package org.locationtech.udig.project.ui; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.locationtech.udig.catalog.IGeoResource; -import org.locationtech.udig.project.IMap; -import org.locationtech.udig.project.IProject; -import org.locationtech.udig.project.internal.Project; -import org.locationtech.udig.project.internal.ProjectPlugin; -import org.locationtech.udig.project.ui.internal.MapEditorPart; -import org.locationtech.udig.project.ui.internal.MapFactory; -import org.locationtech.udig.project.ui.internal.ProjectUIPlugin; - -/** - * A facade into udig to simplify operations such as getting the active map - * and openning a map editor. - * - * @author jeichar - * @since 0.9.0 - * @deprecated - use to {@link ApplicationGIS} - */ -public class PlatformGIS { - /** - * May return null of no project is active. - * - * @return The current active project, or null if no such project exists. - * @deprecated - use to {@link ApplicationGIS#getActiveProject()} - */ - public static IProject getActiveProject() { - Project project = ProjectPlugin.getPlugin().getProjectRegistry() - .getCurrentProject(); - - if (project != null) return project; - - return ProjectPlugin.getPlugin().getProjectRegistry() - .getCurrentProject(); - } - - /** - * May return null if the active editor is not a Map Editor. - * @return the map contained by the current MapEditor or null if the active - * editor is not a map editor. - * @deprecated - use to {@link ApplicationGIS#getActiveMap()()} - */ - public static IMap getActiveMap(){ - - //need to be in an event thread - final ArrayList l = new ArrayList(); - org.locationtech.udig.ui.PlatformGIS.syncInDisplayThread( - new Runnable() { - - public void run() { - try { - IEditorPart editor=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if( editor instanceof MapEditorPart ){ - l.add(((MapEditorPart)editor).getMap()); - } - } - catch(NullPointerException e) { - //do nothing - } - } - } - ); - - if (!l.isEmpty()) - return l.get(0); - - return null; - } - - /** - * May return null if no Map Editors exist. - * @return a list of maps contained or null if no Map Editors exist. - * @deprecated - use to {@link ApplicationGIS#getOpenMaps()} - */ - public static List getMaps(){ - try{ - //For some reason, getting the active workbench doesn't seem to work??!! So looping - // through all the workbenches and all their pages was the slow way to go... - //IEditorReference[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); - IWorkbenchWindow[] wWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); - - List maps = new ArrayList(); - for ( IWorkbenchWindow wWindow : wWindows ) { - IWorkbenchPage[] wPages = wWindow.getPages(); - for ( IWorkbenchPage wPage : wPages ) { - IEditorReference[] editors = wPage.getEditorReferences(); - for ( IEditorReference editor : editors ) { - if( editor.getEditor(false) instanceof MapEditorPart ){ - maps.add(((MapEditorPart)editor.getEditor(false)).getMap()); - } - } - } - } - if (maps.size() == 0) - return null; - return maps; - }catch(NullPointerException e){ - return null; - } - } - - /** - * Opens a Map editor for the provided map. - * @param map the map to open. Must be an instance of Map. - * @deprecated - use to {@link ApplicationGIS#openMap(IMap)} - */ - public static void openMap(IMap map){ - ApplicationGIS.openProjectElement(map, false); - } - /** - * creates a map and opens an editor for the map. - * @param a list of IGeoResources. Each resource will be a layer in the created - * map. - * @deprecated - use to {@link ApplicationGIS#createAndOpenMap(List))} - */ - public static void createAndOpenMap(List resources){ - MapFactory.instance().process(null, resources, true); - } - /** - * creates a map and opens an editor for the map. - * @param a list of IGeoResources. Each resource will be a layer in the created - * map. - * @param owner the project that will contain the map. owner must be an instance of Project. If it - * is obtained using the framework then this will always be the case. - * @deprecated - use to {@link ApplicationGIS#createAndOpenMap(List, IProject))} - */ - public static void createAndOpenMap(List resources, IProject owner ){ - MapFactory.instance().process((Project)owner, resources, true); - } - /** - * If an active map exists the layers will be added to that map. Otherwise - * an IllegalStateException will be thrown. - * @param a list of IGeoResources. Each resource will be a layer in the active - * map. - * @deprecated - use to {@link ApplicationGIS#addLayersToMap(IMap, List, int, Project))} - */ - public static void addLayersToActiveMap(List resources) throws IllegalStateException{ - if( getActiveMap()==null ) - throw new IllegalStateException("No active map exists"); //$NON-NLS-1$ - MapFactory.instance().process(null, resources, false); - } - - /** - * Gets a reference to a view. If the view has not been opened previously then the view will be - * opened. - * - * @param show whether to show the view or not. - * @param id the id of the view to show. - * @return returns the view or null if the view does not exist - * @deprecated - use to {@link ApplicationGIS#getView(boolean, String))} - */ - public static IViewPart getView(boolean show, String id){ - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IViewReference[] view = page.getViewReferences(); - IViewReference infoRef=null; - for (IViewReference reference : view) { - if( reference.getId().equals(id) ){ - infoRef=reference; - break; - } - } - // JONES: need to get the part and set the selection to null so that the last selected feature - // will not flash (because it will not be in list any more). - IViewPart infoView=null; - if( infoRef == null ) { - try { - infoView= page.showView(id); - } catch (PartInitException e1) { - return null; - } - if( infoView==null ){ - return null; - } - } - if( infoRef!=null ) - return (IViewPart) infoRef.getPart(show); - - return null; - - } - - /** - * Runs the given runnable in a protected mode. Exceptions - * thrown in the runnable are logged and passed to the runnable's - * exception handler. Such exceptions are not rethrown by this method. - * @deprecated - use to {@link org.locationtech.udig.ui.PlatformGIS#run(ISafeRunnable)} - */ - public static void run( ISafeRunnable request){ - runner.addRequest(request); - } - - private static Runner runner=new Runner(); - private static class Runner extends Job{ - /** - * @param name - */ - public Runner() { - super(""); //$NON-NLS-1$ - setPriority(LONG); - setSystem(true); - } - - List requests=new LinkedList(); - IProgressMonitor current; - - /** - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected IStatus run(IProgressMonitor monitor) { - current=monitor; - while( requests.size() > 0){ - ISafeRunnable runnable=requests.get(0); - requests.remove(0); - run(runnable); - } - return Status.OK_STATUS; - } - - /** - * Add a runnable object to be run. - * @param runnable - */ - public void addRequest(ISafeRunnable runnable){ - if( getThread()==Thread.currentThread() ){ - if( current.isCanceled() ) - return; - run ( runnable ); - }else{ - requests.add(runnable); - schedule(); - } - } - - private void run(ISafeRunnable runnable) { - try{ - runnable.run(); - }catch (Throwable e) { - // be extra careful. Maybe the handler is crazy. If so log the exception. - try{ - runnable.handleException(e); - }catch (Throwable e2) { - ProjectUIPlugin.log("",e ); //$NON-NLS-1$ - } - } - } - } -} diff --git a/plugins/org.locationtech.udig.tool.edit/src/org/locationtech/udig/tools/edit/commands/CreateDialogAndSelectNewFeature.java b/plugins/org.locationtech.udig.tool.edit/src/org/locationtech/udig/tools/edit/commands/CreateDialogAndSelectNewFeature.java index 81320bfc86..fdaf095265 100644 --- a/plugins/org.locationtech.udig.tool.edit/src/org/locationtech/udig/tools/edit/commands/CreateDialogAndSelectNewFeature.java +++ b/plugins/org.locationtech.udig.tool.edit/src/org/locationtech/udig/tools/edit/commands/CreateDialogAndSelectNewFeature.java @@ -12,14 +12,18 @@ import java.util.Collections; import java.util.List; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.geotools.data.FeatureEvent; import org.locationtech.udig.core.internal.FeatureUtils; import org.locationtech.udig.project.ILayer; import org.locationtech.udig.project.command.AbstractCommand; import org.locationtech.udig.project.command.UndoableMapCommand; import org.locationtech.udig.project.internal.Layer; import org.locationtech.udig.project.internal.commands.edit.AddFeatureCommand; -import org.locationtech.udig.project.ui.ApplicationGIS; -import org.locationtech.udig.project.ui.PlatformGIS; import org.locationtech.udig.project.ui.feature.FeaturePanelEntry; import org.locationtech.udig.tool.edit.internal.Messages; import org.locationtech.udig.tools.edit.support.EditBlackboard; @@ -27,15 +31,6 @@ import org.locationtech.udig.tools.edit.support.EditUtils; import org.locationtech.udig.tools.edit.support.Point; import org.locationtech.udig.tools.edit.support.PrimitiveShape; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.geotools.data.FeatureEvent; import org.opengis.feature.simple.SimpleFeature; import org.opengis.filter.Filter; @@ -78,12 +73,14 @@ public CreateDialogAndSelectNewFeature( EditGeom geom, SimpleFeature feature, IL this.deselectCreatedFeature = deselectCreatedFeature; } + @Override public void run( IProgressMonitor monitor ) throws Exception { final boolean create[] = new boolean[1]; create[0] = false; Display display = PlatformUI.getWorkbench().getDisplay(); display.syncExec( new Runnable(){ + @Override public void run() { boolean yes = MessageDialog.openConfirm(null, "New Feature", "Panels available "+panels.size() ); create[0] = yes; @@ -145,10 +142,12 @@ private void fireFeatureEvent( boolean prev ) { featureChanges.set(index, featureEvent); } + @Override public String getName() { return Messages.CreateAndSetNewFeature_name; } + @Override public void rollback( IProgressMonitor monitor ) throws Exception { monitor.beginTask(getName(), 14); monitor.worked(2);