BookmarkableUrlHelper { public static String registerCloseEditor(final String currentBookmarkableURLStatus, final PlaceRequest place) { if (place != null && place instanceof PathPlaceRequest) { final String path = place.getFullIdentifier(); final String pathWithSep = path.concat(SEPARATOR); if (currentBookmarkableURLStatus.contains(pathWithSep)) { return currentBookmarkableURLStatus.replace(pathWithSep, ""); } return currentBookmarkableURLStatus.replace(path, ""); } return currentBookmarkableURLStatus; }  static String registerOpenedScreen(String bookmarkableUrl,
                                              final PlaceRequest placeRequest); static String registerClose(String bookmarkableUrl,
                                       final String screenName); static PlaceRequest getPerspectiveFromPlace(PlaceRequest place); static boolean isPerspectiveScreen(final String bookmarkableUrl,
                                              final String screen); static boolean isPerspectiveInUrl(final String url); static boolean urlContainsExtraPerspectiveScreen(final String bookmarkableUrl); static String getUrlToken(final String bookmarkableUrl,
                                     final String screen); static Set<String> getDockedScreensFromUrl(final String url); static Set<String> getDockedScreensFromPlace(final PlaceRequest place); static Set<String> getScreensFromPlace(final PlaceRequest place); static Set<String> getClosedScreenFromPlace(final PlaceRequest place); static Set<String> getOpenedScreenFromPlace(final PlaceRequest place); static boolean isScreenClosed(final String bookmarkableUrl,
                                         String screen); static String registerOpenedPerspective(String currentBookmarkableURLStatus,
                                                   PlaceRequest place); static String registerOpenedDock(String currentBookmarkableURLStatus,
                                            UberfireDock targetDock); static String registerClosedDock(String currentBookmarkableURLStatus,
                                            UberfireDock targetDock); static String registerCloseEditor(final String currentBookmarkableURLStatus,
                                             final PlaceRequest place); final static String PERSPECTIVE_SEP; final static String DOCK_BEGIN_SEP; final static String DOCK_CLOSE_SEP; final static String SEPARATOR; final static String OTHER_SCREEN_SEP; final static String CLOSED_PREFIX; final static String CLOSED_DOCK_PREFIX; final static int MAX_NAV_URL_SIZE; }
@Test public void testRegisterCloseEditor() { final Path path = PathFactory.newPath("file", "default: final PlaceRequest ppr = new PathPlaceRequest(path); ppr.setIdentifier("Perspective Editor"); final String perspectiveClosedUrl = "PlugInAuthoringPerspective|[WPlugins Explorer,]$"; final String perspectiveOpenUrl = perspectiveClosedUrl.concat(ppr.getFullIdentifier()); String url = BookmarkableUrlHelper .registerCloseEditor(perspectiveOpenUrl, ppr); assertEquals(perspectiveClosedUrl, url); final PlaceRequest dpr = new DefaultPlaceRequest("default: url = BookmarkableUrlHelper .registerCloseEditor(perspectiveOpenUrl, dpr); assertEquals(perspectiveOpenUrl, url); }
@Test public void testRegisterCloseEditorWithScreens() { final Path path = PathFactory.newPath("file", "default: final PlaceRequest ppr = new PathPlaceRequest(path); ppr.setIdentifier("Perspective Editor"); final String perspectiveClosedUrl = "PlugInAuthoringPerspective|[WPlugins Explorer,]$"; final String perspectiveOpenUrl = perspectiveClosedUrl.concat(ppr.getFullIdentifier()).concat(",screen1"); String url = BookmarkableUrlHelper .registerCloseEditor(perspectiveOpenUrl, ppr); final String expectedUrl = "PlugInAuthoringPerspective|[WPlugins Explorer,]$screen1"; assertEquals(expectedUrl, url); url = BookmarkableUrlHelper .registerCloseEditor(expectedUrl, null); assertEquals(expectedUrl, url); }