@Override public Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage) { String layoutModel = layoutServices.convertLayoutToString(layoutTemplate); LayoutEditorModel plugin = new LayoutEditorModel(layoutTemplate.getName(), PluginType.PERSPECTIVE_LAYOUT, perspectivePath, layoutModel); pluginServices.saveLayout(plugin, commitMessage); return perspectivePath; }
@Override public Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage) { String layoutModel = layoutServices.convertLayoutToString(layoutTemplate); LayoutEditorModel plugin = new LayoutEditorModel(layoutTemplate.getName(), PluginType.PERSPECTIVE_LAYOUT, perspectivePath, layoutModel); pluginServices.saveLayout(plugin, commitMessage); return perspectivePath; }
private void setLayoutTemplateName(Path path, String newName, String comment) { LayoutTemplate layoutTemplate = getLayoutTemplate(path); layoutTemplate.setName(newName); String layoutModel = layoutServices.convertLayoutToString(layoutTemplate); LayoutEditorModel pluginCopy = new LayoutEditorModel(newName, PluginType.PERSPECTIVE_LAYOUT, path, layoutModel); pluginServices.saveLayout(pluginCopy, comment); }
private void setLayoutTemplateName(Path path, String newName, String comment) { LayoutTemplate layoutTemplate = getLayoutTemplate(path); layoutTemplate.setName(newName); String layoutModel = layoutServices.convertLayoutToString(layoutTemplate); LayoutEditorModel pluginCopy = new LayoutEditorModel(newName, PluginType.PERSPECTIVE_LAYOUT, path, layoutModel); pluginServices.saveLayout(pluginCopy, comment); }
@Before public void setup() { LayoutEditorModel layoutEditorModel = new LayoutEditorModel("layout", PluginType.PERSPECTIVE_LAYOUT, path2, "").emptyLayout(); when(pluginServices.createNewPlugin(anyString(), any())).thenReturn(plugin); when(plugin.getPath()).thenReturn(path); when(pluginServices.copy(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.copy(any(), anyString(), any(), anyString())).thenReturn(path2); when(pluginServices.rename(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.getLayoutEditor(eq(path2), eq(PluginType.PERSPECTIVE_LAYOUT))).thenReturn(layoutEditorModel); perspectiveServices = spy(new PerspectiveServicesImpl(pluginServices, layoutServices, saveAndRenameService)); }
@Before public void setup() { LayoutEditorModel layoutEditorModel = new LayoutEditorModel("layout", PluginType.PERSPECTIVE_LAYOUT, path2, "").emptyLayout(); when(pluginServices.createNewPlugin(anyString(), any())).thenReturn(plugin); when(plugin.getPath()).thenReturn(path); when(pluginServices.copy(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.copy(any(), anyString(), any(), anyString())).thenReturn(path2); when(pluginServices.rename(any(), anyString(), anyString())).thenReturn(path2); when(pluginServices.getLayoutEditor(eq(path2), eq(PluginType.PERSPECTIVE_LAYOUT))).thenReturn(layoutEditorModel); perspectiveServices = spy(new PerspectiveServicesImpl(pluginServices, layoutServices, saveAndRenameService)); }
private LayoutEditorModel loadLayoutEditor(String pluginName, org.uberfire.backend.vfs.Path path, PluginType type) { final Path path1 = getLayoutEditorPath(getPluginPath(pluginName), type.toString().toLowerCase()); if (getIoService().exists(path1)) { String fileContent = getIoService().readAllString(path1); return new LayoutEditorModel(pluginName, PluginType.PERSPECTIVE_LAYOUT, path, fileContent); } return new LayoutEditorModel(pluginName, PluginType.PERSPECTIVE_LAYOUT, path, null).emptyLayout(); }