public PluginSimpleContent(final PluginSimpleContent pluginContent, final String template, final Map<CodeType, String> codeMap) { super(pluginContent.getName(), pluginContent.getType(), pluginContent.getPath()); this.codeMap = new HashMap<CodeType, String>(pluginContent.getCodeMap() != null ? pluginContent.getCodeMap() : Collections.<CodeType, String>emptyMap()); if (codeMap != null && !codeMap.isEmpty()) { for (final Map.Entry<CodeType, String> codeTypeStringEntry : codeMap.entrySet()) { this.codeMap.put(codeTypeStringEntry.getKey(), codeTypeStringEntry.getValue()); } } this.template = pluginContent.getTemplate(); if (template != null) { this.template = template; } this.css = pluginContent.getCss(); this.frameworks = new HashSet<Framework>(pluginContent.getFrameworks() != null ? pluginContent.getFrameworks() : Collections.<Framework>emptyList()); this.language = pluginContent.getLanguage(); }
public static PluginSimpleContent getEmptyScreen() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, ""); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("Yo", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
if (plugin.getCodeMap().containsKey(CodeType.MAIN)) { sb.append(plugin.getCodeMap().get(CodeType.MAIN)); if (plugin.getType().equals(PluginType.SCREEN)) { sb.append("$registerPlugin({"); } else if (plugin.getType().equals(PluginType.SPLASH)) { sb.append("$registerSplashScreen({"); } else if (plugin.getType().equals(PluginType.EDITOR)) { sb.append("$registerEditor({"); } else if (plugin.getType().equals(PluginType.PERSPECTIVE)) { sb.append("$registerPerspective({"); sb.append("id:").append('"').append(plugin.getName()).append('"').append(","); if (plugin.getCodeMap().size() > 1) { if (plugin.getCodeMap().containsKey(ct)) { sb.append(ct.toString().toLowerCase()).append(": "); sb.append(prepareEntryValue(ct, plugin.getCodeMap().get(ct))).append(","); if (plugin.getFrameworks() != null && !plugin.getFrameworks().isEmpty()) { final Framework fm = plugin.getFrameworks().iterator().next(); sb.append("type: ").append('"').append(fm.getType()).append('"').append(','); if (!plugin.getType().equals(PluginType.PERSPECTIVE)) { sb.append("template: "); gson.toJson(plugin.getTemplate(),
public org.uberfire.backend.vfs.Path save(final PluginSimpleContent plugin, final String commitMessage) { final Path pluginPath = convert(plugin.getPath()); final boolean isNewPlugin = !getIoService().exists(pluginPath); commentedOption(commitMessage)); saveCodeMap(plugin.getName(), plugin.getCodeMap()); if (plugin.getTemplate() != null) { getIoService().write(getTemplatePath(getPluginPath(plugin.getName())), plugin.getTemplate()); if (plugin.getCss() != null) { getIoService().write(getCssPath(getPluginPath(plugin.getName())), plugin.getCss()); clearDirectory(getPluginPath(plugin.getName()).resolve("dependencies")); if (plugin.getFrameworks() != null && !plugin.getFrameworks().isEmpty()) { final Framework framework = plugin.getFrameworks().iterator().next(); getIoService().write(getDependencyPath(getPluginPath(plugin.getName()), framework), "--"); return plugin.getPath();
public Plugin getContent() { return new PluginSimpleContent(view().getContent(), view().getTemplate(), view().getCss(), view().getCodeMap(), view().getFrameworks(), view().getContent().getLanguage()); }
private Path createPlugin(String name, PluginType type, Framework framework) { pluginServices.createNewPlugin(name, type); verify(pluginAddedEvent, times(1)).fire(any(PluginAdded.class)); reset(pluginAddedEvent); final PluginSimpleContent pluginSimpleContent = buildPlugin(name, type, framework); pluginServices.save(pluginSimpleContent, ""); verify(pluginSavedEvent, times(1)).fire(any(PluginSaved.class)); reset(pluginSavedEvent); return pluginSimpleContent.getPath(); }
public Plugin getContent() { return new PluginSimpleContent(view().getContent(), view().getTemplate(), view().getCss(), view().getCodeMap(), view().getFrameworks(), view().getContent().getLanguage()); }
private Path createPlugin(String name, PluginType type, Framework framework) { pluginServices.createNewPlugin(name, type); verify(pluginAddedEvent, times(1)).fire(any(PluginAdded.class)); reset(pluginAddedEvent); final PluginSimpleContent pluginSimpleContent = buildPlugin(name, type, framework); pluginServices.save(pluginSimpleContent, ""); verify(pluginSavedEvent, times(1)).fire(any(PluginSaved.class)); reset(pluginSavedEvent); return pluginSimpleContent.getPath(); }
final Collection<Framework> frameworks, final Language language) { super(pluginContent.getName(), pluginContent.getType(), pluginContent.getPath()); this.codeMap = new HashMap<CodeType, String>(pluginContent.getCodeMap() != null ? pluginContent.getCodeMap() : Collections.<CodeType, String>emptyMap()); if (codeMap != null && !codeMap.isEmpty()) { for (final Map.Entry<CodeType, String> codeTypeStringEntry : codeMap.entrySet()) { this.language = pluginContent.getLanguage(); if (language != null) { this.language = language; this.template = pluginContent.getTemplate(); if (template != null) { this.template = template; this.css = pluginContent.getCss(); if (css != null) { this.css = css;
public static PluginSimpleContent getEmptyScreen() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, ""); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("Yo", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getScreenWithTitle() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, ""); codeMap.put(CodeType.TITLE, "My Title"); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("ScreenWithTitle", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getScreenWithTitle() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, ""); codeMap.put(CodeType.TITLE, "My Title"); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("ScreenWithTitle", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getScreenWithMainAndTitle() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, "alert('main');"); codeMap.put(CodeType.TITLE, "My Title"); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("ScreenWithTitle", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getScreenWithMainAndTitle() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, "alert('main');"); codeMap.put(CodeType.TITLE, "My Title"); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("ScreenWithTitle", PluginType.SCREEN, path, "", "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
private PluginSimpleContent buildPlugin(String name, PluginType type, Framework framework) { Set<Framework> frameworks = new HashSet<Framework>(); if (framework != null) { frameworks.add(framework); } return new PluginSimpleContent(name, type, PathFactory.newPath(type.name().toLowerCase() + ".plugin", "git://amend-repo-test/" + name + "/" + type.name().toLowerCase() + ".plugin"), null, null, new HashMap<CodeType, String>(), frameworks, null); }
private PluginSimpleContent buildPlugin(String name, PluginType type, Framework framework) { Set<Framework> frameworks = new HashSet<Framework>(); if (framework != null) { frameworks.add(framework); } return new PluginSimpleContent(name, type, PathFactory.newPath(type.name().toLowerCase() + ".plugin", "git://amend-repo-test/" + name + "/" + type.name().toLowerCase() + ".plugin"), null, null, new HashMap<CodeType, String>(), frameworks, null); }
public static PluginSimpleContent getTodoAngularPluginSimpleContent() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, loadSample(ANGULAR_MAIN)); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); frameworks.add(Framework.ANGULAR); PluginSimpleContent plugin = new PluginSimpleContent("Yo", PluginType.SCREEN, path, loadSample(ANGULAR_TEMPLATE), loadSample(ANGULAR_CSS), codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getTodoAngularPluginSimpleContent() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, loadSample(ANGULAR_MAIN)); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); frameworks.add(Framework.ANGULAR); PluginSimpleContent plugin = new PluginSimpleContent("Yo", PluginType.SCREEN, path, loadSample(ANGULAR_TEMPLATE), loadSample(ANGULAR_CSS), codeMap, frameworks, Language.JAVASCRIPT); return plugin; }
public static PluginSimpleContent getSplashScreen() { Map<CodeType, String> codeMap = new HashMap<CodeType, String>(); codeMap.put(CodeType.MAIN, loadSample(SPLASH_MAIN)); codeMap.put(CodeType.ON_CLOSE, loadSample(SPLASH_MAIN)); codeMap.put(CodeType.ON_CONCURRENT_COPY, loadSample(SPLASH_MAIN)); codeMap.put(CodeType.TITLE, "Title"); Path path = null; Set<Framework> frameworks = new HashSet<Framework>(); PluginSimpleContent plugin = new PluginSimpleContent("Splash", PluginType.SPLASH, path, loadSample(SPLASH_TEMPLATE), "", codeMap, frameworks, Language.JAVASCRIPT); return plugin; }