Package org.locationtech.udig.bookmarks.internal

Examples of org.locationtech.udig.bookmarks.internal.MapReference


                        if (MessageDialog
                                .openConfirm(
                                        Display.getCurrent().getActiveShell(),
                                        Messages.BookmarkAction_dialogtitle_removebookmarks,
                                        Messages.BookmarkAction_dialogprompt_removemapbookmarks)) {
                            MapReference map = (MapReference) selection
                                    .getFirstElement();
                            if (bmManager == null) {
                                bmManager = BookmarksPlugin
                                        .getBookmarkService();
                            }
                            bmManager.removeMap(map);
                        }
                    } else {
                        if (MessageDialog
                                .openConfirm(
                                        Display.getCurrent().getActiveShell(),
                                        Messages.BookmarkAction_dialogtitle_removebookmarks,
                                        Messages.BookmarkAction_dialogprompt_removeselectedmaps)) {
                            if (bmManager == null) {
                                bmManager = BookmarksPlugin
                                        .getBookmarkService();
                            }
                            List wrappedMaps = selection.toList();
                            Collection maps = MapWrapper.unwrap(wrappedMaps);
                            bmManager.removeMaps(maps);
                        }
                    }
                    refreshView();
                }
                // }else if(REMOVE_PROJECT_ACTION_ID.equals(action.getId())){
                // int size = selection.size();
                // if(size > 0){
                // if(size > 1){
                // if( MessageDialog.openConfirm(
                // Display.getCurrent().getActiveShell(),
                // Messages..BOOKMARK_ACTION_DIALOGTITLE_REMOVEBOOKMARKS,
                // //$NON-NLS-1$
                // Messages..BOOKMARK_ACTION_DIALOGPROMPT_REMOVEPROJECTBOOKMARKS)
                // ){ //$NON-NLS-1$
                // ProjectWrapper wrapper =
                // (ProjectWrapper)selection.getFirstElement();
                // if(bmManager == null){
                // bmManager = BookmarksPlugin.getBookmarkService();
                // }
                // // bmManager.removeProject(wrapper.getProject());
                // }
                // }else {
                // if( MessageDialog.openConfirm(
                // Display.getCurrent().getActiveShell(),
                // Messages..BOOKMARK_ACTION_DIALOGTITLE_REMOVEBOOKMARKS,
                // //$NON-NLS-1$
                // Messages..BOOKMARK_ACTION_DIALOGPROMPT_REMOVESELECTEDPROJECTS)
                // ){ //$NON-NLS-1$
                // if(bmManager == null){
                // bmManager = BookmarksPlugin.getBookmarkService();
                // }
                // List wrappedProjects = selection.toList();
                // Collection<IProject> projects =
                // ProjectWrapper.unwrap(wrappedProjects);
                // bmManager.removeProjects(projects);
                // }
                // }
                // refreshView();
                // }
            } else if (REMOVE_BOOKMARK_ACTION_ID.equals(action.getId())) {
                int size = selection.size();
                if (size > 0) {
                    if (size > 1) {
                        if (MessageDialog
                                .openConfirm(
                                        Display.getCurrent().getActiveShell(),
                                        Messages.BookmarkAction_dialogtitle_removebookmarks,
                                        Messages.BookmarkAction_dialogprompt_removeselectedbookmarks)) {
                            List bookmarks = selection.toList();
                            if (bmManager == null) {
                                bmManager = BookmarksPlugin
                                        .getBookmarkService();
                            }
                            bmManager.removeBookmarks(bookmarks);
                        }
                    } else {
                        if (MessageDialog
                                .openConfirm(
                                        Display.getCurrent().getActiveShell(),
                                        Messages.BookmarkAction_dialogtitle_removebookmark,
                                        Messages.BookmarkAction_dialogprompt_removebookmark)) {
                            Bookmark bookmark = (Bookmark) selection
                                    .getFirstElement();
                            if (bmManager == null) {
                                bmManager = BookmarksPlugin
                                        .getBookmarkService();
                            }
                            bmManager.removeBookmark(bookmark);
                        }
                    }
                    refreshView();
                }
            } else if (GOTO_BOOKMARK_ACTION_ID.equals(action.getId())) {
                Bookmark bookmark = (Bookmark) selection.getFirstElement();
                gotoBookmark(bookmark);
            } else if (ADD_BOOKMARK_ACTION_ID.equals(action.getId())) {
                IMap map = ApplicationGIS.getActiveMap();
                if (map != ApplicationGIS.NO_MAP) {
                    IViewportModel v = map.getViewportModel();
                    Envelope env = v.getBounds();
                    ReferencedEnvelope bounds;
                    if (env instanceof ReferencedEnvelope) {
                        bounds = (ReferencedEnvelope) env;
                    } else {
                        bounds = new ReferencedEnvelope(env, v.getCRS());
                    }
                    MapReference ref = bmManager.getMapReference(map);
                    Bookmark bookmark = new Bookmark(bounds, ref, null);
                    InputDialog dialog = new InputDialog(
                            Display.getCurrent().getActiveShell(),
                            Messages.BookmarkAction_dialogtitle_bookmarklocation,
                            Messages.BookmarkAction_dialogprompt_enterbookmarkname,
View Full Code Here


                        crs = DefaultGeographicCRS.WGS84;
                    } catch (FactoryException e) {
                        crs = DefaultGeographicCRS.WGS84;
                    }
                    ReferencedEnvelope bounds = new ReferencedEnvelope(env, crs);
                    Bookmark bmark = new Bookmark(bounds, new MapReference(mapURI, projectURI,
                            mapName), URI.decode(bmarkName));
                    getBookmarkService().load(bmark);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.bookmarks.internal.MapReference

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.